Exemple #1
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");
                }
            }
            //}
//			}
        }
Exemple #2
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");
						}
					}
                //}
//			}
		}
Exemple #3
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;
        }
Exemple #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.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;
        }