protected void ImgBtnRegister_Click(object sender, ImageClickEventArgs e) { if (TxtCaptchaCode.Text == CodeAndImagePath[0]) { //code for Registration string gender = "", mycmd1, mycmd2, EncryptedPassword; if (RdBtnMale.Checked == true) { gender = "Male"; } if (RdBtnFemale.Checked == true) { gender = "Female"; } EncryptedPassword = em.EncryptMyData(TxtPassword.Text); mycmd1 = "insert into GeneralInfo values('" + TxtYourName.Text + "','" + TxtFatherName.Text + "','" + gender + "','" + TxtDOB.Text + "','" + TxtClgName.Text + "','" + TxtCourse.Text + "','" + TxtYear.Text + "','" + TxtAddress.Text + "','" + TxtContactNo.Text + "','" + TxtEmailAddress.Text + "','" + FUPicture.FileName + "','" + EncryptedPassword + "','" + DateTime.Now.ToShortDateString() + "','user')"; // mycmd2 = "insert into Login values('" + TxtEmail.Text + "','" + EncryptedPassword + "','User')"; bool n1 = dm.NonQuery(mycmd1); if (n1 == true) { // bool n2 = dm.NonQuery(mycmd2); // if (n2 == true) // { FUPicture.SaveAs(Server.MapPath("Profile/" + FUPicture.FileName)); LblMessage.Text = "Registration has been Done Successfully"; } // else // { // LblMessage.Text = "Registration Failed"; // } // } else { LblMessage.Text = "Registration Failed"; } } else { LblMessage.Text = "Invalid Captcha"; CodeAndImagePath = cg.GetRandomCodeAndImagePath("CaptchaImages"); ImgCaptcha.ImageUrl = CodeAndImagePath[1]; } }
public void UpdateProfile() { string Gender = "", FileName = ""; if (RdbMale.Checked == true) { Gender = "Male"; } else { Gender = "Female"; } if (FUPicture.HasFile == true) { FUPicture.SaveAs(Server.MapPath("~/UserPics/" + FUPicture.FileName)); FileName = FUPicture.FileName; } else { string s = ImgUser.ImageUrl; FileName = s.Substring(s.LastIndexOf('/') + 1); } string MyCommand = "update Registration set ConnectionType='" + TxtConnectionType.Text + "', Name='" + TxtName.Text + "', Gender='" + Gender + "', MobileNumber='" + TxtMobNo.Text + "',PostalAddress='" + TxtPAddress.Text + "',ProfilePic='" + FileName + "' Where EmailID='" + Session["userid"].ToString() + "'"; bool x = dm.ExecuteInsertUpdateOrDelete(MyCommand); if (x == true) { DisplayProfile(); DisableControl(); BtnUpdate.Visible = false; BtnEdit.Visible = true; Response.Write("<script>alert('Your Profile is updated successfully');</script>"); } else { Response.Write("<script>alert('Your Profile is not updated ');</script>"); } }