private void btnsave_Click(object sender, EventArgs e) { byte gender; int? secID; if (edit == 0) { if (sectioncb.SelectedIndex > 0) { secID = Convert.ToInt32(sectioncb.SelectedValue.ToString()); } else { secID = null; } if (Gendercb.SelectedIndex == 0) { gender = 1; } else { gender = 0; } obj.insertAdmission(Student_txt.Text, gender, txt_Fathername.Text, txt_mothername.Text, Fathersjob.Text, Mothersjob.Text, Dob.Value, Nationality.Text, placeofbirth.Text, Convert.ToByte(Religioncb.SelectedIndex), Convert.ToInt32(Classs.SelectedValue.ToString()), secID, Address.Text, Phone.Text, phone2.Text, txt_email.Text, Convert.ToByte(statuscb.SelectedIndex)); Mainclass.ShowMsg("Student Admission Submitted Successfully", "Success", "Success"); loadata(); } else if (edit == 1) { if (sectioncb.SelectedIndex > 0) { secID = Convert.ToInt32(sectioncb.SelectedValue.ToString()); } else { secID = null; } if (Gendercb.SelectedIndex == 0) { gender = 1; } else { gender = 0; } obj.UpdateAdmission(Student_txt.Text, gender, txt_Fathername.Text, txt_mothername.Text, Fathersjob.Text, Mothersjob.Text, Dob.Value, Nationality.Text, placeofbirth.Text, Convert.ToByte(Religioncb.SelectedIndex), Convert.ToInt32(Classs.SelectedValue.ToString()), secID, Address.Text, Phone.Text, phone2.Text, txt_email.Text, Convert.ToByte(statuscb.SelectedIndex), AID); Mainclass.ShowMsg("Admission Application Updated Successfully", "Success", "Success"); loadata(); } }
private void deletebtn_Click(object sender, EventArgs e) { if (edit == 1) { obj.deletestaff(StaffID); Mainclass.ShowMsg(txt_name.Text + " Deleted successfully.", "Success", "Success"); Mainclass.disable_reset(panel1); loadstaff(); } }
private void button1_Click(object sender, EventArgs e) { if (txt_username.Text == "") { errorlabelUsernme.Visible = true; } else { errorlabelUsernme.Visible = false; } if (txt_password.Text == "") { errorlabelpassword.Visible = true; } else { errorlabelpassword.Visible = false; } if (errorlabelpassword.Visible || errorlabelUsernme.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (mai.getStaffLogin(txt_username.Text, txt_password.Text)) { if (Mainclass.STAFFROLE == "Falculty") { FalcultyDashboard hs = new FalcultyDashboard(); Mainclass.showWindow(hs, this, Mdi.ActiveForm); } if (Mainclass.STAFFROLE == "Admin") { Home hs = new Home(); Mainclass.showWindow(hs, this, Mdi.ActiveForm); } if (Mainclass.STAFFROLE == "Teacher") { } if (Mainclass.STAFFROLE == "Principal") { } } else { Mainclass.ShowMsg("Invalid Login Details", "Error...", "Error.."); } } }
private void Savebtn_Click(object sender, EventArgs e) { if (txt_shift.Text == "") { errorlabelshiftname.Visible = true; } else { errorlabelshiftname.Visible = false; } if (Shiftcb.SelectedIndex == -1) { Errorlabeelshiftnumber.Visible = true; } else { Errorlabeelshiftnumber.Visible = false; } if (errorlabelshiftname.Visible || Errorlabeelshiftnumber.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { Shiftt s = new Shiftt(); TimeSpan startTime = new TimeSpan(Startpicker.Value.Hour, Startpicker.Value.Minute, Startpicker.Value.Second); TimeSpan EndTime = new TimeSpan(Endpicker.Value.Hour, Endpicker.Value.Minute, Endpicker.Value.Second); obj.insertshift(txt_shift.Text, Convert.ToByte(Shiftcb.SelectedItem.ToString()), startTime, EndTime); obj.SubmitChanges(); Mainclass.ShowMsg(txt_shift.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { TimeSpan startTime = new TimeSpan(Startpicker.Value.Hour, Startpicker.Value.Minute, Startpicker.Value.Second); TimeSpan EndTime = new TimeSpan(Endpicker.Value.Hour, Endpicker.Value.Minute, Endpicker.Value.Second); obj.Updateshift(txt_shift.Text, Convert.ToByte(Shiftcb.SelectedItem.ToString()), startTime, EndTime, ShiftID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_shift.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
private void btndelete_Click(object sender, EventArgs e) { if (edit == 1) { DialogResult dr = MessageBox.Show("Are you sure you want to delete " + Student_txt.Text + " Admission Application ?", "Questions", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { obj.deleteadmission(AID); Mainclass.ShowMsg(Student_txt.Text + " Application deleted successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadata(); } } }
private void btnsave_Click(object sender, EventArgs e) { if (edit == 0) { obj.insertfeestructure(Convert.ToInt32(Classcb.SelectedValue.ToString()), Convert.ToDecimal(txt_admissionfee.Text), Convert.ToDecimal(MonthlyFEE.Text), Convert.ToDecimal(txt_SecurityDeposit.Text), Convert.ToDecimal(txt_Coursefee.Text), Convert.ToDecimal(txt_SportFee.Text), Convert.ToDecimal(txt_others.Text)); Mainclass.ShowMsg("Fee Addedd Successfully", "Success", "Success"); loadata(); } else if (edit == 1) { obj.UpdateFeeStructure(Convert.ToInt32(Classcb.SelectedValue.ToString()), Convert.ToDecimal(txt_admissionfee.Text), Convert.ToDecimal(MonthlyFEE.Text), Convert.ToDecimal(txt_SecurityDeposit.Text), Convert.ToDecimal(txt_Coursefee.Text), Convert.ToDecimal(txt_SportFee.Text), Convert.ToDecimal(txt_others.Text), FeeID); Mainclass.ShowMsg("Fee Updated Successfully", "Success", "Success"); loadata(); } }
private void btnsave_Click(object sender, EventArgs e) { if (edit == 0) { obj.insertfeemethod(txt_bank.Text, txt_branch.Text, txt_Addrress.Text, txt_account.Text); Mainclass.ShowMsg("Fee Addedd Successfully", "Success", "Success"); loadata(); } else if (edit == 1) { obj.updatefeeMethod(txt_bank.Text, txt_branch.Text, txt_Addrress.Text, txt_account.Text, MethodID); Mainclass.ShowMsg("Fee Updated Successfully", "Success", "Success"); loadata(); } }
private void deletebtn_Click(object sender, EventArgs e) { if (edit == 1) { DialogResult dr = MessageBox.Show("Are you sure you want to delete " + txt_Levelname.Text + "?", "Questions", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { obj.deleterole(LevelID); Mainclass.ShowMsg(txt_Levelname.Text + " deleted successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } } }
private void Savebtn_Click(object sender, EventArgs e) { if (txt_subject.Text == "") { Errorlabelsubject.Visible = true; } else { Errorlabelsubject.Visible = false; } if (Errorlabelsubject.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { try { Subject c = new Subject(); c.Subname = txt_subject.Text; //obj.roles.InsertOnSubmit(r); obj.insertsubject(txt_subject.Text); obj.SubmitChanges(); Mainclass.ShowMsg(txt_subject.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } catch (Exception ex) { Mainclass.ShowMsg("Are trying to insert same lines", "Error", "Error"); } } else if (edit == 1) { obj.updatesubject(txt_subject.Text, SubjectID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_subject.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
public void showReport(int?ClassID, int?SecID, int?FacID) { try { rd = new ReportDocument(); var data = obj.getTimeTableReport(ClassID, FacID, SecID); rd.Load(Application.StartupPath + "\\Reports\\ttreport.rpt"); rd.SetDataSource(data); crystalReportViewer1.ReportSource = rd; crystalReportViewer1.RefreshReport(); } catch (Exception ex) { Mainclass.ShowMsg(ex.Message, "Error", "Error"); } }
private void btnsave_Click(object sender, EventArgs e) { byte admissionFeestatus = Admisssioncheckbox.Checked ? Convert.ToByte(1) : Convert.ToByte(0); byte sportFeeStatus = Sportcheckbox.Checked ? Convert.ToByte(1) : Convert.ToByte(0); byte SecuirityFeeStatus = Securitycheckbox.Checked ? Convert.ToByte(1) : Convert.ToByte(0); byte courseFeestatus = Coursefeecheck.Checked ? Convert.ToByte(1) : Convert.ToByte(0); byte otherfeestatus = otherscb.Checked ? Convert.ToByte(1) : Convert.ToByte(0); if (edit == 0) { foreach (DataGridViewRow row in dataGridView2.Rows) { string reason; float discount; if (row.Cells["ReasonGV"].Value == null || row.Cells["ReasonGV"].Value.ToString() == "") { reason = ""; } else { reason = row.Cells["ReasonGV"].Value.ToString(); } if (row.Cells["DiscountGV"].Value == null || row.Cells["DiscountGV"].Value.ToString() == "") { discount = 0; } else { discount = Convert.ToSingle(row.Cells["DiscountGV"].Value.ToString()); } obj.insertintoFeeVoucher(Convert.ToByte(dateTimePicker1.Value.Month), Convert.ToByte(dateTimePicker1.Value.Year), Convert.ToInt16(row.Cells["StudentIDGV"].Value.ToString()), Convert.ToInt32(classcb.SelectedValue.ToString()), dateTimePicker2.Value, discount, 0, Convert.ToByte(paymentcb.SelectedValue.ToString()), 0, reason, admissionFeestatus, sportFeeStatus, courseFeestatus, SecuirityFeeStatus, otherfeestatus); } Mainclass.ShowMsg(classcb.Text + " Voucher added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); } else { Mainclass.ShowMsg(classcb.Text + " Voucher Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); } }
private void btnsave_Click(object sender, EventArgs e) { if (txt_period.Text == "") { errorlabelperiodname.Visible = true; } else { errorlabelperiodname.Visible = false; } if (errorlabelperiodname.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { Periods p = new Periods(); p.Periodname = txt_period.Text; //obj.roles.InsertOnSubmit(r); obj.insertperiod(txt_period.Text); obj.SubmitChanges(); Mainclass.ShowMsg(txt_period.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { obj.Updateperiod(txt_period.Text, PeriodID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_period.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
private void Savebtn_Click(object sender, EventArgs e) { if (txt_Levelname.Text == "") { errorlabelname.Visible = true; } else { errorlabelname.Visible = false; } if (errorlabelname.Visible || errorlabelname.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { Levels s = new Levels(); obj.insertlevel(txt_Levelname.Text); obj.SubmitChanges(); Mainclass.ShowMsg(txt_Levelname.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { obj.Updatelevel(txt_Levelname.Text, LevelID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_Levelname.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
private void Savebtn_Click(object sender, EventArgs e) { if (txt_name.Text == "") { errorlabelname.Visible = true; } else { errorlabelname.Visible = false; } if (txt_username.Text == "") { errorlabelusername.Visible = true; } else { errorlabelusername.Visible = false; } if (txt_password.Text == "") { errorlabelpassword.Visible = true; } else { errorlabelpassword.Visible = false; } if (txt_conpass.Text == "") { errorlabelconpass.Visible = true; } else { errorlabelconpass.Visible = false; } if (txt_phone.Text == "") { errorlabelphone.Visible = true; } else { errorlabelphone.Visible = false; } if (rolecb.SelectedIndex == -1) { erroelabelrole.Visible = true; } else { erroelabelrole.Visible = false; } if (rolestatus.SelectedIndex == -1) { errorlabelstatus.Visible = true; } else { errorlabelstatus.Visible = false; } if (errorlabelname.Visible || errorlabelusername.Visible || errorlabelpassword.Visible || errorlabelconpass.Visible || errorlabelphone.Visible || erroelabelrole.Visible || errorlabelstatus.Visible) { Mainclass.ShowMsg("Fields with * are mandatory", "Stop.....", "Error"); } if (txt_password.Text != txt_conpass.Text) { MessageBox.Show("Password mismatched"); } else { if (edit == 0) { if (Image.Text == "") { byte stat = rolestatus.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); obj.InsertStaffwithoutimage(txt_name.Text, txt_username.Text, txt_password.Text, txt_phone.Text, txt_phone2.Text, Convert.ToInt32(rolecb.SelectedIndex.ToString()), stat); Mainclass.ShowMsg(txt_name.Text + " added successfully.", "Success", "Success"); Mainclass.disable_reset(panel1); loadstaff(); } else { byte stat = rolestatus.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); MemoryStream ms = new MemoryStream(); i.Save(ms, ImageFormat.Jpeg); byte[] arr = ms.ToArray(); obj.InsertStaff(txt_name.Text, txt_username.Text, txt_password.Text, txt_phone.Text, txt_phone2.Text, Convert.ToInt32(rolecb.SelectedIndex.ToString()), stat, arr); Mainclass.ShowMsg(txt_name.Text + " added successfully.", "Success", "Success"); Mainclass.disable_reset(panel1); loadstaff(); } } else if (edit == 1) { byte stat = rolestatus.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0); if (i == null) { obj.Updatestaffwithoutimage(txt_name.Text, txt_username.Text, txt_password.Text, txt_phone.Text, txt_phone2.Text, Convert.ToInt32(rolecb.SelectedIndex.ToString()), stat, StaffID); Mainclass.ShowMsg(txt_name.Text + " Updated successfully.", "Success", "Success"); Mainclass.disable_reset(panel1); loadstaff(); } else { MemoryStream ms = new MemoryStream(); i.Save(ms, ImageFormat.Jpeg); byte[] arr = ms.ToArray(); obj.UpdateStaff(txt_name.Text, txt_username.Text, txt_password.Text, txt_phone.Text, txt_phone2.Text, Convert.ToInt32(rolecb.SelectedIndex.ToString()), stat, arr, StaffID); Mainclass.ShowMsg(txt_name.Text + " Updated successfully.", "Success", "Success"); Mainclass.disable_reset(panel1); loadstaff(); } } } }
private void btnsave_Click(object sender, EventArgs e) { if (txt_role.Text == "") { erreorlabelrole.Visible = true; } else { erreorlabelrole.Visible = false; } if (rolestatuscb.SelectedIndex == -1) { errorlabelrolestatus.Visible = true; } else { errorlabelrolestatus.Visible = false; } if (erreorlabelrole.Visible || errorlabelrolestatus.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { role r = new role(); r.rolename = txt_role.Text; if (rolestatuscb.SelectedIndex == 0) { r.rolestatus = 1; } else { r.rolestatus = 0; } //obj.roles.InsertOnSubmit(r); obj.InsertRole(txt_role.Text, r.rolestatus); obj.SubmitChanges(); Mainclass.ShowMsg(txt_role.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { byte stat; if (rolestatuscb.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.UpdateRole(txt_role.Text, stat, roleID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_role.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); //var data = obj.roles.Single(x => x.rolesID == roleID); //data.rolename = txt_role.Text; //if (rolestatuscb.SelectedIndex== 0) //{ // data.rolestatus = 1; //} //else //{ // data.rolestatus = 0; //} ////obj.roles.InsertOnSubmit(r); //obj.SubmitChanges(); //Mainclass.ShowMsg(txt_role.Text + " Updated successfully.", "Success...", "Success"); //Mainclass.disable_reset(panel1); //loadData(); } } }
private void btnsave_Click(object sender, EventArgs e) { if (txt_sectionname.Text == "") { errorlabelsectionname.Visible = true; } else { errorlabelsectionname.Visible = false; } if (statuscb.SelectedIndex == -1) { errolabelstatus.Visible = true; } else { errolabelstatus.Visible = false; } if (errorlabelsectionname.Visible || errolabelstatus.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { section s = new section(); s.sec_name = txt_sectionname.Text; if (statuscb.SelectedIndex == 0) { s.sec_status = 1; } else { s.sec_status = 0; } obj.insertsections(txt_sectionname.Text, s.sec_status); obj.SubmitChanges(); Mainclass.ShowMsg(txt_sectionname.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { byte stat; if (statuscb.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.UpdateSection(txt_sectionname.Text, stat, StatID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_sectionname.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
private void btnsave_Click(object sender, EventArgs e) { if (txt_class.Text == "") { errorlabelclassname.Visible = true; } else { errorlabelclassname.Visible = false; } if (selection_cb.SelectedIndex == -1) { errorlabelsecctionname.Visible = true; } { errorlabelsecctionname.Visible = false; } if (Levelcb.SelectedIndex == -1) { errorlablelevel.Visible = true; } else { errorlablelevel.Visible = false; } if (errorlabelclassname.Visible || errorlabelsecctionname.Visible || errorlablelevel.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { Class c = new Class(); c.Class_name = txt_class.Text; if (selection_cb.SelectedIndex == 0) { c.class_stat = 1; } else { c.class_stat = 0; } //obj.roles.InsertOnSubmit(r); obj.insertclass(txt_class.Text, c.class_stat, Convert.ToInt32(Levelcb.SelectedValue.ToString())); obj.SubmitChanges(); Mainclass.ShowMsg(txt_class.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { byte stat; if (selection_cb.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.updateclass(txt_class.Text, stat, Convert.ToInt32(Levelcb.SelectedValue.ToString()), ClassID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_class.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
private void Savebtn_Click(object sender, EventArgs e) { if (periodcb.SelectedIndex == -1) { errorlabelperiodname.Visible = true; } else { errorlabelperiodname.Visible = false; } if (timeshiftcb.SelectedIndex == -1) { erroelabelshift.Visible = true; } else { erroelabelshift.Visible = false; } if (Timingdaycb.SelectedIndex == -1) { errorlabeltimingday.Visible = true; } else { errorlabeltimingday.Visible = false; } if (Timinglevelcb.SelectedIndex == -1) { errorlabeltiminglevel.Visible = true; } else { errorlabeltiminglevel.Visible = false; } if (errorlabelperiodname.Visible || erroelabelshift.Visible || errorlabeltimingday.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { TimeSpan startTime = new TimeSpan(Starttimedp.Value.Hour, Starttimedp.Value.Minute, Starttimedp.Value.Second); TimeSpan EndTime = new TimeSpan(Endtimedp.Value.Hour, Endtimedp.Value.Minute, Endtimedp.Value.Second); timing t = new timing(); obj.insertTiming(Convert.ToInt32(periodcb.SelectedValue.ToString()), Convert.ToInt32(timeshiftcb.SelectedValue.ToString()), startTime, EndTime, Timingdaycb.SelectedItem.ToString(), Convert.ToInt32(Timinglevelcb.SelectedValue.ToString())); obj.SubmitChanges(); Mainclass.ShowMsg(periodcb.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else { TimeSpan startTime = new TimeSpan(Starttimedp.Value.Hour, Starttimedp.Value.Minute, Starttimedp.Value.Second); TimeSpan EndTime = new TimeSpan(Endtimedp.Value.Hour, Endtimedp.Value.Minute, Endtimedp.Value.Second); obj.updatetimings(Convert.ToInt32(periodcb.SelectedValue.ToString()), Convert.ToInt32(timeshiftcb.SelectedValue.ToString()), startTime, EndTime, Timingdaycb.SelectedItem.ToString(), Convert.ToInt32(Timinglevelcb.SelectedValue.ToString()), TimeID); obj.SubmitChanges(); Mainclass.ShowMsg(periodcb.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
private void Savebtn_Click(object sender, EventArgs e) { if (txt_house.Text == "") { errorlabelhousename.Visible = true; } else { errorlabelhousename.Visible = false; } if (Statuscb.SelectedIndex == -1) { errorlabelhousestatus.Visible = true; } else { errorlabelhousestatus.Visible = false; } if (errorlabelhousename.Visible || errorlabelhousestatus.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { Housee h = new Housee(); h.Housename = txt_house.Text; if (Statuscb.SelectedIndex == 0) { h.Housestatus = 1; } else { h.Housestatus = 0; } //obj.roles.InsertOnSubmit(r); obj.inserthouse(txt_house.Text, h.Housestatus); obj.SubmitChanges(); Mainclass.ShowMsg(txt_house.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { byte stat; if (Statuscb.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.UpdateRole(txt_house.Text, stat, HouseID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_house.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }
private void Savebtn_Click(object sender, EventArgs e) { if (Falcultycb.SelectedIndex != -1 && Falcultycb.SelectedIndex != 0) { txt_falculty.Text = Falcultycb.SelectedValue.ToString(); errorlabelFalculty.Visible = false; } else { errorlabelFalculty.Visible = true; } if (Classcb.SelectedIndex == -1) { errorlabelclass.Visible = true; } else { errorlabelclass.Visible = false; } if (comboBox2.SelectedIndex == -1) { errorlabelsubject.Visible = true; } else { errorlabelsubject.Visible = false; } if (errorlabelclass.Visible || errorlabelFalculty.Visible || errorlabelsubject.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { if (sectioncb.SelectedIndex != -1 && sectioncb.SelectedIndex != 0) { obj.insertassignment(Convert.ToInt32(Classcb.SelectedValue.ToString()), Convert.ToInt32(periodcb.SelectedValue.ToString()), Convert.ToInt32(comboBox2.SelectedValue.ToString()), Convert.ToInt32(Falcultycb.SelectedValue.ToString()), Convert.ToInt32(sectioncb.SelectedValue.ToString())); } else { obj.insertassignment(Convert.ToInt32(Classcb.SelectedValue.ToString()), Convert.ToInt32(periodcb.SelectedValue.ToString()), Convert.ToInt32(comboBox2.SelectedValue.ToString()), Convert.ToInt32(Falcultycb.SelectedValue.ToString()), null); } obj.SubmitChanges(); Mainclass.ShowMsg(Falcultycb.Text + " has been assigned to " + Classcb.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { if (sectioncb.SelectedIndex != 1 && sectioncb.SelectedIndex != 0) { obj.Updatefalculty(Convert.ToInt32(Classcb.SelectedValue.ToString()), Convert.ToInt32(periodcb.SelectedValue.ToString()), Convert.ToInt32(comboBox2.SelectedValue.ToString()), Convert.ToInt32(Falcultycb.SelectedItem.ToString()), assignmentID, Convert.ToInt32(sectioncb.SelectedValue.ToString())); } else { obj.Updatefalculty(Convert.ToInt32(Classcb.SelectedValue.ToString()), Convert.ToInt32(periodcb.SelectedValue.ToString()), Convert.ToInt32(comboBox2.SelectedValue.ToString()), Convert.ToInt32(Falcultycb.SelectedValue.ToString()), assignmentID, null); } obj.SubmitChanges(); Mainclass.ShowMsg(Falcultycb.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); } } }