Exemplo n.º 1
0
        private void btnFebSave_Click(object sender, EventArgs e)
        {
            Second_R Feb = new Second_R();

            Feb.memberName      = comboBox1.Text.Trim();
            Feb.monthlyAmount   = txtMonthlyAmount.Text.Trim();
            Feb.interest        = txtInterest.Text.Trim();
            Feb.paidAmount      = txtPaidAmount.Text.Trim();
            Feb.CollectedAmount = txtCollectAmt.Text.Trim();
            Feb.bcName          = labelBcName.Text.Trim();
            if (txtInterest.Text == "")
            {
                MessageBox.Show("Enter The Interest % Amount");
            }
            else if (txtPaidAmount.Text == "")
            {
                MessageBox.Show("Enter Paid Amount");
            }

            else
            {
                MC.Second_R.Add(Feb);
                MC.SaveChanges();
                MessageBox.Show("   Record Save For" + Environment.NewLine +
                                " Member:  " + comboBox1.Text + Environment.NewLine +
                                " To Beei Name:  " + labelBcName.Text);
            }
        }
 private void dgvSecond_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvSecond.CurrentRow.Index != -1)
         {
             m2.id = Convert.ToInt32(dgvSecond.CurrentRow.Cells["idDataGridViewTextBoxColumn1"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 m2                   = mc.Second_R.Where(x => x.id == m2.id).FirstOrDefault();
                 textBox1.Text        = m2.bcName;
                 btnDelSecond.Enabled = true;
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("There Are no Record Available");
     }
 }