public POSLoginSession UpdatePosLoginSessionForEndSession(POSLoginSession posLoginSession) { var jsonPosLoginSession = JsonConvert.SerializeObject(posLoginSession); var httpContentPosLogin = new StringContent(jsonPosLoginSession, Encoding.UTF8, "application/json"); var posLoginResponse = httpClient.PostAsync("api/possession/updateposloginsessionforendsession", httpContentPosLogin); 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 POSLoginSession UpdatePosLoginSessionForEndSession(POSLoginSession posLoginSession) { var posLoginSessionObj = _posLoginSession.GetById(posLoginSession.Id); if (posLoginSessionObj != null) { posLoginSessionObj.LogoutDateTime = DateTime.UtcNow; _posLoginSession.Update(posLoginSession); _posLoginSession.SaveChanges(); } return(posLoginSessionObj); }
public int AddNewPOSLoginSession(POSLoginSession posLoginSession) { var pos = new POSLoginSession { CreatedDateTime = DateTime.UtcNow, LoginDateTime = DateTime.UtcNow, LogoutDateTime = null, UserId = posLoginSession.UserId }; _posLoginSession.Add(pos); _posLoginSession.SaveChanges(); return(pos.Id); }
void bgCheckUserSession_DoWork(object sender, DoWorkEventArgs e) { POSLoginSession loginSession = CheckUserLogOutOrNot(Utility.SettingHelpers.CurrentUserId); if (loginSession == null) { var posLoginSessionObj = _posRepository.GetLastLogoutRecordByUserId(Utility.SettingHelpers.CurrentUserId); if (posLoginSessionObj != null) { var posSessionObjData = _posRepository.GetPosSessionBySessionLoginId(posLoginSessionObj.Id); if (posSessionObjData != null) { if (posSessionObjData.StatusTypeId == 22)//end { MessageBox.Show(StringConstants.ReconcileAccountFirst, "Reconcile Account", MessageBoxButton.OK, MessageBoxImage.Information); Utility.SettingHelpers.IsReconciled = false; IsBusy = false; } else { Utility.SettingHelpers.IsReconciled = true; InsertPOSSession(Utility.SettingHelpers.CurrentUserId); Utility.SettingHelpers.isCashierLogOut = true; } } } else { Utility.SettingHelpers.IsReconciled = true; InsertPOSSession(Utility.SettingHelpers.CurrentUserId); Utility.SettingHelpers.isCashierLogOut = true; } } else { var posSessionData = _posRepository.GetPosSessionBySessionLoginId(loginSession.Id); if (posSessionData != null) { Utility.SettingHelpers.CurrentPosSessionId = posSessionData.Id; } Utility.SettingHelpers.SuspendBillCount = _posRepository.GetSuspendBillCountByUserId(Utility.SettingHelpers.CurrentUserId); Utility.SettingHelpers.isCashierLogOut = false; } }
public POSLoginSession UpdatePosLoginSessionForEndSession(POSLoginSession posLoginSession) { try { var posLoginSessionObj = _posLoginSessionsContext.GetById(posLoginSession.Id); if (posLoginSessionObj != null) { posLoginSessionObj.LogoutDateTime = DateTime.UtcNow; posLoginSessionObj.ModifiedDateTime = DateTime.UtcNow; _posLoginSessionsContext.Update(posLoginSessionObj); _posLoginSessionsContext.SaveChanges(); } return(posLoginSessionObj); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public int AddNewPOSLoginSession(POSLoginSession posLoginSession) { var pos = new POSLoginSession { CreatedDateTime = DateTime.UtcNow, LoginDateTime = DateTime.UtcNow, LogoutDateTime = null, UserId = posLoginSession.UserId }; string jsonStringPosSession = JsonConvert.SerializeObject(pos); var httpContentPosSession = new StringContent(jsonStringPosSession, Encoding.UTF8, "application/json"); var response = httpClient.PostAsync("api/possession/insertposloginsession", httpContentPosSession); if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsAsync <POSLoginSession>().Result; return(data.Id); } return(0); }
/// <summary> /// This method used for insert into table posLoginSession and return primary key. -An /// </summary> /// <param name="posLoginSession">posLoginSession UserId,LoginDateTime,LogoutDateTime</param> /// <returns></returns> public int AddNewPOSLoginSession(POSLoginSession posLoginSession) { try { var pos = new POSLoginSession { CreatedDateTime = DateTime.UtcNow, LoginDateTime = DateTime.UtcNow, LogoutDateTime = null, UserId = posLoginSession.UserId }; _posLoginSessionsContext.Add(pos); _posLoginSessionsContext.SaveChanges(); return(pos.Id); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
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; }