Пример #1
0
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            Encrypting ObjEncrypting = new Encrypting();

            tbl_UserMasterProp Objtbl_UserMasterProp = new tbl_UserMasterProp();
            Objtbl_UserMasterProp.UserName = ObjEncrypting.Encrypt(txtUserName.Text);
            Objtbl_UserMasterProp.Password = ObjEncrypting.Encrypt(txtPassword.Text);

            tbl_UserMasterBAL Objtbl_UserMasterBAL = new tbl_UserMasterBAL();
            DataSet           dsData = Objtbl_UserMasterBAL.Select_Data(Objtbl_UserMasterProp);
            if (dsData.Tables[0].Rows.Count > 0)
            {
                Session["UserName"] = txtUserName.Text;
                Response.Redirect("HomePage.aspx");
            }
            else
            {
                tdError.Visible   = true;
                tdError.InnerText = "Invalid Username/Password";
            }
        }
        catch (Exception ex)
        {
            tdError.Visible   = true;
            tdError.InnerText = ex.Message;
        }
    }
    protected void imgbtnSave_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            Encrypting ObjEncrypting = new Encrypting();


            tbl_UserMasterProp Objtbl_UserMasterProp = new tbl_UserMasterProp();
            Objtbl_UserMasterProp.UserName = ObjEncrypting.Encrypt(txtUserName.Text);
            Objtbl_UserMasterProp.Password = ObjEncrypting.Encrypt(txtPassword.Text);

            tbl_UserMasterBAL Objtbl_UserMasterBAL = new tbl_UserMasterBAL();
            Objtbl_UserMasterBAL.InsertUpdate_Data(Objtbl_UserMasterProp);
            ShowGuidMessage(1, null);
        }
        catch (Exception ex)
        {
            ShowGuidMessage(0, ex); //MessageBox.Show(ex.Message);
        }
    }