Ejemplo n.º 1
0
    protected void btn_save_Click(object sender, EventArgs e)
    {
        tbl_user_BAL objbal = new tbl_user_BAL();
        tbl_user_DAL objdal = new tbl_user_DAL();

        cryptography objcrypt = new cryptography();

        SqlConnection cn    = new SqlConnection(ConfigurationManager.AppSettings["dbconnect"]);
        string        query = "select_tbl_user";
        SqlCommand    cm    = new SqlCommand(query, cn);

        cm.CommandType = CommandType.StoredProcedure;

        cm.Parameters.AddWithValue("@cnd", " where int_user_id=" + Session["uid"].ToString());


        SqlDataAdapter da = new SqlDataAdapter(cm);
        DataSet        ds = new DataSet();

        da.Fill(ds);

        if (ds.Tables[0].Rows.Count > 0)
        {
            string pwd = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());

            if (pwd == old_pass.Text)
            {
                objdal.int_user_id = Convert.ToInt16(Session["uid"]);



                string str = objcrypt.Encrypt(new_pass.Text);


                objdal.str_password = str;

                int val = objbal.update_pass(objdal);

                objbal.update_pass(objdal);


                if (val > 0)
                {
                    lblmsg.Text      = "your password is successfully updated.";
                    lblmsg.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    lblmsg.Text      = "Error in Process,try again.";
                    lblmsg.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                lblmsg.Text      = "your have entered wrong password.";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        changepanel(1, 0, 0);
    }
Ejemplo n.º 2
0
    protected void btn_add_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_user_BAL objbal   = new tbl_user_BAL();
            tbl_user_DAL objdal   = new tbl_user_DAL();
            cryptography objcrypt = new cryptography();

            string str = objcrypt.Encrypt(txt_password.Text);


            objdal.str_user_name = txt_user_name.Text;
            objdal.str_address   = txt_address.Text;
            objdal.int_contact   = Convert.ToInt64(txt_contact.Text);
            objdal.str_email     = txt_email.Text;
            objdal.str_password  = str;

            int val = objbal.insert_data(objdal);

            if (val > 0)
            {
                lblmsg.Text      = "Registration successfully Complate";
                lblmsg.ForeColor = System.Drawing.Color.Green;
            }
            Response.Redirect("home_page.aspx");
            cleardata();
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 3
0
    protected void btn_add_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_voluntar_BAL objbal   = new tbl_voluntar_BAL();
            tbl_voluntar_DAL objdal   = new tbl_voluntar_DAL();
            cryptography     objcrypt = new cryptography();

            string str = objcrypt.Encrypt(txt_password.Text);


            objdal.int_voluntar_team_id = Convert.ToInt16(ddl_voluntar_team.SelectedItem.Value);
            objdal.str_voluntar_name    = txt_voluntar_name.Text;
            objdal.str_address          = txt_address.Text;
            objdal.int_contact          = Convert.ToInt64(txt_contact.Text);
            objdal.str_email            = txt_email.Text;
            objdal.str_password         = str;


            int val = objbal.insert_data(objdal);

            if (val > 0)
            {
                binddata("");

                lblmsg.Text      = "Data successfully inserted";
                lblmsg.ForeColor = System.Drawing.Color.Green;
            }
            changepanel(1, 0);
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 4
0
    protected void btn_login_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_voluntar_BAL objbal   = new tbl_voluntar_BAL();
            cryptography     objcrypt = new cryptography();

            string query = "where str_email='" + txt_voluntar_name.Text + "'";

            DataSet ds = objbal.getdata(query);


            if (ds.Tables[0].Rows.Count > 0)
            {
                string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());

                if (str.Equals(txt_password.Text))
                {
                    Session["vname"] = txt_voluntar_name.Text;
                    Session["vtype"] = "v";
                    Response.Redirect("inquiry_reply_page.aspx");
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void btn_add_Click1(object sender, EventArgs e)
    {
        try
        {
            tbl_user_BAL objbal   = new tbl_user_BAL();
            cryptography objcrypt = new cryptography();

            string query = "where str_email='" + txt_user_name.Text + "'";

            DataSet ds = objbal.getdata(query);


            if (ds.Tables[0].Rows.Count > 0)
            {
                string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());
                //int cnt = Convert.ToInt16(ds.Tables[0].Rows[0]["int_user_id"]);
                if (str.Equals(txt_password.Text))
                {
                    Session["uname"] = txt_user_name.Text;
                    Session["uid"]   = ds.Tables[0].Rows[0]["int_user_id"];
                    Session["unm"]   = ds.Tables[0].Rows[0]["str_user_name"];
                    Session["add"]   = ds.Tables[0].Rows[0]["str_address"];
                    Session["con"]   = ds.Tables[0].Rows[0]["int_contact"];
                    Session["email"] = ds.Tables[0].Rows[0]["str_email"];
                    Response.Redirect("inquiry_page.aspx");
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void btn_add_Click1(object sender, EventArgs e)
    {
        try
        {
            cryptography objcrypt = new cryptography();

            tbl_login_BAL objbal = new tbl_login_BAL();

            string query = " where str_user_name='" + txt_user_name.Text + "'";

            DataSet ds = objbal.getData(query);

            if (ds.Tables[0].Rows.Count > 0)
            {
                string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());
                if (str.Equals(txt_password.Text))
                {
                    Session["uname"] = txt_user_name.Text;
                    Session["name"]  = ds.Tables[0].Rows[0]["str_user_name"].ToString();
                    Session["img"]   = ds.Tables[0].Rows[0]["str_img"].ToString();
                    Response.Redirect("home.aspx");
                }
                else
                {
                    lbl_error.Text      = "wrong email and password ..try again..";
                    lbl_error.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 7
0
    protected void btn_login_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_user_BAL objbal   = new tbl_user_BAL();
            cryptography objcrypt = new cryptography();

            string query = "where str_email='" + txt_user_name.Text + "'";

            DataSet ds = objbal.getdata(query);

            if (ds.Tables[0].Rows.Count > 0)
            {
                string str = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());
                //int cnt = Convert.ToInt16(ds.Tables[0].Rows[0]["int_user_id"]);
                if (str == txt_password.Text)
                {
                    if (str.Equals(txt_password.Text))
                    {
                        Session["uname"] = txt_user_name.Text;
                        Session["uid"]   = ds.Tables[0].Rows[0]["int_user_id"];
                        Session["unm"]   = ds.Tables[0].Rows[0]["str_user_name"];
                        Session["add"]   = ds.Tables[0].Rows[0]["str_address"];
                        Session["con"]   = ds.Tables[0].Rows[0]["int_contact"];
                        Session["email"] = ds.Tables[0].Rows[0]["str_email"];
                        Response.Redirect("user_profile.aspx");
                    }
                }

                else
                {
                    lblmsg.Text      = "wrong emailid and password ..try again...";
                    lblmsg.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                lblmsg.Text      = "wrong emailid and password ..try again...";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void btn_add_Click(object sender, EventArgs e)
    {
        try
        {
            tbl_member_BAL objbal   = new tbl_member_BAL();
            tbl_member_DAL objdal   = new tbl_member_DAL();
            cryptography   objcrypt = new cryptography();

            string str = objcrypt.Encrypt(txt_password.Text);

            objdal.int_disaster_id    = Convert.ToInt16(ddl_disaster_master.SelectedItem.Value);
            objdal.str_member_name    = txt_member_name.Text;
            objdal.int_designation_id = Convert.ToInt16(ddl_designation_name.SelectedItem.Value);


            objdal.str_current_working = txt_currentworking.Text;
            objdal.str_address         = txt_address.Text;
            objdal.int_contact         = Convert.ToInt64(txt_contact.Text);
            objdal.str_email           = txt_email.Text;
            objdal.str_password        = str;


            int val = objbal.insert_data(objdal);

            if (val > 0)
            {
                lblmsg.Text      = "Data successfully inserted";
                lblmsg.ForeColor = System.Drawing.Color.Green;
                ddl_disaster_master.ClearSelection();
                txt_member_name.Text = string.Empty;
                ddl_designation_name.ClearSelection();
                txt_currentworking.Text = string.Empty;
                txt_address.Text        = string.Empty;
                txt_contact.Text        = string.Empty;
                txt_email.Text          = string.Empty;
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        cryptography obj = new cryptography();

        string str = obj.Encrypt("ash");
    }
Ejemplo n.º 10
0
    protected void SendMail()
    {
        try
        {
            cryptography objcrypt = new cryptography();



            SqlConnection cn    = new SqlConnection(ConfigurationManager.AppSettings["dbconnect"]);
            string        query = "select_tbl_user";
            SqlCommand    cm    = new SqlCommand(query, cn);
            cm.CommandType = CommandType.StoredProcedure;

            cm.Parameters.AddWithValue("@cnd", " where str_email='" + txt_email.Text + "'");


            SqlDataAdapter da = new SqlDataAdapter(cm);
            DataSet        ds = new DataSet();

            da.Fill(ds);

            if (ds.Tables[0].Rows.Count > 0)
            {
                //string pwd = ds.Tables[0].Rows[0]["str_password"].ToString();

                string pwd = objcrypt.Decrypt(ds.Tables[0].Rows[0]["str_password"].ToString());



                // Gmail Address from where you send the mail
                var fromAddress = "*****@*****.**";
                // any address where the email will be sending
                //var toAddress = "*****@*****.**";
                var toAddress = txt_email.Text;
                //Password of your gmail address
                const string fromPassword = "******";
                // Passing the values and make a email formate to display
                string        subject = "Forget Password";
                StringBuilder str     = new StringBuilder();

                StringBuilder sb = new StringBuilder();
                sb.Append("Your Password is ");
                sb.Append(pwd);
                //sb.Append("<head></head>");
                //sb.Append("<body>");
                //sb.Append("<div>My Test Div </div>");
                //sb.Append("</body>");
                //sb.Append("</html>");
                //str.AppendLine("WelCome to Resume Maker Site.");
                //str.AppendLine("\n");
                //str.AppendFormat("Click <a href='{0}'>here</a> To activate yourself.", "https://www.google.co.in/?gws_rd=cr&ei=KiXnUqfsCsmOrQf_x4GYAg");

                // smtp settings
                var smtp = new System.Net.Mail.SmtpClient();
                {
                    smtp.Host           = "smtp.gmail.com";
                    smtp.Port           = 587;
                    smtp.EnableSsl      = true;
                    smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                    smtp.Credentials    = new NetworkCredential(fromAddress, fromPassword);
                    smtp.Timeout        = 20000;
                }
                // Passing values to smtp object
                smtp.Send(fromAddress, toAddress, subject, sb.ToString());
            }
        }
        catch (Exception ex)
        {
        }
    }