protected void BtnUpdate_Click(object sender, EventArgs e) { if (RdbMale.Checked) { gender = "Male"; } if (RdbFemale.Checked) { gender = "Female"; } if (FUProfilePic.HasFile == true) { filename = FUProfilePic.FileName; } string Query = "update Registration set UName='" + TxtName.Text + "',gender='" + gender + "',DOB='" + TxtDOB + "',Address='" + TxtAddress + "',MobileNo='" + TxtMobileNo + "',ProfilePic='" + filename + "' where EmailId='" + Session["userid"] + "'"; bool x = dm.ExecuteInsertUpdateDelete(Query); if (x == true) { if (FUProfilePic.HasFile == true) { FUProfilePic.SaveAs(Server.MapPath("~/ProfilePic/" + FUProfilePic.FileName)); } DisplayProfile(); DisableControls(); Response.Write("<script>alert('Your Prifile is Updated')</script>"); } else { DisplayProfile(); DisableControls(); Response.Write("<script>alert('Your Prifile is not Updated')</script>"); } }
protected void BtnSubmit_Click(object sender, EventArgs e) { if (capcode == TxtCaptcha.Text) { //Response.Write("<script>alert('Do Registration')</script>"); string gender = "", filename = "", epass = ""; if (RbtnMale.Checked == true) { gender = "Male"; } if (RbtnFemale.Checked == true) { gender = "Female"; } epass = EncryptionManager.EncryptMyData(TxtPassword.Text); if (FUProfilePic.HasFile == true) { filename = FUProfilePic.PostedFile.ContentType; } string ext = filename.Substring(filename.LastIndexOf('/') + 1); ext = ext.ToLower(); ext = Path.GetRandomFileName() + "." + ext; string Query1 = "insert into Registration values('" + DDLConnectionType.SelectedValue + "','" + TxtName.Text + "','" + gender + "','" + TxtMobNo.Text + "','" + TxtEmailId.Text + "','" + TxtAddress.Text + "','" + ext + "','" + epass + "','" + DateTime.Now.ToShortDateString() + "')"; string Query2 = "insert into Login values('" + TxtEmailId.Text + "','" + epass + "','user',1,0,'')"; bool b = dm.ExecuteInsertUpdateDelete(Query1); if (b == true) { b = dm.ExecuteInsertUpdateDelete(Query2); if (b == true) { string Msg = "Hellow" + TxtName.Text + "Thanks for registration. Your user id is:" + TxtEmailId.Text + "and your password is:" + TxtPassword.Text + "Regards-GGL"; MySMSSender ss = new MySMSSender(); ss.SendMySMS(TxtMobNo.Text, Msg); FUProfilePic.SaveAs(Server.MapPath("ProfilePic/" + ext)); Response.Write("<script>alert('Registration Successfull')</script>"); } else { Response.Write("<script>alert('Login details are not saved')</script>"); } } else { Response.Write("<script>alert('Database Error')</script>"); } } else { Response.Write("<script>alert('Invalid Captcha Code!')</script>"); } }