public LoginForm()
 {
     InitializeComponent();
     _rand     = new Random();
     _userBLL  = new UserLoginBLL();
     _user     = new UserLogin();
     _identity = new List <long>();
     _password = new List <string>();
 }
 public RegisterForm()
 {
     InitializeComponent();
     _patientBLL = new PatientBLL();
     _userBLL    = new UserLoginBLL();
     _user       = new UserLogin();
     _identity   = new List <long>();
     _mail       = new List <string>();
     DateControl();
 }
Beispiel #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            pwdsp.InnerText      = "";
            usernamesp.InnerText = "";
            string userName = txtUserName.Value;
            string pwd      = txtPwd.Value;

            if (string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(pwd))
            {
                usernamesp.InnerText = "用户名不能为空!";
                pwdsp.InnerText      = "";
            }
            if (string.IsNullOrEmpty(pwd) && !string.IsNullOrEmpty(userName))
            {
                usernamesp.InnerText = "";
                pwdsp.InnerText      = "密码不能为空!";
            }
            if (string.IsNullOrEmpty(pwd) && string.IsNullOrEmpty(userName))
            {
                pwdsp.InnerText      = "密码不能为空!";
                usernamesp.InnerText = "用户名不能为空!";
            }
            UserLoginBLL bll  = new UserLoginBLL();
            UserLogin    user = bll.GetUserByUserName(userName);

            if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(pwd))
            {
                if (user == null)
                {
                    usernamesp.InnerText = "用户名不存在!";
                    //Response.Write("<script>alert('用户名不存在');</script>");
                }
                else
                {
                    if (user.Pwd == pwd)
                    {
                        Session["UserName"] = userName;
                        Response.Redirect("Defult.aspx");
                    }
                    else
                    {
                        usernamesp.InnerText = " ";
                        pwdsp.InnerText      = "密码错误!";

                        //Response.Write("<script> alert('密码错误!');</script>");
                    }
                }
            }
        }
Beispiel #4
0
        public IHttpActionResult Login(UserLoginModel model)
        {
            if (string.IsNullOrWhiteSpace(model.UserName))
            {
                return(InspurJson(new ReturnItem <RetUserLoginInfo>()
                {
                    Code = -1, Msg = "未填写用户名"
                }));
            }
            if (string.IsNullOrWhiteSpace(model.PassWord))
            {
                return(InspurJson(new ReturnItem <RetUserLoginInfo>()
                {
                    Code = -1, Msg = "未填写密码"
                }));
            }
            UserLoginBLL user = new UserLoginBLL();
            var          get  = user.UserLogin(model);

            UserInfoLoging(get);
            return(InspurJson <RetUserLoginInfo>(get));
        }
Beispiel #5
0
        public ActionResult Login(UserLogin userLogin)
        {
            UserLoginBLL objUserLoginBll = new UserLoginBLL();

            if (ModelState.IsValid)
            {
                var loginInfo = objUserLoginBll.IsValid(userLogin);

                if (loginInfo != null)
                {
                    SessionUtility.TBSessionContainer.UserID   = loginInfo.AdminUserId;
                    SessionUtility.TBSessionContainer.UserName = loginInfo.AdminUsername;

                    FormsAuthentication.SetAuthCookie("Cookie", true);

                    return(RedirectToAction("Index", "AdminUser", new { area = "Admin" }));
                }
                else
                {
                    ModelState.AddModelError("", "Login data is incorrect!");
                }
            }
            return(View());
        }
Beispiel #6
0
        public ActionResult Login(UserLogin userLogin, string returnUrl)
        {
            UserLoginBLL objUserLoginBll = new UserLoginBLL();

            if (ModelState.IsValid)
            {
                var loginInfo = objUserLoginBll.IsValid(userLogin);

                if (loginInfo != null)
                {
                    SessionUtility.STSessionContainer.UserID   = loginInfo.UserDetailId;
                    SessionUtility.STSessionContainer.UserName = loginInfo.Username;

                    FormsAuthentication.SetAuthCookie(loginInfo.Username, true);

                    return(RedirectToLocal(returnUrl));
                }
                else
                {
                    ModelState.AddModelError("", "Login data is incorrect!");
                }
            }
            return(View("Login"));
        }
Beispiel #7
0
        public IHttpActionResult GetUserInfoInside(GetUserLoginInfoParameter parameter)
        {
            UserLoginBLL user = new UserLoginBLL();

            return(InspurJson(user.GetUserLoginInfo(parameter), true));
        }
Beispiel #8
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        try
        {
            Property objProp = new Property();
            UserLoginBLL userLog = new UserLoginBLL();

            EncryptPassword encPwd = new EncryptPassword();

            TextBox txtUserID = (TextBox)phLogin.FindControl("txtUserID");
            TextBox txtPwd = (TextBox)phLogin.FindControl("txtPassword");

            string encPassword = encPwd.EncryptText(txtPwd.Text, "helloworld");
            objProp.UserID = txtUserID.Text.Trim();
            objProp.Password = encPassword.Trim();

            if (userLog.LoginUser(objProp))
            {
                Session["User"] = objProp.UserID;
                if ((string)Session["Role"] == "D")
                    Response.Redirect("Home/DoctorHome.aspx");
                else if ((string)Session["Role"] == "N")
                    Response.Redirect("Home/NurseHome.aspx");
                else if ((string)Session["Role"] == "P" || (string)Session["Role"] == "T")
                    Response.Redirect("Home/PharmacistHome.aspx");
                else if ((string)Session["Role"] == "C")
                    Response.Redirect("Home/CSRHome.aspx");
                else
                    Response.Redirect("Patient/AllPatientProfile.aspx");
            }
            else
            {
                Session["User"] = null;
                Label lblStatus = (Label)phLogin.FindControl("lblStatus");
                lblStatus.Visible = true;
                lblStatus.Text = "Invalid UserID/Password..!";
                objNLog.Error("Login failed for the user - " + txtUserID.Text);
            }
        }
        catch (Exception ex)
        {
            objNLog.Error("Error : " + ex.Message);
        }
    }
Beispiel #9
0
        /// <summary>
        /// 登出操作
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public IHttpActionResult DisableTokenId(DisableTokenIdParameter parameter)
        {
            UserLoginBLL user = new UserLoginBLL();

            return(InspurJson(user.DisableTokenId(parameter), true));
        }
Beispiel #10
0
 public PasswordRememberForm()
 {
     InitializeComponent();
     _userBLL = new UserLoginBLL();
     _user    = new UserLogin();
 }
 public RegisterForm(int id)
 {
     _patientBLL = new PatientBLL();
     _userBLL    = new UserLoginBLL();
     _user       = _userBLL.GetUserLogin(id);
 }