private void LoadRecord() { Int64 iID = Convert.ToInt64(Session["UID"].ToString()); AccessUser clsAccessUser = new AccessUser(); AccessUserDetails clsDetails = clsAccessUser.Details(iID); clsAccessUser.CommitAndDispose(); lblUID.Text = clsDetails.UID.ToString(); txtUserName.Text = clsDetails.UserName; txtPassword.Text = clsDetails.Password; txtConfirm.Text = clsDetails.Password; txtName.Text = clsDetails.Name; cboCountry.SelectedIndex = cboCountry.Items.IndexOf(cboCountry.Items.FindByValue(clsDetails.CountryID.ToString())); txtAddress1.Text = clsDetails.Address1; txtAddress2.Text = clsDetails.Address2; txtCity.Text = clsDetails.City; txtState.Text = clsDetails.State; txtOfficePhone.Text = clsDetails.OfficePhone; txtDirectPhone.Text = clsDetails.DirectPhone; txtHomePhone.Text = clsDetails.HomePhone; txtFaxNumber.Text = clsDetails.FaxPhone; txtMobile.Text = clsDetails.MobilePhone; txtEmail.Text = clsDetails.EmailAddress.ToString(); cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(clsDetails.GroupID.ToString())); txtPageSize.Text = clsDetails.PageSize.ToString(); }
private Int64 LoginUser() { string strUserName = txtUserName.Text; string strPassword = txtPassword.Text; if (strUserName == string.Empty) { txtUserName.Focus(); return 0; } else if (strPassword == string.Empty && strUserName.Length == 13 && strUserName.Contains("800000")) { } else if (strPassword == string.Empty && strUserName.Length >= 16) { } else if (strPassword == string.Empty && !strUserName.Contains("|")) { txtPassword.Focus(); return 0; } string strName = string.Empty; AccessUser clsAccessUser = new AccessUser(); if (strPassword == string.Empty) { if (strUserName.Contains("|")) { string[] strSplit = strUserName.Split('|'); strPassword = strSplit[1].ToString(); strUserName = strSplit[0].ToString(); } else if (strUserName.Length == 13 & strUserName.Contains("800000")) // this is the defined no of burnt card no { //strUserName = strUserName.Replace("800000", ""); strUserName = strUserName.Remove(0, 6); strPassword = strUserName; } else if (strUserName.Length >= 16) // this is the defined no of burnt card no { strUserName = strUserName.Replace("%", "").Replace("?", ""); strPassword = strUserName.Remove(0, 10); strUserName = strUserName.Remove(10, strUserName.Length - 10); } } Int64 iUID = clsAccessUser.Login(strUserName, strPassword, mAccessType, out strName); // 06Jun2015 : assign the details for override AccessUserDetails = clsAccessUser.Details(iUID); AuditTrail clsAuditTrail = new AuditTrail(clsAccessUser.Connection, clsAccessUser.Transaction); AuditTrailDetails[] clsAuditTrailDetails = clsAuditTrail.DetailedList(DateTime.Today, DateTime.MinValue, strName, AccessTypes.None, "FE:", 1, "ActivityDate", SortOption.Desscending); clsAccessUser.CommitAndDispose(); if (mintUserID != 0) { if (iUID != mintUserID) { switch (iUID) { case 0: Methods.InsertAuditLog(TerminalDetails, txtUserName.Text, AccessTypes.LoginFE, "System login FAILED at terminal no. " + TerminalDetails.TerminalNo + " @ Branch: " + TerminalDetails.BranchDetails.BranchCode + " using username:"******"Sorry you are not allowed to access this transaction or you entered an Invalid user name and/or password.", "RetailPlus", MessageBoxButtons.OK); break; default: Methods.InsertAuditLog(TerminalDetails, txtUserName.Text, AccessTypes.LoginFE, "System login FAILED at terminal no. " + TerminalDetails.TerminalNo + " @ Branch: " + TerminalDetails.BranchDetails.BranchCode + " using username:"******"Sorry you are not allowed to access this transaction or you entered an Invalid user name and/or password.", "RetailPlus", MessageBoxButtons.OK); break; } } } else { if (iUID == 0) { Methods.InsertAuditLog(TerminalDetails, txtUserName.Text, AccessTypes.LoginFE, "System login FAILED at terminal no. " + TerminalDetails.TerminalNo + " @ Branch: " + TerminalDetails.BranchDetails.BranchCode + " using username:"******"Sorry you are not allowed to access this transaction or you entered an Invalid user name and/or password.", "RetailPlus", MessageBoxButtons.OK); } } if (iUID != 0 && mintUserID == 0 && clsAuditTrailDetails.Length > 0 && mAccessType == AccessTypes.LoginFE) { if (clsAuditTrailDetails[0].Activity != AccessTypes.LogoutFE.ToString("G")) { if (clsAuditTrailDetails[0].IPAddress != System.Net.Dns.GetHostName()) { if (clsAuditTrailDetails[0].ActivityDate >= DateTime.Now.AddMinutes(-10)) { Methods.InsertAuditLog(TerminalDetails, txtUserName.Text, AccessTypes.LoginFE, "System login FAILED at terminal no. " + TerminalDetails.TerminalNo + " @ Branch: " + TerminalDetails.BranchDetails.BranchCode + " using username:"******" already logged-in."); iUID = 0; txtUserName.Text = string.Empty; txtPassword.Text = string.Empty; txtUserName.Focus(); MessageBox.Show("You are still doing transaction at " + clsAuditTrailDetails[0].IPAddress + "." + Environment.NewLine + "Please logout from that terminal first or wait for 1 hour(s) for automatic logout.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } txtUserName.PasswordChar = '\0'; txtUserName.Font = new Font("Tahoma", 12, FontStyle.Bold); return iUID; }
public void AssignUserSession(Int64 UID) { AccessUser clsAccessUser = new AccessUser(); AccessUserDetails clsDetails = clsAccessUser.Details(UID); clsAccessUser.CommitAndDispose(); Session.RemoveAll(); Session.Add("BranchID", Constants.BRANCH_ID_MAIN); Session.Add("TerminalNo", Constants.C_DEFAULT_TERMINAL_01); Session.Add("AccessUserDetails", clsDetails); Session.Add("PageSize",clsDetails.PageSize); Session.Add("UID", UID); Session.Add("UserName", clsDetails.UserName); Session.Add("Password", clsDetails.Password); Session.Add("Name",clsDetails.Name); Session.Add("CountryID", clsDetails.CountryID); Session.Add("Addres1", clsDetails.Address1); Session.Add("Addres2", clsDetails.Address2); Session.Add("City", clsDetails.City); Session.Add("State", clsDetails.State); Session.Add("OfficePhone", clsDetails.OfficePhone); Session.Add("DirectPhone", clsDetails.DirectPhone); Session.Add("HomePhone", clsDetails.HomePhone); Session.Add("FaxPhone", clsDetails.FaxPhone); Session.Add("MobilePhone", clsDetails.MobilePhone); Session.Add("EmailAddress", clsDetails.EmailAddress); //Data.SysConfig clsSysConfig = new Data.SysConfig(); //Session.Add(Constants.SYS_CONFIG_BACKEND_VARIATION_TYPE, clsSysConfig.get_BackendVariationType()); //clsSysConfig.CommitAndDispose(); //overwrite the companydetails from the database Data.SysConfig clsSysConfig = new Data.SysConfig(); Data.SysConfigDetails clsSysConfigDetails = clsSysConfig.get_SysConfigDetails(); clsSysConfig.CommitAndDispose(); Session.Add(Constants.SYS_CONFIG_BACKEND_VARIATION_TYPE, clsSysConfigDetails.BACKEND_VARIATION_TYPE); CompanyDetails.BECompanyCode = string.IsNullOrEmpty(clsSysConfigDetails.BECompanyCode) ? CompanyDetails.BECompanyCode : clsSysConfigDetails.BECompanyCode; CompanyDetails.CompanyCode = string.IsNullOrEmpty(clsSysConfigDetails.CompanyCode) ? CompanyDetails.CompanyCode : clsSysConfigDetails.CompanyCode; CompanyDetails.CompanyName = string.IsNullOrEmpty(clsSysConfigDetails.CompanyName) ? CompanyDetails.CompanyName : clsSysConfigDetails.CompanyName; CompanyDetails.Currency = string.IsNullOrEmpty(clsSysConfigDetails.Currency) ? CompanyDetails.Currency : clsSysConfigDetails.Currency; CompanyDetails.TIN = string.IsNullOrEmpty(clsSysConfigDetails.TIN) ? CompanyDetails.TIN : clsSysConfigDetails.TIN; CompanyDetails.Address1 = string.IsNullOrEmpty(clsSysConfigDetails.Address1) ? CompanyDetails.Address1 : clsSysConfigDetails.Address1; CompanyDetails.Address2 = string.IsNullOrEmpty(clsSysConfigDetails.Address2) ? CompanyDetails.Address2 : clsSysConfigDetails.Address2; CompanyDetails.City = string.IsNullOrEmpty(clsSysConfigDetails.City) ? CompanyDetails.City : clsSysConfigDetails.City; CompanyDetails.State = string.IsNullOrEmpty(clsSysConfigDetails.State) ? CompanyDetails.State : clsSysConfigDetails.State; CompanyDetails.Zip = string.IsNullOrEmpty(clsSysConfigDetails.Zip) ? CompanyDetails.Zip : clsSysConfigDetails.Zip; CompanyDetails.Country = string.IsNullOrEmpty(clsSysConfigDetails.Country) ? CompanyDetails.Country : clsSysConfigDetails.Country; CompanyDetails.OfficePhone = string.IsNullOrEmpty(clsSysConfigDetails.OfficePhone) ? CompanyDetails.OfficePhone : clsSysConfigDetails.OfficePhone; CompanyDetails.DirectPhone = string.IsNullOrEmpty(clsSysConfigDetails.DirectPhone) ? CompanyDetails.DirectPhone : clsSysConfigDetails.DirectPhone; CompanyDetails.FaxPhone = string.IsNullOrEmpty(clsSysConfigDetails.FaxPhone) ? CompanyDetails.FaxPhone : clsSysConfigDetails.FaxPhone; CompanyDetails.MobilePhone = string.IsNullOrEmpty(clsSysConfigDetails.MobilePhone) ? CompanyDetails.MobilePhone : clsSysConfigDetails.MobilePhone; CompanyDetails.EmailAddress = string.IsNullOrEmpty(clsSysConfigDetails.EmailAddress) ? CompanyDetails.EmailAddress : clsSysConfigDetails.EmailAddress; CompanyDetails.WebSite = string.IsNullOrEmpty(clsSysConfigDetails.WebSite) ? CompanyDetails.WebSite : clsSysConfigDetails.WebSite; }
public void InitializeAllZreadWithSameORSeries(bool boWithOutTF) { try { Cursor.Current = Cursors.WaitCursor; Data.Terminal clsTerminal = new Data.Terminal(mConnection, mTransaction); mConnection = clsTerminal.Connection; mTransaction = clsTerminal.Transaction; Data.TerminalReport clsTerminalReport = new Data.TerminalReport(mConnection, mTransaction); mConnection = clsTerminalReport.Connection; mTransaction = clsTerminalReport.Transaction; AccessUser clsUser = new AccessUser(mConnection, mTransaction); mConnection = clsUser.Connection; mTransaction = clsUser.Transaction; System.Data.DataTable dt = clsTerminal.ListORSeries(mclsTerminalDetails.ORSeriesTerminalNo); foreach (System.Data.DataRow dr in dt.Rows) { Int32 iBranchID = Int32.Parse(dr["BranchID"].ToString()); string stTerminalNo = dr["TerminalNo"].ToString(); clsEvent.AddEventLn("Getting Terminal Info BranchID: " + iBranchID.ToString() + " Terminalno:" + stTerminalNo, true); mclsTerminalDetails = clsTerminal.Details(iBranchID, stTerminalNo); mclsSalesTransactionDetails.CashierID = clsTerminal.getLastLoggedCashierID(mclsTerminalDetails.BranchDetails.BranchID, mclsTerminalDetails.TerminalNo); if (mclsSalesTransactionDetails.CashierID == 0) mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); AccessUserDetails details = clsUser.Details(mclsSalesTransactionDetails.CashierID); mclsSalesTransactionDetails.CashierName = details.Name; if (IsDateLastInitializationOK(false)) { try { clsEvent.AddEvent("[" + lblCashier.Text + "] Initializing ZReading.", true); PrintZRead(false); // Dec 01, 2008 Lemuel E. Aceron // added the IsCashCountInitialized for // 1 time Cash count every printing of report. clsTerminal.UpdateIsCashCountInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierID, false); //initialize Z-Read clsTerminalReport.InitializeZRead(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, mclsSalesTransactionDetails.CashierName, Constants.C_DATE_MIN_VALUE, boWithOutTF); InsertAuditLog(AccessTypes.InitializeZRead, "Initialize Z-Read." + " [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo); DateTime dteMAXDateLastInitialized = DateTime.MinValue; // May 21, 2009 Lemuel E. Aceron // added the for auto FTP of file for RLC // get the maxdatelastinitialized if (CONFIG.MallCode.ToUpper() == MallCodes.RLC) { Data.TerminalReportHistory clsTerminalReportHistory = new Data.TerminalReportHistory(mConnection, mTransaction); mConnection = clsTerminalReportHistory.Connection; mTransaction = clsTerminalReportHistory.Transaction; dteMAXDateLastInitialized = clsTerminalReportHistory.MINDateLastInitialized(mclsTerminalDetails.BranchID, mclsTerminalDetails.TerminalNo, DateTime.Now); } clsEvent.AddEventLn("Done!", true); MessageBox.Show("Z-Read has been initialized for [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo + "...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information); // May 21, 2009 Lemuel E. Aceron // added the for auto FTP of file for RLC // send the data to RLC if (CONFIG.MallCode.ToUpper() == MallCodes.RLC) ProcessMallForwarder(dteMAXDateLastInitialized, true); } catch (Exception ex) { InsertErrorLogToFile(ex, "ERRROR!!! Initializing ZREAD for [Branch]:" + mclsTerminalDetails.BranchDetails.BranchCode + " [TerminalNo]" + mclsTerminalDetails.TerminalNo); } } } clsTerminal.CommitAndDispose(); Cursor.Current = Cursors.Default; } catch (Exception ex) { InsertErrorLogToFile(ex, "ERRROR!!! Initializing ALL ZREAD [ORSeriesBranchID]:" + mclsTerminalDetails.ORSeriesBranchID.ToString() + " [ORSeriesTerminalNo]" + mclsTerminalDetails.ORSeriesTerminalNo); } // 23Mar2015 : Needed to do this mclsSalesTransactionDetails.CashierID = Convert.ToInt64(lblCashier.Tag); mclsSalesTransactionDetails.CashierName = lblCashier.Text; }
public void UnLock(long UserID) { try { AccessUser clsUser = new AccessUser(mConnection, mTransaction); mConnection = clsUser.Connection; mTransaction = clsUser.Transaction; AccessUserDetails details = clsUser.Details(UserID); clsEvent.AddEvent("[" + details.Name + "] UnLocking client application."); this.lblTransDate.Text = DateTime.Now.ToString("MMM. dd, yyyy hh:mm:ss tt"); this.lblCashier.Tag = details.UID; this.lblCashier.Text = details.Name; this.mCashierName = details.Name; this.mboLocked = false; this.panLocked.Visible = false; this.txtBarCode.Text = ""; this.txtBarCode.Enabled = true; this.txtBarCode.Focus(); mclsSalesTransactionDetails.CashierID = details.UID; mclsSalesTransactionDetails.CashierName = details.Name; InsertAuditLog(AccessTypes.UnlockTerminal, "Unlock terminal #: " + mclsTerminalDetails.TerminalNo + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode); clsUser.CommitAndDispose(); clsEvent.AddEventLn("Done!", true); } catch (Exception ex) { InsertErrorLogToFile(ex, "ERROR!!! Unlocking window."); } }
private void LoadOptions() { long lngID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); lblUID.Text = lngID.ToString(); DataClass clsDataClass = new DataClass(); AccessUser clsAccessUser = new AccessUser(); int intGroupID = clsAccessUser.Details(lngID).GroupID; AccessGroup clsAccessGroup = new AccessGroup(clsAccessUser.Connection, clsAccessUser.Transaction); cboGroup.DataTextField = "GroupName"; cboGroup.DataValueField = "GroupID"; cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.List("GroupName", SortOption.Ascending)).DefaultView; cboGroup.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(intGroupID.ToString())); clsAccessUser.CommitAndDispose(); }
protected void imgReload_Click(object sender, System.Web.UI.ImageClickEventArgs e) { DataClass clsDataClass = new DataClass(); AccessUser clsAccessUser = new AccessUser(); int intGroupID = clsAccessUser.Details(long.Parse(lblUID.Text)).GroupID; AccessType clsAccessType = new AccessType(clsAccessUser.Connection, clsAccessUser.Transaction); lstAccessCategory.DataSource = clsAccessType.Categories("Category, SequenceNo", SortOption.Ascending).DefaultView; clsAccessUser.CommitAndDispose(); lstAccessCategory.DataBind(); cboGroup.SelectedIndex = cboGroup.Items.IndexOf(cboGroup.Items.FindByValue(intGroupID.ToString())); }