Commits

K.Inanloo  committed efb63c1

Moved to .NEt Framework 4.5

  • Participants
  • Parent commits 561123f

Comments (0)

Files changed (8)

File LiteREST/LiteREST.csproj

     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>LiteREST</RootNamespace>
     <AssemblyName>LiteREST</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <TargetFrameworkProfile />
   </PropertyGroup>
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Castle.Core">
-      <HintPath>..\packages\Castle.Core.3.2.0\lib\net40-client\Castle.Core.dll</HintPath>
+    <Reference Include="Castle.Core, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\packages\Castle.Core.3.2.0\lib\net45\Castle.Core.dll</HintPath>
     </Reference>
-    <Reference Include="Inflector">
-      <HintPath>..\packages\Inflector.1.0.0.0\lib\net40\Inflector.dll</HintPath>
+    <Reference Include="Inflector, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\packages\Inflector.1.0.0.0\lib\net45\Inflector.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json">
+    <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
       <HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
-    <Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll</HintPath>
-    </Reference>
+    <Reference Include="System.Net.Http" />
     <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
-    <Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
-    </Reference>
+    <Reference Include="System.Net.Http.WebRequest" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />

File LiteREST/RestInterceptor.cs

 			{
 				case "Get":
 				case "Fetch":
-				{
-					if (invocation.Arguments.Length == 0)
 					{
-						response = client.GetAsync(string.Format("api/{0}", entityName)).Result;
+						if (invocation.Arguments.Length == 0)
+						{
+							response = client.GetAsync(string.Format("api/{0}", entityName)).Result;
+						}
+						else if (invocation.Arguments.Length == 1)
+						{
+							response = client.GetAsync(string.Format("api/{0}/{1}", entityName.Pluralize(), invocation.Arguments[0])).Result;
+						}
+						else
+						{
+							var parameters = invocation.Method.GetParameters();
+							int i = 0;
+							response = client.GetAsync(string.Format("api/{0}?{1}", entityName.Pluralize(),
+								string.Join("&", invocation.Arguments.Select(arg => string.Format("{0}={1}", parameters[i++].Name, arg)))
+								)).Result;
+						}
+
+						if (response.IsSuccessStatusCode)
+						{
+							invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
+						}
+						break;
 					}
-					else if (invocation.Arguments.Length == 1)
-					{
-						response = client.GetAsync(string.Format("api/{0}/{1}", entityName.Pluralize(), invocation.Arguments[0])).Result;
-					}
-					else
-					{
-						var parameters = invocation.Method.GetParameters();
-						int i = 0;						
-						response = client.GetAsync(string.Format("api/{0}/{1}", entityName.Pluralize(),
-							string.Join("&", invocation.Arguments.Select(arg => string.Format("{0}={1}", parameters[i++].Name, arg)))
-							)).Result;
-					}
-
-					if (response.IsSuccessStatusCode)
-					{						
-						invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
-					}
-					break;
-				}
 				case "Add":
 				case "Insert":
-				{
-					int i = 0;
-					var parameters = invocation.Method.GetParameters();
-					var data = invocation.Arguments.ToDictionary(arg => parameters[i++].Name, arg => arg);
-					response = client.PostAsJsonAsync(string.Format("api/{0}", entityName.Pluralize()), data).Result;
-					if (response.IsSuccessStatusCode)
 					{
-						invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
+						int i = 0;
+						var parameters = invocation.Method.GetParameters();
+						var data = invocation.Arguments.ToDictionary(arg => parameters[i++].Name, arg => arg);
+						response = client.PostAsJsonAsync(string.Format("api/{0}", entityName.Pluralize()), data).Result;
+						if (response.IsSuccessStatusCode)
+						{
+							invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
+						}
+
+
+						break;
 					}
-
-
-					break;
-				}
 				case "Update":
 				case "Edit":
-				{
-					int i = 0;
-					var parameters = invocation.Method.GetParameters();
-					var data = invocation.Arguments.ToDictionary(arg => parameters[i++].Name, arg => arg);
-					response = client.PutAsJsonAsync(string.Format("api/{0}", entityName.Pluralize()), data).Result;
-					if (response.IsSuccessStatusCode)
 					{
-						invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
+						int i = 0;
+						var parameters = invocation.Method.GetParameters();
+						var data = invocation.Arguments.ToDictionary(arg => parameters[i++].Name, arg => arg);
+						response = client.PutAsJsonAsync(string.Format("api/{0}", entityName.Pluralize()), data).Result;
+						if (response.IsSuccessStatusCode)
+						{
+							invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
+						}
+
+						break;
 					}
-
-					break;
-				}
 				case "Delete":
 				case "Remove":
-				{
-					response = client.DeleteAsync(string.Format("api/{0}/{1}", entityName.Pluralize(), invocation.Arguments[0])).Result;
-					if (response.IsSuccessStatusCode)
 					{
-						invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
+						response = client.DeleteAsync(string.Format("api/{0}/{1}", entityName.Pluralize(), invocation.Arguments[0])).Result;
+						if (response.IsSuccessStatusCode)
+						{
+							invocation.ReturnValue = response.Content.ReadAsAsync(invocation.Method.ReturnType).Result;
+						}
+
+						break;
 					}
-
-					break;
-				}
 			}
 		}
 

File LiteREST/packages.config

 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Castle.Core" version="3.2.0" targetFramework="net40" />
-  <package id="Inflector" version="1.0.0.0" targetFramework="net40" />
-  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net40" />
-  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
-  <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
+  <package id="Castle.Core" version="3.2.0" targetFramework="net45" />
+  <package id="Inflector" version="1.0.0.0" targetFramework="net45" />
+  <package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
+  <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
+  <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
 </packages>

File Test/FinancialCondition.cs

+namespace Test
+{
+	using System;
+
+	[Serializable]
+	public partial class FinancialCondition
+	{
+
+		public FinancialCondition() { }
+
+		public bool HasFinancial
+		{
+			get;
+			set;
+		}
+
+		public string FinancialStatusTitle
+		{
+			get;
+			set;
+		}
+
+		public bool RegisterPermit
+		{
+			get;
+			set;
+		}
+
+		public bool HasListDisplayed
+		{
+			get;
+			set;
+		}
+
+		public bool HasPrintWorkbook
+		{
+			get;
+			set;
+		}
+
+		public bool HasPrintTermWorkbook
+		{
+			get;
+			set;
+		}
+
+		public bool HasPrintReport
+		{
+			get;
+			set;
+		}
+
+		public bool TemporaryRegistration
+		{
+			get;
+			set;
+		}
+
+		public int? TemporaryRegistrationHour
+		{
+			get;
+			set;
+		}
+
+		public decimal? MinimumPayment
+		{
+			get;
+			set;
+		}
+
+		public decimal? MaximumDebit
+		{
+			get;
+			set;
+		}
+
+		public decimal? FinalDebit
+		{
+			get;
+			set;
+		}
+	}
+
+}

File Test/IFinancial.cs

 	{
 		BankAccount[] GetBankAccounts();
 		decimal GetVariableTuition(string studentNumber, string termCode, string lessonCode, int lessonStatusId);
+		FinancialCondition GetStudentFinancialTermCondition(string studentNumber, string termCode);
 	}
 }

File Test/Program.cs

 	{
 		static void Main(string[] args)
 		{
-			Setup.Register<IFinancial>("http://192.168.1.10/SFS/");
+			Setup.Register<IFinancial>("http://WebServer/Financial");
 
-			//var financial = Setup.GetInstance<IFinancial>();
-			dynamic financial = Setup.GetInstance("http://192.168.1.10/SFS/");
+			var financial = Setup.GetInstance<IFinancial>();
+			//dynamic financial = Setup.GetInstance("http://192.168.1.10/SFS/");
+
 			
-			
-			List<BankAccount> list = financial.GetBankAccounts<List<BankAccount>>();
-			financial.GetVariableTuition<bool>(StudentNumber : "12121", TermCode: "891", LessonCode: "123123", LessonGroup: 1);
-
-			foreach (var item in list)
-			{
-				Console.WriteLine(item.Bank.Title);
-			}
+			//var tuition = financial.GetVariableTuition("9130001", "913", "91300012", 2);
+			var res = financial.GetStudentFinancialTermCondition("911110026", "912");
+			//Console.WriteLine(tuition);
 			Console.ReadLine();
 		}
 	}

File Test/Test.csproj

     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Test</RootNamespace>
     <AssemblyName>Test</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
   <ItemGroup>
     <Compile Include="Bank.cs" />
     <Compile Include="BankAccount.cs" />
+    <Compile Include="FinancialCondition.cs" />
     <Compile Include="IFinancial.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
       <Name>LiteREST</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

File Test/app.config

+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>