コード例 #1
0
        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);
            }
        }
コード例 #2
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);
                }
            }
        }
コード例 #3
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            ep.Clear();

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

            if (txtNewPassword.Text.Trim() == txtConfirmPassword.Text.Trim())
            {
                var userid = UsersHelper.GetUserIDbyName(txtUserName.Text);
                if (!UsersHelper.HaveUserID(txtUserName.Text.ToLower(), userid))
                {
                    var staffID = UsersHelper.Login(txtSearchUserName.Text, txtSearchPassword.Text).Item2;

                    var up = UserPrivilegesHelper.GetByStaffID(staffID);
                    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.Update(up);

                    var u = UsersHelper.GetByStaffID(staffID);
                    u.UserName = txtUserName.Text;
                    u.Password = txtNewPassword.Text;
                    UsersHelper.Update(u);

                    MessageBox.Show("Üye Güncelleme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    btnUpdate.Enabled         = false;
                    txtSearchUserName.Enabled = true;
                    txtSearchPassword.Enabled = true;
                    btnSearch.Enabled         = true;

                    txtSearchUserName.Text = string.Empty;
                    txtSearchPassword.Text = string.Empty;

                    txtUpdateUser.Text      = string.Empty;
                    txtContactNo.Text       = string.Empty;
                    txtDesignation.Text     = string.Empty;
                    txtUserName.Text        = string.Empty;
                    txtNewPassword.Text     = string.Empty;
                    txtConfirmPassword.Text = string.Empty;

                    chkConfiguration.Checked = false;
                    chkStaff.Checked         = false;
                    chkStudent.Checked       = false;
                    chkBook.Checked          = false;
                    chkIssueBook.Checked     = false;
                    chkReturnBook.Checked    = false;
                    chkReport.Checked        = false;
                    chkGSM.Checked           = false;
                    chkEmail.Checked         = false;
                }
                else
                {
                    MessageBox.Show("Sistemde bu User Name zaten kayıtlı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                ep.SetError(txtConfirmPassword, "Şifreler eşleşmiyor!");
                txtConfirmPassword.Focus();
                return;
            }
        }
コード例 #4
0
        private void UserPre()
        {
            var userPre = UserPrivilegesHelper.GetByStaffID(_staffID);

            if (userPre.Configuration == 1)
            {
                configurationToolStripMenuItem.Enabled = true;
                toolStripDepartment.Enabled            = true;
                toolStripSession.Enabled = true;
                toolStripProgram.Enabled = true;
            }
            else
            {
                configurationToolStripMenuItem.Enabled = false;
                toolStripDepartment.Enabled            = false;
                toolStripSession.Enabled = false;
                toolStripProgram.Enabled = false;
            }

            if (userPre.Staff == 1)
            {
                toolStripAddStaff.Enabled      = true;
                staffToolStripMenuItem.Enabled = true;
            }
            else
            {
                toolStripAddStaff.Enabled      = false;
                staffToolStripMenuItem.Enabled = false;
            }

            if (userPre.Student == 1)
            {
                studentsToolStripMenuItem.Enabled = true;
                toolStripStudent.Enabled          = true;
            }
            else
            {
                studentsToolStripMenuItem.Enabled = false;
                toolStripStudent.Enabled          = false;
            }

            if (userPre.Book == 1)
            {
                toolStripAddBook.Enabled       = true;
                booksToolStripMenuItem.Enabled = true;
            }
            else
            {
                toolStripAddBook.Enabled       = false;
                booksToolStripMenuItem.Enabled = false;
            }

            if (userPre.IssueBook == 1)
            {
                toolStripIssueBooks.Enabled        = true;
                issueBookToolStripMenuItem.Enabled = true;
            }
            else
            {
                toolStripIssueBooks.Enabled        = false;
                issueBookToolStripMenuItem.Enabled = false;
            }

            if (userPre.ReturnBook == 1)
            {
                toolStripReturnBooks.Enabled        = true;
                returnBookToolStripMenuItem.Enabled = true;
            }
            else
            {
                toolStripReturnBooks.Enabled        = false;
                returnBookToolStripMenuItem.Enabled = false;
            }

            if (userPre.Report == 1)
            {
                toolStripReports.Enabled         = true;
                reportsToolStripMenuItem.Enabled = true;
            }
            else
            {
                toolStripReports.Enabled         = false;
                reportsToolStripMenuItem.Enabled = false;
            }

            if (userPre.Gsm == 1)
            {
                servicesToolStripMenuItem.Enabled = true;
            }
            else
            {
                servicesToolStripMenuItem.Enabled = false;
            }

            if (userPre.Email == 1)
            {
                eMailToolStripMenuItem.Enabled = true;
            }
            else
            {
                eMailToolStripMenuItem.Enabled = false;
            }
        }