private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (dgvStudentList.Rows.Count > 0)
            {
                if (dgvStudentList.SelectedRows.Count == 1)
                {
                    int selectIndex = dgvStudentList.CurrentRow.Index;
                    var studentID   = dgvStudentList.Rows[selectIndex].Cells[0].Value;

                    var student = StudentsHelper.GetById(Convert.ToInt32(studentID));

                    cmbSession.SelectedItem    = SessionsHelper.GetByNameFromID(student.SessionID);
                    cmbDepartment.SelectedItem = DepartmentsHelper.GetByNameFromID(student.DepartmentID);
                    cmbProgram.SelectedItem    = ProgramsHelper.GetByNameFromID(student.ProgramID);
                    txtStudentName.Text        = student.Name;
                    txtTCNO.Text            = student.TCNO;
                    cmbGender.SelectedIndex = student.Gender;
                    txtEnrollNo.Text        = student.EnrollNo;
                    txtAddress.Text         = student.Address;
                    txtContactNo.Text       = student.ContactNo;

                    EnableComponent();
                }
            }
        }
Example #2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (dgvBookList.Rows.Count > 0)
            {
                if (dgvBookList.SelectedRows.Count == 1)
                {
                    int selectIndex = dgvBookList.CurrentRow.Index;
                    var bookID      = dgvBookList.Rows[selectIndex].Cells[0].Value;

                    var book = BooksHelper.GetBookByID(Convert.ToInt32(bookID));

                    cmbDepartment.SelectedItem = DepartmentsHelper.GetByNameFromID(book.DepartmentID);
                    cmbCategory.SelectedItem   = BookCategoriesHelper.GetByNameFromID(book.BookCategoryID);
                    txtBookName.Text           = book.BookName;
                    txtTitle.Text    = book.Title;
                    txtAuthor.Text   = book.Author;
                    txtEdition.Text  = book.Edition;
                    txtEdition.Text  = string.Empty;
                    dtpRegDate.Value = book.DateOfRegister;
                    txtPrice.Text    = book.Price.ToString();

                    DisableComponent();
                }
            }
        }
 private void frmStudent_Load(object sender, EventArgs e)
 {
     cmbSession.DataSource    = SessionsHelper.GetSessionsNameList();
     cmbDepartment.DataSource = DepartmentsHelper.GetDepartmentsNameList();
     cmbProgram.DataSource    = ProgramsHelper.GetProgramsNameList();
     cmbGender.DataSource     = Enum.GetValues(typeof(Gender));
     FillGrid();
 }
Example #4
0
 private void FillGridStudent(Students s)
 {
     dgvStudentDetail.Rows.Clear();
     dgvStudentDetail.Rows.Add($"Adı   : {s.Name}");
     dgvStudentDetail.Rows.Add($"TC No : {s.TCNO}");
     dgvStudentDetail.Rows.Add($"Dönem : {SessionsHelper.GetByNameFromID(s.SessionID)}");
     dgvStudentDetail.Rows.Add($"Bölüm : {DepartmentsHelper.GetByNameFromID(s.DepartmentID)}");
     dgvStudentDetail.Rows.Add($"Dönem : {ProgramsHelper.GetByNameFromID(s.ProgramID)}");
 }
Example #5
0
 private void FillGridBook(Books b)
 {
     dgvBookDetail.Rows.Clear();
     dgvBookDetail.Rows.Add($"Adı       : {b.BookName}");
     dgvBookDetail.Rows.Add($"Yazarı    : {b.Author}");
     dgvBookDetail.Rows.Add($"Kategori  : {BookCategoriesHelper.GetByNameFromID(b.BookCategoryID)}");
     dgvBookDetail.Rows.Add($"Bölüm     : {DepartmentsHelper.GetByNameFromID(b.DepartmentID)}");
     dgvBookDetail.Rows.Add($"Miktar    : {b.NoOfCopies}");
 }
 private void FillGrid()
 {
     dgvDepartmentList.Rows.Clear();
     foreach (var department in DepartmentsHelper.GetDepartmentsModelList())
     {
         int row = dgvDepartmentList.Rows.Add();
         dgvDepartmentList.Rows[row].Cells[0].Value = department.DepartmentID;
         dgvDepartmentList.Rows[row].Cells[1].Value = department.Name;
         dgvDepartmentList.Rows[row].Cells[2].Value = department.EstablishDate.ToString("dd MMMM yyyy");
         row++;
     }
 }
Example #7
0
        private DepartmentsData GetDepartments(string departmentId)
        {
            var data = new DepartmentsData();

            try
            {
                DepartmentsHelper dbHelper = new DepartmentsHelper(_appSettings.Secrets.DbConnectionString);
                data = dbHelper.SelectData(departmentId);
            }
            catch (Exception ex)
            {
                _logger.LogError("Error GetDepartments: {0}", ex.Message);
            }

            return(data);
        }
 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++;
     }
 }
Example #9
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 btnUpdate_Click(object sender, EventArgs e)
        {
            epProgram.Clear();
            bool check = DepartmentsHelper.ControlValidate(txtDepartmentName, "Lütfen Department  İsmini Giriniz.", epProgram);

            if (check)
            {
                int selectIndex   = dgvDepartmentList.CurrentRow.Index;
                var dDepartmentID = dgvDepartmentList.Rows[selectIndex].Cells[0].Value;

                var d = DepartmentsHelper.GetById(Convert.ToInt32(dDepartmentID));
                d.Name          = txtDepartmentName.Text.Trim();
                d.EstablishDate = dtpEstablishDate.Value;

                DepartmentsHelper.Update(d);

                MessageBox.Show("Department güncelleme başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearForm();
                FillGrid();
                DisableComponent();
            }
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvDepartmentList.Rows.Count > 0)
            {
                if (dgvDepartmentList.SelectedRows.Count == 1)
                {
                    int selectIndex  = dgvDepartmentList.CurrentRow.Index;
                    var departmentID = dgvDepartmentList.Rows[selectIndex].Cells[0].Value;

                    var d = DepartmentsHelper.GetById(Convert.ToInt32(departmentID));

                    txtDepartmentName.Text = Convert.ToString(d.Name);
                    dtpEstablishDate.Value = d.EstablishDate;

                    EnableComponent();
                }
            }
            else
            {
                MessageBox.Show("Department listesi boş!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtDepartmentName.Text.Trim().Length == 0)
            {
                MessageBox.Show("Lütfen Department ismini giriniz!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!DepartmentsHelper.HaveDepartmentName(txtDepartmentName.Text))
            {
                Departments d = new Departments();
                d.Name          = txtDepartmentName.Text;
                d.EstablishDate = dtpEstablishDate.Value;

                DepartmentsHelper.Add(d);
                MessageBox.Show("Department ekleme başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                FillGrid();
            }
            else
            {
                MessageBox.Show("Aynı isimde bir Department zaten ekli!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvDepartmentList.Rows.Count > 0)
                {
                    if (dgvDepartmentList.SelectedRows.Count == 1)
                    {
                        DialogResult dialogResult = MessageBox.Show("Department'i silmek istediğinize emin misiniz?", "Library Management System", MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            int selectIndex  = dgvDepartmentList.CurrentRow.Index;
                            var departmentID = dgvDepartmentList.Rows[selectIndex].Cells[0].Value;

                            DepartmentsHelper.Delete(Convert.ToInt32(departmentID));

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

                            FillGrid();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Lütfen silmek istediğiniz department'i seçiniz!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Department listesi boş!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lütfen silmek istediğiniz Department'i seçiniz!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ep.Clear();

            if (txtStudentName.Text.Trim().Length == 0)
            {
                ep.SetError(txtStudentName, "Öğrenci adı boş bırakılamaz!");
                txtStudentName.Focus();
                return;
            }
            if (txtTCNO.Text.Trim().Length == 0)
            {
                ep.SetError(txtTCNO, "TC NO boş bırakılamaz!");
                txtTCNO.Focus();
                return;
            }
            if (txtEnrollNo.Text.Trim().Length == 0)
            {
                ep.SetError(txtEnrollNo, "Enroll No boş bırakılamaz!");
                txtEnrollNo.Focus();
                return;
            }
            if (txtAddress.Text.Trim().Length == 0)
            {
                ep.SetError(txtAddress, "Adres boş bırakılamaz!");
                txtAddress.Focus();
                return;
            }
            if (txtContactNo.Text.Trim().Length == 0)
            {
                ep.SetError(txtContactNo, "Telefon No boş bırakılamaz!");
                txtContactNo.Focus();
                return;
            }

            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 (!StudentsHelper.HaveTCNO(txtTCNO.Text) && !StudentsHelper.HaveEnrollNo(txtEnrollNo.Text) && !StudentsHelper.HaveContactNo(txtEnrollNo.Text))
            {
                Students s = new Students();
                s.SessionID    = SessionsHelper.GetByName(cmbSession.SelectedItem.ToString());
                s.DepartmentID = DepartmentsHelper.GetByName(cmbDepartment.SelectedItem.ToString());
                s.ProgramID    = ProgramsHelper.GetByName(cmbProgram.SelectedItem.ToString());
                s.StaffID      = _staffID;
                s.Name         = txtStudentName.Text;
                s.TCNO         = txtTCNO.Text;
                s.Status       = 1;
                s.Gender       = cmbGender.SelectedIndex;
                s.EnrollNo     = txtEnrollNo.Text;
                s.Address      = txtAddress.Text;
                s.ContactNo    = txtContactNo.Text;
                s.RegisterDate = DateTime.Now;
                StudentsHelper.Add(s);

                MessageBox.Show("Öğrenci Ekleme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);

                cmbSession.SelectedIndex    = 0;
                cmbDepartment.SelectedIndex = 0;
                cmbProgram.SelectedIndex    = 0;
                txtStudentName.Text         = string.Empty;
                txtTCNO.Text            = string.Empty;
                cmbGender.SelectedIndex = 0;
                txtEnrollNo.Text        = string.Empty;
                txtAddress.Text         = string.Empty;
                txtContactNo.Text       = string.Empty;

                FillGrid();
            }
            else
            {
                MessageBox.Show("Girdiğiniz TC, Enroll veya Telefon numarası sistemde kayıtlıdır.", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            ep.Clear();

            if (txtStudentName.Text.Trim().Length == 0)
            {
                ep.SetError(txtStudentName, "Öğrenci adı boş bırakılamaz!");
                txtStudentName.Focus();
                return;
            }
            if (txtTCNO.Text.Trim().Length == 0)
            {
                ep.SetError(txtTCNO, "TC NO boş bırakılamaz!");
                txtTCNO.Focus();
                return;
            }
            if (txtEnrollNo.Text.Trim().Length == 0)
            {
                ep.SetError(txtEnrollNo, "Enroll No boş bırakılamaz!");
                txtEnrollNo.Focus();
                return;
            }
            if (txtAddress.Text.Trim().Length == 0)
            {
                ep.SetError(txtAddress, "Adres boş bırakılamaz!");
                txtAddress.Focus();
                return;
            }
            if (txtContactNo.Text.Trim().Length == 0)
            {
                ep.SetError(txtContactNo, "Telefon No boş bırakılamaz!");
                txtContactNo.Focus();
                return;
            }

            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;
            }

            int selectIndex = dgvStudentList.CurrentRow.Index;
            var studentID   = dgvStudentList.Rows[selectIndex].Cells[0].Value;

            if (!StudentsHelper.HaveContactNo(txtContactNo.Text, Convert.ToInt32(studentID)) &&
                !StudentsHelper.HaveEnrollNo(txtEnrollNo.Text, Convert.ToInt32(studentID)) &&
                !StudentsHelper.HaveTCNO(txtTCNO.Text, Convert.ToInt32(studentID)))
            {
                var s = StudentsHelper.GetById(Convert.ToInt32(studentID));
                s.SessionID    = SessionsHelper.GetByName(cmbSession.SelectedItem.ToString());
                s.DepartmentID = DepartmentsHelper.GetByName(cmbDepartment.SelectedItem.ToString());
                s.ProgramID    = ProgramsHelper.GetByName(cmbProgram.SelectedItem.ToString());
                s.Name         = txtStudentName.Text;
                s.Gender       = cmbGender.SelectedIndex;
                s.Address      = txtAddress.Text;
                s.EnrollNo     = txtEnrollNo.Text;
                s.TCNO         = txtTCNO.Text;
                s.ContactNo    = txtContactNo.Text;
                StudentsHelper.Update(s);


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

                cmbSession.SelectedIndex    = 0;
                cmbDepartment.SelectedIndex = 0;
                cmbProgram.SelectedIndex    = 0;
                txtStudentName.Text         = string.Empty;
                txtTCNO.Text            = string.Empty;
                cmbGender.SelectedIndex = 0;
                txtEnrollNo.Text        = string.Empty;
                txtAddress.Text         = string.Empty;
                txtContactNo.Text       = string.Empty;

                ClearForm();
                FillGrid();
                DisableComponent();
            }
            else
            {
                MessageBox.Show("Girdiğiniz TC, Enroll veya Telefon numarası sistemde kayıtlıdır!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #16
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            ep.Clear();

            if (txtBookName.Text.Trim().Length == 0)
            {
                ep.SetError(txtBookName, "Book Name boş bırakılamaz!");
                txtBookName.Focus();
                return;
            }
            if (txtTitle.Text.Trim().Length == 0)
            {
                ep.SetError(txtTitle, "Title boş bırakılamaz!");
                txtTitle.Focus();
                return;
            }
            if (txtAuthor.Text.Trim().Length == 0)
            {
                ep.SetError(txtAuthor, "Author boş bırakılamaz!");
                txtAuthor.Focus();
                return;
            }
            if (txtEdition.Text.Trim().Length == 0)
            {
                ep.SetError(txtEdition, "Edition boş bırakılamaz!");
                txtEdition.Focus();
                return;
            }
            if (txtNoOfCopies.Text.Trim().Length == 0)
            {
                ep.SetError(txtNoOfCopies, "Edition boş bırakılamaz!");
                txtNoOfCopies.Focus();
                return;
            }
            if (txtPrice.Text.Trim().Length == 0)
            {
                ep.SetError(txtPrice, "Price boş bırakılamaz!");
                txtPrice.Focus();
                return;
            }

            if (!BooksHelper.HaveBook(txtBookName.Text, txtAuthor.Text, txtAuthor.Text))
            {
                Books b = new Books();
                b.BookCategoryID = BookCategoriesHelper.GetByName(cmbCategory.SelectedItem.ToString());
                b.StaffID        = _staffID;
                b.DepartmentID   = DepartmentsHelper.GetByName(cmbDepartment.SelectedItem.ToString());
                b.BookName       = txtBookName.Text;
                b.Author         = txtAuthor.Text;
                b.Title          = txtTitle.Text;
                b.Edition        = txtEdition.Text;
                b.NoOfCopies     = Convert.ToInt32(txtNoOfCopies.Text);
                b.DateOfRegister = dtpRegDate.Value;
                b.Price          = Convert.ToInt32(txtPrice.Text);
                BooksHelper.Add(b);

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

                cmbDepartment.SelectedIndex = 0;
                cmbCategory.SelectedIndex   = 0;
                txtBookName.Text            = string.Empty;
                txtTitle.Text      = string.Empty;
                txtAuthor.Text     = string.Empty;
                txtEdition.Text    = string.Empty;
                txtNoOfCopies.Text = string.Empty;
                dtpRegDate.Value   = DateTime.Now;
                txtPrice.Text      = string.Empty;

                FillGrid();
            }
            else
            {
                MessageBox.Show("Eklemk istediğiniz kitap sistemde zaten mevcut!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #17
0
 private void FrmAddBook_Load(object sender, EventArgs e)
 {
     cmbDepartment.DataSource = DepartmentsHelper.GetDepartmentsNameList();
     cmbCategory.DataSource   = BookCategoriesHelper.GetBookCategoriesNameList();
     FillGrid();
 }