protected void Button2_Click(object sender, EventArgs e) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@pass", TextBox10.Text), new SqlParameter("@cpass", chgnp.Text), new SqlParameter("@cont", chgcon0.Text) }; string query = "select Password from CandidateRegistration where Password=@pass"; ds = ob.ExeAdapter(query, parameter, "CandidateRegistration"); int count = ds.Tables["CandidateRegistration"].Rows.Count; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@pass", TextBox10.Text), new SqlParameter("@cpass", chgnp.Text), new SqlParameter("@cont", chgcon0.Text) }; if (count > 0) { query = "update CandidateRegistration set Password=@cpass where Password=@pass"; ob.ExeQuery(query, parameters); Response.Redirect("Candidate.aspx?Email=" + name); } else { Response.Write("<script>alert('Your password is incorrect:')</script>"); } }
protected void submit_Click(object sender, EventArgs e) { string path = ""; string paths = ""; if (FileUpload1.HasFile) { Label2.Text = ""; string filename = FileUpload1.FileName; path = Server.MapPath("Uploads/Esign"); path = path + "/" + filename; string[] extension = filename.Split('.'); FileUpload1.PostedFile.SaveAs(path); Image2.Visible = true; Image2.ImageUrl = "~/Uploads/Esign/" + filename; path = "/Uploads/Esign/" + filename; //FileUpload1.SaveAs(path); /* * else * { * Label2.Visible = true; * Label2.Text = "<font color='red' size='5'>File must be a image file:</font>"; * }*/ } else { Label2.Text = "<font color='red' size='5'>Please select a file:</font>"; } if (FileUpload3.HasFile) { Label3.Text = ""; string filenames = FileUpload3.FileName; paths = Server.MapPath("Uploads/VId"); paths = paths + "/" + filenames; string[] extension = filenames.Split('.'); FileUpload3.PostedFile.SaveAs(paths); ImgE.Visible = true; ImgE.ImageUrl = "~/Uploads/VId/" + filenames; paths = "/Uploads/VId/" + filenames; //FileUpload1.SaveAs(path); /* else * { * Label3.Visible = true; * Label3.Text = "<font color='red' size='5'>File must be a image file:</font>"; * }*/ } else { Label3.Text = "<font color='red' size='5'>Please select a file:</font>"; } string query = "select * from CandidateRegistration where email='" + TextBox15 + "'"; ds = ob.ExeAdapter(query, "CandidateRegistration"); int count = ds.Tables["CandidateRegistration"].Rows.Count; string gender; if (RadioButton1.Checked) { gender = RadioButton1.Text; } else { gender = RadioButton2.Text; } SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@email", TextBox15.Text), new SqlParameter("@Cname", TextBox1.Text), new SqlParameter("@Address", TextBox2.Text), new SqlParameter("@Mnum", TextBox3.Text), new SqlParameter("@Fname", TextBox4.Text), new SqlParameter("@Foc", TextBox5.Text), new SqlParameter("@Tplace", TextBox6.Text), new SqlParameter("@Esign", paths), new SqlParameter("@Exp", TextBox7.Text), new SqlParameter("@Vimg", path), new SqlParameter("@Gen", gender), new SqlParameter("@Pass", TextBox9.Text), new SqlParameter("@National", DropDownList1.SelectedItem.Text) , new SqlParameter("@dob", TextBox16.Text) }; if (count == 0) { query = "insert into CandidateRegistration(CandidateName,Address,MobileNumber,FatherName,FatherOccupation,Ticketplace,Experiance,Nationality,Gender,Password,email,Dob,Electionsign,VoterId) values(@Cname,@Address,@Mnum,@Fname,@Foc,@Tplace,@Exp,@National,@Gen,@Pass,@email,@dob,@Esign,@Vimg)"; ob.ExeQuery(query, parameter); Label1.Text = "Register Successfully"; query = "insert into voting(CandidateName,numberofvote) values('" + TextBox1.Text + "',0) "; ob.ExeQuery(query); Response.Redirect("Candidatelogin.aspx"); } else { Label1.Text = "this Email id is already Register"; } }