Ejemplo n.º 1
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show("Are you sure to delete the record?", "Delete Record", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    var entity = db.Entry(model_class);
                    if (entity.State == EntityState.Detached)
                    {
                        db.basicdata_class.Attach(model_class);
                    }
                    db.basicdata_class.Remove(model_class);
                    db.SaveChangesAsync();

                    btndelete.Enabled = false;

                    if (XtraMessageBox.Show("Do you want to delete all the addtendance for this class shedule too?", "Authentication Required!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        var data = db.data_attandance.Where(rec => rec.batch == cmbbatch.Text && rec.classdate == txtdate.Text);
                        db.data_attandance.RemoveRange(data);
                        db.SaveChanges();
                    }

                    clear_feild();

                    message_popup_ok("Data Deleted!");
                }
            }
        }
Ejemplo n.º 2
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show("Are you sure to delete the record?", "Delete Record", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    var entity = db.Entry(model_feeschedule);
                    if (entity.State == EntityState.Detached)
                    {
                        db.basicdate_feeschedule.Attach(model_feeschedule);
                    }
                    db.basicdate_feeschedule.Remove(model_feeschedule);
                    db.SaveChangesAsync();

                    btndelete.Enabled = false;

                    if (XtraMessageBox.Show("Do you want to delete all the fee records for this shedule too?", "Authentication Required!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        var data = db.data_feecollection.Where(rec => rec.batch == cmbbatch.Text && rec.feeschedule == lblmonth.Text);
                        db.data_feecollection.RemoveRange(data);
                        db.SaveChanges();
                    }

                    clear_feild();

                    MessageBox.Show("Data Deleted!");

                    dgvpaymentschedule.DataSource = db.basicdate_feeschedule.Where(data => data.batch == cmbbatch.Text).ToList <basicdate_feeschedule>();
                }
            }
        }
Ejemplo n.º 3
0
        private void btnsubdelete_Click(object sender, EventArgs e)
        {
            if (XtraMessageBox.Show("Are you sure to delete the record?", "Delete Record", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    var entity = db.Entry(model_examschedule);
                    if (entity.State == EntityState.Detached)
                    {
                        db.basicdate_schedule.Attach(model_examschedule);
                    }
                    db.basicdate_schedule.Remove(model_examschedule);
                    db.SaveChangesAsync();

                    populate_examschedule_data_grid_view();
                    populate_all_examschedule_rich_data_grid_view();

                    btnsubsave.Text = "Save";

                    if (XtraMessageBox.Show("Do you want to delete all the Marks for this exam shedule too?", "Authentication Required!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        var data = db.data_examresults.Where(rec => rec.exam == txtexam.Text && rec.batch == cmbbatch.Text);
                        db.data_examresults.RemoveRange(data);
                        db.SaveChanges();
                    }
                    clear_fields();

                    message_popup_ok("Data Deleted!");
                }
            }
        }
Ejemplo n.º 4
0
        private void generate_marks_list(string batch, string exam)
        {
            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                var selectedStudents = db.basicdata_student.Where(i => i.Batch == batch).ToList();

                foreach (basicdata_student student in selectedStudents)
                {
                    model_results.subject_1     = 0;
                    model_results.subject_2     = 0;
                    model_results.subject_3     = 0;
                    model_results.English       = 0;
                    model_results.git           = 0;
                    model_results.total_marks   = 0;
                    model_results.average_marks = 0;
                    model_results.avg_state     = "";
                    model_results.regid         = student.regid;
                    model_results.exam          = exam;
                    model_results.batch         = batch;
                    model_results.exam_date     = dtpstartdate.Text;

                    db.data_examresults.Add(model_results);
                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 5
0
        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();
                        txtbatch.Text = model_student.Batch;
                    }
                    else
                    {
                        clear();
                        lblmessage.Text = "Invalid Class Entry..";
                    }
                }

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    model_attandance.intime     = DateTime.Now.ToString();
                    model_attandance.attandance = "Attend";

                    if (db.data_attandance.Where(data => data.regid == txtstudentid.Text && data.batch == txtbatch.Text && data.classdate == txttoday.Text).Any())//Update attandance
                    {
                        model_attandance            = db.data_attandance.Where(x => x.regid == txtstudentid.Text && x.batch == txtbatch.Text && x.classdate == txttoday.Text).FirstOrDefault();
                        model_attandance.intime     = DateTime.Now.ToString();
                        model_attandance.attandance = "Attend";

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

                        lblmessage.Text = "Welcome : " + model_student.Firstname;
                    }
                    else
                    {
                        lblmessage.Text = "Invalid Class Entry..";
                    }
                }
                txtstudentid.Text = null;
                txtbatch.Text     = null;
            }
        }
Ejemplo n.º 6
0
        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;
            }
        }
Ejemplo n.º 7
0
        private void generate_attandance_records()
        {
            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                var selectedStudents = db.basicdata_student.Where(i => i.Batch == cmbbatch.Text).ToList();

                foreach (basicdata_student student in selectedStudents)
                {
                    model_attandance.classdate  = txtdate.Text;
                    model_attandance.attandance = "Not Attend";
                    model_attandance.batch      = cmbbatch.Text;
                    model_attandance.intime     = "0";
                    model_attandance.regid      = student.regid;

                    db.data_attandance.Add(model_attandance);
                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 8
0
        private void generate_payment_records()
        {
            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                var selectedStudents = db.basicdata_student.Where(i => i.Batch == cmbbatch.Text && i.Scholarship == "NO").ToList();

                foreach (basicdata_student student in selectedStudents)
                {
                    model_feedata.amount       = "0";
                    model_feedata.batch        = cmbbatch.Text;
                    model_feedata.feeschedule  = txtmonth.Text;
                    model_feedata.payment      = "Not Paid";
                    model_feedata.payment_date = "";
                    model_feedata.regid        = student.regid;
                    model_feedata.year         = txtyear.Text;

                    db.data_feecollection.Add(model_feedata);
                    db.SaveChanges();
                }
            }
        }