protected void Button1_Click(object sender, EventArgs e)
    {
        string username = "";

        usr      = TextBox1.Text + db.numpassword(5);
        username = db.extscalr("select username from tb_login where username='******' or email='" + TextBox3.Text + "'");
        if (username == "")
        {
            pass = TextBox1.Text + db.MakePwd(5);
            if (FileUpload1.HasFiles)
            {
                str = "~/CEO/images/" + FileUpload1.FileName + "123";
                FileUpload1.SaveAs(MapPath(str));
            }
            string skey = db.MakePwd(3) + db.numpassword(4);
            bool   b    = db.extnon("insert into tb_manage_employee values('" + TextBox1.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + usr + "','" + RadioButtonList1.SelectedItem.Text + "','" + TextBox2.Text + "','" + TextBox5.Text + "','" + str + "','','" + skey + "')");
            bool   c    = db.extnon("insert into tb_login values('" + TextBox3.Text + "','" + usr + "','" + pass + "','" + 1 + "','user','')");
            if (b == c == true)
            {
                TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = TextBox5.Text = null;
                RadioButtonList1.ClearSelection();
                ma.send_msg("Your secretKey", skey);
                RegisterStartupScript("", "<script Language=JavaScript>alert('Successfully Inserted')</Script>");
            }
        }
        else
        {
            RegisterStartupScript("", "<script Language=JavaScript>alert('You Already have an account with this email address')</Script>");
        }
    }
Example #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        ds.Clear();
        string e_key = db.extscalr("select ekey from tb_upload where fname='" + Session["fn"].ToString() + "'");


        enc_string = cld.encrypt(TextBox1.Text, e_key);
        string enc_path = Server.MapPath("~/Employee/files/efile/" + Session["fn"].ToString() + ".txt");

        File.WriteAllText(enc_path, enc_string);


        bool b = db.extnon("update  tb_upload set e_status='2',date ='" + DateTime.Now.ToString() + "' where fname='" + Session["fn"].ToString() + "'");

        if (b == true)
        {
            List <string> ls = new List <string>();
            ds.Clear();
            ds = db.discont("select roles from tb_role_policy where filename='" + Session["fn"].ToString() + "'");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ls.Add(ds.Tables[0].Rows[i]["roles"].ToString());
            }
            for (int i = 0; i < ls.Count; i++)
            {
                ds.Clear();
                ds = db.discont("select role from  tb_login where role='" + ls[i].ToString() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    mail ma = new mail();
                    ma.send_msg(" File modified :", Session["fn"].ToString());
                    break;
                }
            }
            TextBox1.Text = null;

            RegisterStartupScript("", "<script Language=JavaScript>alert('Successfully Uploaded')</Script>");
        }
    }