private void LoadBlankCertConfig()
 {
     try
     {
         List <BlankCertConfigModel> blankCertConfigModels = managingBlankCertConfigService.GetAllBlankCertConfig();
         BlankCertConfigDataGridView.Rows.Clear();
         int i = 0;
         foreach (var blankCertConfigModel in blankCertConfigModels)
         {
             BlankCertConfigDataGridView.Rows.Add
             (
                 blankCertConfigModel.Id,
                 false,
                 i++,
                 blankCertConfigModel.BlankCertTypeName,
                 blankCertConfigModel.CreatedAt.ToString("dd/MM/yyyy"),
                 blankCertConfigModel.IsActive == true ? "Đang dùng" : "Không dùng"
             );
         }
     }
     catch (Exception ex)
     {
         NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Warning);
         notificationForm.ShowDialog();
     }
 }
Example #2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> roleIds = (from RoleModel r in RoleCheckedListBox.CheckedItems
                                      select r.Id).ToList();

                int result = accountService.UpdateAccountRole(_accountIds, roleIds);
                if (result > 0)
                {
                    //MessageBox.Show("Cập nhật quyền tài khoản thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    NotificationForm notificationForm = new NotificationForm("Cập nhật quyền tài khoản thành công", "Thông báo", MessageBoxIcon.Information);
                    notificationForm.ShowDialog();
                    OnAccountRoleUpdated();
                }
                else
                {
                    //MessageBox.Show("Cập nhật quyền tài khoản không thành công", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Cập nhật quyền tài khoản không thành công", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                var a = ex.Message;
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #3
0
        private void BlankCertDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == BlankCertDataGridView.Columns["Select"].Index && e.RowIndex >= 0)
            {
                int blankCertId = int.Parse(BlankCertDataGridView.Rows[e.RowIndex].Cells["Id"].Value.ToString());
                ChangeDataChosenBlankCerts(blankCertId, true);
            }
            else if (e.ColumnIndex == BlankCertDataGridView.Columns["ShowImage"].Index && e.RowIndex >= 0)
            {
                int blankCertId = int.Parse(BlankCertDataGridView.Rows[e.RowIndex].Cells["Id"].Value.ToString());
                string imageName = managingBlankCertService.GetSingleById(blankCertId).Image;
                if (string.IsNullOrEmpty(imageName))
                {
                    //MessageBox.Show("Không tìm thấy ảnh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    NotificationForm notificationForm = new NotificationForm("Không tìm thấy ảnh", "Lỗi", MessageBoxIcon.Error);
                    notificationForm.ShowDialog();
                    return;
                }
                string path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
                ShowingImageForm showingImageForm = new ShowingImageForm(Path.Combine(@"C:\JbCert_Resource\Images\", imageName));
                showingImageForm.ShowDialog();

            }
  
        }
Example #4
0
 private void ChangeDataChosenBlankCerts(int blankCertId, bool doAdd)
 {
     try
     {
         if (chosenBlankCertModels.Any(x => x.Id == blankCertId) && doAdd)
         {
             //MessageBox.Show("Đã chọn phôi này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             NotificationForm notificationForm = new NotificationForm("Đã chọn phôi này", "Thông báo", MessageBoxIcon.Information);
             notificationForm.ShowDialog();
         }
         else
         {
             if (doAdd)
             {
                 BlankCertModel blankCertModel = managingBlankCertService.GetSingleById(blankCertId);
                 blankCertModel.ReferenceNumber = "";
                 chosenBlankCertModels.Add(blankCertModel);
             }
             else
             {
                 chosenBlankCertModels.Remove(chosenBlankCertModels.Where(x => x.Id == blankCertId).FirstOrDefault());
             }
         }
         LoadChosenBlankCerts();
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
         notificationForm.ShowDialog();
     }
 }
Example #5
0
 private void CertDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == CertDataGridView.Columns["ViewStudentImage"].Index && e.RowIndex >= 0)
     {
         int       certId    = int.Parse(CertDataGridView.Rows[e.RowIndex].Cells["Id"].Value.ToString());
         CertModel certModel = managingCertService.GetSingleCertById(certId);
         string    imageName = managingStudentService.GetStudentImage(certModel.StudentId);
         if (string.IsNullOrEmpty(imageName))
         {
             //MessageBox.Show("Không tìm thấy ảnh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             NotificationForm notificationForm = new NotificationForm("Không tìm thấy ảnh", "Cảnh báo", MessageBoxIcon.Warning);
             notificationForm.ShowDialog();
             return;
         }
         string           path             = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
         ShowingImageForm showingImageForm = new ShowingImageForm(Path.Combine(@"C:\JbCert_Resource\StudentImages\", imageName));
         showingImageForm.ShowDialog();
     }
     else if (e.ColumnIndex == CertDataGridView.Columns["ViewBlankCertImage"].Index && e.RowIndex >= 0)
     {
         int       certId    = int.Parse(CertDataGridView.Rows[e.RowIndex].Cells["Id"].Value.ToString());
         CertModel certModel = managingCertService.GetSingleCertById(certId);
         string    imageName = managingBlankCertService.GetBlankCertImage(certModel.BlankCertId);
         if (string.IsNullOrEmpty(imageName))
         {
             //MessageBox.Show("Không tìm thấy ảnh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             NotificationForm notificationForm = new NotificationForm("Không tìm thấy ảnh", "Cảnh báo", MessageBoxIcon.Warning);
             notificationForm.ShowDialog();
             return;
         }
         string           path             = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
         ShowingImageForm showingImageForm = new ShowingImageForm(Path.Combine(@"C:\JbCert_Resource\Images\", imageName));
         showingImageForm.ShowDialog();
     }
 }
 private void AvatarButton_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog ofDlg = new OpenFileDialog();
         ofDlg.Filter = "JPG|*.jpg|GIF|*.gif|PNG|*.png|BMP|*.bmp";
         if (DialogResult.OK == ofDlg.ShowDialog())
         {
             imageLocation            = ofDlg.FileName;
             extension                = Path.GetExtension(imageLocation);
             AvatarPictureBox.Enabled = true;
             AvatarPictureBox.Image   = null;
             using (FileStream fs = new FileStream(imageLocation, FileMode.Open))
             {
                 AvatarPictureBox.Image = Image.FromStream(fs);
             }
             //AvatarPictureBox.ImageLocation = imageLocation;
         }
     }
     catch (Exception ex)
     {
         NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
         notificationForm.ShowDialog();
     }
 }
        private void textBox1_MouseLeave(object sender, EventArgs e)
        {
            //MessageBox.Show("Đây là sản phẩm demo, chức năng này có trên sản phẩm chính thức", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            NotificationForm notificationForm = new NotificationForm("Đây là sản phẩm demo, chức năng này có trên sản phẩm chính thức", "Thông báo", MessageBoxIcon.Error);

            notificationForm.ShowDialog();
        }
        private void EditButton_Click(object sender, EventArgs e)
        {
            List <int> blankCertTypeIds = (from DataGridViewRow r in BlankCertTypeDataGridView.Rows
                                           where Convert.ToBoolean(r.Cells[1].Value) == true
                                           select Convert.ToInt32(r.Cells[0].Value)).ToList();

            try
            {
                if (blankCertTypeIds.Count == 1)
                {
                    int blankCertTypeId = blankCertTypeIds.FirstOrDefault();
                    EditBlankCertTypeForm editBlankCertTypeForm = new EditBlankCertTypeForm(blankCertTypeId);
                    editBlankCertTypeForm.ShowDialog();
                }
                else if (blankCertTypeIds.Count == 0)
                {
                    //MessageBox.Show("Bạn chưa chọn loại phôi nào", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Bạn chưa chọn loại phôi nào", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                }
                else
                {
                    //MessageBox.Show("Chỉ chọn 1 loại phôi để sửa", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Bạn chưa chọn loại phôi nào", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
        private void DetailStudentForm_Load(object sender, EventArgs e)
        {
            try
            {
                StudentModel studentModel = managingStudentService.GetSingleStudentById(_studentId);
                FullnameTextBox.Text       = studentModel.FullName;
                AddressTextBox.Text        = studentModel.Address;
                BornedAddressTextBox.Text  = studentModel.BornedAddress;
                HouseHoldTextBox.Text      = studentModel.HouseHold;
                IdentityTextBox.Text       = studentModel.IdentityNumber;
                ScoreTextBox.Text          = studentModel.Score.ToString();
                GraduatingYearTextBox.Text = studentModel.GraduatingYear.ToString();
                DobTextBox.Text            = studentModel.Dob.ToString("dd/MM/yyyy");
                NoteRichTextBox.Text       = studentModel.Note;
                SchoolTextBox.Text         = studentModel.SchoolName;
                MajorTextBox.Text          = studentModel.MajorName;
                EthnicTextBox.Text         = studentModel.EthnicName;
                GenderTextBox.Text         = studentModel.Gender;
                LearningModeTextBox.Text   = studentModel.LearningModeName;
                RankingTextBox.Text        = studentModel.RankingName;

                string path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
                using (FileStream fs = new FileStream(Path.Combine(@"C:\JbCert_Resource\StudentImages\", studentModel.Image), FileMode.Open))
                {
                    AvatarPictureBox.Image = Image.FromStream(fs);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #10
0
 private void ChosenStudentDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == ChosenStudentDataGridView.Columns["ChosenRemove"].Index && e.RowIndex >= 0)
     {
         int studentId = int.Parse(ChosenStudentDataGridView.Rows[e.RowIndex].Cells["ChosenId"].Value.ToString());
         ChangeDataChosenStudents(studentId, false);
     }
     else if (e.ColumnIndex == StudentDataGridView.Columns["ShowImage"].Index && e.RowIndex >= 0)
     {
         int    studentId = int.Parse(ChosenStudentDataGridView.Rows[e.RowIndex].Cells["ChosenId"].Value.ToString());
         string imageName = managingStudentService.GetStudentImage(studentId);
         if (string.IsNullOrEmpty(imageName))
         {
             //MessageBox.Show("Không tìm thấy ảnh", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             NotificationForm notificationForm = new NotificationForm("Không tìm thấy ảnh", "Lỗi", MessageBoxIcon.Error);
             notificationForm.ShowDialog();
             return;
         }
         string           path             = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
         ShowingImageForm showingImageForm = new ShowingImageForm(Path.Combine(@"C:\JbCert_Resource\StudentImages", imageName));
         showingImageForm.ShowDialog();
     }
     else if (e.ColumnIndex == StudentDataGridView.Columns["Detail"].Index && e.RowIndex >= 0)
     {
         int studentId = int.Parse(ChosenStudentDataGridView.Rows[e.RowIndex].Cells["ChosenId"].Value.ToString());
         DetailStudentForm detailStudentForm = new DetailStudentForm(studentId);
         detailStudentForm.ShowDialog();
     }
 }
        private void ChosenSearchBlankCertButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(ChosenSerialTextBox.Text))
                {
                    ChosenSerialTextBox.Text = "";
                }

                ChosenBlankCertDataGridView.Rows.Clear();

                List <BlankCertModel> searchedChosenBlankCerts = new List <BlankCertModel>();

                searchedChosenBlankCerts = chosenBlankCertModels.Where(x => x.Serial.Contains(ChosenSerialTextBox.Text)).ToList();

                foreach (var searchChosenBlankCert in searchedChosenBlankCerts)
                {
                    ChosenBlankCertDataGridView.Rows.Add
                    (
                        searchChosenBlankCert.Id,
                        searchChosenBlankCert.Serial,
                        searchChosenBlankCert.ReferenceNumber
                    );
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            List <int> studentIds = (from DataGridViewRow r in StudentDataGridView.Rows
                                     where Convert.ToBoolean(r.Cells[1].Value) == true
                                     select Convert.ToInt32(r.Cells[0].Value)).ToList();
            ConfirmForm confirmForm = new ConfirmForm("Đồng ý xóa ?");

            confirmForm.ShowDialog();
            if (confirmForm.Result == DialogResult.Yes)
            {
                try
                {
                    int result = managingStudentService.DeleteManyStudent(studentIds);
                    if (result > 0)
                    {
                        //MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        NotificationForm notificationForm = new NotificationForm("Xóa thành công", "Thông báo", MessageBoxIcon.Information);
                        notificationForm.ShowDialog();
                        LoadStudentList();
                    }
                    else
                    {
                        //MessageBox.Show("Xóa không thành công", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        NotificationForm notificationForm = new NotificationForm("Xóa không thành công", "Cảnh báo", MessageBoxIcon.Warning);
                        notificationForm.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                    notificationForm.ShowDialog();
                }
            }
        }
Example #13
0
 private void LoadListBlankCert()
 {
     try
     {
         List <BlankCertModel> blankCertModels = managingBlankCertService.GetAllBlankCert();
         int i = 1;
         BlankCertDataGridView.Rows.Clear();
         foreach (var blankCertModel in blankCertModels)
         {
             BlankCertDataGridView.Rows.Add
             (
                 blankCertModel.Id,
                 false,
                 i++,
                 blankCertModel.Serial,
                 blankCertModel.IsAvailable == true ? "Khả dụng" : "Không thể sử dụng",
                 blankCertModel.IsReturned == true ? "Đã thu hồi" : "Không thu hồi",
                 blankCertModel.CreatedAt,
                 blankCertModel.BlankCertTypeName,
                 blankCertModel.UpdatedAt.ToString("dd/MM/yyyy")
             );
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Warning);
         notificationForm.ShowDialog();
     }
 }
Example #14
0
 private void EditButton_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> examIds = new List <int>();
         examIds.Add(Convert.ToInt32(ExamDataGridView.Rows[ExamDataGridView.SelectedCells[0].RowIndex].Cells[0].Value));
         if (examIds.Count == 1)
         {
             int          examId       = examIds.FirstOrDefault();
             EditExamForm editExamForm = new EditExamForm(examId);
             editExamForm.ShowDialog();
         }
         else if (examIds.Count == 0)
         {
             //MessageBox.Show("Bạn chưa chọn kỳ thi nào", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             NotificationForm notificationForm = new NotificationForm("Bạn chưa chọn kỳ thi nào", "Cảnh báo", MessageBoxIcon.Warning);
             notificationForm.ShowDialog();
         }
         else
         {
             //MessageBox.Show("Chỉ chọn 1 kỳ thi để sửa", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             NotificationForm notificationForm = new NotificationForm("Chỉ chọn 1 kỳ thi để sửa", "Cảnh báo", MessageBoxIcon.Warning);
             notificationForm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
         notificationForm.ShowDialog();
     }
 }
 private void EditButton_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> studentIds = new List <int>();
         studentIds.Add(Convert.ToInt32(StudentDataGridView.Rows[StudentDataGridView.SelectedCells[0].RowIndex].Cells[0].Value));
         if (studentIds.Count == 1)
         {
             int             studentId         = studentIds.FirstOrDefault();
             EditStudentForm editBlankCertForm = new EditStudentForm(studentId);
             editBlankCertForm.ShowDialog();
         }
         else if (studentIds.Count == 0)
         {
             //MessageBox.Show("Bạn chưa chọn học sinh nào", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             NotificationForm notificationForm = new NotificationForm("Bạn chưa chọn học sinh nào", "Cảnh báo", MessageBoxIcon.Warning);
             notificationForm.ShowDialog();
         }
         else
         {
             //MessageBox.Show("Chỉ chọn 1 học sinh để chỉnh sửa", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             NotificationForm notificationForm = new NotificationForm("Chỉ chọn 1 học sinh để chỉnh sửa", "Cảnh báo", MessageBoxIcon.Warning);
             notificationForm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
         notificationForm.ShowDialog();
     }
 }
Example #16
0
 private void LoadStudent()
 {
     try
     {
         if (string.IsNullOrEmpty(StudentNameTextBox.Text))
         {
             StudentNameTextBox.Text = "";
         }
         List <StudentModel> studentModels = managingStudentService.SearchStudentForAddingCert(StudentNameTextBox.Text, int.Parse(SchoolComboBox.SelectedValue.ToString()));
         StudentDataGridView.Rows.Clear();
         if (studentModels == null || studentModels.Count == 0)
         {
             //MessageBox.Show("Không tìm thấy dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             NotificationForm notificationForm = new NotificationForm("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Information);
             notificationForm.ShowDialog();
             return;
         }
         int i = 1;
         foreach (var studentModel in studentModels)
         {
             StudentDataGridView.Rows.Add
             (
                 studentModel.Id,
                 i++,
                 studentModel.FullName,
                 studentModel.IdentityNumber,
                 studentModel.RankingName
             );
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #17
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                AccountModel accountModel = accountService.GetSingleAccountById(CurrentUser.Id);
                accountModel.Id          = CurrentUser.Id;
                accountModel.Username    = UsernameTextBox.Text;
                accountModel.Email       = string.IsNullOrEmpty(EmailTextBox.Text) ? "" : EmailTextBox.Text;
                accountModel.PhoneNumber = string.IsNullOrEmpty(PhoneNumberTextBox.Text) ? "" : PhoneNumberTextBox.Text;
                accountModel.IsActive    = false;


                int result = accountService.UpdateAccountInformation(accountModel);

                if (result > 0)
                {
                    //MessageBox.Show("Cập nhật thông tin thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    NotificationForm notificationForm = new NotificationForm("Cập nhật thông tin thành công", "Thông báo", MessageBoxIcon.Information);
                    notificationForm.ShowDialog();
                }
                else
                {
                    //MessageBox.Show("Cập nhật thông tin không thành công", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Cập nhật thông tin không thành công", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #18
0
        private void LoadChosenStudents()
        {
            try
            {
                ChosenStudentDataGridView.Rows.Clear();
                if (string.IsNullOrEmpty(ChosenStudentNameTextBox.Text))
                {
                    ChosenStudentNameTextBox.Text = "";
                }
                List <StudentModel> searchedChosenStudents = new List <StudentModel>();
                int schoolId = int.Parse(ChosenSchoolComboBox.SelectedValue.ToString());

                searchedChosenStudents = chosenStudents.Where(x => x.FullName.Contains(ChosenStudentNameTextBox.Text) &&
                                                              ((schoolId == -1) || (x.SchoolId == schoolId)))
                                         .ToList();
                int i = 1;
                foreach (var chosenStudent in searchedChosenStudents)
                {
                    ChosenStudentDataGridView.Rows.Add
                    (
                        chosenStudent.Id,
                        i++,
                        chosenStudent.FullName,
                        chosenStudent.IdentityNumber,
                        chosenStudent.RankingName
                    );;
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #19
0
 private void ChangeDataChosenStudents(int studentId, bool isAdd)
 {
     if (chosenStudents.Any(x => x.Id == studentId) && isAdd)
     {
         MessageBox.Show("Đã chọn học sinh này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         NotificationForm notificationForm = new NotificationForm("Đã chọn học sinh này", "Thông báo", MessageBoxIcon.Information);
         notificationForm.ShowDialog();
         return;
     }
     else
     {
         if (isAdd)
         {
             // add
             StudentModel studentModel          = managingStudentService.GetSingleStudentById(studentId);
             RankingModel defaultRankingStudent = managingStudentService.GetAllRanking().FirstOrDefault();
             studentModel.RankingId   = defaultRankingStudent.Id;
             studentModel.RankingName = defaultRankingStudent.RankingName;
             chosenStudents.Add(studentModel);
         }
         else
         {
             // remove
             chosenStudents.Remove(chosenStudents.Where(x => x.Id == studentId).FirstOrDefault());
         }
         LoadChosenStudents();
     }
 }
Example #20
0
        private void UpdateInformationButton_Click(object sender, EventArgs e)
        {
            //List<int> accountIds = (from DataGridViewRow r in AccountDataGridView.Rows
            //                        where Convert.ToBoolean(r.Cells[1].Value) == true
            //                        select Convert.ToInt32(r.Cells[0].Value)).ToList();
            List <int> accountIds = new List <int>();

            accountIds.Add(Convert.ToInt32(AccountDataGridView.Rows[AccountDataGridView.SelectedCells[0].RowIndex].Cells[0].Value));
            if (accountIds.Count == 1)
            {
                EditAccountInformationForm editAccountInformationForm = new EditAccountInformationForm(accountIds.FirstOrDefault());
                editAccountInformationForm.ShowDialog();
            }
            else if (accountIds.Count == 0)
            {
                //MessageBox.Show("Chưa chọn tài khoản nào", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                NotificationForm notificationForm = new NotificationForm("Chưa chọn tài khoản nào", "Cảnh báo", MessageBoxIcon.Warning);
                notificationForm.ShowDialog();
            }
            else
            {
                //MessageBox.Show("Chỉ được chọn 1 tài khoản", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                NotificationForm notificationForm = new NotificationForm("Chỉ được chọn 1 tài khoản", "Cảnh báo", MessageBoxIcon.Warning);
                notificationForm.ShowDialog();
            }
        }
Example #21
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(NameTextBox.Text))
                {
                    //MessageBox.Show("Điền tên sở giáo dục", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Điền tên sở giáo dục", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                if (string.IsNullOrEmpty(PhoneNumberTextBox.Text))
                {
                    //MessageBox.Show("Điền số điện thoại sở giáo dục", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Điền số điện thoại sở giáo dục", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                if (string.IsNullOrEmpty(ProvinceTextBox.Text))
                {
                    //MessageBox.Show("Điền tỉnh sở giáo dục", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Điền tỉnh sở giáo dục", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                DepartmentOfEducationAndTrainingModel departmentOfEducationAndTrainingModel = new DepartmentOfEducationAndTrainingModel();
                departmentOfEducationAndTrainingModel.Name        = NameTextBox.Text;
                departmentOfEducationAndTrainingModel.PhoneNumber = PhoneNumberTextBox.Text;
                departmentOfEducationAndTrainingModel.Province    = ProvinceTextBox.Text;

                int result = departmentOfEducationAndTrainingService.UpdateInfor(departmentOfEducationAndTrainingModel);
                if (result == 1)
                {
                    //MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    NotificationForm notificationForm = new NotificationForm("Cập nhật thành công", "Thông báo", MessageBoxIcon.Information);
                    notificationForm.ShowDialog();
                    OnInforUpdated();
                }
                else
                {
                    //MessageBox.Show("Cập nhật không thành công", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Cập nhật không thành công", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                }
                this.Close();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #22
0
        private void SeachButton_Click(object sender, EventArgs e)
        {
            string serial          = "";
            int    blankCertTypeId = -1;
            int    status          = 0;

            try
            {
                if (!string.IsNullOrEmpty(SerialTextBox.Text))
                {
                    serial = SerialTextBox.Text;
                }

                if (BlankCertTypeComboBox.SelectedValue == null)
                {
                    NotificationForm notificationForm = new NotificationForm("Loại bằng không tồn tại", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                if (StatusComboBox.SelectedItem == null)
                {
                    NotificationForm notificationForm = new NotificationForm("Trạng thái không tồn tại", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                blankCertTypeId = int.Parse(BlankCertTypeComboBox.SelectedValue.ToString());
                status          = StatusComboBox.SelectedIndex;

                List <BlankCertModel> blankCertModels = managingBlankCertService.SearchBlankCert(serial, blankCertTypeId, status);
                int i = 1;
                BlankCertDataGridView.Rows.Clear();
                foreach (var blankCertModel in blankCertModels)
                {
                    BlankCertDataGridView.Rows.Add
                    (
                        blankCertModel.Id,
                        false,
                        i++,
                        blankCertModel.Serial,
                        blankCertModel.IsAvailable == true ? "Khả dụng" : "Không thể sử dụng",
                        blankCertModel.IsReturned == true ? "Đã thu hồi" : "Không thu hồi",
                        blankCertModel.CreatedAt,
                        blankCertModel.BlankCertTypeName,
                        blankCertModel.UpdatedAt.ToString("dd/MM/yyyy")
                    );
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #23
0
 private void ChosenStudentSearchButton_Click(object sender, EventArgs e)
 {
     if (ChosenSchoolComboBox.SelectedValue == null)
     {
         NotificationForm notificationForm = new NotificationForm("Giá trị trường học không tồn tại", "Cảnh báo", MessageBoxIcon.Warning);
         notificationForm.ShowDialog();
         return;
     }
     LoadChosenStudents();
 }
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(VillageNameTextBox.Text))
            {
                NotificationForm notificationForm = new NotificationForm("Điền tên xã", "Cảnh báo", MessageBoxIcon.Warning);
                notificationForm.ShowDialog();
                return;
            }

            if (string.IsNullOrEmpty(AddressTextBox.Text))
            {
                NotificationForm notificationForm = new NotificationForm("Điền địa chỉ huyện", "Cảnh báo", MessageBoxIcon.Warning);
                notificationForm.ShowDialog();
                return;
            }

            if (TownComboBox.SelectedValue == null)
            {
                NotificationForm notificationForm = new NotificationForm("Chọn huyện", "Cảnh báo", MessageBoxIcon.Warning);
                notificationForm.ShowDialog();
                return;
            }

            VillageModel villageModel = new VillageModel();

            villageModel.Id          = _villageId;
            villageModel.VillageName = VillageNameTextBox.Text;
            villageModel.Address     = AddressTextBox.Text;
            villageModel.TownId      = int.Parse(TownComboBox.SelectedValue.ToString());
            villageModel.PhoneNumber = string.IsNullOrEmpty(PhoneNumberTextBox.Text) ? "" : PhoneNumberTextBox.Text;
            villageModel.Fax         = string.IsNullOrEmpty(FaxTextBox.Text) ? "" : FaxTextBox.Text;
            villageModel.Note        = string.IsNullOrEmpty(NoteRichTextBox.Text) ? "" : NoteRichTextBox.Text;
            villageModel.IsDeleted   = false;
            try
            {
                int result = managingAdministrativeBoundariesService.UpdateVillage(villageModel);
                if (result > 0)
                {
                    OnVillageUpdated();
                    NotificationForm notificationForm = new NotificationForm("Cập nhật xã thành công", "Thông báo", MessageBoxIcon.Information);
                    notificationForm.ShowDialog();
                    this.Close();
                }
                else
                {
                    NotificationForm notificationForm = new NotificationForm("Cập nhật xã không thành công", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
        private void AddBlankCertButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(SerialCertTextBox.Text))
                {
                    //MessageBox.Show("Điền số hiệu văn bằng!", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Điền số hiệu văn bằng!", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                if (BlankCertTypeComboBox.SelectedValue == null)
                {
                    //MessageBox.Show("Chọn ảnh phôi!", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Chọn loại phôi", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                if (string.IsNullOrEmpty(imageLocation))
                {
                    //MessageBox.Show("Chọn ảnh phôi!", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Chọn ảnh phôi!", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }
                saveFileName = SerialCertTextBox.Text;
                string path = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;


                int result = managingBlankCertService.Add(SerialCertTextBox.Text, "", saveFileName + extension, int.Parse(BlankCertTypeComboBox.SelectedValue.ToString()));
                if (result > 0)
                {
                    OnBlankCertAdded();
                    File.Copy(imageLocation, Path.Combine(@"C:\JbCert_Resource\Images", saveFileName + extension));
                    //MessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    NotificationForm notificationForm = new NotificationForm("Thêm thành công", "Thông báo", MessageBoxIcon.Information);
                    notificationForm.ShowDialog();
                    this.Close();
                }
                else
                {
                    //MessageBox.Show("Thêm không thành công", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Thêm không thành công", "Cảnh báo", MessageBoxIcon.Information);
                    notificationForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #26
0
        private void OpenPrintOptionFormButton_Click(object sender, EventArgs e)
        {
            if (chosenCertIdList.Count == 0)
            {
                NotificationForm notificationForm = new NotificationForm("Chọn ít nhất 1 bằng để in", "Cảnh báo", MessageBoxIcon.Warning);
                notificationForm.ShowDialog();
                return;
            }
            PrintOptionForm printOptionForm = new PrintOptionForm(chosenCertIdList);

            printOptionForm.ShowDialog();
        }
Example #27
0
        private void LockButton_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> accountIds = (from DataGridViewRow r in AccountDataGridView.Rows
                                         where Convert.ToBoolean(r.Cells[1].Value) == true
                                         select Convert.ToInt32(r.Cells[0].Value)).ToList();

                if (accountIds.Count == 0)
                {
                    //MessageBox.Show("Chưa chọn tài khoản nào", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    NotificationForm notificationForm = new NotificationForm("Chưa chọn tài khoản nào", "Cảnh báo", MessageBoxIcon.Warning);
                    notificationForm.ShowDialog();
                    return;
                }

                int         result      = accountService.LockManyAccount(accountIds);
                ConfirmForm confirmForm = new ConfirmForm("Đồng ý xóa ?");
                confirmForm.ShowDialog();
                if (confirmForm.Result == DialogResult.Yes)
                {
                    try
                    {
                        if (accountIds.Count > 0)
                        {
                            //MessageBox.Show("Khóa tài khoản thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            NotificationForm notificationForm = new NotificationForm("Khóa tài khoản thành công", "Thông báo", MessageBoxIcon.Information);
                            notificationForm.ShowDialog();
                        }
                        else
                        {
                            //MessageBox.Show("Khóa tài khoản không thành công", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            NotificationForm notificationForm = new NotificationForm("Khóa tài khoản không thành công", "Thông báo", MessageBoxIcon.Warning);
                            notificationForm.ShowDialog();
                        }
                    }
                    catch (Exception ex)
                    {
                        NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Warning);
                        notificationForm.ShowDialog();
                    }
                }


                LoadAccountList();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
                notificationForm.ShowDialog();
            }
        }
Example #28
0
 private void AccountDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         NotificationForm notificationForm = new NotificationForm(Common.Common.COMMON_ERORR, "Lỗi", MessageBoxIcon.Error);
         notificationForm.ShowDialog();
     }
 }
Example #29
0
 private void PhoneNumberTextBox_Leave(object sender, EventArgs e)
 {
     try
     {
         int result = int.Parse(PhoneNumberTextBox.Text);
     }
     catch (Exception ex)
     {
         //MessageBox.Show("Chỉ được điền số", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         NotificationForm notificationForm = new NotificationForm("Chỉ được điền số", "Cảnh báo", MessageBoxIcon.Warning);
         notificationForm.ShowDialog();
     }
 }
Example #30
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            if (chosenStudents.Count == 0)
            {
                MessageBox.Show("Chọn tối thiểu 1 sinh viên", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                NotificationForm notificationForm = new NotificationForm("Chọn tối thiểu 1 sinh viên", "Cảnh báo", MessageBoxIcon.Warning);
                notificationForm.ShowDialog();
                return;
            }
            SelectBlankCertForm selectBlankCertForm = new SelectBlankCertForm(this, _blankCertTypeId);

            selectBlankCertForm.ShowDialog();
        }