protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton l = (LinkButton)sender; Label lbl1 = (Label)l.Parent.FindControl("IdLabel"); int id_candidate = Convert.ToInt32(lbl1.Text); Label lbl2 = (Label)l.Parent.FindControl("Commission_fkLabel"); int id_commissiion = Convert.ToInt32(lbl2.Text); ElectionData election = new ElectionData(); ElectionDal eledal = new ElectionDal(); CandidateDal candal = new CandidateDal(); ElectedDal ed = new ElectedDal(); string n = (TextBox1.Text).ToString(); int id = ed.ReturnID(n); election.Elected_fk = id; election.Commission_fk = id_commissiion; election.Candidate_fk = id_candidate; int no = ed.Check_Elected(id); if (no == 0) { eledal.InsertElection(election); Response.Redirect("OK.aspx"); } else { Response.Redirect("VoteInfo.aspx"); } }
protected void DeleteButton_Click(object sender, EventArgs e) { CandidateData d = new CandidateData(); int id = Convert.ToInt32(d.Id); CandidateDal c = new CandidateDal(); c.DeleteCandidate1(id); }
protected void btn_ok_Click(object sender, EventArgs e) { CandidateDal d = new CandidateDal(); d.DeleteRow_Candidate(Convert.ToInt32(txt_delete.Text)); int id = d.return_id(Convert.ToInt32(txt_delete.Text)); d.DeleteCandidate1(id); }