Esempio n. 1
0
        private void SaveData()
        {
            string sUserName = Session["User"].ToString();

            oDAL   = new UsersDAL();
            oClass = new UserModel();


            oClass.UserName     = UserName.Value;
            oClass.UserPassword = EncryptDecryptProvider.EncryptString("b14ca5898a4e4133bbce2ea2315a1916", UserPassword.Value);
            oClass.LastName     = LastName.Value;
            oClass.FirstName    = FirstName.Value;
            oClass.AccountType  = AccountType.Value;
            oClass.Address      = txtAddress.InnerText;
            oClass.Phone        = txtContact.Value;
            oClass.Email        = txtEmail.Value;

            string id = UserID.Value;

            if (id == "")
            {
                oDAL.InsertData(sUserName, oClass);
                //lblMsg.Text = "New Record has been saved";
            }
            else
            {
                oClass.ID = Convert.ToInt16(id);
                oDAL.UpdateData(sUserName, oClass);
                // lblMsg.Text = "Record has been updated";
            }
        }
Esempio n. 2
0
        private void HealthAssistLogin()
        {
            UserClass oClass = new UserClass();
            UserDAL   oDal   = new UserDAL();
            DataSet   oDS    = new DataSet();

            // oClass.UserID = UserName.text;
            //TextBox un =   LoginUser.FindControl("UserName") as TextBox;
            oClass.UserName = txbUsername.Text;
            oDS             = oDal.CheckUserName(oClass);

            if (oDS != null)
            {
                if (oDS.Tables[0].Rows.Count > 0)
                {
                    oClass = new UserClass();
                    oDal   = new UserDAL();

                    DataSet oDSPwd = new DataSet();

                    //TextBox un1 = UserName.Text;//LoginUser.FindControl("UserName") as TextBox;
                    //TextBox pwd = LoginUser.FindControl("Password") as TextBox;
                    oClass.UserName = txbUsername.Text;
                    oClass.Password = EncryptDecryptProvider.EncryptString("b14ca5898a4e4133bbce2ea2315a1916", txbPassword.Text);
                    oDSPwd          = oDal.CheckUserNamePassword(oClass);

                    if (oDSPwd.Tables[0].Rows.Count > 0)
                    {
                        //Response.Redirect("WebFormClientList.aspx");

                        Session["UserType"] = oDSPwd.Tables[0].Rows[0]["account_type"].ToString();
                        Session["UserID"]   = oDSPwd.Tables[0].Rows[0][0].ToString();
                        Session["User"]     = txbUsername.Text;


                        //Session["UserLoginCode"] = GenerateRandomNumber(1000,9999);
                        //SendEmail(oDSPwd.Tables[0].Rows[0]["email"].ToString());
                        //Response.Redirect("ConfirmLogin.aspx");

                        //Response.Redirect("Dashboard.aspx");
                        if (Session["UserType"].ToString() == "Admin")
                        {
                            Response.Redirect("Dashboard.aspx");
                        }

                        else if (Session["UserType"].ToString() == "Staff")
                        {
                            Response.Redirect("Patient.aspx");
                        }
                        else if (Session["UserType"].ToString() == "Physician")
                        {
                            Response.Redirect("Physician/EncounterList.aspx?View=Pending");
                        }
                    }
                    else
                    {
                        //Label lb = LoginUser.FindControl("lblError") as Label;
                        string script = "<script type=\"text/javascript\">alert('Please check your password');</script>";
                        Response.Write(script);
                    }
                }

                else
                {
                    //Label lb = LoginUser.FindControl("lblError") as Label;
                    string script = "<script type=\"text/javascript\">alert('Invalid User');</script>";
                    Response.Write(script);
                    // Response.Write("<script>alert('Invalid User');</script>");
                }
            }
        }