protected void BtnChangePassword_Click(object sender, EventArgs e)
    {
        DBManager         dm        = new DBManager();
        EncryptionManager em        = new EncryptionManager();
        string            CurPasswd = em.EncrptedCode(TxtCurPassword.Text);
        string            NewPasswd = em.EncrptedCode(TxtNewPassword.Text);
        string            c         = "update TblAdminLogin set Passwd='" + NewPasswd + "' where AdminID='" + Session["adminid"].ToString() + "' and Passwd='" + CurPasswd + "'";

        if (dm.ExecuteInsertUpdateOrDelete(c) == true)
        {
            Response.Write("<script>alert('Your Password is Change Successfully.');</script>");
        }
        else
        {
            Response.Write("<script>alert('Your Password is not Change.');</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        EncryptionManager em        = new EncryptionManager();
        DBManager         dm        = new DBManager();
        string            oldpasswd = em.EncrptedCode(TxtOldPasswd.Text);
        string            newpasswd = em.EncrptedCode(TxtNewPasswd.Text);
        string            command   = "update TblLogin set passwd='" + newpasswd + "' where UserID='" + Session["userid"].ToString() + "' and Passwd='" + oldpasswd + "'";
        bool x = dm.ExecuteInsertUpdateOrDelete(command);

        if (x == true)
        {
            Response.Write("<script>alert('Your password is change successfully');</script>");
        }
        else
        {
            Response.Write("<script>alert('Your password is not change ');</script>");
        }
    }
 protected void btnReg_Click(object sender, EventArgs e)
 {
     if (TxtEnterCaptcha.Text == CaptchaCodeAndImage[0])
     {
         // code for registration...
         string MyCommand1, Gender = "", Encryptedpasswd;
         if (RdbMale.Checked == true)
         {
             Gender = "Male";
         }
         else
         {
             Gender = "Female";
         }
         Encryptedpasswd = em.EncrptedCode(TxtPasswd.Text);
         MyCommand1      = "insert into Registration values('" + DDLConnection.Text + "','" + TxtName.Text + "','" + Gender + "','" + TxtMobNo.Text + "','" + TxtEmailID.Text + "','" + TxtPAddress.Text + "','" + TxtFile.FileName + "','" + DateTime.Now.ToString() + "')";
         string MyCommand2 = "insert into TblLogin values('" + TxtEmailID.Text + "','" + Encryptedpasswd + "',1,0,'')";
         bool   x          = dm.ExecuteInsertUpdateOrDelete(MyCommand1);
         if (x == true)
         {
             if (dm.ExecuteInsertUpdateOrDelete(MyCommand2) == true)
             {
                 TxtFile.SaveAs(Server.MapPath("~/UserPics/" + TxtFile.FileName));
                 Response.Write("<script>alert('Your Registration is completed successfully');</script>");
                 Response.Redirect("login.aspx");
             }
             else
             {
                 Response.Write("<script>alert('Your Registration is not completed');</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('Your Registration is not completed');</script>");
         }
         DDLConnection.Text = "";
         TxtName.Text       = "";
         Gender             = "";
         TxtMobNo.Text      = "";
         TxtEmailID.Text    = "";
         TxtPAddress.Text   = "";
     }
     else
     {
         Response.Write("<script>alert('Invalid Captcha Code...');</script>");
     }
 }
예제 #4
0
    protected void BtnLogin_Click(object sender, EventArgs e)
    {
        string    EncryptedPass = em.EncrptedCode(TxtPass.Text);
        string    command       = "select * From TblLogin where UserID='" + TxtEmail.Text + "' and Passwd='" + EncryptedPass + "'";
        DataTable dt            = dm.ExecuteSelect(command);

        if (dt.Rows.Count > 0)
        {
            string cmd = "update TblLogin set LCount = (LCount + 1) , LoginTime = '" + DateTime.Now.ToString() + "' where UserID='" + TxtEmail.Text + "' and Passwd='" + EncryptedPass + "' and Status=true";
            bool   x   = dm.ExecuteInsertUpdateOrDelete(cmd);
            Session["userid"] = TxtEmail.Text;
            Response.Redirect("~/ConsumerMaster/home.aspx");
        }
        else
        {
            Response.Write("<script>alert('Invalid UserID or Password')</script>");
        }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        EncryptionManager em      = new EncryptionManager();
        DBManager         dm      = new DBManager();
        string            epass   = em.EncrptedCode(txtPassword.Text);
        string            command = "select * from TblAdminLogin where AdminID='" + txtEmail.Text + "' and Passwd='" + epass + "'";
        DataTable         dt      = dm.ExecuteSelect(command);

        if (dt.Rows.Count > 0)
        {
            string cm = "update TblAdminLogin set LCount=(LCount+1), LoginTime='" + DateTime.Now.ToString() + "' where AdminID='" + txtEmail.Text + "' and Passwd='" + epass + "' and Status=true";
            bool   x  = dm.ExecuteInsertUpdateOrDelete(cm);
            Session["adminid"] = txtEmail.Text;
            Response.Redirect("~/AdminZone/Home.aspx");
        }
        else
        {
            Response.Write("<script>alert('Your ID or Password is invalid');</script>");
        }
    }