private void btnfeesave_Click(object sender, EventArgs e)
        {
            if (cmbfeebatch.Text != "" || txtfeeamount.Text != "" || cmbfeestate.Text != "")
            {
                model_fee.batch_ = cmbfeebatch.Text;
                model_fee.amount = txtfeeamount.Text;
                model_fee.state  = cmbfeestate.Text;

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    if (model_fee.id == 0)//Insert
                    {
                        db.basicdate_fee.Add(model_fee);
                    }
                    else //Update
                    {
                        db.Entry(model_fee).State = EntityState.Modified;
                    }

                    db.SaveChangesAsync();
                    clear_fields();
                    message_popup_ok("Data Record Saved!");
                    populate_fee_data_grid_view();

                    //Reset normal after changes done
                    model_fee.id    = 0;
                    btnfeesave.Text = "Save";
                }
            }
            else
            {
                message_popup_ok("Empty fields found.");
            }
        }
        private void btnsubsave_Click(object sender, EventArgs e)
        {
            if (txtsubject.Text != "" || txtteacher.Text != "")
            {
                model_subject.subject = txtsubject.Text.Trim();
                model_subject.teacher = txtteacher.Text.Trim();
                model_subject.log     = DateTime.Now.ToString();

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    if (model_subject.subid == 0)//Insert
                    {
                        db.basicdata_subject.Add(model_subject);
                    }
                    else //Update
                    {
                        db.Entry(model_subject).State = EntityState.Modified;
                    }

                    db.SaveChangesAsync();
                    clear_fields();
                    message_popup_ok("Data Record Saved!");
                    populate_subject_data_grid_view();

                    //Reset normal after changes done
                    model_subject.subid = 0;
                    btnsubsave.Text     = "Save";
                }
            }
            else
            {
                message_popup_ok("Empty fields found.");
            }
        }
Esempio n. 3
0
 private void populate_all_examschedule_rich_data_grid_view()
 {
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         dgvAllExam.DataSource = db.basicdate_schedule.ToList <basicdate_schedule>();
     }
 }
Esempio n. 4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtusername.Text != null || txtpassword.Text != null || cmbuser.Text != null)
            {
                model_user.username = txtusername.Text;
                model_user.password = txtpassword.Text;
                model_user.role     = cmbuser.Text;

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    if (db.basicdata_users.Where(data => data.username == txtusername.Text && data.password == txtpassword.Text && data.role == cmbuser.Text).Any())
                    {
                        frmDashborad dashborad = new frmDashborad();
                        dashborad.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Invalid User login, Please try again.");
                        txtusername.Text = null;
                        txtpassword.Text = null;
                        cmbuser.Text     = null;
                    }
                }
            }
            else
            {
                MessageBox.Show("Please fill all the fields.");
            }
        }
        private void btnsave_Click(object sender, EventArgs e)
        {
            if (txtmonth.Text == "" || txtyear.Text == "" || cmbbatch.Text == "")
            {
                MessageBox.Show("Please fill all the feilds..");
            }
            else
            {
                model_feeschedule.batch    = cmbbatch.Text;
                model_feeschedule.feemonth = txtmonth.Text;
                model_feeschedule.year     = txtyear.Text;
                model_feeschedule.state    = "Active";

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    db.basicdate_feeschedule.Add(model_feeschedule);

                    db.SaveChangesAsync();

                    //student payment empty records creating
                    generate_payment_records();

                    MessageBox.Show("Data Record Saved!");
                    dgvpaymentschedule.DataSource = db.basicdate_feeschedule.Where(data => data.batch == cmbbatch.Text).ToList <basicdate_feeschedule>();
                }
            }
            clear_feild();
        }
        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>();
                }
            }
        }
Esempio n. 7
0
        private void dgvUser_DoubleClick_1(object sender, EventArgs e)
        {
            if (dgvUser.CurrentRow.Index != -1)
            {
                model_users.id = Convert.ToInt32(dgvUser.CurrentRow.Cells["id"].Value);

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    model_users            = db.basicdata_users.Where(x => x.id == model_users.id).FirstOrDefault();
                    txtfullname.Text       = model_users.fullname;
                    txtnic.Text            = model_users.nic;
                    txtemail.Text          = model_users.email;
                    txtphone.Text          = model_users.phone.ToString();
                    cmbrole.SelectedValue  = model_users.role;
                    cmbstate.SelectedValue = model_users.status;
                    txtusername.Text       = model_users.username;
                    txtpassword.Text       = model_users.password;
                    string now = DateTime.Now.ToString();
                    now = model_users.log;
                }

                btnSave.Text      = "Update";
                btnDelete.Enabled = true;
            }
        }
Esempio n. 8
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!");
                }
            }
        }
 private void cmbsearchbybatch_SelectedValueChanged(object sender, EventArgs e)
 {
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         dgvpaymentschedule.DataSource = db.basicdate_feeschedule.Where(data => data.batch == cmbsearchbybatch.Text).ToList <basicdate_feeschedule>();
     }
 }
Esempio n. 10
0
 private void populate_shedule()
 {
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         dgvclassshedule.DataSource = db.basicdata_class.ToList <basicdata_class>();
     }
 }
Esempio n. 11
0
 private void populate_all_student_data_grid_view()
 {
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         dgvAllStudent.DataSource = db.basicdata_student.ToList <basicdata_student>();
     }
 }
Esempio n. 12
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();
                }
            }
        }
Esempio n. 13
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!");
                }
            }
        }
Esempio n. 14
0
        private void btnsearch_Click(object sender, EventArgs e)
        {
            if (txtsearch.Text != null)
            {
                model_students.regid = txtfind.Text;

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    model_students              = db.basicdata_student.Where(x => x.regid == model_students.regid).FirstOrDefault();
                    txtfirstname.Text           = model_students.Firstname;
                    txtlastname.Text            = model_students.Lastname;
                    txtnic.Text                 = model_students.Nic;
                    dtpdob.Text                 = model_students.Dob;
                    txthomeaddress.Text         = model_students.home_address;
                    txthometell.Text            = model_students.Home_tell;
                    txtstayingaddress.Text      = model_students.Staying_address;
                    txtstayingtell.Text         = model_students.Stay_home_tell;
                    txtfathername.Text          = model_students.Father_name;
                    txtparenttell.Text          = model_students.Parents_contact;
                    cmbolschool.Text            = model_students.Ol_School;
                    cmbalschool.Text            = model_students.Al_school;
                    txtolresult.Text            = model_students.Ol_result;
                    txtjoiningdate.Text         = model_students.JoinDate;
                    cmbbatch.Text               = model_students.Batch;
                    cmbgender.Text              = model_students.Gender;
                    cmbscholership.SelectedItem = model_students.Scholarship;
                }

                btnSave.Text      = "Update";
                btnDelete.Enabled = true;
            }
        }
Esempio n. 15
0
        private void dgvStudent_DoubleClick(object sender, EventArgs e)
        {
            if (dgvStudent.CurrentRow.Index != -1)
            {
                model_students.Id = Convert.ToInt32(dgvStudent.CurrentRow.Cells["Id"].Value);

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    model_students              = db.basicdata_student.Where(x => x.Id == model_students.Id).FirstOrDefault();
                    txtfirstname.Text           = model_students.Firstname;
                    txtlastname.Text            = model_students.Lastname;
                    txtnic.Text                 = model_students.Nic;
                    dtpdob.Text                 = model_students.Dob;
                    txthomeaddress.Text         = model_students.home_address;
                    txthometell.Text            = model_students.Home_tell;
                    txtstayingaddress.Text      = model_students.Staying_address;
                    txtstayingtell.Text         = model_students.Stay_home_tell;
                    txtfathername.Text          = model_students.Father_name;
                    txtparenttell.Text          = model_students.Parents_contact;
                    cmbolschool.Text            = model_students.Ol_School;
                    cmbalschool.Text            = model_students.Al_school;
                    txtolresult.Text            = model_students.Ol_result;
                    txtjoiningdate.Text         = model_students.JoinDate;
                    cmbbatch.Text               = model_students.Batch;
                    cmbgender.Text              = model_students.Gender;
                    cmbscholership.SelectedItem = model_students.Scholarship;
                }

                btnSave.Text      = "Update";
                btnDelete.Enabled = true;
            }
        }
Esempio n. 16
0
        private void btnstudentsearch_Click(object sender, EventArgs e)
        {
            if (txtstudentid.Text != null)
            {
                model_students.regid = txtstudentid.Text;
                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    if (db.basicdata_student.Where(data => data.regid == txtstudentid.Text).Any())
                    {
                        model_students        = db.basicdata_student.Where(x => x.regid == model_students.regid).FirstOrDefault();
                        txtstudentname.Text   = model_students.Firstname;
                        txtbatch.Text         = model_students.Batch;
                        txtschool.Text        = model_students.Al_school;
                        cmbexam.Enabled       = true;
                        btnexamsearch.Enabled = true;
                        get_student_exam_vale_list();
                    }
                    else
                    {
                        clear();
                        MessageBox.Show("Invalud Student Registration ID. Please Try Again!");
                    }
                }
            }
            else
            {
                MessageBox.Show("Invalud Student Registration ID. Please Try Again!");
                clear();
            }

            populate_all_student_exam_marks_data();
        }
Esempio n. 17
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            if (txtdate.Text != "" && cmbbatch.Text != "")
            {
                model_class.batch     = cmbbatch.Text;
                model_class.classdate = txtdate.Text;
                model_class.state     = "Active";

                using (proadmin_v1Entities db = new proadmin_v1Entities())
                {
                    db.basicdata_class.Add(model_class);

                    db.SaveChangesAsync();

                    //student attdance empty records creating
                    generate_attandance_records();

                    message_popup_ok("Data Record Saved!");
                    dgvclassshedule.DataSource = db.basicdata_class.Where(x => x.classdate == txtdate.Text).ToList <basicdata_class>();
                    clear_feild();
                }
            }
            else
            {
                message_popup_ok("Please fill all the fields!");
            }
        }
Esempio n. 18
0
 private void populate_student_data_grid_view()
 {
     dgvStudent.AutoGenerateColumns = false;
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         dgvStudent.DataSource = db.basicdata_student.ToList <basicdata_student>();
     }
 }
Esempio n. 19
0
 private void populate_examschedule_data_grid_view()
 {
     dgvExamSchedule.AutoGenerateColumns = false;
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         dgvExamSchedule.DataSource = db.basicdate_schedule.ToList <basicdate_schedule>();
     }
 }
Esempio n. 20
0
 private void populate_users_data_grid_view()
 {
     dgvUser.AutoGenerateColumns = false;
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         dgvUser.DataSource = db.basicdata_users.ToList <basicdata_users>();
     }
 }
Esempio n. 21
0
        private void populate_school_data_grid_view()
        {
            dgvSchoolView.AutoGenerateColumns = false;

            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                dgvSchoolView.DataSource = db.basicdata_school.ToList <basicdata_school>();
            }
        }
Esempio n. 22
0
        private void populate_fee_data_grid_view()
        {
            dgvSubjectView.AutoGenerateColumns = false;

            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                dgvfee.DataSource = db.basicdate_fee.ToList <basicdate_fee>();
            }
        }
Esempio n. 23
0
        private void populate_university_data_grid_view()
        {
            dgvUniversityView.AutoGenerateColumns = false;

            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                dgvUniversityView.DataSource = db.basicdata_university.ToList <basicdata_university>();
            }
        }
Esempio n. 24
0
        private void claclass_Click(object sender, EventArgs e)
        {
            txtdate.Text = claclass.SelectedRanges.Start.ToShortDateString();

            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                dgvclassshedule.DataSource = db.basicdata_class.Where(x => x.classdate == txtdate.Text).ToList <basicdata_class>();
            }
        }
Esempio n. 25
0
 public void populate_all_student_exam_marks_data()
 {
     dgvStudentResultData.AutoGenerateColumns = false;
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         model_results.regid             = txtstudentid.Text;
         dgvStudentResultData.DataSource = db.data_examresults.Where(x => x.regid == model_results.regid).ToList <data_examresults>();
     }
 }
Esempio n. 26
0
        //Pupulate Events
        private void populate_batch_data_grid_view()
        {
            dgvBatchView.AutoGenerateColumns = false;

            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                dgvBatchView.DataSource = db.basicdata_batch.ToList <basicdata_batch>();
            }
        }
Esempio n. 27
0
        private void cmbsearchbybatch_SelectedIndexChanged(object sender, EventArgs e)
        {
            dgvExamSchedule.AutoGenerateColumns = false;
            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                model_examschedule.batch = cmbsearchbybatch.Text;

                dgvExamSchedule.DataSource = db.basicdate_schedule.Where(x => x.batch == model_examschedule.batch).ToList <basicdate_schedule>();
            }
        }
Esempio n. 28
0
 private void get_combo_vale_list()
 {
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         var batch = db.basicdata_batch.Select(y => new { y.batchid, y.batch, y.batchstate }).Where(y => y.batchstate == "Active");
         cmbbatch.DataSource    = batch.ToList();
         cmbbatch.DisplayMember = "batch";
         cmbbatch.SelectedItem  = null;
     }
 }
Esempio n. 29
0
 private void txtdate_SelectionChanged(object sender, EventArgs e)
 {
     using (proadmin_v1Entities db = new proadmin_v1Entities())
     {
         var batch_data = from data in db.basicdata_class where data.classdate == txtdate.Text select new { Name = data.id, ID = data.batch };
         cmbbatch.DataSource    = batch_data.ToList();
         cmbbatch.ValueMember   = "id";
         cmbbatch.DisplayMember = "batch";
         cmbbatch.SelectedItem  = null;
     }
 }
Esempio n. 30
0
        private void cmbmissbatch_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (proadmin_v1Entities db = new proadmin_v1Entities())
            {
                var exam = from data in db.basicdate_schedule where data.batch == cmbmissbatch.Text select new { Name = data.id, ID = data.exam };

                cmbmissexam.DataSource    = exam.ToList();
                cmbmissexam.ValueMember   = "id";
                cmbmissexam.DisplayMember = "exam";
                cmbmissexam.SelectedItem  = null;
            }
        }