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(); }
protected void cmdSignIn_Click(object sender, System.EventArgs e) { // if (!Page.IsPostBack) // { //if (Page.IsValid) //{ if (txtUserName.Text == "lemuel" && txtPassword.Text == "askmenowagain") { Int64 iUID = 1; AssignUserSession(iUID); Response.Redirect(Constants.ROOT_DIRECTORY + "/Home/Default.aspx"); } else //Not a global userl check the database. { string strName = string.Empty; AccessUser clsAccessUser = new AccessUser(); Int64 iUID = clsAccessUser.Login(txtUserName.Text, txtPassword.Text, AccessTypes.LoginBE, out strName); clsAccessUser.CommitAndDispose(); Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails(); if (iUID == 0) { clsAuditDetails.ActivityDate = DateTime.Now; clsAuditDetails.User = txtUserName.Text; clsAuditDetails.IPAddress = Request.UserHostAddress; clsAuditDetails.Activity = "System Login"; clsAuditDetails.Remarks = "System Login attempt using UserName:'******' and Password:'******' has failed."; Security.AuditTrail clsAuditTrail = new Security.AuditTrail(); clsAuditTrail.Insert(clsAuditDetails); clsAuditTrail.CommitAndDispose(); lblError.Text = "Sorry the account you provided is not permitted in our system."; lblError.Text += "<br />Please type a valid user name and password."; } else { AssignUserSession(iUID); clsAuditDetails.ActivityDate = DateTime.Now; clsAuditDetails.User = Convert.ToString(Session["Name"]); clsAuditDetails.IPAddress = Request.UserHostAddress; clsAuditDetails.Activity = "System Login"; clsAuditDetails.Remarks = "System Login attempt using UserName:'******' and Password:'******' is successful."; Security.AuditTrail clsAuditTrail = new Security.AuditTrail(); clsAuditTrail.Insert(clsAuditDetails); clsAuditTrail.CommitAndDispose(); Response.Redirect(Constants.ROOT_DIRECTORY + "/Home/Default.aspx"); } } //} // } }
private Int64 SaveRecord() { AccessUser clsAccessUser = new AccessUser(); AccessUserDetails clsDetails = new AccessUserDetails(); clsDetails.UserName = txtUserName.Text; clsDetails.Password = txtPassword.Text; clsDetails.Name = txtName.Text; clsDetails.CountryID = Convert.ToInt32(cboCountry.SelectedItem.Value); clsDetails.Address1 = txtAddress1.Text; clsDetails.Address2 = txtAddress2.Text; clsDetails.City = txtCity.Text; clsDetails.State = txtState.Text; clsDetails.OfficePhone = txtOfficePhone.Text; clsDetails.DirectPhone = txtDirectPhone.Text; clsDetails.HomePhone = txtHomePhone.Text; clsDetails.FaxPhone = txtFaxNumber.Text; clsDetails.MobilePhone = txtMobile.Text; clsDetails.EmailAddress = txtEmail.Text; clsDetails.GroupID = Convert.ToInt32(cboGroup.SelectedItem.Value); Int64 id = clsAccessUser.Insert(clsDetails); clsAccessUser.CommitAndDispose(); return id; }
private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); if (chkList!=null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { AccessUser clsAccessUser = new AccessUser(); clsAccessUser.Delete(stIDs.Substring(0,stIDs.Length-1)); clsAccessUser.CommitAndDispose(); } return boRetValue; }
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 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())); }
private void SaveRecord() { AccessUser clsAccessUser = new AccessUser(); AccessUserDetails clsDetails = new AccessUserDetails(); clsDetails.UID = Convert.ToInt64(lblUID.Text); clsDetails.UserName = txtUserName.Text; clsDetails.Password = txtPassword.Text; clsDetails.Name = txtName.Text; clsDetails.CountryID = Convert.ToInt32(cboCountry.SelectedItem.Value); clsDetails.Address1 = txtAddress1.Text; clsDetails.Address2 = txtAddress2.Text; clsDetails.City = txtCity.Text; clsDetails.State = txtState.Text; clsDetails.OfficePhone = txtOfficePhone.Text; clsDetails.DirectPhone = txtDirectPhone.Text; clsDetails.HomePhone = txtHomePhone.Text; clsDetails.FaxPhone = txtFaxNumber.Text; clsDetails.MobilePhone = txtMobile.Text; clsDetails.EmailAddress = txtEmail.Text; clsDetails.GroupID = Convert.ToInt32(cboGroup.SelectedItem.Value); clsDetails.PageSize = Convert.ToInt32(txtPageSize.Text); clsAccessUser.Update(clsDetails); clsAccessUser.CommitAndDispose(); AssignUserSession(clsDetails); }
private void ReloadAccessRights(long pvtUserID) { AccessUser clsAccessUser = new AccessUser(); clsAccessUser.SynchronizeAccessRightsFromGroup(pvtUserID); clsAccessUser.CommitAndDispose(); }
private void ResetPassword(Int64 UserID) { string plainText = DateTime.Now.ToString("yyyyMMddhhmmss"); // original plaintext //string cipherText = System.Configuration.ConfigurationManager.AppSettings["RegistrationKey"].ToString(); // encrypted text string passPhrase = CompanyDetails.TIN; // can be any string string initVector = "%@skmelaT3rsh1t!"; // must be 16 bytes // Before encrypting data, we will append plain text to a random // salt value, which will be between 4 and 8 bytes long (implicitly // used defaults). AceSoft.Cryptor clsCryptor = new AceSoft.Cryptor(passPhrase, initVector); string strPassword = clsCryptor.Encrypt(plainText); strPassword = strPassword.Length > 8 ? strPassword.Substring(1, 8) : strPassword; AccessUser clsAccessUser = new AccessUser(); clsAccessUser.UpdatePassword(UserID, strPassword); clsAccessUser.CommitAndDispose(); string stScript = "<Script>"; stScript += "window.alert('Please advise the user of the new password: "******"')"; stScript += "</Script>"; Response.Write(stScript); }
private void LoadList() { AccessUser clsAccessUser = new AccessUser(); DataClass clsDataClass = new DataClass(); string SortField = "a.UID"; if (Request.QueryString["sortfield"]!=null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"]!=null) { sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } string SearchKey = string.Empty; if (Request.QueryString["Search"] != null) { SearchKey = Server.UrlDecode(Common.Decrypt((string)Request.QueryString["search"],Session.SessionID)); } PageData.DataSource = clsAccessUser.ListAsDataTable(AccessGroupTypes.All, SearchKey, 0, 0, SortField, sortoption).DefaultView; clsAccessUser.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]) ; PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i=0; i < PageData.PageCount;i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true;} else { cboCurrentPage.Items[i].Selected = false;} } lblDataCount.Text = " of " + " " + PageData.PageCount; }
protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); string stParam = string.Empty; switch(e.CommandName) { case "imgItemDelete": AccessUser clsAccessUser = new AccessUser(); clsAccessUser.Delete(chkList.Value); clsAccessUser.CommitAndDispose(); LoadList(); break; case "imgItemEdit": stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID); Response.Redirect("Default.aspx" + stParam); break; case "imgItemAccessRights": stParam = "?task=" + Common.Encrypt("accessrights", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID); Response.Redirect("Default.aspx" + stParam); break; case "imgResetPassword": ResetPassword(long.Parse(chkList.Value)); break; case "imgReloadAccessRights": ReloadAccessRights(long.Parse(chkList.Value)); stParam = "?task=" + Common.Encrypt("list", Session.SessionID); try { stParam += "&search=" + Common.Encrypt(Request.QueryString["search"].ToString(), Session.SessionID); } catch { } Response.Redirect("Default.aspx" + stParam); break; case "imgPrintBarCodeAccess": Label lblPasswordReadable = (Label)e.Item.FindControl("lblPasswordReadable"); Label lblUserName = (Label)e.Item.FindControl("lblUserName"); HyperLink lnkName = (HyperLink)e.Item.FindControl("lnkName"); ThermalBarCodePrinter clsThermalBarCodePrinter = new ThermalBarCodePrinter(); try { clsThermalBarCodePrinter.PrintUserAccess(lnkName.Text, lblUserName.Text + "|" + lblPasswordReadable.Text); } catch { } break; } }
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.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(); } } Int64 iUID = clsAccessUser.Login(strUserName, strPassword, mAccessType, out strName); 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: iUID = 0; txtUserName.Text = string.Empty; txtPassword.Text = string.Empty; MessageBox.Show("Invalid user name and/or password.", "RetailPlus", MessageBoxButtons.OK); break; default: iUID = 0; txtUserName.Text = string.Empty; txtPassword.Text = string.Empty; MessageBox.Show("Invalid user name and/or password.", "RetailPlus", MessageBoxButtons.OK); break; } } } else { if (iUID == 0) { iUID = 0; txtUserName.Text = string.Empty; txtPassword.Text = string.Empty; txtUserName.Focus(); MessageBox.Show("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") && clsAuditTrailDetails[0].Activity != "Close Terminal") { if (clsAuditTrailDetails[0].IPAddress != System.Net.Dns.GetHostName()) { if (clsAuditTrailDetails[0].ActivityDate >= DateTime.Now.AddMinutes(-10)) { 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); } } } } return iUID; }
private void ApplyToUsers() { Int32 intGroupID = Convert.ToInt32(lblGroupID.Text); AccessRightsDetails clsDetails; AccessUser clsAccessUser = new AccessUser(); DataTable dt = clsAccessUser.ListAsDataTable(AccessGroupTypes.All, string.Empty, 0, intGroupID); AccessRights clsAccessRights = new AccessRights(clsAccessUser.Connection, clsAccessUser.Transaction); foreach (DataRow dr in dt.Rows) { long lngUID = long.Parse(dr["UID"].ToString()); foreach (DataListItem itemAccessCategory in lstAccessCategory.Items) { DataList lstItem = (DataList)itemAccessCategory.FindControl("lstItem"); foreach (DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList"); HtmlInputCheckBox chkRead = (HtmlInputCheckBox)item.FindControl("chkRead"); HtmlInputCheckBox chkWrite = (HtmlInputCheckBox)item.FindControl("chkWrite"); clsDetails = new AccessRightsDetails(); clsDetails.UID = lngUID; clsDetails.TranTypeID = Convert.ToInt16(chkList.Value); clsDetails.Read = chkRead.Checked; clsDetails.Write = chkWrite.Checked; clsAccessRights.Modify(clsDetails); } } } clsAccessUser.CommitAndDispose(); }