private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvStaffList.Rows.Count > 0)
                {
                    int selectIndex = dgvStaffList.CurrentRow.Index;
                    var staffID     = dgvStaffList.Rows[selectIndex].Cells[0].Value;

                    DialogResult dialogResult = MessageBox.Show("Staff'ı silmek istediğinize emin misiniz?", "Library Management System", MessageBoxButtons.YesNo);

                    if (dialogResult == DialogResult.Yes)
                    {
                        var s = StaffsHelper.GetById(Convert.ToInt32(staffID));

                        s.Status = 0;

                        StaffsHelper.Update(s);

                        MessageBox.Show("Staff Silme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        FillGrid();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Herhangi bir eleman seçmediniz!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            ep.Clear();

            if (txtSearchUserName.Text.Trim().Length == 0)
            {
                ep.SetError(txtSearchUserName, "Kullacı adı boş bırakılamaz!");
                txtSearchUserName.Focus();
                return;
            }
            if (txtSearchPassword.Text.Trim().Length == 0)
            {
                ep.SetError(txtSearchPassword, "Şifre boş bırakılamaz!");
                txtSearchPassword.Focus();
                return;
            }


            var check   = UsersHelper.Login(txtSearchUserName.Text, txtSearchPassword.Text).Item1;
            var staffID = UsersHelper.Login(txtSearchUserName.Text, txtSearchPassword.Text).Item2;

            if (check)
            {
                var userPrivileges = UserPrivilegesHelper.GetByStaffID(staffID);

                chkConfiguration.Checked = Convert.ToBoolean(userPrivileges.Configuration);
                chkStaff.Checked         = Convert.ToBoolean(userPrivileges.Staff);
                chkStudent.Checked       = Convert.ToBoolean(userPrivileges.Student);
                chkBook.Checked          = Convert.ToBoolean(userPrivileges.Book);
                chkIssueBook.Checked     = Convert.ToBoolean(userPrivileges.IssueBook);
                chkReturnBook.Checked    = Convert.ToBoolean(userPrivileges.ReturnBook);
                chkReport.Checked        = Convert.ToBoolean(userPrivileges.Report);
                chkGSM.Checked           = Convert.ToBoolean(userPrivileges.Gsm);
                chkEmail.Checked         = Convert.ToBoolean(userPrivileges.Email);

                var staff = StaffsHelper.GetById(staffID);
                txtUpdateUser.Text = staff.Name;
                txtContactNo.Text  = staff.ContactNo;

                var designation = DesignationsHelper.GetById(staff.DesignationID);
                txtDesignation.Text = designation.Name;

                btnUpdate.Enabled         = true;
                txtSearchUserName.Enabled = false;
                txtSearchPassword.Enabled = false;
                btnSearch.Enabled         = false;
            }
            else
            {
                MessageBox.Show("Kullanıcı Adı ve Şifre Eşleşmiyor.", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            epName.Clear();
            bool check1 = StaffsHelper.ControlValidate(txtName, "Lütfen Staff İsmini Giriniz.", epName);

            epTCNO.Clear();
            bool check2 = StaffsHelper.ControlValidate(txtTcNo, "Lütfen TC No Giriniz.", epTCNO);

            epAddress.Clear();
            bool check3 = StaffsHelper.ControlValidate(txtAddress, "Lütfen Address İsmini Giriniz.", epAddress);

            epContactNo.Clear();
            bool check4 = StaffsHelper.ControlValidate(txtContactNo, "Lütfen Contact No Giriniz.", epContactNo);

            if (txtTcNo.Text.Trim().Length != 11)
            {
                MessageBox.Show("TC No 11 hanali olmalıdır.", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (txtContactNo.Text.Trim().Length < 9 || txtContactNo.Text.Trim().Length > 14)
            {
                MessageBox.Show("Lütfen geçerli bir telefon numarası giriniz!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (check1 && check2 && check3 && check4)
            {
                if (!StaffsHelper.HaveTCNO(txtTcNo.Text.Trim()) && !StaffsHelper.HaveContactNo(txtContactNo.Text))
                {
                    Staffs s = new Staffs();

                    s.DesignationID = DesignationsHelper.GetByName(cmbDesignation.SelectedItem.ToString());
                    s.Name          = txtName.Text;
                    s.TCNO          = txtTcNo.Text;
                    s.Gender        = cmbGender.SelectedIndex;
                    s.Address       = txtAddress.Text;
                    s.ContactNo     = txtContactNo.Text;
                    s.Status        = 1;

                    StaffsHelper.Add(s);

                    MessageBox.Show("Staff Ekleme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    FillGrid();
                }
                else
                {
                    MessageBox.Show("Girdiğiniz TC veya Telefon numarası sistemde kayıtlıdır.", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 4
0
 private void FillGridBook(int studentID)
 {
     dgvIssueBookList.Rows.Clear();
     foreach (var issueBook in IssueBooksHelper.GetIssueBookListFromStudentID(studentID))
     {
         int row = dgvIssueBookList.Rows.Add();
         dgvIssueBookList.Rows[row].Cells[0].Value = issueBook.IssueID;
         dgvIssueBookList.Rows[row].Cells[1].Value = issueBook.BookID;
         dgvIssueBookList.Rows[row].Cells[2].Value = BooksHelper.GetBookNameByID(issueBook.BookID);
         dgvIssueBookList.Rows[row].Cells[3].Value = StaffsHelper.GetByNameFromID(issueBook.StaffID);
         dgvIssueBookList.Rows[row].Cells[4].Value = issueBook.NoOfCopies;
         dgvIssueBookList.Rows[row].Cells[5].Value = issueBook.DateOfIssue.ToString("dd MMMM yyyy");
         dgvIssueBookList.Rows[row].Cells[6].Value = issueBook.DateOfReturn.ToString("dd MMMM yyyy");
         row++;
     }
 }
 private void FillGrid()
 {
     dgvStaffList.Rows.Clear();
     foreach (var staff in StaffsHelper.GetStaffsModelList())
     {
         int row = dgvStaffList.Rows.Add();
         dgvStaffList.Rows[row].Cells[0].Value = staff.StaffID;
         dgvStaffList.Rows[row].Cells[1].Value = staff.Designations.Name;
         dgvStaffList.Rows[row].Cells[2].Value = staff.Name;
         dgvStaffList.Rows[row].Cells[3].Value = staff.TCNO;
         dgvStaffList.Rows[row].Cells[4].Value = staff._Gender;
         dgvStaffList.Rows[row].Cells[5].Value = staff.Address;
         dgvStaffList.Rows[row].Cells[6].Value = staff.ContactNo;
         row++;
     }
 }
Esempio n. 6
0
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            epUserName.Clear();
            bool check1 = SessionsHelper.ControlValidate(txtUserName, "Lütfen User Name Giriniz.", epUserName);

            epPassword.Clear();
            bool check2 = SessionsHelper.ControlValidate(txtEnterPassword, "Lütfen Password Giriniz.", epPassword);

            if (txtEnterPassword.Text.Trim() != txtConfirmPassword.Text.Trim())
            {
                epConfirmPass.Clear();
                epConfirmPass.SetError(txtConfirmPassword, "Şifreler eşleşmiyor!");
                return;
            }

            if (check1 && check2)
            {
                if (!UsersHelper.HaveUserID(txtUserName.Text.ToLower()))
                {
                    UserPrivileges up = new UserPrivileges();
                    up.StaffID       = StaffsHelper.GetByName(cmbSelectUser.SelectedItem.ToString());
                    up.Configuration = Convert.ToInt32(chkConfiguration.Checked);
                    up.Book          = Convert.ToInt32(chkBook.Checked);
                    up.Report        = Convert.ToInt32(chkReport.Checked);
                    up.Staff         = Convert.ToInt32(chkStaff.Checked);
                    up.IssueBook     = Convert.ToInt32(chkIssueBook.Checked);
                    up.Gsm           = Convert.ToInt32(chkGSM.Checked);
                    up.Student       = Convert.ToInt32(chkStudent.Checked);
                    up.ReturnBook    = Convert.ToInt32(chkReturnBook.Checked);
                    up.Email         = Convert.ToInt32(chkEmail.Checked);
                    UserPrivilegesHelper.Add(up);

                    Users u = new Users();
                    u.StaffID  = StaffsHelper.GetByName(cmbSelectUser.SelectedItem.ToString());
                    u.UserName = txtUserName.Text;
                    u.Password = txtEnterPassword.Text;
                    UsersHelper.Add(u);

                    MessageBox.Show("Üye Ekleme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Eklemek istediğiniz User Name sistemde mevcuttur.", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
 private void FillGrid()
 {
     dgvStudentList.Rows.Clear();
     foreach (var student in StudentsHelper.GetActiveStudentsList())
     {
         int row = dgvStudentList.Rows.Add();
         dgvStudentList.Rows[row].Cells[0].Value  = student.StudentID;
         dgvStudentList.Rows[row].Cells[1].Value  = student.Name;
         dgvStudentList.Rows[row].Cells[2].Value  = student.TCNO;
         dgvStudentList.Rows[row].Cells[3].Value  = student.EnrollNo;
         dgvStudentList.Rows[row].Cells[4].Value  = SessionsHelper.GetByNameFromID(student.SessionID);
         dgvStudentList.Rows[row].Cells[5].Value  = DepartmentsHelper.GetByNameFromID(student.DepartmentID);
         dgvStudentList.Rows[row].Cells[6].Value  = ProgramsHelper.GetByNameFromID(student.ProgramID);
         dgvStudentList.Rows[row].Cells[7].Value  = student.RegisterDate.ToString("dd MMMM yyyy");
         dgvStudentList.Rows[row].Cells[8].Value  = student.Address;
         dgvStudentList.Rows[row].Cells[9].Value  = student.ContactNo;
         dgvStudentList.Rows[row].Cells[10].Value = StaffsHelper.GetByNameFromID(student.StaffID);
         row++;
     }
 }
Esempio n. 8
0
 private void FillGrid()
 {
     dgvBookList.Rows.Clear();
     foreach (var book in BooksHelper.GetBooksList())
     {
         int row = dgvBookList.Rows.Add();
         dgvBookList.Rows[row].Cells[0].Value  = book.BookID;
         dgvBookList.Rows[row].Cells[1].Value  = book.BookName;
         dgvBookList.Rows[row].Cells[2].Value  = BookCategoriesHelper.GetByNameFromID(book.BookCategoryID);
         dgvBookList.Rows[row].Cells[3].Value  = DepartmentsHelper.GetByNameFromID(book.DepartmentID);
         dgvBookList.Rows[row].Cells[4].Value  = book.Author;
         dgvBookList.Rows[row].Cells[5].Value  = book.Title;
         dgvBookList.Rows[row].Cells[6].Value  = book.Edition;
         dgvBookList.Rows[row].Cells[7].Value  = book.NoOfCopies;
         dgvBookList.Rows[row].Cells[8].Value  = book.DateOfRegister.ToString("dd MMMM yyyy");
         dgvBookList.Rows[row].Cells[9].Value  = book.Price;
         dgvBookList.Rows[row].Cells[10].Value = StaffsHelper.GetByNameFromID(_staffID);
         row++;
     }
 }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvStaffList.Rows.Count > 0)
            {
                if (dgvStaffList.SelectedRows.Count == 1)
                {
                    int selectIndex = dgvStaffList.CurrentRow.Index;
                    var staffID     = dgvStaffList.Rows[selectIndex].Cells[0].Value;

                    var s = StaffsHelper.GetById(Convert.ToInt32(staffID));
                    var d = DesignationsHelper.GetById(s.DesignationID);

                    cmbDesignation.SelectedItem = d.Name;
                    txtName.Text            = s.Name;
                    txtTcNo.Text            = s.TCNO;
                    cmbGender.SelectedIndex = s.Gender;
                    txtAddress.Text         = s.Address;
                    txtContactNo.Text       = s.ContactNo;

                    EnableComponent();
                }
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            epName.Clear();
            bool check1 = StaffsHelper.ControlValidate(txtName, "Lütfen Staff İsmini Giriniz.", epName);

            epTCNO.Clear();
            bool check2 = StaffsHelper.ControlValidate(txtTcNo, "Lütfen TC No Giriniz.", epTCNO);

            epAddress.Clear();
            bool check3 = StaffsHelper.ControlValidate(txtAddress, "Lütfen Address İsmini Giriniz.", epAddress);

            epContactNo.Clear();
            bool check4 = StaffsHelper.ControlValidate(txtContactNo, "Lütfen Contact No Giriniz.", epContactNo);

            if (check1 && check2 && check3 && check4)
            {
                int selectIndex = dgvStaffList.CurrentRow.Index;
                var staffID     = dgvStaffList.Rows[selectIndex].Cells[0].Value;

                var s = StaffsHelper.GetById(Convert.ToInt32(staffID));

                s.DesignationID = DesignationsHelper.GetByName(cmbDesignation.SelectedItem.ToString());
                s.Name          = txtName.Text;
                s.TCNO          = txtTcNo.Text;
                s.Gender        = cmbGender.SelectedIndex;
                s.Address       = txtAddress.Text;
                s.ContactNo     = txtContactNo.Text;

                StaffsHelper.Update(s);

                MessageBox.Show("Staff güncelleme başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearForm();
                FillGrid();
                DisableComponent();
            }
        }
Esempio n. 11
0
 private void CmbContactNo_SelectedIndexChanged(object sender, EventArgs e)
 {
     txtDesignation.Text = StaffsHelper.GetDesignation(cmbContactNo.SelectedItem.ToString());
 }
Esempio n. 12
0
 private void CmbSelectUser_SelectedIndexChanged(object sender, EventArgs e)
 {
     cmbContactNo.DataSource = StaffsHelper.GetContactNoList(cmbSelectUser.SelectedItem.ToString());
 }
Esempio n. 13
0
 private void FrmAddUser_Load(object sender, EventArgs e)
 {
     cmbSelectUser.DataSource = StaffsHelper.GetStaffsNameList();
 }
Esempio n. 14
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     UserPre();
     toolStripStatusLabel1.Text = StaffsHelper.GetByNameFromID(_staffID);
 }