public void DeletePOSTempIransItem(POSTempTransItem posTempTransItem) { HttpClients httpClient = new HttpClients(); string jsonString = JsonConvert.SerializeObject(posTempTransItem); var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json"); var response = httpClient.PostAsync("api/posprocess/deletepostemptransitem", httpContent); }
public POSTempTransItem AddPosTempTranItem(POSTempTransItem posTempTransItem) { var item = _posTempTranItems.Add(posTempTransItem); _posTempTranItems.SaveChanges(); return(item); }
public POSTempTransItem AddPosTempTranItem(POSTempTransItem posTempTransItem) { string tempTransString = JsonConvert.SerializeObject(posTempTransItem); var httpContentTempItem = new StringContent(tempTransString, Encoding.UTF8, "application/json"); var tempItemResponse = httpClient.PostAsync("api/posprocess/insertpostemptransitemsdata", httpContentTempItem); return(null); }
public IHttpActionResult UpdatePosTempTransItem(POSTempTransItem posTempItem) { try { var posTempObj = _iPOSProcessRepository.UpdatePosTempTransItem(posTempItem); return(Ok(posTempObj)); } catch (Exception) { throw; } }
public IHttpActionResult InsertPOSTempTransItemsData(POSTempTransItem posTempTransItem) { try { int id = _iPOSProcessRepository.InsertPOSTempTransItemsData(posTempTransItem); return(Ok(id)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult DeletePOSTempIransItemByBarcode(POSTempTransItem posTempTransItem) { try { _iPOSProcessRepository.DeletePOSTempIransItemByBarcode(posTempTransItem); return(Ok()); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public void DeletePOSTempIransItemByBarcode(POSTempTransItem posTempTransItem) { var posTempItemList = _posTempTranItems.Fetch(x => x.Barcode == posTempTransItem.Barcode && x.TempTransID == posTempTransItem.TempTransID).ToList(); if (posTempItemList.Any()) { foreach (var item in posTempItemList) { _posTempTranItems.Delete(item.Id); _posTempTranItems.SaveChanges(); } } }
public POSTempTransItem UpdatePosTempTransItem(POSTempTransItem posTempItem) { string jsonString = JsonConvert.SerializeObject(posTempItem); var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json"); var response = httpClient.PostAsync("api/posprocess/updatepostemptransitem", httpContent); if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsAsync <POSTempTransItem>().Result; return(data); } return(null); }
public void DeletePOSTempIransItem(POSTempTransItem posTempTransItem) { var tempItem = _posTempTranItems.GetAll(). Where(x => x.Barcode == posTempTransItem.Barcode && x.TempTransID == posTempTransItem.TempTransID && x.Quantity == posTempTransItem.Quantity && x.IsOfferItem == posTempTransItem.IsOfferItem) .FirstOrDefault(); if (tempItem != null) { _posTempTranItems.Delete(tempItem.Id); _posTempTranItems.SaveChanges(); } }
/// <summary> /// This method used for insert into post temp Trans Data and retyrn primary key.-An /// </summary> /// <param name="posTempTransData">posTempTransdata contain TempTransID,ItemID,Barcode,Quantity</param> /// <returns></returns> public int InsertPOSTempTransItemsData(POSTempTransItem posTempTransItem) { try { posTempTransItem.CreatedDateTime = DateTime.UtcNow; _posTempTransItemContext.Add(posTempTransItem); _posTempTransItemContext.SaveChanges(); return(posTempTransItem.Id); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public POSTempTransItem UpdatePosTempTransItem(POSTempTransItem posTempItem) { var posTempObj = _posTempTranItems. FirstOrDefault(x => x.Barcode == posTempItem.Barcode && x.IsOfferItem == posTempItem.IsOfferItem && x.TempTransID == posTempItem.TempTransID); if (posTempObj != null) { posTempObj.Quantity = posTempItem.Quantity; posTempItem.ModifiedDateTime = DateTime.UtcNow; _posTempTranItems.Update(posTempObj); _posTempTranItems.SaveChanges(); } return(posTempObj); }
/// <summary> /// This method is used for Insert data in POSTempTransItem table. /// </summary> /// <returns>boolean</returns> private bool InsertTempTranscationItemData(List <POSItemDetail> cpoDetailData) { HttpClients httpClient = new HttpClients(); foreach (var item in cpoDetailData) { POSTempTransItem tempItem = new POSTempTransItem(); tempItem.Barcode = item.Barcode; tempItem.CreatedDateTime = DateTime.UtcNow; tempItem.ItemPrice = item.ItemPrice; tempItem.ItemID = item.ItemId; tempItem.Quantity = item.ItemQuantity; tempItem.TempTransID = SettingHelpers.CurrentTempTransId; tempItem.IsOfferItem = item.IsOfferItem; string tempTransString = JsonConvert.SerializeObject(tempItem); var httpContentTempItem = new StringContent(tempTransString, Encoding.UTF8, "application/json"); var tempItemResponse = httpClient.PostAsync("api/posprocess/insertpostemptransitemsdata", httpContentTempItem); } return(true); }
public void DeletePOSTempIransItemByBarcode(POSTempTransItem posTempTransItem) { try { var posTempItemList = _posTempTransItemContext.Fetch(x => x.Barcode == posTempTransItem.Barcode && x.TempTransID == posTempTransItem.TempTransID).ToList(); if (posTempItemList.Any()) { foreach (var item in posTempItemList) { _posTempTransItemContext.Delete(item.Id); _posTempTransItemContext.SaveChanges(); } } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public void DeletePOSTempIransItem(POSTempTransItem posTempTransItem) { try { var tempItem = _posTempTransItemContext.GetAll(). Where(x => x.Barcode == posTempTransItem.Barcode && x.TempTransID == posTempTransItem.TempTransID && x.Quantity == posTempTransItem.Quantity && x.IsOfferItem == posTempTransItem.IsOfferItem) .FirstOrDefault(); if (tempItem != null) { _posTempTransItemContext.Delete(tempItem.Id); _posTempTransItemContext.SaveChanges(); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public POSTempTransItem UpdatePosTempTransItem(POSTempTransItem posTempItem) { try { var PosTempObj = _posTempTransItemContext. FirstOrDefault(x => x.Barcode == posTempItem.Barcode && x.IsOfferItem == posTempItem.IsOfferItem && x.TempTransID == posTempItem.TempTransID); if (PosTempObj != null) { PosTempObj.Quantity = posTempItem.Quantity; posTempItem.ModifiedDateTime = DateTime.UtcNow; _posTempTransItemContext.Update(PosTempObj); _posTempTransItemContext.SaveChanges(); } return(PosTempObj); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public void SubmitButtonCommand() { HttpClients httpClient = new HttpClients(); if (!String.IsNullOrEmpty(PopupValue)) { isError = false; if (_isCustomer) { if (PopupValue.Trim().Equals("00001")) { _posWindow.ViewModel.CustomerInformation.Customer = new CustomerProfile { MembershipCode = 1, Id = 1, Name = "Walkin Customer", IsWalkIn = true }; _customerWindow.DialogResult = true; _customerWindow.Close(); } else { var response = httpClient.GetAsync("api/customer/getcustomerbymebershipcodeormobileno?number=" + PopupValue); if (response.IsSuccessStatusCode) { string data = response.Content.ReadAsStringAsync().Result; var CustomerProfile = JsonConvert.DeserializeObject <CustomerProfile>(data); if (CustomerProfile != null) { if (CustomerProfile.IsActive) { CustomerProfileObject = CustomerProfile; _posWindow.ViewModel.CustomerInformation.Customer = CustomerProfile; _customerWindow.DialogResult = true; _customerWindow.Close(); } else { isError = true; Message = StringConstants.InActiveCustomer; } } else { isError = true; Message = StringConstants.CustomerNoNotFound; } //return CustomerProfile; } else { isError = true; Message = StringConstants.CustomerNoNotFound; } } } if (_isCustomerPO) { var CustomerPOResponse = httpClient.GetAsync("api/customerpo/getcustomerpobyponumber?purchaseOrderNumber=" + PopupValue); if (CustomerPOResponse.IsSuccessStatusCode) { var customerPOString = CustomerPOResponse.Content.ReadAsStringAsync().Result; var customerPOData = JsonConvert.DeserializeObject <CustomerPurchaseOrder>(customerPOString); if (customerPOData != null) { var cpoDetailResponse = httpClient.GetAsync("api/customerpo/getcustomerpurchaseorderbycpoid?cpoId=" + customerPOData.Id); if (cpoDetailResponse.IsSuccessStatusCode) { var cpoDetailString = cpoDetailResponse.Content.ReadAsStringAsync().Result; var cpoDetailData = JsonConvert.DeserializeObject <CustomerPOAC>(cpoDetailString); if (cpoDetailData != null) { if (cpoDetailData.IsCollected) { isError = true; Message = StringConstants.CpoCollected; } else if (cpoDetailData.IsCancel) { isError = true; Message = StringConstants.CpoCancelled; } else { if (cpoDetailData.CollectingBranchId != SettingHelpers.CurrentBranchId) { MessageBox.Show(string.Format(StringConstants.CPOCollectionValidation, cpoDetailData.CollectingBranchName), "CPO Collection Validation", MessageBoxButton.OK, MessageBoxImage.Information); return; } _posWindow.ViewModel.CustomerInformation.Customer = cpoDetailData.Customer; // SettingHelpers.CurrentBranchId = cpoDetailData.CollectingBranchId; _posWindow.ViewModel.BillSummary.DownPayment = cpoDetailData.POSBillAmount; _posWindow.ViewModel.ItemProfileCollectionNew = new ObservableCollection <POSItemDetail>(); _posWindow.ViewModel.BillSummary.OrderAmount = 0; _posWindow.ViewModel.BillSummary.Discount = 0; if (cpoDetailData.CPOAdditionalCost.Any()) { _posWindow.ViewModel.BillSummary.AdditionalAmount = cpoDetailData.CPOAdditionalCost.Sum(x => x.Amount); } SettingHelpers.AdditionalAmount = _posWindow.ViewModel.BillSummary.AdditionalAmount == null ? 0 : _posWindow.ViewModel.BillSummary.AdditionalAmount.Value; var tempPosItem = new List <POSTempTransItem>(); POSTempTransItem newObj; foreach (var item in cpoDetailData.CPOItem.ToList()) { newObj = new POSTempTransItem(); newObj.Barcode = item.Barcode; newObj.ItemProfile = item.ItemProfile; newObj.Quantity = item.Quantity; newObj.ItemID = item.ItemId; tempPosItem.Add(newObj); } if (SettingHelpers.CurrentTempTransId == 0) { InsertTempTranscation(cpoDetailData); } _posWindow.ViewModel.ProcessTempTransactionItems(tempPosItem, false); cpoDetailData.CPOItemDetailPOS = _posWindow.ViewModel.ItemProfileCollectionNew; SettingHelpers.IsCustomerPO = true; _posWindow.ViewModel.CustomerInformation.CPO = new CustomerPurchaseOrder { PurchaseOrderNo = cpoDetailData.PurchaseOrderNo }; _customerWindow.DialogResult = true; _customerWindow.Close(); //BackgroundWorker bgInsertTempTrans = new BackgroundWorker(); //bgInsertTempTrans.DoWork += bgInsertTempTrans_DoWork; //bgInsertTempTrans.RunWorkerCompleted += bgInsertTempTrans_RunWorkerCompleted; //bgInsertTempTrans.RunWorkerAsync(cpoDetailData); } } } } else { isError = true; Message = StringConstants.CpoNotExists; } } } else if (_isReturnBill) { var responseReturnBill = httpClient.GetAsync("api/returnbill/getposreturnbilldatabyreturnbillno?billNo=" + PopupValue); if (responseReturnBill.IsSuccessStatusCode) { var returnBillData = responseReturnBill.Content.ReadAsAsync <POSReturnBill>().Result; if (returnBillData != null) { if (!returnBillData.IsProcessed) { if (SettingHelpers.CurrentBranchId != returnBillData.IssuingBranchID) { if (SettingHelpers.CompanyConfigruationObject.ReturnItem) { _posWindow.ViewModel.CustomerInformation.ReturnBill = returnBillData; if (returnBillData.POSBill.Customer != null) { _posWindow.ViewModel.CustomerInformation.Customer = returnBillData.POSBill.Customer; } _customerWindow.DialogResult = true; _customerWindow.Close(); } else { MessageBox.Show(string.Format(StringConstants.ReturnOtherBranchNotAllowd, returnBillData.BranchDetail.Name), "Return Item", MessageBoxButton.OK, MessageBoxImage.Information); } } else { if (returnBillData.POSBill.Customer != null) { _posWindow.ViewModel.CustomerInformation.Customer = returnBillData.POSBill.Customer; } _posWindow.ViewModel.CustomerInformation.ReturnBill = returnBillData; _customerWindow.DialogResult = true; _customerWindow.Close(); } } else { isError = true; Message = StringConstants.ReturnBillProceed; } } else { isError = true; Message = StringConstants.ReturnBillNotFount; } } else { isError = true; Message = StringConstants.ReturnBillNotFount; } } } else { isError = true; if (_isCustomer) { Message = StringConstants.CustomerNoRequired; } else if (_isReturnBill) { Message = StringConstants.ReturnBillNoRequired; } else { Message = StringConstants.CustomerPORequired; } } }