private void dgvfee_DoubleClick(object sender, EventArgs e)
        {
            if (dgvfee.CurrentRow.Index != -1)
            {
                model_fee.id = Convert.ToInt32(dgvfee.CurrentRow.Cells["id"].Value);

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    model_fee         = db.basicdate_fee.Where(x => x.id == model_fee.id).FirstOrDefault();
                    cmbfeestate.Text  = model_fee.state;
                    cmbfeebatch.Text  = model_fee.batch_;
                    txtfeeamount.Text = model_fee.amount;
                }

                btnfeesave.Text      = "Update";
                btnfeedelete.Enabled = true;
            }
        }
        private void btnregister_Click(object sender, EventArgs e)
        {
            if (txtstudentid.Text != null)
            {
                model_student.regid = txtstudentid.Text;
                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    if (db.basicdata_student.Where(data => data.regid == txtstudentid.Text).Any())
                    {
                        model_student = db.basicdata_student.Where(x => x.regid == model_student.regid).FirstOrDefault();
                        batch         = model_student.Batch;
                    }
                    else
                    {
                        txtstudentid.Text = null;
                        lblmessage.Text   = "Invalid Entry..";
                    }

                    model_fee = db.basicdate_fee.Where(data => data.batch_ == batch).FirstOrDefault();
                    amount    = model_fee.amount;
                }

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    if (db.data_feecollection.Where(data => data.regid == txtstudentid.Text && data.batch == batch && data.feeschedule == txtmonth.Text).Any())//Update attandance
                    {
                        model_feecollection              = db.data_feecollection.Where(data => data.regid == txtstudentid.Text && data.batch == batch && data.feeschedule == txtmonth.Text).FirstOrDefault();
                        model_feecollection.payment      = "Paid";
                        model_feecollection.payment_date = DateTime.Now.ToString();
                        model_feecollection.amount       = amount;

                        db.Entry(model_feecollection).State = EntityState.Modified;
                        db.SaveChanges();

                        lblmessage.Text = "Payment Colleted for : " + model_student.Firstname;
                    }
                    else
                    {
                        lblmessage.Text = "Invalid Entry..";
                    }
                }
                txtstudentid.Text = null;
            }
        }