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 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!"); } }
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>(); } } }
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!"); } } }
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 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."); } }
private void btnupdate_Click(object sender, EventArgs e) { decimal sub1 = decimal.Parse(txtsubject1.Text); decimal sub2 = decimal.Parse(txtsubject2.Text); decimal sub3 = decimal.Parse(txtsubject3.Text); decimal eng = decimal.Parse(txtenglish.Text); decimal git = decimal.Parse(txtgit.Text); decimal tot = decimal.Parse(txttotal.Text); decimal avg = decimal.Parse(txtaverage.Text); model_results.subject_1 = sub1; model_results.subject_2 = sub2; model_results.subject_3 = sub3; model_results.English = eng; model_results.git = git; model_results.total_marks = tot; model_results.average_marks = avg; model_results.avg_state = txtavgstate.Text; model_results.regid = txtstudentid.Text; model_results.exam = cmbexam.Text; model_results.batch = txtbatch.Text; using (proadmin_v1Entities db = new proadmin_v1Entities()) { if (cmbexam.Text != null) { model_examschedule.exam = cmbexam.Text; model_examschedule = db.basicdate_schedule.Where(x => x.exam == model_examschedule.exam).FirstOrDefault(); model_results.exam_date = model_examschedule.start_date; } else { message_popup_ok("Pleae fill all data fields!"); } if (db.data_examresults.Where(data => data.regid == txtstudentid.Text && data.exam == cmbexam.Text).Any())//Insert { db.Entry(model_results).State = EntityState.Modified; } else //Update { db.data_examresults.Add(model_results); } db.SaveChangesAsync(); message_popup_ok("Data Record Saved!"); } populate_all_student_exam_marks_data(); }
private void btnsubsave_Click(object sender, EventArgs e) { if (txtexam.Text == "" || dtpstartdate.Text == "" || dtpenddate.Text == "" || cmbstate.Text == "" || cmbexamtype.Text == "" || cmbbatch.Text == "") { message_popup_ok("Empty fields found."); } else { string exam = txtexam.Text + '_' + cmbexamtype.Text; model_examschedule.exam = exam; model_examschedule.start_date = dtpstartdate.Text; model_examschedule.end_date = dtpenddate.Text; model_examschedule.state = cmbstate.Text; model_examschedule.exam_type = cmbexamtype.Text; model_examschedule.batch = cmbbatch.Text; using (proadmin_v1Entities db = new proadmin_v1Entities()) { if (model_examschedule.id == 0)//Insert { db.basicdate_schedule.Add(model_examschedule); if (XtraMessageBox.Show("If you created this record, there will be students marks list also generated at the same time. Are you sure you want to shedule an exam?", "Authentication Required!", MessageBoxButtons.YesNo) == DialogResult.Yes) { generate_marks_list(cmbbatch.Text, exam); } } else //Update { db.Entry(model_examschedule).State = EntityState.Modified; } db.SaveChangesAsync(); clear_fields(); message_popup_ok("Data Record Saved!"); populate_examschedule_data_grid_view(); populate_all_examschedule_rich_data_grid_view(); //Reset normal after changes done model_examschedule.id = 0; btnsubsave.Text = "Save"; } } }
private void btnSave_Click(object sender, EventArgs e) { if (txtfullname.Text != "" || txtnic.Text != "" || txtemail.Text != "" || txtfullname.Text != "" || txtphone.Text != "" || txtusername.Text != "" || txtpassword.Text != "") { model_users.fullname = txtfullname.Text; model_users.nic = txtnic.Text; model_users.email = txtemail.Text; model_users.phone = Convert.ToInt32(txtphone.Text); model_users.role = cmbrole.SelectedItem.ToString(); model_users.status = cmbstate.SelectedItem.ToString(); model_users.username = txtusername.Text; model_users.password = txtpassword.Text; model_users.log = DateTime.Now.ToString(); using (proadmin_v1Entities db = new proadmin_v1Entities()) { if (model_users.id == 0)//Insert { db.basicdata_users.Add(model_users); } else //Update { db.Entry(model_users).State = EntityState.Modified; } db.SaveChangesAsync(); clear_fields(); message_popup_ok("Data Record Saved!"); populate_users_data_grid_view(); //Reset normal after changes done model_users.id = 0; btnSave.Text = "Save"; } } else { message_popup_ok("Empty fields found."); } }
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_users); if (entity.State == EntityState.Detached) { db.basicdata_users.Attach(model_users); } db.basicdata_users.Remove(model_users); db.SaveChangesAsync(); populate_users_data_grid_view(); clear_fields(); btnSave.Text = "Save"; message_popup_ok("Data Deleted!"); } } }
private void btnnewsave_Click(object sender, EventArgs e) { int seq_val = 0; using (proadmin_v1Entities db = new proadmin_v1Entities()) { var seq = db.GetNextSequenceValue(); int?nextSequenceValue = seq.Single(); seq_val = nextSequenceValue.Value; } if (txtnewfullname.Text == "" || txtnewlastname.Text == "" || txtnewnic.Text == "" || dtpnewdob.Text == "" || txtnewhomwaddress.Text == "" || txtnewhometell.Text == "" || txtnewfathername.Text == "" || txtnewparentsname.Text == "" || cmbnewolschool.Text == "" || cmbnewalschool.Text == "" || cmbnewbatch.Text == "" || cmbnewscol.Text == "" || cmbnewgender.Text == "" || txtnewstaytell.Text == "" || txtnewstayaddress.Text == "") { message_popup_ok("Empty fields found."); } else { string regid = cmbnewbatch.Text + "01" + seq_val; model_students.regid = regid; model_students.Firstname = txtnewfullname.Text; model_students.Lastname = txtnewlastname.Text; model_students.Nic = txtnewnic.Text; model_students.Dob = dtpnewdob.Text; model_students.home_address = txtnewhomwaddress.Text; model_students.Home_tell = txtnewhometell.Text; model_students.Staying_address = txtnewstayaddress.Text; model_students.Stay_home_tell = txtnewstaytell.Text; model_students.Father_name = txtnewfathername.Text; model_students.Parents_contact = txtnewparentsname.Text; model_students.Ol_School = cmbnewolschool.Text; model_students.Al_school = cmbnewalschool.Text; model_students.Ol_result = txtnewolresult.Text; model_students.JoinDate = txtnewjoiningdate.Text; model_students.Batch = cmbnewbatch.Text; model_students.Gender = cmbnewgender.Text; model_students.Scholarship = cmbnewscol.SelectedItem.ToString(); using (proadmin_v1Entities db = new proadmin_v1Entities()) { if (model_students.Id == 0)//Insert { db.basicdata_student.Add(model_students); } else //Update { db.Entry(model_students).State = EntityState.Modified; } db.SaveChangesAsync(); clear_fields(); message_popup_ok("Data Record Saved!"); populate_student_data_grid_view(); //Reset normal after changes done model_students.Id = 0; btnSave.Text = "Save"; txtmessage.Text = "New Student Reg ID : '" + regid + "'"; txtmessagbarcode.Text = regid; } } }