Exemplo n.º 1
0
        public bool IsValidUser(string email, string password, string role)
        {
            UserBo objbo = new UserBo();

            objbo.EmailId     = email.Trim();
            objbo.Password    = password.Trim();
            objbo.LoginTypeID = Convert.ToInt32(role);
            DataSet dsLogin = _regDal.CheckLogin(objbo);

            if (dsLogin.Tables[0].Rows.Count > 0)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        protected void btnlogin_Click(object sender, EventArgs e)
        {
            UserBo objbo = new UserBo();

            objbo.EmailId     = txtuserid.Text.Trim();
            objbo.Password    = txtpassword.Text.Trim();
            objbo.LoginTypeID = Convert.ToInt32(ddlLoginType.SelectedValue);
            DataSet dsLogin = objreg.CheckLogin(objbo);

            if (dsLogin.Tables[0].Rows.Count > 0)
            {
                Session["UserId"]   = dsLogin.Tables[0].Rows[0]["UserId"].ToString();
                Session["RoleName"] = dsLogin.Tables[0].Rows[0]["RoleName"].ToString();
                Session["Name"]     = dsLogin.Tables[0].Rows[0]["Name"].ToString();
                Session["TeamID"]   = dsLogin.Tables[0].Rows[0]["teamId"].ToString();
                UserBo.RoleName role = (UserBo.RoleName)Enum.Parse(typeof(UserBo.RoleName), dsLogin.Tables[0].Rows[0]["RoleName"].ToString());
                switch (role)
                {
                case UserBo.RoleName.Admin:
                    Response.Redirect("~/DashBoard/Pages/Admin/AdminDashBoard.aspx");
                    break;

                case UserBo.RoleName.IC:
                    Response.Redirect("~/DashBoard/Pages/IC/ICDashBoard.aspx");
                    break;

                case UserBo.RoleName.TC:
                    Response.Redirect("~/DashBoard/Pages/TC/TCDashBoard.aspx");
                    break;

                case UserBo.RoleName.TM:
                    Response.Redirect("~/DashBoard/Pages/TM/TMDashBoard.aspx");
                    break;
                }
            }
            else
            {
                lblLoginMsg.Text = "UserID/Password incorrect.";
            }
        }