示例#1
0
 private void UpdateReuturnBill()
 {
     try
     {
         HttpClients httpClients = new HttpClients();
         if (customerInfo.ReturnBill != null)
         {
             POSReturnBill posReuturnObj = customerInfo.ReturnBill;
             posReuturnObj.IsProcessed        = true;
             posReuturnObj.ProcessingBranchID = SettingHelpers.CurrentBranchId;
             posReuturnObj.ProcessorID        = SettingHelpers.CurrentUserId;
             var jsonString  = JsonConvert.SerializeObject(posReuturnObj);
             var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
             var response    = httpClients.PostAsync("api/returnbill/updateposreturnbillforpos", httpContent);
             if (response.IsSuccessStatusCode)
             {
                 var        result     = response.Content.ReadAsAsync <bool>().Result;
                 POSSession posSession = new POSSession();
                 posSession.Id           = SettingHelpers.CurrentPosSessionId;
                 posSession.ReturnedBill = RemainingAmount;
                 string jsonPosSession        = JsonConvert.SerializeObject(posSession);
                 var    httpContentPosSession = new StringContent(jsonPosSession, Encoding.UTF8, "application/json");
                 var    reponsePosSession     = httpClients.PostAsync("api/possession/updatepossessionforreturnedbillamount", httpContentPosSession);
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#2
0
 public POSSession GetPosSessionBySessionLoginId(int userLoginId)
 {
     try
     {
         POSSession posSession = _posSessionsContext.FirstOrDefault(x => x.POSLoginSessionId == userLoginId);
         return(posSession);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public POSSession UpdatePosSessionData(POSSession posSession)
        {
            var jsonString  = JsonConvert.SerializeObject(posSession);
            var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
            var response    = httpClient.PostAsync("api/possession/updatepossessiondata", httpContent);

            if (response.IsSuccessStatusCode)
            {
                return(response.Content.ReadAsAsync <POSSession>().Result);
            }
            return(null);
        }
        public void EndSession()
        {
            MessageBoxResult messageResult = MessageBox.Show(StringConstants.EndSessionMessage, "LogOut Confirmation", MessageBoxButton.YesNo);

            if (messageResult == MessageBoxResult.Yes)
            {
                if (!String.IsNullOrEmpty(SettingHelpers.TotalAmount))
                {
                    MessageBox.Show("Please Delete the Added Item To Sign Out.", "End Session", MessageBoxButton.OK, MessageBoxImage.Warning);
                    _logOUtWindow.DialogResult = false;
                    _logOUtWindow.Close();
                    return;
                }

                //Application.Current.Shutdown();
                if (SettingHelpers.SuspendBillCount != 0)
                {
                    MessageBox.Show("Please Delete Suspend Bills " + SettingHelpers.SuspendBillCount + " To Sign Out.", "End Session", MessageBoxButton.OK, MessageBoxImage.Warning);
                    _logOUtWindow.DialogResult = false;
                    _logOUtWindow.Close();
                    return;
                }
                POSSession posSession = new POSSession();
                posSession.Id               = SettingHelpers.CurrentPosSessionId;
                posSession.StatusTypeId     = 22;//End
                posSession.ModifiedDateTime = DateTime.UtcNow;
                var updatedPosSession = _posRepository.UpdatePosSessionForEndSeesion(posSession);
                if (updatedPosSession != null)
                {
                    POSLoginSession posLoginSession = new POSLoginSession();
                    posLoginSession.Id = updatedPosSession.POSLoginSessionId;
                    var jsonPosLoginSession = JsonConvert.SerializeObject(posLoginSession);
                    posLoginSession.ModifiedDateTime = DateTime.UtcNow;
                    _posRepository.UpdatePosLoginSessionForEndSession(posLoginSession);

                    //changed by ankit
                    if (SettingHelpers.OperationIncidentReport.Count > 0)
                    {
                        if (SettingHelpers.OperationIncidentReport[0].OperationTypeId == Convert.ToInt32(OperationTypes.PerCashierLoginSeesion))
                        {
                            _posRepository.UpdateIncidentReportByCashierId(SettingHelpers.CurrentUserId);
                        }
                    }
                }
                _logOUtWindow.DialogResult = true;
                _logOUtWindow.Close();
            }
            else
            {
                _logOUtWindow.DialogResult = false;
                _logOUtWindow.Close();
            }
        }
        public POSSession UpdatePosSessionForEndSeesion(POSSession posSession)
        {
            var posSessionObje = _posSessions.GetById(posSession.Id);

            if (posSessionObje != null)
            {
                posSessionObje.StatusTypeId     = posSession.StatusTypeId;
                posSessionObje.ModifiedDateTime = DateTime.UtcNow;
                _posSessions.Update(posSessionObje);
                _posSessions.SaveChanges();
            }
            return(posSessionObje);
        }
        public int InsertPOSSessionsData(POSSession posSession)
        {
            string posSessionJsonString = JsonConvert.SerializeObject(posSession);
            var    httpContent          = new StringContent(posSessionJsonString, Encoding.UTF8, "application/json");

            var posSesionResponse = httpClient.PostAsync("api/possession/insertpossession", httpContent);

            if (posSesionResponse.IsSuccessStatusCode)
            {
                var posSessionData = posSesionResponse.Content.ReadAsAsync <POSSession>().Result;
                return(posSessionData.Id);
            }
            return(0);
        }
示例#7
0
 /// <summary>
 /// This method used for insert into pos bill payment . -An
 /// </summary>
 /// <param name="posSession">POSLoginSessionId,MismatchResolveTypeID,StartDate,EndDate,IsMatched,MismatchedValue,Cash,DebitCard,CreditCard,Coupon,CreditAccount,ReturnedBill,ActualCash,ActualDebitCard,ActualCreditCard,ActualCoupon,ActualCreditAccount,ActualReturnedBill</param>
 /// <returns></returns>
 public int InsertPOSSessionsData(POSSession posSession)
 {
     try
     {
         _posSessionContext.Add(posSession);
         _posSessionContext.SaveChanges();
         return(posSession.Id);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
示例#8
0
        /// <summary>
        ///This method used for delete current Payment Type by POSBillId. -An
        /// </summary>
        /// <param name="posBillId"></param>
        /// <returns></returns>
        public bool DeleteCurrentPaymentTYpeByPOSBillId(int posBillId)
        {
            try
            {
                List <POSBillPayment> listOfPOSBillPayment = _POSBillPayment.Fetch(x => x.POSBillID == posBillId).ToList();
                POSSession            posSession           = new POSSession();
                foreach (var posBillPayment in listOfPOSBillPayment)
                {
                    posSession = _posSessionsContext.FirstOrDefault(x => x.POSLoginSessionId == posBillPayment.POSBill.POSSessionID);
                    if (posSession != null)
                    {
                        switch (posBillPayment.ParamType.ValueEn)
                        {
                        case StringConstants.Cash:
                            posSession.Cash -= posBillPayment.Amount;
                            break;

                        case StringConstants.DebitCard:
                            posSession.DebitCard -= posBillPayment.Amount;
                            break;

                        case StringConstants.CreditCardPOS:
                            posSession.CreditCard -= posBillPayment.Amount;
                            break;

                        case StringConstants.Coupon:
                            posSession.Coupon -= posBillPayment.Amount;
                            break;

                        case StringConstants.Cheque:
                            posSession.Cheque -= posBillPayment.Amount;
                            break;

                        default:
                            break;
                        }
                        _posSessionsContext.Update(posSession);
                        _posSessionsContext.SaveChanges();
                    }
                    _POSBillPayment.Delete(posBillPayment.Id);
                    _POSBillPayment.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
示例#9
0
 /// <summary>
 /// This method used for update pos session. -An
 /// </summary>
 /// <param name="posSession"></param>
 /// <returns></returns>
 public int UpdatePOSSession(POSSession posSession)
 {
     try
     {
         posSession.ModifiedDateTime = DateTime.UtcNow;
         _posSessionsContext.Update(posSession);
         _posSessionsContext.SaveChanges();
         return(posSession.Id);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
示例#10
0
 /// <summary>
 /// This method used for insert into POSSession table and return primary key. -An
 /// </summary>
 /// <param name="posSession">POSsession contains  POSLoginSessionId,MismatchResolveTypeID,StartDate,EndDate,IsMatched,MismatchedValue,
 /// Cash,DebitCard,CreditCard,Coupon,CreditAccount,ReturnedBill,ActualCash,ActualDebitCard,ActualCreditCard,ActualCoupon,ActualCreditAccount</param>
 /// <returns></returns>
 public int AddNewPOSSession(POSSession posSession)
 {
     try
     {
         posSession.CreatedDateTime = DateTime.UtcNow;
         _posSessionsContext.Add(posSession);
         _posSessionsContext.SaveChanges();
         return(posSession.Id);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        public POSSession UpdatePosSessionData(POSSession posSession)
        {
            var posSessionObj = _posSessions.GetById(posSession.Id);

            posSessionObj.Cash             = posSession.Cash + posSessionObj.Cash;
            posSessionObj.DebitCard        = posSession.DebitCard + posSessionObj.DebitCard;
            posSessionObj.CreditCard       = posSession.CreditCard + posSessionObj.CreditCard;
            posSessionObj.Coupon           = posSession.Coupon + posSessionObj.Coupon;
            posSessionObj.CreditAccount    = posSession.CreditAccount + posSessionObj.CreditAccount;
            posSessionObj.Cheque           = posSession.Cheque + posSessionObj.Cheque;
            posSessionObj.ModifiedDateTime = DateTime.UtcNow;
            _posSessions.Update(posSessionObj);
            _posSessions.SaveChanges();
            return(posSessionObj);
        }
示例#12
0
 public void UpdatePosSessionForReturnedBillAmount(POSSession posSession)
 {
     try
     {
         var posSessionObject = _posSessionsContext.GetById(posSession.Id);
         if (posSessionObject != null)
         {
             posSessionObject.ReturnedBill     = Convert.ToDecimal(posSessionObject.ReturnedBill) + posSession.ReturnedBill;
             posSessionObject.ModifiedDateTime = DateTime.UtcNow;
             _posSessionsContext.Update(posSessionObject);
             _posSessionsContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
示例#13
0
 /// <summary>
 /// This method is used for Update PosSession data once payment is done.
 /// </summary>
 private void UpdatePosSessionData()
 {
     try
     {
         POSSession posSession = new POSSession();
         posSession.Id            = SettingHelpers.CurrentPosSessionId;
         posSession.Cash          = Convert.ToDecimal(CashAmount);
         posSession.DebitCard     = Convert.ToDecimal(DebitCardAmount);
         posSession.CreditCard    = Convert.ToDecimal(CreditCardAmount);
         posSession.Coupon        = Convert.ToDecimal(CouponAmount);
         posSession.CreditAccount = Convert.ToDecimal(CreditAccountAmount);
         posSession.Cheque        = Convert.ToDecimal(chequeAmount);
         _posRepository.UpdatePosSessionData(posSession);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#14
0
 public POSSession UpdatePosSessionForEndSeesion(POSSession posSession)
 {
     try
     {
         var posSessionObje = _posSessionsContext.GetById(posSession.Id);
         if (posSessionObje != null)
         {
             posSessionObje.StatusTypeId     = posSession.StatusTypeId;
             posSessionObje.ModifiedDateTime = DateTime.UtcNow;
             _posSessionsContext.Update(posSessionObje);
             _posSessionsContext.SaveChanges();
         }
         return(posSessionObje);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
示例#15
0
        public POSSession UpdatePosSessionData(POSSession posSession)
        {
            try
            {
                var posSessionObj = _posSessionsContext.GetById(posSession.Id);

                posSessionObj.Cash             = posSession.Cash + posSessionObj.Cash;
                posSessionObj.DebitCard        = posSession.DebitCard + posSessionObj.DebitCard;
                posSessionObj.CreditCard       = posSession.CreditCard + posSessionObj.CreditCard;
                posSessionObj.Coupon           = posSession.Coupon + posSessionObj.Coupon;
                posSessionObj.CreditAccount    = posSession.CreditAccount + posSessionObj.CreditAccount;
                posSessionObj.Cheque           = posSession.Cheque + posSessionObj.Cheque;
                posSessionObj.ModifiedDateTime = DateTime.UtcNow;
                _posSessionsContext.Update(posSessionObj);
                _posSessionsContext.SaveChanges();
                return(posSessionObj);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
        public bool UpdatePosReturnBillForPOs(POSReturnBill posReturnBill, POSSession posSession)
        {
            var httpClient  = new HttpClients();
            var jsonString  = JsonConvert.SerializeObject(posReturnBill);
            var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
            var response    = httpClient.PostAsync("api/returnbill/updateposreturnbillforpos", httpContent);

            if (response.IsSuccessStatusCode)
            {
                string jsonPosSession        = JsonConvert.SerializeObject(posSession);
                var    httpContentPosSession = new StringContent(jsonPosSession, Encoding.UTF8, "application/json");
                var    reponsePosSession     = httpClient.PostAsync("api/possession/updatepossessionforreturnedbillamount", httpContentPosSession);
                if (!reponsePosSession.IsSuccessStatusCode)
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
示例#17
0
        private void InsertPOSSession(int userId)
        {
            POSLoginSession posLoginSession = new POSLoginSession();

            posLoginSession.UserId          = userId;
            posLoginSession.LoginDateTime   = DateTime.UtcNow;
            posLoginSession.LogoutDateTime  = null;
            posLoginSession.CreatedDateTime = DateTime.UtcNow;
            var        id         = _posRepository.AddNewPOSLoginSession(posLoginSession);
            POSSession posSession = new POSSession();

            posSession.ActualCash          = 0;
            posSession.ActualCoupon        = 0;
            posSession.ActualCreditAccount = 0;
            posSession.ActualCreditCard    = 0;
            posSession.ActualDebitCard     = 0;
            posSession.ActualReturnedBill  = 0;
            posSession.Cash                  = 0;
            posSession.Coupon                = 0;
            posSession.CreatedDateTime       = DateTime.UtcNow;
            posSession.CreditAccount         = 0;
            posSession.CreditCard            = 0;
            posSession.DebitCard             = 0;
            posSession.EndDate               = DateTime.UtcNow;
            posSession.IsMatched             = false;
            posSession.MismatchedValue       = 0;
            posSession.MismatchResolveTypeID = 1;
            posSession.POSLoginSessionId     = id;
            posSession.ReturnedBill          = 0;
            posSession.StartDate             = DateTime.UtcNow;
            posSession.ParentRecord          = null;
            posSession.Comment               = null;
            posSession.StatusTypeId          = 21;//"Processing"
            var posSessionId = _posRepository.InsertPOSSessionsData(posSession);

            Utility.SettingHelpers.CurrentPosSessionId = posSessionId;
        }
 public int InsertPOSSessionsData(POSSession posSession)
 {
     _posSessions.Add(posSession);
     _posSessions.SaveChanges();
     return(posSession.Id);
 }