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