private void InsertUser()
        {
            imageToByteArray();

            _userService.ValidateUser(new User
            {
                UserName = txtUserName.Text,
                Password = txtPassword.Text,
                UserTypeID = 2
            });
            _lecturerService.InsertLecturer(new LecturerQueryItem
            {
                UserName = txtUserName.Text,
                Password = txtPassword.Text,
                UserTypeID = 2,
                LecturerID = txtUserName.Text,
                FirstName = txtFirstName.Text,
                MiddleName = txtMiddleName.Text,
                LastName = txtLastName.Text,
                Address = txtAddress.Text,
                Phone = txtPhone.Text,
                Photo = arr == null ? null : arr
            });
            MMessageBox.ShowMessage("Successfully enrolled a new staff", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            PopulateListLecturer();
        }
Пример #2
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var dr = MMessageBox.Show(this, "Lưu thực đơn?", "Thông báo"
                                      , MMessageBoxButtons.YesNo, MMessageBoxIcon.Warning);

            if (DialogResult.No == dr)
            {
                Dispose();
                return;
            }
            var menuCode    = txtMenuCode.Text.Trim();
            var menuName    = txtMenuName.Text.Trim();
            var unitId      = MControlUtil.GetValueFromCombobox(cboUnit);
            var price       = txtPrice.Text.Trim();
            var description = txtDescription.Text.Trim();
            var dto         = new MenuDto()
            {
                Id          = _menuId,
                Code        = menuCode,
                Name        = menuName,
                CategoryId  = _categoryId,
                UnitId      = long.Parse(unitId),
                Price       = float.Parse(price),
                Description = description
            };

            _billingDao.SaveMenu(dto);
            _isChange = true;
            Dispose();
        }
 public static void RunMethod(Action action)
 {
     try
     {
         action();
     }
     catch (ValidationException ex)
     {
         MMessageBox.ShowMessage(ex.Message.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (DataUsedException ex)
     {
         MMessageBox.ShowMessage(ex.Message.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (DataExistException ex)
     {
         MMessageBox.ShowMessage(ex.Message.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (LoginFailedException ex)
     {
         MMessageBox.ShowMessage(ex.Message.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (TransactionFailedException ex)
     {
         MMessageBox.ShowMessage(ex.Message.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (DbUpdateException)
     {
         MMessageBox.ShowMessage("Data Already Exists", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception)
     {
         MMessageBox.ShowMessage("Something Went Wrong", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
0
        private bool IsValidInputData()
        {
            var billId = GetSelectedBillId();

            if (billId == -1)
            {
                MMessageBox.Show(this, "Bạn chưa chọn hóa đơn", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                btnThemHoaDon.Focus();
                return(false);
            }

            if ("".Equals(cboMonAn.Text.Trim()))
            {
                MMessageBox.Show(this, "Bạn chưa chọn món ăn", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                cboMonAn.Focus();
                return(false);
            }
            if ("".Equals(txtSoLuong.Text.Trim()) || long.Parse(txtSoLuong.Text.Trim()) == 0)
            {
                MMessageBox.Show(this, "Bạn chưa nhập số lượng", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtSoLuong.Focus();
                return(false);
            }
            return(true);
        }
        private bool IsValidInputData()
        {
            string maNhom = txtMaNhom.Text.Trim();

            if ("".Equals(maNhom))
            {
                MMessageBox.Show(this, "Bạn chưa nhập mã nhóm", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtMaNhom.Focus();
                return(false);
            }
            if (_billingDao.IsExistCategoryCode(maNhom, _categoryId))
            {
                MMessageBox.Show(this, "Mã nhóm đã tồn tại, vui lòng nhập lại", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtMaNhom.Focus();
                return(false);
            }
            if ("".Equals(txtTenNhom.Text.Trim()))
            {
                MMessageBox.Show(this, "Bạn chưa nhập tên nhóm", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtTenNhom.Focus();
                return(false);
            }
            return(true);
        }
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            if (!IsValidInputData())
            {
                return;
            }
            var dr = MMessageBox.Show(this, "Lưu nhóm thực đơn?", "Thông báo"
                                      , MMessageBoxButtons.YesNo, MMessageBoxIcon.Warning);

            if (DialogResult.No == dr)
            {
                Dispose();
                return;
            }
            var maNhom  = txtMaNhom.Text.Trim();
            var tenNhom = txtTenNhom.Text.Trim();
            var dto     = new DanhMucDto()
            {
                Id  = Convert.ToString(_categoryId),
                Ma  = maNhom,
                Ten = tenNhom
            };

            _billingDao.SaveCategory(dto);
            _isChange = true;
            Dispose();
        }
Пример #7
0
        private void btnHuy_Click(object sender, EventArgs e)
        {
            var billId = GetSelectedBillId();

            if (billId == -1)
            {
                MMessageBox.Show(this, "Bạn chưa chọn hóa đơn", "Thông báo"
                                 , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                btnThemHoaDon.Focus();
                return;
            }
            var dr = MMessageBox.Show(this, "Bạn có muốn hủy hóa đơn?", "Thông báo"
                                      , MMessageBoxButtons.YesNo, MMessageBoxIcon.Warning);

            if (DialogResult.No == dr)
            {
                return;
            }
            var billingCancel = new BillingCancel();

            billingCancel.ShowDialog(this);
            var reason = billingCancel.Reason;

            if (String.IsNullOrEmpty(reason))
            {
                return;
            }
            var billDto = _billingDao.getBillDto(billId);

            billDto.Payment      = ConstUtil.CANCEL;
            billDto.CancelReason = reason;
            _billingDao.ThanhToan(billDto);
            dgvHoaDon_SelectionChanged(null, null);
        }
 private void RemoveUser()
 {
     _userService.Delete(user);
     _lecturerService.Delete(lecturer);
     PopulateListLecturer();
     MMessageBox.ShowMessage("Deleted Staff From system.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
 private void DeleteCourse()
 {
     _courseService.InactivateCourse(new Course {
         CourseID = globalCourseID, CourseName = txtCourse.Text, IsCourseActive = false
     });
     PopulateGridCourse();
     MMessageBox.ShowMessage("Course Removed Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
 private void DeleteUser()
 {
     _userService.Delete(user);
     _studentService.Delete(student);
     _studentIntakeService.Delete(studentIntake);
     PopulateListLecturer();
     MMessageBox.ShowMessage("Removed Student From system.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Пример #11
0
 private void DeleteTimeTable()
 {
     _timeTableService.Delete(new TimeTable {
         TimeTableID = (int)dgvListIntakeTimeTable.CurrentRow.Cells["TimeTableID"].Value
     });
     PopulateGridIntakeTimeTable();
     MMessageBox.ShowMessage("Record Deleted.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Пример #12
0
 private void UpdateTimeTable()
 {
     _timeTableService.Update(new TimeTable {
         TimeTableID = timeTable.TimeTableID, LecturerID = cbxLecturer.SelectedValue.ToString(), SubjectID = (int)cbxSubject.SelectedValue, IntakeID = cbxIntake.SelectedValue.ToString(), SubjectDay = (int)cbxDayOfWeek.SelectedValue, SubjectTime = dtpSubjectTime.Value.TimeOfDay, SubjectDuration = (int)nudDuration.Value, ClassRoomID = (int)cbxClassRoom.SelectedValue
     });
     PopulateGridIntakeTimeTable();
     MMessageBox.ShowMessage("Record Updated Successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Пример #13
0
 private void DeleteSubject()
 {
     _subjectService.Delete(new Subject {
         SubjectID = (int)dgvSubjects.CurrentRow.Cells["SubjectID"].Value
     });
     PopulateGridSubjects();
     MMessageBox.ShowMessage("Data Deleted.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
 private void LinkIntake()
 {
     _intakeCourseService.Insert(new IntakeCourse {
         CourseID = globalCourseID, IntakeID = txtIntake.Text, IsIntakeCourseActive = true
     });
     PopulateGridIntake();
     PopulateGridCourse();
     MMessageBox.ShowMessage("Successfully Inserted!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Пример #15
0
        private void mnuThoat_Click(object sender, System.EventArgs e)
        {
            var dr = MMessageBox.Show(this, "Bạn có muốn thoát khỏi chương trình?", "Cảnh báo"
                                      , MMessageBoxButtons.YesNo, MMessageBoxIcon.Question);

            if (DialogResult.Yes == dr)
            {
                OnCancelLogin(null, null);
            }
        }
Пример #16
0
 private void mButton1_Click(object sender, EventArgs e)
 {
     if (!IsValidInputData())
     {
         return;
     }
     MMessageBox.Show(this, "Đổi mật khẩu thành công", "Thông báo"
                      , MMessageBoxButtons.OK, MMessageBoxIcon.Information);
     DialogResult = DialogResult.OK;
 }
Пример #17
0
 private bool IsValidInputData()
 {
     if ("".Equals(txtReason.Text.Trim()))
     {
         MMessageBox.Show(this, "Bạn chưa nhập lý do", "Thông báo"
                          , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
         txtReason.Focus();
         return(false);
     }
     return(true);
 }
Пример #18
0
        /// <summary>
        /// Ham nay thiet lap gia tri cho Cell trong Table
        ///
        /// </summary>
        /// <param name="colIndex">Chi so cua column chua Cell, bat dau tu 1</param>
        /// <param name="row">row trong Table</param>
        /// <param name="value">Gia tri cho Cell</param>

        public static void SetValueForTableCell(Row row, int colIndex, string value)
        {
            try
            {
                row.Cells.Item(colIndex).Range.Text = value;
            }
            catch (Exception exception)
            {
                MMessageBox.Show(null, exception.Message);
            }
        }
Пример #19
0
 public static void Merge2Cell(Cell MergeFrom, Cell MergeTo)
 {
     try
     {
         MergeFrom.Merge(MergeTo);
     }
     catch (Exception exception)
     {
         MMessageBox.Show(null, exception.Message);
     }
 }
Пример #20
0
 public static void SetStyleForCell(Cell cell, object style)
 {
     try
     {
         cell.Range.set_Style(style);
     }
     catch (Exception exception)
     {
         MMessageBox.Show(null, exception.Message);
     }
 }
Пример #21
0
        private void btnImpexpProcess_Click(object sender, EventArgs e)
        {
            _storeDao.AddList(listStoreDto);

            MMessageBox.Show(this, "Bạn đã " + importExportType.name.ToLower() + " thành công", "Thông báo"
                             , MMessageBoxButtons.OK, MMessageBoxIcon.Information);

            ResetForm();

            return;
        }
 private bool IsValidInputData()
 {
     if (String.IsNullOrEmpty(txtFromDate.Text))
     {
         MMessageBox.Show(this, "Bạn chưa nhập Từ ngày", "Thông báo"
                          , MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
         txtFromDate.Focus();
         return(false);
     }
     return(true);
 }
Пример #23
0
        public static void SetStyleForCell(Cell cell)
        {
            try
            {
//                cell.Range.Font.Bold = 0;
                cell.WordWrap = false;
            }
            catch (Exception exception)
            {
                MMessageBox.Show(null, exception.Message);
            }
        }
Пример #24
0
        private void Delete_btn_Click(object sender, RoutedEventArgs e)
        {
            MMessageBox.Reault reault = MMessageBox.ShouBox(
                "是否要删除?",
                "警 告",
                MMessageBox.ButtonType.YesNo,
                MMessageBox.IconType.warring,
                Orientation.Horizontal,
                "是",
                "否"
                );

            if (reault == MMessageBox.Reault.Yes)
            {
                // MMessageBox.ShowSuccessAlert("你点了 是");
                string LoginID    = ((Button)sender).Tag.ToString();
                int    idex       = this.dataGrid1.SelectedIndex;
                string Account    = Convert.ToString((((DataView)this.dataGrid1.ItemsSource).Table).Rows[idex]["Account"]);
                string LoginIDtwo = Convert.ToString((((DataView)this.dataGrid1.ItemsSource).Table).Rows[idex]["LoginID"]);
                if (LoginID == LoginIDtwo)
                {
                    if (LoginService.Delete(LoginIDtwo, Account, "10000003"))
                    {
                        MMessageBox.ShowSuccessAlert("删除成功 ^_^ ");
                        //读取当前的页数
                        int       page  = int.Parse(this.tbkCurrentsize.Text);
                        int       total = 0;
                        DataTable dt    = LoginService.getAllUserDataTable(ref total, page, rows);
                        if (dt.Rows.Count < rows)
                        {
                            this.btnNext.IsEnabled = false;
                        }
                        if (dt == null || dt.Rows.Count == 0)
                        {
                            this.btnNext.IsEnabled = false;

                            return;
                        }
                        this.dataGrid1.DataContext = dt;
                        this.tbkCurrentsize.Text   = page.ToString();
                        this.tbkTotal.Text         = total.ToString();
                    }
                    else
                    {
                        MMessageBox.ShowSuccessAlert("删除失败,请联系管理员 ^_^ ");
                    }
                }
                else
                {
                    MMessageBox.ShowSuccessAlert("系统服务忙,请联系管理员 ^_^ ");
                }
            }
        }
Пример #25
0
        public static void ShowMessageDialog(string keyTitle, string keyText)
        {
            var messageBox = new MMessageBox(_owner)
            {
                Data = new MMessageBoxData()
                {
                    KeyText  = keyText,
                    KeyTitle = keyTitle
                }
            };

            messageBox.ShowDialog();
        }
Пример #26
0
 /// <summary>
 /// Hàm này dùng để thêm một(hoặc nhiều) row mới vào trước một row cho trước trong table
 /// </summary>
 /// <param name="rowIndex">index của row cho trước</param>
 /// <param name="numRow">số row cần bổ sung</param>
 public static void AddRowsAbove(int index, int rowIndex, int numRow)
 {
     try
     {
         Table tbl = _doc.Content.Tables.Item(index);
         tbl.Rows.Item(rowIndex).Select();
         _msWord.Selection.InsertRowsAbove(numRow);
     }
     catch (Exception exception)
     {
         MMessageBox.Show(null, exception.Message);
     }
 }
Пример #27
0
        private void QuitMenuItem_Click(object sender, EventArgs e)
        {
            currWindow.Activate();

            MMessageBox.Result result = MMessageBox.GetInstance().ShowBox("你确定退出程系吗", "提示", MMessageBox.ButtonType.YesNo, MMessageBox.IconType.Info);
            if (result == MMessageBox.Result.Yes)
            {
                Application.Current.Shutdown();
            }
            else
            {
                currWindow.WindowState = WindowState.Normal;
            }
        }
Пример #28
0
        public bool IsValidInputData()
        {
            if (String.IsNullOrEmpty(txtFullName.Text.Trim()))
            {
                MMessageBox.Show(this, "Bạn phải nhập tên người dùng", "Thông báo", MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtFullName.Focus();
                return(false);
            }

            var username = txtUsername.Text.Trim();

            if (String.IsNullOrEmpty(username))
            {
                MMessageBox.Show(this, "Bạn phải nhập thông tin Mã đăng nhập", "Thông báo", MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtUsername.Focus();
                return(false);
            }

            if (_danhSachUser.ExistsUser(_userID, username))
            {
                MMessageBox.Show(this, "Đã tồn tại người dùng trong hệ thống", "Thông báo", MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtUsername.Focus();
                return(false);
            }

            if (IsNewUser() && String.IsNullOrEmpty(txtMkMoi.Text.Trim()))
            {
                MMessageBox.Show(this, "Bạn phải nhập thông tin Mật khẩu", "Thông báo", MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtMkMoi.Focus();
                return(false);
            }

            if (IsNewUser() && String.IsNullOrEmpty(txtMkMoi2.Text.Trim()))
            {
                MMessageBox.Show(this, "Bạn phải nhập thông tin Mật khẩu xác nhận", "Thông báo", MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtMkMoi2.Focus();
                return(false);
            }

            if (IsNewUser() && !txtMkMoi.Text.Equals(txtMkMoi2.Text.Trim()))
            {
                MMessageBox.Show(this, "Mật khẩu xác nhận không khớp", "Thông báo", MMessageBoxButtons.OK, MMessageBoxIcon.Warning);
                txtMkMoi.Text  = "";
                txtMkMoi2.Text = "";
                txtMkMoi.Focus();
                return(false);
            }

            return(true);
        }
Пример #29
0
 public static void SetStyleForCell(Cell cell, bool isBold, bool isItalic, bool isUnderline)
 {
     try
     {
         //row.Range.set_Style(ref style);
         cell.Range.Font.Bold      = isBold ? 1 : 0;
         cell.Range.Font.Underline = isUnderline ? WdUnderline.wdUnderlineSingle : WdUnderline.wdUnderlineNone;
         cell.WordWrap             = false;
     }
     catch (Exception exception)
     {
         MMessageBox.Show(null, exception.Message);
     }
 }
Пример #30
0
        public static void FillDataToWordDocTableWithoutStt2(int index, bool isBold, bool isItalic, bool isUnderline, bool includeHeader, bool includeSumRow, bool isFirstTime)
        {
            if (_doc == null)
            {
                return;
            }
            if (_doc.Tables.Count == 0)
            {
                return;
            }

            if (index < 1)
            {
                throw new ArgumentException("Index phai >=1");
            }

            try
            {
                Table tbl1         = _doc.Content.Tables.Item(index);
                var   lastRowIndex = includeSumRow ? tbl1.Rows.Count - 1 : tbl1.Rows.Count;
                if (lastRowIndex == 0)
                {
                    lastRowIndex = 1;
                }
                int prev = lastRowIndex;
                if (isFirstTime)
                {
                    if (SourceTable.Rows.Count > 1)
                    {
                        AddRowsBelow(index, prev, SourceTable.Rows.Count - 1);
                    }
                }
                else
                {
                    AddRowsBelow(index, prev, SourceTable.Rows.Count);
                    prev++;
                }
                foreach (DataRow sRow in SourceTable.Rows)
                {
                    Row row = tbl1.Rows.Item(prev);
                    SetAllValueForTableRowWithStyle(row, AllValues2(sRow, ColumnNames), isBold, isItalic, isUnderline);
                    prev++;
                }
            }
            catch (Exception exception)
            {
                MMessageBox.Show(null, exception.Message);
            }
        }