示例#1
0
 public override void deleteBtn_Click(object sender, EventArgs e)
 {
     if (edit == 1)
     {
         DialogResult dr = MessageBox.Show("Are you sure you want to delete" + levelNameTxt.Text + "?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             obj.st_deletelevel(levelID);
             MainClass.ShowMSG(levelNameTxt.Text + " deleted successfully.", "Success...", "Success");
             MainClass.disable_reset(panel6);
             loadData();
         }
     }
 }
        private void acceptBtn_Click_1(object sender, EventArgs e)
        {
            if (fieldCheck() == 1)
            {
                if (btnStatus == "add")
                {
                    Events ev = new Events();

                    if (enameTxt.Text != "")
                    {
                        String   timeString = dateTimePicker2.Text;
                        TimeSpan timeValue  = TimeSpan.Parse(timeString);
                        //DateTime date = DateTime.ParseExact(timeString, "h:mm:ss tt", CultureInfo.InvariantCulture);
                        obj.event_insert(enameTxt.Text, MainClass.getDateFromString(dateTimePicker1.Text), evenueTxt.Text, timeValue);
                        obj.SubmitChanges();
                        MainClass.showMsg(enameTxt.Text + " added successfully", "Success", "success");
                    }

                    else
                    {
                        MainClass.showMsg(enameTxt.Text + dateTimePicker1 + evenueTxt + dateTimePicker2 + "complete the all the fields", "error", "error");
                    }
                }

                else if (btnStatus == "edit")
                {
                    Events ev = new Events();

                    if (enameTxt.Text != "")

                    {
                        String   timeString = dateTimePicker2.Text;
                        TimeSpan timeValue  = TimeSpan.Parse(timeString);

                        obj.event_update(enameTxt.Text, MainClass.getDateFromString(dateTimePicker1.Text), evenueTxt.Text, timeValue, Convert.ToInt32(eIdTxt.Text));

                        MainClass.showMsg(enameTxt.Text + " updated successfully", "Success", "success");
                    }

                    else
                    {
                        MainClass.showMsg(enameTxt.Text + dateTimePicker1 + evenueTxt + dateTimePicker2 + eIdTxt + "complete the all the fields", "error", "error");
                    }
                }

                MainClass.disable_reset(panel5);
                loadEvent();
            }
        }
 public override void saveBtn_Click(object sender, EventArgs e)
 {
     if (subjectTxt.Text == "")
     {
         subjectErrorLabel.Visible = true;
     }
     else
     {
         subjectErrorLabel.Visible = false;
         if (classDD.SelectedIndex == -1)
         {
             belongsErrorLabel.Visible = true;
         }
         else
         {
             belongsErrorLabel.Visible = false;
         }
         if (subjectErrorLabel.Visible || belongsErrorLabel.Visible)
         {
             MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error");
         }
         else
         {
             if (edit == 0) // code for SAVE operation
             {
                 try
                 {
                     subject s = new subject();
                     obj.st_insertSubject(subjectTxt.Text, Convert.ToInt32(classDD.SelectedValue.ToString()));
                     obj.SubmitChanges();
                     MainClass.ShowMSG(subjectTxt.Text + " added successfully.", "Success...", "Success");
                     MainClass.disable_reset(panel6);
                     loadData();
                 }
                 catch (Exception ex)
                 {
                     MainClass.ShowMSG("Possible Errors\n\n1.Are you trying to add same subject in this class?\n2.Contact technical support assistance.", "Error", "Error");
                 }
             }
             else
             {
                 obj.st_updateSubject(subjectTxt.Text, Convert.ToInt32(classDD.SelectedValue.ToString()), subjectID);
                 MainClass.ShowMSG(subjectTxt.Text + " updated successfully.", "Success...", "Success");
                 MainClass.disable_reset(panel6);
                 loadData();
             }
         }
     }
 }
示例#4
0
        private void empAcceptBtn_Click(object sender, EventArgs e)
        {
            if (btnStatus == "add" && fieldCheck() == 1)
            {
                obj.empPayment_insert((long)Convert.ToInt32(EmpIDTxt.Text), (long)Convert.ToDouble(empAmount.Text), MainClass.getDateFromString(EmpPaidDate.Text));

                MainClass.showMsg("Added Successfully.", "Success", "success");
            }
            else if (btnStatus == "edit")
            {
                obj.empPayment_edit((long)Convert.ToDouble(empAmount.Text), MainClass.getDateFromString(EmpPaidDate.Text), emp_payID);
                MainClass.showMsg("Edit Successfull.", "Success", "success");
            }
            MainClass.disable_reset(panel5);
            loadEmpPayments();
        }
        public override void searchTxt_TextChanged(object sender, EventArgs e)
        {
            MainClass.disable_reset(panel5);
            var dataSet = obj.student_search(searchTxt.Text);

            id.DataPropertyName        = "sid";
            nicId.DataPropertyName     = "nic";
            fName.DataPropertyName     = "firstName";
            lName.DataPropertyName     = "lastName";
            birthDate.DataPropertyName = "birthdate";
            address.DataPropertyName   = "address";
            telephone.DataPropertyName = "telephone";
            gender.DataPropertyName    = "gender";
            grade.DataPropertyName     = "grade";
            cls.DataPropertyName       = "class";
            studentGridView.DataSource = dataSet;
        }
示例#6
0
 public override void txtSearch_TextChanged(object sender, EventArgs e)
 {
     try
     {
         MainClass.disable_reset(panel6);
         var dataSet = obj.libraryBookSearch(txtSearch.Text);
         BookIDGV.DataPropertyName   = "book_ID";
         BookNameGV.DataPropertyName = "name";
         AuthorGV.DataPropertyName   = "author";
         DateGV.DataPropertyName     = "addDate";
         BookGridView.DataSource     = dataSet;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
 public override void txtSearch_TextChanged(object sender, EventArgs e)
 {
     try
     {
         MainClass.disable_reset(panel6);
         var dataSet = obj.libraryOverdueSearch(txtSearch.Text);
         overDueIDGV.DataPropertyName = "overdue_ID";
         memberIDGV.DataPropertyName = "member_ID";
         dueDateGV.DataPropertyName = "dueDate";
         noOfDueDaysGV.DataPropertyName = "noOfDueDays";
         totalAmountGV.DataPropertyName = "totalAmount";
         overdueGridView.DataSource = dataSet;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
示例#8
0
        public override void deleteBtn_Click(object sender, EventArgs e)
        {
            operation.Text = "View";
            btnStatus      = "view";

            DialogResult dr = MessageBox.Show("Are you sure want to delete ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                obj.empPayment_delete(emp_payID);
                MainClass.showMsg(emp_payID + " Deleted successfully", "Success", "success");
                MainClass.disable_reset(panel5);
                loadEmpPayments();
            }
            else
            {
            }
        }
        public void loadStudents()
        {
            MainClass.disable_reset(panel5);
            studentImage.Image = Properties.Resources.user1;
            var dataSet = obj.student_getStudent();

            id.DataPropertyName        = "sid";
            nicId.DataPropertyName     = "nic";
            fName.DataPropertyName     = "firstName";
            lName.DataPropertyName     = "lastName";
            birthDate.DataPropertyName = "birthdate";
            address.DataPropertyName   = "address";
            telephone.DataPropertyName = "telephone";
            gender.DataPropertyName    = "gender";
            grade.DataPropertyName     = "grade";
            cls.DataPropertyName       = "class";
            studentGridView.DataSource = dataSet;
        }
 public override void txtSearch_TextChanged(object sender, EventArgs e)
 {
     try
     {
         MainClass.disable_reset(panel6);
         var dataSet = obj.libraryReserveSearch(txtSearch.Text);
         reserveIDGV.DataPropertyName   = "reserve_ID";
         bookIDGV.DataPropertyName      = "book_ID";
         bookNameGV.DataPropertyName    = "bookName";
         memberIDGV.DataPropertyName    = "member_ID";
         reserveDateGV.DataPropertyName = "reserveDate";
         dueDateGV.DataPropertyName     = "dueDate";
         ReserveGridView.DataSource     = dataSet;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
        public override void btnDelete_Click(object sender, EventArgs e)
        {
            if (txtReserveID.Text != "")
            {
                DialogResult dr = MessageBox.Show("Do you want to delete Reservation" + txtReserveID.Text + " Details ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            string q = "DELETE libraryReserveBooks  where reserve_ID ='" + txtReserveID.Text + "' ";
                            Console.Write(q);
                            SqlCommand cmd = new SqlCommand(q, con);
                            cmd.ExecuteNonQuery();
                            MainClass.showMsgLibrary("Successfully Deleted!", "Success", "Success");

                            SqlCommand cmd2 = con.CreateCommand();
                            cmd2.CommandType = CommandType.Text;
                            cmd2.CommandText = "UPDATE libraryBooks set quantity= quantity+1 where name='" + txtBookName.Text + "'";
                            cmd2.ExecuteNonQuery();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error");
                    }
                }
                else
                {
                }
            }
            else
            {
                MainClass.showMsg("Select a record that you want to delete!", "error", "error");
            }
            con.Close();
            showReserveDetails();
            lblMain.Text = "View";
            MainClass.disable_reset(panel6);
        }
示例#12
0
 public override void deleteBtn_Click(object sender, EventArgs e)
 {
     if (userNameTxt.Text != "")
     {
         operationTxt.Text = "View";
         DialogResult dr = MessageBox.Show("Are you sure want to delete " + userNameTxt.Text + "?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             obj.users_deleteUser(userID);
             MainClass.showMsg(userNameTxt.Text + " deleted successfully", "Success", "success");
             MainClass.disable_reset(panel5);
             loadUsers();
         }
         else
         {
         }
     }
     else
     {
         MainClass.showMsg("Select a row first", "Error", "Error");
     }
 }
示例#13
0
 public override void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtMemberID.Text != "")
     {
         DialogResult dr = MessageBox.Show("Do you want to delete " + txtFName.Text + "'s Details ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             con.Open();
             if (con.State == System.Data.ConnectionState.Open)
             {
                 try
                 {
                     string q = "DELETE libraryMember  where member_ID ='" + txtMemberID.Text + "' ";
                     Console.Write(q);
                     SqlCommand cmd = new SqlCommand(q, con);
                     cmd.ExecuteNonQuery();
                     MainClass.showMsgLibrary("Successfully Deleted!", "Success", "Success");
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message, "Error");
                 }
             }
             else
             {
             }
         }
     }
     else
     {
         MainClass.showMsg("Select a record that you want to delete!", "error", "error");
     }
     con.Close();
     MainClass.disable_reset(panel6);
     showMemberDetails();
     lblMain.Text = "View";
 }
        public override void deleteBtn_Click(object sender, EventArgs e)
        {
            if (eid > 0)
            {
                btnStatus = "view";


                DialogResult dr = MessageBox.Show("Do you want to delete " + enameTxt.Text + "?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    obj.event_delete(eid);
                    MainClass.showMsg(enameTxt.Text + "Deleted Successfully", "Success", "success");
                    MainClass.disable_reset(panel5);
                    loadEvent();
                }
                else
                {
                }
            }
            else
            {
                MainClass.showMsg("Select a record first ", "error", "error");
            }
        }
        public override void deleteBtn_Click(object sender, EventArgs e)
        {
            if (firstName_txt.Text != "")
            {
                operation.Text = "View";
                btnStatus      = "view";

                DialogResult dr = MessageBox.Show("Are you sure want to delete " + firstName_txt.Text + "?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    obj.student_delete(sid);
                    MainClass.showMsg(firstName_txt.Text + " deleted successfully", "Success", "success");
                    MainClass.disable_reset(panel5);
                    loadStudents();
                }
                else
                {
                }
            }
            else
            {
                MainClass.showMsg("Select a record first", "error", "error");
            }
        }
示例#16
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (levelNameTxt.Text == "")
            {
                levelErrorLabel.Visible = true;
            }
            else
            {
                levelErrorLabel.Visible = false;
            }
            if (levelErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error");
            }
            else
            {
                if (edit == 0) // code for SAVE operation
                {
                    levels c = new levels();

                    obj.st_insertlevel(levelNameTxt.Text);
                    obj.SubmitChanges();
                    MainClass.ShowMSG(levelNameTxt.Text + " added successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
                else if (edit == 1) // code for UPDATE
                {
                    obj.st_updatelevel(levelID, levelNameTxt.Text);

                    MainClass.ShowMSG(levelNameTxt.Text + " updated successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
            }
        }
        private void btnCalculateAndSubmit_Click(object sender, EventArgs e)
        {
            if (btnStatus == "add")
            {
                try
                {
                    int days, amount, total;

                    days = Convert.ToInt32(txtDueDays.Text);
                    amount = Convert.ToInt32(txtPerDayAmount.Text);

                    total = days * amount;
                    totalAmount.Text = total.ToString();
                }
                catch
                {
                    
                }
                if (OverDueIDNull.Visible || MemberIDNull.Visible || DueDateNull.Visible || DueDaysNull.Visible || PerDayAmountNull.Visible)
                {
                    MainClass.showMsgLibrary("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            string q = "INSERT INTO libraryOverDue (overdue_ID, member_ID, dueDate, noOfDueDays, totalAmount) VALUES ('" + txtOverDueID.Text + "','" + txtMemberID.Text + "','" + DueDate.Text + "','" + txtDueDays.Text + "','" + totalAmount.Text + "')";
                            Console.Write(q);
                            SqlCommand cmd = new SqlCommand(q, con);
                            cmd.ExecuteNonQuery();
                            MainClass.showMsg(" Payment added Successfully!", "Success", "success");
                        }
                    }
                    catch
                    {
                        int overdue_ID = 0;
                        int member_ID = 0;

                        try
                        {
                            overdue_ID = int.Parse(txtOverDueID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Overdue ID should be a numerical value!", "Warning", "Error");
                        }
                        try
                        {
                            member_ID = int.Parse(txtMemberID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Member ID should be a numerical value!", "Warning", "Error");
                        }
                    }
                }
                con.Close();
                lblMain.Text = "View";
                showOverduePaymentsDetails();                
                MainClass.disable_reset(panel6);
            }
              else if (btnStatus == "update")
              {
                try
                {
                    int days, amount, total;

                    days = Convert.ToInt32(txtDueDays.Text);
                    amount = Convert.ToInt32(txtPerDayAmount.Text);

                    total = days * amount;
                    totalAmount.Text = total.ToString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
                if (OverDueIDNull.Visible || MemberIDNull.Visible || DueDateNull.Visible || DueDaysNull.Visible || PerDayAmountNull.Visible)
                {
                    MainClass.showMsgLibrary("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            string q = "UPDATE libraryOverDue SET overdue_ID ='" + txtOverDueID.Text + "' ,member_ID='" + txtMemberID.Text + "',dueDate='" + DueDate.Text + "',noOfDueDays='" + txtDueDays.Text + "',totalAmount='" + totalAmount.Text + "' where overdue_ID ='" + txtOverDueID.Text + "' ";
                            Console.Write(q);
                            SqlCommand cmd = new SqlCommand(q, con);
                            cmd.ExecuteNonQuery();
                            MainClass.showMsg("Details Updated Successfully", "Success", "success");
                        }
                    }
                    catch
                    {

                    }     
                }
                con.Close();
                lblMain.Text = "View";
                showOverduePaymentsDetails();
                MainClass.disable_reset(panel6);              
            }
           }
        private void btnReserve_Click(object sender, EventArgs e)
        {
            if (btnStatus == "add")
            {
                if (ReserveIDNull.Visible || BookIDNull.Visible || BookNameNull.Visible || MemberIDNull.Visible)
                {
                    MainClass.showMsgLibrary("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            int        bookQty = 0;
                            SqlCommand cmd3    = con.CreateCommand();
                            cmd3.CommandType = CommandType.Text;
                            cmd3.CommandText = "SELECT * FROM libraryBooks WHERE name='" + txtBookName.Text + "'";
                            cmd3.ExecuteNonQuery();
                            DataTable      dt2 = new DataTable();
                            SqlDataAdapter da2 = new SqlDataAdapter(cmd3);
                            da2.Fill(dt2);
                            foreach (DataRow dr2 in dt2.Rows)
                            {
                                bookQty = int.Parse(dr2["quantity"].ToString());
                            }

                            if (bookQty > 0)
                            {
                                SqlCommand cmd = con.CreateCommand();
                                cmd.CommandType = CommandType.Text;
                                cmd.CommandText = "INSERT INTO libraryReserveBooks (reserve_ID, book_ID, bookName, member_ID, reserveDate, dueDate)  VALUES ('" + txtReserveID.Text + "', '" + txtBookID.Text + "', '" + txtBookName.Text + "', '" + txtMemberID.Text + "', '" + ReserveDate.Text + "', '" + DueDate.Text + "')";
                                cmd.ExecuteNonQuery();
                                MainClass.showMsgLibrary("Successfull Reserved!", "Success", "Success");

                                SqlCommand cmd2 = con.CreateCommand();
                                cmd2.CommandType = CommandType.Text;
                                cmd2.CommandText = "UPDATE libraryBooks set quantity= quantity-1 where name='" + txtBookName.Text + "'";
                                cmd2.ExecuteNonQuery();
                            }
                            else
                            {
                                MainClass.showMsgLibrary("Book has already reserved!", "Warning", "Error");
                            }
                        }
                    }
                    catch
                    {
                        int reserveID = 0;
                        int bookID    = 0;
                        int memberID  = 0;

                        try
                        {
                            reserveID = int.Parse(txtReserveID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Reserve ID should be a numerical value!", "Warning", "Error");
                        }

                        try
                        {
                            bookID = int.Parse(txtBookID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Book ID should be a numerical value!", "Warning", "Error");
                        }
                        try
                        {
                            memberID = int.Parse(txtMemberID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Member ID should be a numerical value!", "Warning", "Error");
                        }
                    }

                    con.Close();
                    showReserveDetails();
                    lblMain.Text = "View";
                    MainClass.disable_reset(panel6);
                }
            }
            else if (btnStatus == "update")
            {
                if (ReserveIDNull.Visible || BookIDNull.Visible || MemberIDNull.Visible)
                {
                    MainClass.showMsgLibrary("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            int        bookQty = 0;
                            SqlCommand cmd3    = con.CreateCommand();
                            cmd3.CommandType = CommandType.Text;
                            cmd3.CommandText = "SELECT * FROM libraryBooks WHERE name='" + txtBookName.Text + "'";
                            cmd3.ExecuteNonQuery();
                            DataTable      dt2 = new DataTable();
                            SqlDataAdapter da2 = new SqlDataAdapter(cmd3);
                            da2.Fill(dt2);
                            foreach (DataRow dr2 in dt2.Rows)
                            {
                                bookQty = int.Parse(dr2["quantity"].ToString());
                            }

                            if (bookQty > 0)
                            {
                                string q = "UPDATE libraryReserveBooks SET reserve_ID ='" + txtReserveID.Text + "' ,book_ID='" + txtBookID.Text + "',bookName='" + txtBookName.Text + "', member_ID='" + txtMemberID.Text + "',reserveDate='" + ReserveDate.Text + "',dueDate='" + DueDate.Text + "' where reserve_ID ='" + txtReserveID.Text + "' ";
                                Console.Write(q);
                                SqlCommand cmd = new SqlCommand(q, con);
                                cmd.ExecuteNonQuery();
                                MainClass.showMsgLibrary("Successfull Updated!", "Success", "Success");

                                SqlCommand cmd2 = con.CreateCommand();
                                cmd2.CommandType = CommandType.Text;
                                cmd2.CommandText = "UPDATE libraryBooks set quantity= quantity-1 where name='" + txtBookName.Text + "'";
                                cmd2.ExecuteNonQuery();
                            }
                            else
                            {
                                MainClass.showMsgLibrary("all books has reserved!", "Warning", "Error");
                            }
                        }
                    }
                    catch
                    {
                        int bookID   = 0;
                        int memberID = 0;

                        try
                        {
                            bookID = int.Parse(txtBookID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Book ID should be a numerical value!", "Warning", "Error");
                        }
                        try
                        {
                            memberID = int.Parse(txtMemberID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Member ID should be a numerical value!", "Warning", "Error");
                        }
                    }
                }
            }
            con.Close();
            showReserveDetails();
            lblMain.Text = "View";
            MainClass.disable_reset(panel6);
        }
 private void reserveBooks_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(panel6);
     showReserveDetails();
 }
示例#20
0
        private void btnAddMembers_Click(object sender, EventArgs e)
        {
            if (btnStatus == "add")
            {
                if (MemberIDNull.Visible || FNameNull.Visible || LNameNull.Visible || AddressNull.Visible || ContactNull.Visible)
                {
                    MainClass.showMsgLibrary("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            string q = "INSERT INTO libraryMember (member_ID, FirstName, LastName, address, contactNo, addDate) VALUES ('" + txtMemberID.Text + "','" + txtFName.Text + "','" + txtLName.Text + "','" + txtAddress.Text + "','" + txtContact.Text + "','" + AddDate.Text + "')";
                            Console.Write(q);
                            SqlCommand cmd = new SqlCommand(q, con);
                            cmd.ExecuteNonQuery();
                            MainClass.showMsg(txtFName.Text + " 's Details Added Successfully", "Success", "success");
                        }
                    }
                    catch
                    {
                        int member_ID = 0;
                        int contactNo = 0;

                        try
                        {
                            member_ID = int.Parse(txtMemberID.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Member ID should be a numerical Value!", "Warning", "Error");
                        }
                        try
                        {
                            contactNo = int.Parse(txtContact.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Contact no should be an integer!", "Warning", "Error");
                        }
                    }
                }
                con.Close();
                lblMain.Text = "View";
            }

            else if (btnStatus == "update")
            {
                if (MemberIDNull.Visible || FNameNull.Visible || LNameNull.Visible || AddressNull.Visible || ContactNull.Visible)
                {
                    MainClass.showMsgLibrary("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            string q = "UPDATE libraryMember SET member_ID ='" + txtMemberID.Text + "' ,FirstName='" + txtFName.Text + "',LastName='" + txtLName.Text + "',address='" + txtAddress.Text + "',contactNo='" + txtContact.Text + "',addDate='" + AddDate.Text + "' where member_ID ='" + txtMemberID.Text + "' ";
                            Console.Write(q);
                            SqlCommand cmd = new SqlCommand(q, con);
                            cmd.ExecuteNonQuery();
                            MainClass.showMsg(txtFName.Text + " 's Details Updated Successfully", "Success", "success");
                        }
                    }
                    catch
                    {
                        int contactNo = 0;

                        try
                        {
                            contactNo = int.Parse(txtContact.Text);
                        }
                        catch
                        {
                            MainClass.showMsgLibrary("Contact no should be a numerical!", "Warning", "Error");
                        }
                    }
                }
            }
            con.Close();
            showMemberDetails();
            MainClass.disable_reset(panel6);
            lblMain.Text = "View";
        }
        private void acceptBtn_Click(object sender, EventArgs e)
        {
            if (fieldCheck() == 1)
            {
                if (btnStatus == "add")
                {
                    imageExist = false;
                    student s = new student();
                    byte    gender;


                    if (genderDropDown.SelectedIndex == 0)
                    {
                        gender = 1;
                    }
                    else
                    {
                        gender = 0;
                    }

                    if (imageExist == false)
                    {
                        obj.student_insert_withoutImage(NIC_txt.Text, firstName_txt.Text, lastName_txt.Text, telephone_txt.Text, birthDay_txt.Value, address_txt.Text, gender, gradeDropDown.SelectedIndex + 1, classDropDown.SelectedIndex + 1);
                        MainClass.showMsg(firstName_txt.Text + " added Successfully", "Success", "success");
                    }
                    else
                    {
                        MemoryStream ms = new MemoryStream();
                        i.Save(ms, ImageFormat.Jpeg);
                        arr = ms.ToArray();
                        obj.student_insert(NIC_txt.Text, firstName_txt.Text, lastName_txt.Text, telephone_txt.Text, birthDay_txt.Value, address_txt.Text, gender, gradeDropDown.SelectedIndex + 1, classDropDown.SelectedIndex + 1, arr);
                        MainClass.showMsg(firstName_txt.Text + " added Successfully", "Success", "success");
                    }
                }
                else if (btnStatus == "edit")
                {
                    student s = new student();
                    byte    gender;

                    if (genderDropDown.SelectedIndex == 0)
                    {
                        gender = 1;
                    }
                    else
                    {
                        gender = 0;
                    }

                    if (imageExist == false)
                    {
                        obj.student_update_withoutImage(NIC_txt.Text, firstName_txt.Text, lastName_txt.Text, telephone_txt.Text, birthDay_txt.Value, address_txt.Text, gender, gradeDropDown.SelectedIndex + 1, classDropDown.SelectedIndex + 1, sid);
                    }
                    else
                    {
                        MemoryStream ms = new MemoryStream();
                        i.Save(ms, ImageFormat.Jpeg);
                        byte[] arr = ms.ToArray();
                        obj.student_update(NIC_txt.Text, firstName_txt.Text, lastName_txt.Text, telephone_txt.Text, birthDay_txt.Value, address_txt.Text, gender, arr, gradeDropDown.SelectedIndex + 1, classDropDown.SelectedIndex + 1, sid);
                    }

                    MainClass.showMsg(firstName_txt.Text + " updated Successfully", "Success", "success");
                }
                MainClass.disable_reset(panel5);
                loadStudents();
                loadAStudent(sid);
            }
        }
示例#22
0
 private void Classes_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(panel6);
     loadList();
 }
示例#23
0
 private void addMembers_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(panel6);
     showMemberDetails();
 }
示例#24
0
 private void Roles_Load(object sender, EventArgs e)
 {
     loadRoles();
     MainClass.disable_reset(panel5);
     adSearch.Visible = false;
 }
示例#25
0
        private void acceptBtn_Click(object sender, EventArgs e)
        {
            if (roleTxt.Text == "")
            {
                rolesErrorLabel.Visible = true;
            }
            else
            {
                rolesErrorLabel.Visible = false;
            }

            if (statusTxt.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (rolesErrorLabel.Visible)
            {
                MainClass.showMsg("Roles field is empty", "error", "error");
            }
            else if (statusErrorLabel.Visible)
            {
                MainClass.showMsg("Status field is empty", "error", "error");
            }

            if (btnStatus == "add")
            {
                role r = new role();
                r.roleName = roleTxt.Text;
                if (statusTxt.SelectedIndex == 0)
                {
                    r.status = 1;
                }
                else
                {
                    r.status = 0;
                }
                if (statusTxt.SelectedIndex >= 0)
                {
                    obj.roles_insert(roleTxt.Text, r.status);
                    obj.SubmitChanges();
                    MainClass.showMsg(roleTxt.Text + " added successfully.", "Success", "success");
                    MainClass.disable_reset(panel5);
                    loadRoles();
                }
                else
                {
                }
            }
            else if (btnStatus == "edit")
            {
                byte stat;
                if (statusTxt.SelectedIndex == 0)
                {
                    stat = 1;
                }
                else
                {
                    stat = 0;
                }

                obj.roles_update(roleTxt.Text, stat, roleId);
                obj.SubmitChanges();
                MainClass.showMsg(roleTxt.Text + " updated successfully", "Success", "success");
                MainClass.disable_reset(panel5);
                loadRoles();
            }
        }
示例#26
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (sectionTxt.Text == "")
            {
                sectionErrorLabel.Visible = true;
            }
            else
            {
                sectionErrorLabel.Visible = false;
            }
            if (statusDD.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }
            if (sectionErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error");
            }
            else
            {
                if (edit == 0) // code for SAVe
                {
                    section s = new section();

                    if (statusDD.SelectedIndex == 0)
                    {
                        s.sec_status = 1;
                    }
                    else
                    {
                        s.sec_status = 0;
                    }

                    obj.st_insertSections(sectionTxt.Text, s.sec_status);
                    obj.SubmitChanges();
                    MainClass.ShowMSG(sectionTxt.Text + " added successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
                else // code for update
                {
                    byte stat;
                    if (statusDD.SelectedIndex == 0)
                    {
                        stat = 1;
                    }
                    else
                    {
                        stat = 0;
                    }
                    obj.st_updateSections(sectionTxt.Text, stat, sectionID);

                    MainClass.ShowMSG(sectionTxt.Text + " updated successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
            }
        }
示例#27
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (classnameTxt.Text == "")
            {
                classNameErrorLabel.Visible = true;
            }
            else
            {
                classNameErrorLabel.Visible = false;
            }
            if (statusDD.SelectedIndex == -1)
            {
                levlErrorLabel.Visible = true;
            }
            else
            {
                levlErrorLabel.Visible = false;
            }
            if (levelDD.SelectedIndex == -1)
            {
                levlErrorLabel.Visible = true;
            }
            else
            {
                levlErrorLabel.Visible = false;
            }
            if (classNameErrorLabel.Visible || levlErrorLabel.Visible || levlErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error");
            }
            else
            {
                if (edit == 0) // code for SAVE operation
                {
                    clase c = new clase();
                    // c.cls_name = classnameTxt.Text;


                    if (statusDD.SelectedIndex == 0)
                    {
                        c.cls_status = 1;
                    }
                    else
                    {
                        c.cls_status = 0;
                    }

                    //obj.roles.InsertOnSubmit(r);
                    obj.st_insertClass(classnameTxt.Text, c.cls_status);
                    //obj.SubmitChanges();
                    MainClass.ShowMSG(classnameTxt.Text + " added successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
                else if (edit == 1) // code for UPDATE
                {
                    byte stat;
                    if (statusDD.SelectedIndex == 0)
                    {
                        stat = 1;
                    }
                    else
                    {
                        stat = 0;
                    }
                    obj.st_updateClass(classnameTxt.Text, stat, classID);

                    MainClass.ShowMSG(classnameTxt.Text + " updated successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
            }
        }
 private void overDuePayments_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(panel6);
     showOverduePaymentsDetails();
 }
示例#29
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (shiftNameTxt.Text == "")
            {
                shiftErrorLabel.Visible = true;
            }
            else
            {
                shiftErrorLabel.Visible = false;
            }

            if (shiftDD.SelectedIndex == -1)
            {
                shiftDDerrorLabel.Visible = true;
            }
            else
            {
                shiftDDerrorLabel.Visible = false;
            }

            if (shiftDDerrorLabel.Visible || shiftDDerrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error");
            }
            else
            {
                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);
                //startTime.ToString();
                //endTime.ToString();
                //TimeSpan st = Convert.ToInt16(startPicker.Value.Hour.ToString());
                //TimeSpan et = endPicker.Value.TimeOfDay;

                //TimeSpan st = this.startPicker.Value.TimeOfDay;
                //TimeSpan et = this.endPicker.Value.TimeOfDay;

                //int st = Convert.ToInt16(startPicker.Value.ToString());
                //int et = Convert.ToInt16(endPicker.Value.ToString());

                //DateTime start = DateTime.Parse(startPicker.Text).Date;
                //DateTime end = DateTime.Parse(endPicker.Text).Date;

                //DateTime dt = startPicker.Value;
                //TimeSpan st = new TimeSpan(dt.Hour, dt.Minute, dt.Second);
                //DateTime en = endPicker.Value;
                //TimeSpan et = new TimeSpan(en.Hour, en.Minute, en.Second);

                //TimeSpan st = dt.TimeOfDay;

                //int t = Convert.ToInt16(startPicker.Value.Hour.ToString());
                //int y = Convert.ToInt16(endPicker.Value.Hour.ToString());

                //TimeSpan ts1 = TimeSpan.Parse(startPicker.Text);
                //TimeSpan ts2 = TimeSpan.Parse(endPicker.Text);


                //TimeSpan ts = startPicker.Value.TimeOfDay;
                //TimeSpan es = endPicker.Value.TimeOfDay;



                if (edit == 0) // code for SAVE operation
                {
                    try
                    {
                        shift s = new shift();


                        obj.st_insertShifts(shiftNameTxt.Text, Convert.ToByte(shiftDD.SelectedItem.ToString()), startTime, endTime);
                        obj.SubmitChanges();
                        MainClass.ShowMSG(shiftNameTxt.Text + " added successfully.", "Success...", "Success");
                        MainClass.disable_reset(panel6);
                        loadData();
                    }
                    catch (Exception ex)
                    {
                        MainClass.ShowMSG(ex.Message, "Error", "Error");
                    }
                }
                else
                {
                    obj.st_updateShifts(shiftNameTxt.Text, Convert.ToByte(shiftDD.SelectedItem.ToString()), startTime, endTime, shiftID);
                    MainClass.ShowMSG(shiftNameTxt.Text + " updated successfully.", "Success...", "Success");
                    MainClass.disable_reset(panel6);
                    loadData();
                }
            }
        }
示例#30
0
        public override void saveBtn_Click(object sender, EventArgs e)
        {
            if (nameTxt.Text == "")
            {
                nameErrorLabel.Visible = true;
            }
            else
            {
                nameErrorLabel.Visible = false;
            }
            if (usernameTxt.Text == "")
            {
                usernameErrorLabel.Visible = true;
            }
            else
            {
                usernameErrorLabel.Visible = false;
            }
            if (passwordTxt.Text == "")
            {
                passwordErrorLabel.Visible = true;
            }
            else
            {
                passwordErrorLabel.Visible = false;
            }
            if (confirmPassTxt.Text == "")
            {
                confirmPassErrorLabel.Visible = true;
            }
            else
            {
                confirmPassErrorLabel.Visible = false;
            }
            if (passwordTxt.Text != confirmPassTxt.Text)
            {
                mismatchedErrorLabel.Visible = true;
            }
            else
            {
                mismatchedErrorLabel.Visible = false;
            }
            if (phone1Txt.Text == "")
            {
                phone1ErrorLabel.Visible = true;
            }
            else
            {
                phone1ErrorLabel.Visible = false;
            }
            if (roleDD.SelectedIndex == -1)
            {
                roleErrorLabel.Visible = true;
            }
            else
            {
                roleErrorLabel.Visible = false;
            }
            if (statusDD.SelectedIndex == -1)
            {
                statusErrorLabel.Visible = true;
            }
            else
            {
                statusErrorLabel.Visible = false;
            }

            if (nameErrorLabel.Visible || usernameErrorLabel.Visible || passwordErrorLabel.Visible || confirmPassErrorLabel.Visible || mismatchedErrorLabel.Visible || phone1ErrorLabel.Visible || roleErrorLabel.Visible || statusErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are mandatory.", "Stop...", "Error");
            }
            else
            {
                if (edit == 0) // code for SAVE operation
                {
                    if (imagePathTxt.Text == "")
                    {
                        byte stat = statusDD.SelectedIndex == 0? Convert.ToByte(1) : Convert.ToByte(0);
                        obj.st_insertStaffWithoutImage(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat);
                        MainClass.ShowMSG(nameTxt.Text + " added successfully into the system.", "Success", "Success");
                        MainClass.disable_reset(panel6);
                        loadData();
                    }
                    else
                    {
                        byte         stat = statusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0);
                        MemoryStream ms   = new MemoryStream();
                        i.Save(ms, ImageFormat.Jpeg);
                        byte[] arr = ms.ToArray();
                        obj.st_insertStaff(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, arr);
                        MainClass.ShowMSG(nameTxt.Text + " added successfully into the system.", "Success", "Success");
                        MainClass.disable_reset(panel6);
                        loadData();
                    }
                }
                else if (edit == 1) // code for UPDATE operation
                {
                    byte stat = statusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0);
                    if (i == null)
                    {
                        obj.st_updateStaffWithoutImage(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, staffID);
                        MainClass.ShowMSG(nameTxt.Text + " data updated successfully into the system.", "Success", "Success");
                        MainClass.disable_reset(panel6);
                        loadData();
                    }
                    else
                    {
                        MemoryStream ms = new MemoryStream();
                        i.Save(ms, ImageFormat.Jpeg);
                        byte[] arr = ms.ToArray();
                        obj.st_updateStaff(nameTxt.Text, usernameTxt.Text, passwordTxt.Text, phone1Txt.Text, phone2Txt.Text, Convert.ToInt32(roleDD.SelectedValue.ToString()), stat, arr, staffID);
                        MainClass.ShowMSG(nameTxt.Text + " data updated successfully into the system.", "Success", "Success");
                        MainClass.disable_reset(panel6);
                        loadData();
                    }
                }
            }
        }