Exemple #1
0
		private bool InitializeBeginningCashierID()
		{
			CashierLogsDetails clsLogDetails = new CashierLogsDetails();
			clsLogDetails.CashierID = miCashierID;
			clsLogDetails.LoginDate = DateTime.Now;
            clsLogDetails.BranchID = TerminalDetails.BranchID;
            clsLogDetails.TerminalNo = TerminalDetails.TerminalNo;
			clsLogDetails.IPAddress = System.Net.Dns.GetHostName();
			clsLogDetails.Status = CashierLogStatus.LoggedIn;

			CashierLogs clsCashierLogs = new CashierLogs();
			clsCashierLogs.UpdateBeginningBalance(clsLogDetails, Convert.ToDecimal(txtAmount.Text));
			clsCashierLogs.CommitAndDispose();

			return true;
		}
Exemple #2
0
		private DialogResult LoggedOutCashier(bool LogOutOnly)
		{
			if (!mboLocked)
			{
                if (!SuspendTransactionAndContinue()) return System.Windows.Forms.DialogResult.Cancel;

				DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.LogoutFE);

				if (loginresult == DialogResult.OK)
				{
					if (LogOutOnly)
					{
						if (MessageBox.Show("Are you sure you want to Log Out?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
						{
							return DialogResult.Cancel;
						}
					}

					Cursor.Current = Cursors.WaitCursor;
					try
					{
						clsEvent.AddEvent("[" + lblCashier.Text + "] Logging out...");

						CashierLogs clsCashierLogs = new CashierLogs(mConnection, mTransaction);
                        mConnection = clsCashierLogs.Connection; mTransaction = clsCashierLogs.Transaction;

						clsCashierLogs.Logout(Convert.ToInt64(lblCashierName.Tag));

                        InsertAuditLog(AccessTypes.LogoutFE, "User logout." + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

						clsEvent.AddEventLn("Done!", true);

						this.Lock();

						clsEvent.AddEventLn("System is now closed for any transaction!", true);
                        clsCashierLogs.CommitAndDispose();
					}
					catch (Exception ex)
					{
                        InsertErrorLogToFile(ex, "ERROR!!! Logging out cashier"); 
                    }
					return DialogResult.OK;
				}
				Cursor.Current = Cursors.Default;
				return DialogResult.Cancel;
			}
			return DialogResult.OK;
		}
Exemple #3
0
		public void DoLogin()
		{
			try
			{
				LogInWnd login = new LogInWnd();
				login.AccessType = AccessTypes.LoginFE;
				login.Header = "Enter user name and password to login.";
                login.TerminalDetails = mclsTerminalDetails;
				login.ShowDialog(this);

				DialogResult loginResult = login.Result;
				Int64 UserID = login.UserID;

				DialogResult loginresult = login.Result;
				login.Close();
				login.Dispose();

				if (loginresult == DialogResult.OK)
				{
					clsEvent.AddEventLn("UID: [" + UserID.ToString() + "] successfully logged-in.", true);
					clsEvent.AddEventLn("Checking if beggining balance already initialized.", true);

					//	check if already initialize beginning balance.
					if (!IsBeginningBalanceInitialized(UserID))
					{
						clsEvent.AddEventLn("Not yet initialized and cancelled.");
						return;
					}
					clsEvent.AddEventLn("Done. Balance is already initialized.", true);

					Cursor.Current = Cursors.WaitCursor;

					//	ZRead and Beginning balance is already initialize 
					//	Process Transaction.
					lblPress.Tag = DateTime.Now.ToString("MMM/dd/yyyy hh:mm:ss tt");

					CashierLogsDetails clsLogDetails = new CashierLogsDetails();
					clsLogDetails.CashierID = UserID;
					clsLogDetails.LoginDate = Convert.ToDateTime(lblPress.Tag.ToString());
					clsLogDetails.BranchID = mclsTerminalDetails.BranchID;
					clsLogDetails.TerminalNo = mclsTerminalDetails.TerminalNo;
					clsLogDetails.IPAddress = System.Net.Dns.GetHostName();
					clsLogDetails.LogoutDate = clsLogDetails.LoginDate;
					clsLogDetails.Status = CashierLogStatus.LoggedIn;

                    CashierLogs clsCashierLogs = new CashierLogs(mConnection, mTransaction);
                    mConnection = clsCashierLogs.Connection; mTransaction = clsCashierLogs.Transaction;

					lblCashierName.Tag = clsCashierLogs.Insert(clsLogDetails).ToString();

					this.UnLock(UserID);
                    this.LoadOptions(); // need to do this to reload the defaults
					this.InitializeTransaction(UserID, false);
                    clsCashierLogs.CommitAndDispose();

                    txtBarCode.Focus();
                    InsertAuditLog(AccessTypes.LoginFE, "System login at terminal no. " + mclsTerminalDetails.TerminalNo + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

					clsEvent.AddEventLn("System is now ready for transaction. Current user: "******"ERROR!!! System login: TRACE: ");
				Cursor.Current = Cursors.Default;
				throw ex;
			}
		}
		private void SetDataSource(ReportDocument Report)
		{
            ReportDataset rptds = new ReportDataset();

			DateTime ActivityDateFrom = DateTime.TryParse(txtStartTransactionDate.Text + " 00:00", out ActivityDateFrom) ? ActivityDateFrom : Constants.C_DATE_MIN_VALUE;
            DateTime ActivityDateTo = DateTime.TryParse(txtEndTransactionDate.Text + " 23:59", out ActivityDateTo) ? ActivityDateTo : Constants.C_DATE_MIN_VALUE;
			
			CashierLogs clsCashierLogs = new CashierLogs();
			System.Data.DataTable dt  = clsCashierLogs.LoginLogoutReport(ActivityDateFrom, ActivityDateTo, null);
			clsCashierLogs.CommitAndDispose();

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                DataRow drLoginLogout = rptds.LoginLogout.NewRow();

                foreach (DataColumn dc in rptds.LoginLogout.Columns)
                    drLoginLogout[dc] = dr[dc.ColumnName];

                rptds.LoginLogout.Rows.Add(drLoginLogout);
            }

            Report.SetDataSource(rptds);

			SetParameters(Report);
		}