//Eventhanlder click Del button void AddPhase_onDelete(object sender, EventArgs e) { Add_Phase AddPhase = new Add_Phase(); int phaseID = (e as MyEventArgs).IDPhase; foreach (Add_Phase item in ps.flp_Phase.Controls) { if (item.ID_Phase == phaseID) { Phase.IDPhase = Convert.ToInt32(item.lbl_IDPhase.Text.Trim()); PhaseQuestionBL.DeletePhaseQuestionbyIDPhase(Phase); PhaseBL.DeletePhasebyIDPhase(Phase); ps.flp_Phase.Controls.Remove(item); } } }
public void LoadPhaseSetting() { ps.flp_Phase.Controls.Clear(); List<Phase> ListPhase; ListPhase = PhaseBL.GetPhase(); if (ListPhase != null) { for (int j = 0; j < ListPhase.Count; j++) { if (ListPhase.ElementAt(j).IDContest == IdContest) { Add_Phase AddPhase = new Add_Phase(); PhaseTag++; AddPhase.Tag = PhaseTag; AddPhase.ID_Phase = PhaseTag; AddPhase.onDelete += AddPhase_onDelete; AddPhase.lbl_IDPhase.Text = ListPhase.ElementAt(j).IDPhase.ToString(); AddPhase.txt_PhaseName.Text = ListPhase.ElementAt(j).NamePhase; AddPhase.txt_Time.Text = ListPhase.ElementAt(j).TimePhase.ToString(); AddPhase.txt_Score.Text = ListPhase.ElementAt(j).ScorePhase.ToString(); AddPhase.txt_Minus.Text = ListPhase.ElementAt(j).MinusPhase.ToString(); AddPhase.txt_Sequence.Text = ListPhase.ElementAt(j).Sequence.ToString(); ps.flp_Phase.Controls.Add(AddPhase); } } } }