public async Task <List <BranchStoretable> > GetByBranchIdtable(int itemId) { List <BranchStoretable> items = new List <BranchStoretable>(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemId", itemId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("BranchStore/GetByBranchId", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <BranchStoretable>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
//*********************************************** public async Task <int> saveDocImage(DocImage docImage) { Dictionary <string, string> parameters = new Dictionary <string, string>(); string method = "DocImage/saveImageDoc"; var myContent = JsonConvert.SerializeObject(docImage); parameters.Add("Object", myContent); return(await APIResult.post(method, parameters)); //string message = ""; //// ... Use HttpClient. //ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; //// //var myContent = JsonConvert.SerializeObject(docImage); //using (var client = new HttpClient()) //{ // ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // client.BaseAddress = new Uri(Global.APIUri); // client.DefaultRequestHeaders.Clear(); // client.DefaultRequestHeaders.Add("Connection", "Keep-Alive"); // client.DefaultRequestHeaders.Add("Keep-Alive", "3600"); // HttpRequestMessage request = new HttpRequestMessage(); // // encoding parameter to get special characters // myContent = HttpUtility.UrlEncode(myContent); // request.RequestUri = new Uri(Global.APIUri + "DocImage/saveImageDoc?docImageObject=" + myContent); // request.Headers.Add("APIKey", Global.APIKey); // request.Method = HttpMethod.Post; // //set content type // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var response = await client.SendAsync(request); // if (response.IsSuccessStatusCode) // { // message = await response.Content.ReadAsStringAsync(); // message = JsonConvert.DeserializeObject<string>(message); // } // return message; //} }
public async Task <int> getUnitAmount(int itemUnitId, int branchId) { Dictionary <string, string> parameters = new Dictionary <string, string>(); string method = "ItemsLocations/getUnitAmount"; parameters.Add("itemUnitId", itemUnitId.ToString()); parameters.Add("branchId", branchId.ToString()); return(await APIResult.post(method, parameters)); //// ... Use HttpClient. //ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; //using (var client = new HttpClient()) //{ // ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // client.BaseAddress = new Uri(Global.APIUri); // client.DefaultRequestHeaders.Clear(); // client.DefaultRequestHeaders.Add("Connection", "Keep-Alive"); // client.DefaultRequestHeaders.Add("Keep-Alive", "3600"); // HttpRequestMessage request = new HttpRequestMessage(); // request.RequestUri = new Uri(Global.APIUri + "ItemsLocations/getUnitAmount?itemUnitId=" + itemUnitId + "&branchId=" + branchId); // request.Headers.Add("APIKey", Global.APIKey); // request.Method = HttpMethod.Get; // //set content type // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var response = await client.SendAsync(request); // if (response.IsSuccessStatusCode) // { // var AvailableAmount = await response.Content.ReadAsStringAsync(); // return int.Parse(AvailableAmount); // } // return 0; //} }
public async Task <string> getbackup() { string messsage = ""; Dictionary <string, string> parameters = new Dictionary <string, string>(); //parameters.Add("mainBranchId", mainBranchId.ToString()); //parameters.Add("userId", userId.ToString()); //parameters.Add("date", date.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Backup/getbackup", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { messsage = c.Value.ToString(); break; } } return(messsage); }
public async Task <Agent> getAgentById(int agentId) { Agent agent = new Agent(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("agentId", agentId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Agent/GetAgentByID", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { agent = JsonConvert.DeserializeObject <Agent>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); break; } } return(agent); }
public async Task <List <Unit> > getSmallUnits(int itemId, int unitId) { List <Unit> items = new List <Unit>(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemId", itemId.ToString()); parameters.Add("unitId", unitId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Units/getSmallUnits", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <Unit>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <Bank> getBankById(int itemId) { Bank item = new Bank(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemId", itemId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Banks/GetBankByID", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { item = JsonConvert.DeserializeObject <Bank>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); break; } } return(item); }
public async Task <List <User> > GetActiveForAccount(string payType) { List <User> items = new List <User>(); // to pass parameters (optional) Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("payType", payType.ToString()); IEnumerable <Claim> claims = await APIResult.getList("Users/GetActiveForAccount", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <User>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <User> getUserById(int userId) { User user = new User(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemId", userId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Users/GetUserByID", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { user = JsonConvert.DeserializeObject <User>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); break; } } return(user); }
public async Task <Card> GetByisActive(byte isActive) { Card item = new Card(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("isActive", isActive.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("cards/GetByisActive", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { item = JsonConvert.DeserializeObject <Card>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); break; } } return(item); }
public async Task <int> getAmountByItemLocId(int itemLocId) { int item = 0; Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemLocId", itemLocId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("ItemsLocations/getAmountByItemLocId", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { item = int.Parse(c.Value); break; } } return(item); }
public async Task <int> smallToLargeUnit(int fromItemUnit, int toItemUnit) { int AvailableAmount = 0; Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("fromItemUnit", fromItemUnit.ToString()); parameters.Add("toItemUnit", toItemUnit.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("itemsUnits/smallToLargeUnitQuan", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { AvailableAmount = int.Parse(c.Value); } } return(AvailableAmount); }
public async Task <Coupon> getCouponByBarCode(string barcode) { Coupon item = new Coupon(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemId", barcode.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("coupons/GetCouponByBarcode", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { item = JsonConvert.DeserializeObject <Coupon>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); break; } } return(item); }
//ارجا ع كل الفروع التي يرتبط بها هذا المستخدم public async Task <Branch> GetByBranchUser(int userId) { Branch items = new Branch(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("userId", userId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Branches/GetByBranchUser", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items = JsonConvert.DeserializeObject <Branch>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); break; } } return(items); }
public async Task <List <Category> > GetSubCategories(int categoryId, int userId) { List <Category> items = new List <Category>(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemId", categoryId.ToString()); parameters.Add("userId", userId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Categories/GetSubCategories", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <Category>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <List <NotificationUser> > GetByUserId(int userId, string type, int posId) { List <NotificationUser> items = new List <NotificationUser>(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemId", userId.ToString()); parameters.Add("type", type.ToString()); parameters.Add("posId", posId.ToString()); IEnumerable <Claim> claims = await APIResult.getList("notificationUser/GetByUserId", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <NotificationUser>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <int> Delete(int packageId, int userId, bool final) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("packageId", packageId.ToString()); parameters.Add("userId", userId.ToString()); parameters.Add("final", final.ToString()); string method = "Package/Delete"; return(await APIResult.post(method, parameters)); //// ... Use HttpClient. //ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; //using (var client = new HttpClient()) //{ // ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // client.BaseAddress = new Uri(Global.APIUri); // client.DefaultRequestHeaders.Clear(); // client.DefaultRequestHeaders.Add("Connection", "Keep-Alive"); // client.DefaultRequestHeaders.Add("Keep-Alive", "3600"); // HttpRequestMessage request = new HttpRequestMessage(); // request.RequestUri = new Uri(Global.APIUri + "Package/Delete?packageId=" + packageId + "&userId=" + userId + "&final=" + final); // request.Headers.Add("APIKey", Global.APIKey); // request.Method = HttpMethod.Post; // //set content type // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var response = await client.SendAsync(request); // if (response.IsSuccessStatusCode) // { // var message = await response.Content.ReadAsStringAsync(); // message = JsonConvert.DeserializeObject<string>(message); // return message; // } // return ""; //} }
public async Task <int> Delete(int Id) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("Id", Id.ToString()); string method = "userSetValues/Delete"; return(await APIResult.post(method, parameters)); //// ... Use HttpClient. //ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; //using (var client = new HttpClient()) //{ // ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // client.BaseAddress = new Uri(Global.APIUri); // client.DefaultRequestHeaders.Clear(); // client.DefaultRequestHeaders.Add("Connection", "Keep-Alive"); // client.DefaultRequestHeaders.Add("Keep-Alive", "3600"); // HttpRequestMessage request = new HttpRequestMessage(); // request.RequestUri = new Uri(Global.APIUri + "userSetValues/Delete?Id=" + Id); // request.Headers.Add("APIKey", Global.APIKey); // request.Method = HttpMethod.Post; // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var response = await client.SendAsync(request); // if (response.IsSuccessStatusCode) // { // return true; // } // return false; //} }
public async Task <string> getrestore() { string messsage = ""; //newlog.userId = MainWindow.userID; //newlog.posId = MainWindow.posID; int logId = (int)MainWindow.userLogInID; BackupCls item = new BackupCls(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("logId", logId.ToString()); parameters.Add("fileName", fileName); //parameters.Add("userId", userId.ToString());fileName //parameters.Add("date", date.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("Backup/getrestore", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { if (c.Type == "scopes") { item = JsonConvert.DeserializeObject <BackupCls>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); break; } } } if (item.result == "1") { MainWindow.userLogInID = item.logId; } return(item.result); }
public async Task <List <Item> > GetAllItems() { List <Item> items = new List <Item>(); //########### to pass parameters (optional) //Dictionary<string, string> parameters = new Dictionary<string, string>(); //parameters.Add("itemObject", myContent); //IEnumerable<Claim> claims = await APIResult.getList("items/GetAllItems",parameters); //################# IEnumerable <Claim> claims = await APIResult.getList("items/GetAllItems"); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <Item>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <List <User> > getBranchSalesMan(int branchId, string objectName) { List <User> items = new List <User>(); //########### to pass parameters (optional) Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("branchId", branchId.ToString()); parameters.Add("objectName", objectName); IEnumerable <Claim> claims = await APIResult.getList("Users/GetSalesMan", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <User>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <List <Branch> > GetBalance(string type) { List <Branch> items = new List <Branch>(); // to pass parameters (optional) Dictionary <string, string> parameters = new Dictionary <string, string>(); string myContent = type; parameters.Add("type", myContent); // IEnumerable <Claim> claims = await APIResult.getList("Branches/GetBalance", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <Branch>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <int> GetLastNumOfCode(string type) { int value = 0; Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("type", type); //################# IEnumerable <Claim> claims = await APIResult.getList("Agent/GetLastNumOfCode", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { value = int.Parse(JsonConvert.DeserializeObject <String>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); break; } } return(value); }
public async Task <int> updatesalecode(string skey) { int item = 0; // int res = 0; // SendDetail item = new SendDetail(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("skey", skey); //################# IEnumerable <Claim> claims = await APIResult.getList("Activate/updatesalecode", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { item = int.Parse(c.Value); // item = JsonConvert.DeserializeObject<SendDetail>(c.Value, new JsonSerializerSettings { DateParseHandling = DateParseHandling.None }); break; } } return(item); }
public async Task <SendDetail> OfflineActivate(SendDetail SendDetaildata, string activeState) { SendDetail item = new SendDetail(); Dictionary <string, string> parameters = new Dictionary <string, string>(); var myContent3 = JsonConvert.SerializeObject(SendDetaildata); parameters.Add("object", myContent3); parameters.Add("activeState", activeState); //################# IEnumerable <Claim> claims = await APIResult.getList("Activate/OfflineActivate", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { item = JsonConvert.DeserializeObject <SendDetail>(c.Value, new JsonSerializerSettings { DateParseHandling = DateParseHandling.None }); } } return(item); }
public async Task <List <Item> > GetSaleOrPurItems(int categoryId, short defaultSale, short defaultPurchase, int branchId) { List <Item> items = new List <Item>(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("categoryId", categoryId.ToString()); parameters.Add("defaultSale", defaultSale.ToString()); parameters.Add("defaultPurchase", defaultPurchase.ToString()); parameters.Add("branchId", branchId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("items/GetSaleOrPurItems", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { items.Add(JsonConvert.DeserializeObject <Item>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(items); }
public async Task <List <ItemLocation> > getSpecificItemLocation(string itemUnitsIds, int branchId) { List <ItemLocation> list = new List <ItemLocation>(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("itemUnitsIds", itemUnitsIds.ToString()); parameters.Add("branchId", branchId.ToString()); //################# IEnumerable <Claim> claims = await APIResult.getList("ItemsLocations/getSpecificItemLocation", parameters); foreach (Claim c in claims) { if (c.Type == "scopes") { list.Add(JsonConvert.DeserializeObject <ItemLocation>(c.Value, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" })); } } return(list); //List<ItemLocation> items = null; //var myContent = JsonConvert.SerializeObject(itemUnitsIds); //// ... Use HttpClient. //ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; //using (var client = new HttpClient()) //{ // ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // client.BaseAddress = new Uri(Global.APIUri); // client.DefaultRequestHeaders.Clear(); // client.DefaultRequestHeaders.Add("Connection", "Keep-Alive"); // client.DefaultRequestHeaders.Add("Keep-Alive", "3600"); // HttpRequestMessage request = new HttpRequestMessage(); // request.RequestUri = new Uri(Global.APIUri + "ItemsLocations/getSpecificItemLocation?itemUnitsIds=" + myContent+"&branchId= " + branchId); // request.Headers.Add("APIKey", Global.APIKey); // request.Method = HttpMethod.Get; // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // HttpResponseMessage response = await client.SendAsync(request); // if (response.IsSuccessStatusCode) // { // var jsonString = await response.Content.ReadAsStringAsync(); // jsonString = jsonString.Replace("\\", string.Empty); // jsonString = jsonString.Trim('"'); // // fix date format // JsonSerializerSettings settings = new JsonSerializerSettings // { // Converters = new List<JsonConverter> { new BadDateFixingConverter() }, // DateParseHandling = DateParseHandling.None // }; // items = JsonConvert.DeserializeObject<List<ItemLocation>>(jsonString, new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }); // return items; // } // else //web api sent error response // { // items = new List<ItemLocation>(); // } // return items; //} }