Пример #1
0
		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;
		}
Пример #2
0
		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();
}
Пример #3
0
		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");
						}
					}
                //}
//			}
		}
Пример #4
0
        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;
        }
Пример #5
0
		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;
		}
Пример #6
0
        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;
        }
Пример #7
0
        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.");
            }
		}
Пример #8
0
        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();
        }
Пример #9
0
        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;
        }
Пример #10
0
		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);
		}
Пример #11
0
 private void ReloadAccessRights(long pvtUserID)
 {
     AccessUser clsAccessUser = new AccessUser();
     clsAccessUser.SynchronizeAccessRightsFromGroup(pvtUserID);
     clsAccessUser.CommitAndDispose();
 }
Пример #12
0
        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);	
        }
Пример #13
0
		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;
		}
Пример #14
0
        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;
			}
		}
Пример #15
0
		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;
		}
Пример #16
0
        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()));
        }
Пример #17
0
        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();
        }