Exemple #1
0
 private void userAddBtn_Click(object sender, EventArgs e)
 {
     if (uName.Text == "")
     {
         MainClass.showMsg("Username cannot be empty!", "Error", "error");
     }
     else if (roleIdDropDown.SelectedIndex == -1)
     {
         MainClass.showMsg("Role name cannot be empty!", "Error", "error");
     }
     else if (userPass.Text == "")
     {
         MainClass.showMsg("Password cannot be empty!", "Error", "error");
     }
     else if (userConPass.Text == "")
     {
         MainClass.showMsg("Confirm the password!", "Error", "error");
     }
     else if (userConPass.Text != userPass.Text)
     {
         MainClass.showMsg("Passwords doesn't match!", "Error", "error");
     }
     else
     {
         obj.users_insert(uName.Text, userPass.Text, roleIdDropDown.SelectedIndex + 1);
         obj.SubmitChanges();
         MainClass.showMsg(uName.Text + " added successfully.", "Success", "success");
         MainClass.disable_reset(panel5);
         loadUsers();
     }
 }
 public override void btnDelete_Click(object sender, EventArgs e)
 {
     if (txtOverDueID.Text != "")
     {
         DialogResult dr = MessageBox.Show("Do you want to delete " + "'s Details ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             con.Open();
             if (con.State == System.Data.ConnectionState.Open)
             {
                 string q = "DELETE libraryOverDue  where overdue_ID ='" + txtOverDueID.Text + "' ";
                 Console.Write(q);
                 SqlCommand cmd = new SqlCommand(q, con);
                 cmd.ExecuteNonQuery();
                 MainClass.showMsgLibrary("Successfully Deleted!", "Success", "Success");
             }
         }
         else { }
     }
     else
     {
         MainClass.showMsg("Select a record that you want to delete!", "error", "error");
     }
     con.Close();
     showOverduePaymentsDetails();
     MainClass.disable_reset(panel6);
     lblMain.Text = "View";
 }
        public int fieldCheck()
        {
            int status = 0;

            if (firstName_txt.Text == "")
            {
                MainClass.showMsg("First Name value cannot be empty", "Stop", "error");
            }
            else if (lastName_txt.Text == "")
            {
                MainClass.showMsg("Last Name value cannot be empty", "Stop", "error");
            }
            else if (birthDay_txt.Text == "")
            {
                MainClass.showMsg("Birthday value cannot be empty", "Stop", "error");
            }
            else if (telephone_txt.Text == "")
            {
                MainClass.showMsg("Telephone value cannot be empty", "Stop", "error");
            }
            else if (address_txt.Text == "")
            {
                MainClass.showMsg("Address value cannot be empty", "Stop", "error");
            }
            else if (genderDropDown.SelectedIndex < 0)
            {
                MainClass.showMsg("Gender value cannot be empty", "Stop", "error");
            }
            else
            {
                status = 1;
            }
            return(status);
        }
Exemple #4
0
        public Boolean changeUserPassword()
        {
            if (currentPassword.Text == "")
            {
                MainClass.showMsg("Enter the current password!", "Error", "Error");
            }
            else if (newPassword.Text == "")
            {
                MainClass.showMsg("Enter the new password!", "Error", "Error");
            }
            else if (confirmNewPassword.Text == "")
            {
                MainClass.showMsg("Confirm the new password!", "Error", "Error");
            }
            else if (newPassword.Text != confirmNewPassword.Text)
            {
                MainClass.showMsg("Passwords doesn't match!", "Error", "Error");
            }
            else
            {
                var change = obj.users_changePassword(userID, currentPassword.Text, newPassword.Text);
                obj.SubmitChanges();

                foreach (var item in change)
                {
                    if (item.changedId == userID)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
 private void loginBtn_Click(object sender, EventArgs e)
 {
     if (main.setLogin(userName.Text, password.Text))
     {
         status = true;
         this.Close();
     }
     else
     {
         MainClass.showMsg("Login details invalid", "Error", "Error");
     }
 }
        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();
            }
        }
Exemple #7
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();
        }
Exemple #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 int fieldCheck()
        {
            int status = 0;

            if (enameTxt.Text == "")
            {
                MainClass.showMsg("Event name cannot be empty", "Stop", "error");
            }
            else if (evenueTxt.Text == "")
            {
                MainClass.showMsg("Venue cannot be empty", "Stop", "error");
            }
            else
            {
                status = 1;
            }
            return(status);
        }
Exemple #10
0
 private void changePassPanelV_Click(object sender, EventArgs e)
 {
     if (userID != 0)
     {
         if (passwordChangePanel.Visible == false)
         {
             passwordChangePanel.Visible = true;
         }
         else
         {
             passwordChangePanel.Visible = false;
         }
     }
     else
     {
         MainClass.showMsg("Select a record first!", "Error", "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);
        }
Exemple #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");
     }
 }
        public int fieldCheck()
        {
            int status = 0;

            if (StdIDTxt.Text == "")
            {
                MainClass.showMsg("Student ID value cannot be empty", "Stop", "error");
            }
            else if (stdAmount.Text == "")
            {
                MainClass.showMsg("Amount value cannot be empty", "Stop", "error");
            }
            else if (payDate.Text == "")
            {
                MainClass.showMsg("Date value cannot be empty", "Stop", "error");
            }
            else
            {
                status = 1;
            }
            return(status);
        }
Exemple #14
0
        public int fieldCheck()
        {
            int status = 0;

            if (EmpIDTxt.Text == "")
            {
                MainClass.showMsg("Employee ID value cannot be empty", "Stop", "error");
            }
            else if (empAmount.Text == "")
            {
                MainClass.showMsg("Salary cannot be empty", "Stop", "error");
            }
            else if (EmpPaidDate.Text == "")
            {
                MainClass.showMsg("Date value cannot be empty", "Stop", "error");
            }
            else
            {
                status = 1;
            }
            return(status);
        }
Exemple #15
0
 private void changePasswordBtn_Click(object sender, EventArgs e)
 {
     if (changeUserPassword())
     {
         if (userID == 1)
         {
             MainClass.showMsg("Password Changed Successfully, Logging out for changes!", "Success", "success");
             MainClass.appStatus = "";
             MainClass.immediateLogoutOn();
             MainClass.closeMDI();
         }
         else
         {
             MainClass.showMsg("Password Changed Successfully!", "Success", "success");
             MainClass.enable_reset(passwordChangePanel);
         }
     }
     else
     {
         MainClass.showMsg("Current Password doesn't match!", "Error", "Error");
     }
 }
 public override void editBtn_Click(object sender, EventArgs e)
 {
     if (btnStatus == "edit")
     {
         btnStatus      = "view";
         operation.Text = "View Student";
         MainClass.disable(panel5);
     }
     else
     {
         if (firstName_txt.Text != "")
         {
             btnStatus      = "edit";
             operation.Text = "Edit Student";
             MainClass.enable(panel5);
         }
         else
         {
             MainClass.showMsg("Select a record first", "error", "error");
         }
     }
 }
 private void actionBtn_Click(object sender, EventArgs e)
 {
     if (operationLabel.Text == "VIEW")
     {
         selectGrade.SelectedIndex = -1;
         selectClass.SelectedIndex = -1;
         var data = obj.student_attendance_getAllAttendance();
         studentAttendanceGridView.DataSource = data;
     }
     else if (operationLabel.Text == "EDIT")
     {
     }
     else if (operationLabel.Text == "ADD")
     {
         if (ifRecorded())
         {
             MainClass.showMsg("Attendance already recorded for this class", "error", "error");
         }
         else
         {
         }
     }
 }
        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");
            }
        }
        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");
            }
        }
        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 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);
            }
        }
Exemple #22
0
        private void btnAddBooks_Click(object sender, EventArgs e)
        {
            if (btnStatus == "add")
            {
                if (BookIDNull.Visible || BookNameNull.Visible || AuthorNull.Visible)
                {
                    MainClass.showMsg("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            string q = "INSERT INTO libraryBooks (book_ID, name, author, quantity, addDate) VALUES ('" + txtBookID.Text + "','" + txtBookName.Text + "','" + txtAuthor.Text + "', '1', '" + AddDate.Text + "')";
                            Console.Write(q);
                            SqlCommand cmd = new SqlCommand(q, con);
                            cmd.ExecuteNonQuery();
                            MainClass.showMsgLibrary(txtBookName.Text + "Successfully Added!", "Success", "Success");
                        }
                    }
                    catch
                    {
                        int book_ID = 0;

                        try
                        {
                            book_ID = int.Parse(txtBookID.Text);
                        }
                        catch
                        {
                            MainClass.showMsg("Book ID should be an numerical value!", "Warning", "Error");
                        }
                    }
                }
                con.Close();
                lblMain.Text = "View";
            }
            else if (btnStatus == "update")
            {
                if (BookIDNull.Visible || BookNameNull.Visible || AuthorNull.Visible)
                {
                    MainClass.showMsg("Fields with * are mandetory!", "Warning", "Error");
                }
                else
                {
                    try
                    {
                        con.Open();
                        if (con.State == System.Data.ConnectionState.Open)
                        {
                            string q = "UPDATE libraryBooks SET book_ID ='" + txtBookID.Text + "' ,name='" + txtBookName.Text + "',author='" + txtAuthor.Text + "',quantity='1',addDate='" + AddDate.Text + "' where book_ID ='" + txtBookID.Text + "' ";
                            Console.Write(q);
                            SqlCommand cmd = new SqlCommand(q, con);
                            cmd.ExecuteNonQuery();
                            MainClass.showMsgLibrary("Successfull Updated!", "Success", "Success");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error");
                    }
                }
            }
            con.Close();
            showBookDetails();
            MainClass.disable_reset(panel6);
            lblMain.Text = "View";
        }
Exemple #23
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";
        }
Exemple #24
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();
            }
        }