private void Staf_f_Load(object sender, EventArgs e)
 {
     loadstaff();
     Mainclass.disable_reset(panel1);
     edit = 0;
     loadlist();
 }
 private void Classes_Load(object sender, EventArgs e)
 {
     edit = 0;
     Mainclass.disable_reset(panel1);
     loadData();
     loadlist();
 }
Example #3
0
 private void Assignment_Load(object sender, EventArgs e)
 {
     dataGridView.AutoGenerateColumns = false;
     edit = 0;
     Mainclass.disable_reset(panel1);
     loadlist();
 }
Example #4
0
 private void btnadd_Click(object sender, EventArgs e)
 {
     edit = 0;
     Mainclass.enable_reset(panel1);
     latefee.Enabled        = false;
     Monthlyfee_txt.Enabled = false;
     //classcb.SelectedIndex = 0;
 }
Example #5
0
        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 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();
     }
 }
Example #10
0
 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 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();
                }
            }
        }
Example #12
0
        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 searchdata()
        {
            var abc = obj.searchstaff(textBox1.Text);

            UserIDGV.DataPropertyName   = "ID";
            NameGV.DataPropertyName     = "Name";
            UsernameGV.DataPropertyName = "Username";
            PasswordGV.DataPropertyName = "Password";
            Phone1GV.DataPropertyName   = "Phone1";
            Phone2GV.DataPropertyName   = "Phone2";
            RoleGV.DataPropertyName     = "Role";
            StatusGV.DataPropertyName   = "Status";
            dataGridView1.DataSource    = abc;
            RoleIDGV.DataPropertyName   = "RoleID";
            Mainclass.sno(dataGridView1, "snogv");
        }
        private void loadstaff()
        {
            var data = obj.getstaff();

            UserIDGV.DataPropertyName   = "ID";
            NameGV.DataPropertyName     = "Name";
            UsernameGV.DataPropertyName = "Username";
            PasswordGV.DataPropertyName = "Password";
            Phone1GV.DataPropertyName   = "Phone1";
            Phone2GV.DataPropertyName   = "Phone2";
            RoleGV.DataPropertyName     = "Role";
            StatusGV.DataPropertyName   = "Status";
            dataGridView1.DataSource    = data;
            RoleIDGV.DataPropertyName   = "RoleID";
            Mainclass.sno(dataGridView1, "snogv");
        }
Example #15
0
        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");
            }
        }
Example #17
0
        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);
            }
        }
Example #18
0
        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 editbtn_Click(object sender, EventArgs e)
 {
     edit = 1;
     Mainclass.enable_reset(panel1);
 }
        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();
                }
            }
        }
Example #22
0
        private void button7_Click(object sender, EventArgs e)
        {
            Stafff hs = new Stafff();

            Mainclass.showWindow(hs, this, Mdi.ActiveForm);
        }
 private void Level_Load(object sender, EventArgs e)
 {
     Mainclass.disable_reset(panel1);
     edit = 0;
     loadData();
 }
 private void addbtn_Click(object sender, EventArgs e)
 {
     Mainclass.enable_reset(panel1);
     Image.Enabled = false;
     edit          = 0;
 }
 private void editbtn_Click(object sender, EventArgs e)
 {
     edit = 1;
     Mainclass.enable(panel1);
     Image.Enabled = false;
 }
Example #26
0
        private void button16_Click(object sender, EventArgs e)
        {
            Period hs = new Period();

            Mainclass.showWindow(hs, this, Mdi.ActiveForm);
        }
Example #27
0
        private void button17_Click(object sender, EventArgs e)
        {
            Assignment hs = new Assignment();

            Mainclass.showWindow(hs, this, Mdi.ActiveForm);
        }
        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 label3_Click(object sender, EventArgs e)
        {
            Home hs = new Home();

            Mainclass.showWindow(hs, this, Mdi.ActiveForm);
        }
        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();
                    }
                }
            }
        }