public POSTempTrans AddPosTempTransaction(POSTempTrans posTempTran)
        {
            var item = _posTempTran.Add(posTempTran);

            _posTempTran.SaveChanges();
            return(item);
        }
        /// <summary>
        /// This method is used for insert temp data for puchase item by customer. - PS
        /// </summary>
        /// <returns></returns>
        private bool InsertTempTranscation(CustomerPOAC cpoDetailData)
        {
            POSTempTrans tempTrans = new POSTempTrans();

            tempTrans.BranchID         = SettingHelpers.CurrentBranchId;
            tempTrans.CreatedDateTime  = DateTime.UtcNow;
            tempTrans.CustomerID       = cpoDetailData.Customer.Id;
            tempTrans.IsSuspendedBill  = false;
            tempTrans.PurchaseOrderNo  = cpoDetailData.PurchaseOrderNo;
            tempTrans.ReturnedBillNo   = null;
            tempTrans.TransDate        = DateTime.UtcNow;
            tempTrans.TransReference   = string.Empty;
            tempTrans.UserID           = SettingHelpers.CurrentUserId;
            tempTrans.CpoDownPayment   = cpoDetailData.DownPaymentAmount;
            tempTrans.AdditionalAmount = SettingHelpers.AdditionalAmount;

            HttpClients httpClient  = new HttpClients();
            string      jsonString  = JsonConvert.SerializeObject(tempTrans);
            var         httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");

            var response = httpClient.PostAsync("api/posprocess/insertpostemptransdata", httpContent);

            if (response.IsSuccessStatusCode)
            {
                var tempTranscation = response.Content.ReadAsAsync <POSTempTrans>().Result;
                SettingHelpers.CurrentTempTransId = tempTranscation.Id;
                // bool result = InsertTempTranscationItemData(cpoDetailData.CPOItemDetailPOS.ToList());
                return(true);
            }
            return(false);
        }
        public POSTempTrans AddPosTempTransaction(POSTempTrans posTempTran)
        {
            string jsonString  = JsonConvert.SerializeObject(posTempTran);
            var    httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
            var    response    = httpClient.PostAsync("api/posprocess/insertpostemptransdata", httpContent);

            if (response.IsSuccessStatusCode)
            {
                return(response.Content.ReadAsAsync <POSTempTrans>().Result);
            }
            return(null);
        }
Exemplo n.º 4
0
 public IHttpActionResult UpdatePosTempTransForSuspendBill(POSTempTrans posTempTrans)
 {
     try
     {
         _iPOSProcessRepository.UpdatePosTempTransForSuspendBill(posTempTrans);
         return(Ok());
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        public void SubmitButtonCommand()
        {
            try
            {
                if (!String.IsNullOrEmpty(ReferenceName))
                {
                    ValidationMessage = string.Empty;
                    POSTempTrans posTempTrans = new POSTempTrans();
                    posTempTrans.Id = SettingHelpers.CurrentTempTransId;
                    posTempTrans.IsSuspendedBill = true;
                    posTempTrans.TransReference  = ReferenceName;
                    if (_posWindow.ViewModel.CustomerInformation.Customer != null && _posWindow.ViewModel.CustomerInformation.Customer.Id != 0)
                    {
                        posTempTrans.CustomerID = _posWindow.ViewModel.CustomerInformation.Customer.Id;
                    }
                    else
                    {
                        posTempTrans.CustomerID = 1;
                    }

                    _posRepository.UpdatePosTempTransForSuspendBill(posTempTrans);
                    SettingHelpers.SuspendBillCount   = (SettingHelpers.SuspendBillCount) + (1);
                    SettingHelpers.TotalAmount        = string.Empty;
                    _posWindow.ViewModel              = new POSWindowViewModel(_posWindow, true);
                    SettingHelpers.CurrentTempTransId = 0;
                    SettingHelpers.IsCustomerPO       = false;
                    var customerInformation = new CustomerInformation
                    {
                        Customer = new DomainModel.Models.Customer.CustomerProfile
                        {
                            MembershipCode = 00001,
                            Name           = "Walkin",
                            IsWalkIn       = true,
                            Id             = 1
                        }
                    };
                    _posWindow.ViewModel.CustomerInformation = customerInformation;
                    _posWindow.ViewModel.BillSummary         = new BillSummary();
                    _suspendBill.DialogResult = true;
                    _suspendBill.Close();
                }
                else
                {
                    ValidationMessage = StringConstants.EnterReference;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void UpdatePosTempTransForSuspendBill(POSTempTrans posTempTrans)
        {
            var posTempOjb = _posTempTran.GetById(posTempTrans.Id);

            if (posTempOjb != null)
            {
                posTempOjb.IsSuspendedBill  = posTempTrans.IsSuspendedBill;
                posTempOjb.TransReference   = posTempTrans.TransReference;
                posTempOjb.CustomerID       = posTempTrans.CustomerID;
                posTempOjb.ModifiedDateTime = DateTime.UtcNow;
                _posTempTran.Update(posTempOjb);
                _posTempTran.SaveChanges();
            }
        }
Exemplo n.º 7
0
 public IHttpActionResult InsertPOSTempTransData(POSTempTrans posTempTrans)
 {
     try
     {
         int id = _iPOSProcessRepository.InsertPOSTempTransData(posTempTrans);
         posTempTrans.Id = id;
         return(Ok(posTempTrans));
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// This method used for insert pos temp trans data and return primary key. -An
 /// </summary>
 /// <param name="postTempTrans">postTrmpTrans contain UserID,BranchID,CustomerID,ReturnedBillNo,PurchaseOrderNo,TransReference
 /// TransDate,IsSuspendedBill,CreatedDateTime</param>
 /// <returns></returns>
 public int InsertPOSTempTransData(POSTempTrans postTempTrans)
 {
     try
     {
         postTempTrans.CreatedDateTime = DateTime.UtcNow;
         _posTempTransContext.Add(postTempTrans);
         _posTempTransContext.SaveChanges();
         return(postTempTrans.Id);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemplo n.º 9
0
 public void UpdatePosTempTransForSuspendBill(POSTempTrans posTempTrans)
 {
     try
     {
         var posTempOjb = _posTempTransContext.GetById(posTempTrans.Id);
         if (posTempOjb != null)
         {
             posTempOjb.IsSuspendedBill  = posTempTrans.IsSuspendedBill;
             posTempOjb.TransReference   = posTempTrans.TransReference;
             posTempOjb.CustomerID       = posTempTrans.CustomerID;
             posTempOjb.ModifiedDateTime = DateTime.UtcNow;
             _posTempTransContext.Update(posTempOjb);
             _posTempTransContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 public void UpdatePosTempTransForSuspendBill(POSTempTrans posTempTrans)
 {
     var jsonString  = JsonConvert.SerializeObject(posTempTrans);
     var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
     var response    = httpClient.PostAsync("api/posprocess/updatepostemptransforsuspendbill", httpContent);
 }