private void gridCoachPay_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex != -1) { CoachPayForm cpf = new CoachPayForm(this, manager); cpf.Show(); int currentCoachPayID = Convert.ToInt32(gridCoachPay.Rows[e.RowIndex].Cells[0].Value); CoachPay pay = pays.Where(x => x.ID == currentCoachPayID).ToList <CoachPay>()[0]; cpf.Populate(pay, e.RowIndex); } }
public CoachPayForm(MainForm parentForm, AcademyMgr.AcademyMgr manager) { InitializeComponent(); AcademyMgr = manager; mainform = parentForm; currentCoachPayment = new CoachPay(); //On remplit la combo des coachs: List <Member> coachs = AcademyMgr.getMembers(true); cbCoachs.Items.AddRange(coachs.ToArray()); cbCoachs.DisplayMember = "Lastname"; }
public void Populate(CoachPay pay, int index) { rowIndex = index; currentCoachPayment = pay; cbCoachs.SelectedIndex = cbCoachs.FindStringExact(pay.Coach.Lastname); txtMonth.Text = pay.Month; txtLessons.Text = pay.Lessons.ToString(); txtLessonPrice.Text = pay.Pay.ToString(); txtAmount.Text = pay.Amount.ToString(); txtComment.Text = pay.Comment.ToString(); if (pay.Date != DateTime.MinValue) { dateTimePickerReception.Value = pay.Date; } }