Example #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Classes.CUsers cu     = new Classes.CUsers();
            int            UserId = cu.GetUserIdByName(txtLoginUserId.Text);

            Models.MUsers mu          = new Models.MUsers();
            string        WareHouseId = string.Empty;

            mu.name     = txtLoginUserId.Text;
            mu.password = txtLoginPassword.Text;
            int retVal = cu.ValidateUser(mu);

            if (retVal == -1)
            {
                lblShow.Text = "Invalid User ID or Password";
            }
            else if (retVal == -2)
            {
                Response.Redirect("~/Pages/SetFiscalYear.aspx");
            }
            else
            {
                Session["UserId"]     = cu.GetUserIdByName(txtLoginUserId.Text);
                Session["User"]       = txtLoginUserId.Text;
                Session["FiscalYear"] = retVal;
                Session["WareHouse"]  = ReturnWareHouseId(UserId.ToString());
                Response.Redirect("~/Pages/Main.aspx");
            }
        }
Example #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Models.MUsers mu = new Models.MUsers();
         mu.name     = txtuserID.Text;
         mu.password = txtPassword.Text;
         Classes.CUsers cu     = new Classes.CUsers();
         int            RetVal = cu.Save(mu);
         if (RetVal < 0)
         {
             ShowFailMessage();
         }
         else if (RetVal == 2)
         {
             lbluser.Text = "UserName [" + txtuserID.Text + "] Already exists";
         }
         else
         {
             ShowSuccessMessage();
         }
     }
 }