private void btnMarchSave_Click(object sender, EventArgs e) { Third_mR March = new Third_mR(); March.memberName = comboBox1.Text.Trim(); March.monthlyAmount = txtMonthlyAmount.Text.Trim(); March.interest = txtInterest.Text.Trim(); March.paidAmount = txtPaidAmount.Text.Trim(); March.CollectedAmount = txtCollectAmt.Text.Trim(); March.bcName = labelBcName.Text.Trim(); if (txtInterest.Text == "") { MessageBox.Show("Enter The Interest % Amount"); } else if (txtPaidAmount.Text == "") { MessageBox.Show("Enter Paid Amount"); } else { MC.Third_mR.Add(March); MC.SaveChanges(); MessageBox.Show(" Record Save For" + Environment.NewLine + " Member: " + comboBox1.Text + Environment.NewLine + " To Beei Name: " + labelBcName.Text); } }
private void dgvThird_Click(object sender, EventArgs e) { try { if (dgvThird.CurrentRow.Index != -1) { m3.id = Convert.ToInt32(dgvThird.CurrentRow.Cells["thirdId"].Value); using (MonthlyContributionEntities mc = new MonthlyContributionEntities()) { m3 = mc.Third_mR.Where(x => x.id == m3.id).FirstOrDefault(); textBox1.Text = m3.bcName; btndelThird.Enabled = true; } } } catch (NullReferenceException) { MessageBox.Show("There Are no Record Available"); } }