private void btnSave_Click(object sender, EventArgs e)
        {
            if (!checkData())
            {
                return;
            }
            else
            {
                String unitName = Utils.standardNamePerson(txtUnitName.Text);
                unitObject = new DTOUnit("DOV0000000", unitName);

                if (unitBUS.InsertUnit(unitObject))
                {
                    XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    btnAdd.Enabled       = true;
                    btnCancelAdd.Enabled = false;
                    btnCancelAdd.Visible = false;
                    btnSave.Enabled      = false;
                }
                else
                {
                    XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                }
            }
        }
        /*
         * Type: 1: information
         * Type: 2: Question
         * Type: 3: Warning
         * Type: 4: Error
         * */
        public static DialogResult Show(String Text, String Caption, bool useDefault, int iType)
        {
            m_message = new XtraCustomMessageBox();
            m_message.labInfo.Text  = Text;
            m_message.StartPosition = FormStartPosition.CenterParent;
            if (m_message.labInfo.Location.Y + m_message.labInfo.Height > m_message.panelView.Location.Y + m_message.panelView.Height)
            {
                m_message.Height = m_message.Height + m_message.labInfo.Location.Y + m_message.labInfo.Height - m_message.panelView.Location.Y - m_message.panelView.Height;
            }
            m_message.Text = Caption;
            if (useDefault)
            {
                m_message.btnYes.Location = m_message.btnOK.Location;
                m_message.btnNo.Visible   = false;
                m_message.btnOK.Visible   = false;
                m_message.btnYes.Text     = "Vâng";
            }
            //Image for Dialog
            switch (iType)
            {
            case 1:    //Information
                m_message.picBoxImageShow.Image = Properties.Resources.ic_information;
                m_message.btnOK.Visible         = true;
                m_message.btnYes.Visible        = false;
                m_message.btnNo.Visible         = false;
                break;

            case 2:    //Question
                m_message.picBoxImageShow.Image = Properties.Resources.ic_question;
                //m_message.btnYes.Location = m_message.btnOK.Location;
                m_message.btnOK.Visible  = false;
                m_message.btnYes.Visible = true;
                m_message.btnNo.Visible  = true;
                break;

            case 3:    //Warning
                m_message.picBoxImageShow.Image = Properties.Resources.ic_warning_circle;
                m_message.btnOK.Visible         = true;
                m_message.btnYes.Visible        = false;
                m_message.btnNo.Visible         = false;
                break;

            case 4:    //Error
                m_message.picBoxImageShow.Image = Properties.Resources.ic_error;
                m_message.btnOK.Visible         = true;
                m_message.btnYes.Visible        = false;
                m_message.btnNo.Visible         = false;
                break;

            case 0:
                m_message.picBoxImageShow.Image = null;
                m_message.btnOK.Visible         = true;
                m_message.btnYes.Visible        = false;
                m_message.btnNo.Visible         = false;
                break;
            }

            m_message.ShowDialog();
            return(m_result);
        }
예제 #3
0
 private void txtServiceId_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         String serviceId = txtServiceId.Text.Trim().ToUpper();
         //Kiểm tra xem service nhập vào đúng hay ko?
         if (servicesBUS.CheckServiceIsExistInDatabase(serviceId))
         {
             btnAddInListServiceDetail.Enabled = true;
             //
             spPrices.Properties.ReadOnly   = true;
             spQuantity.Properties.ReadOnly = false;
             spQuantity.EditValue           = 0;
             //
             //du de ban
             DataTable tb = servicesBUS.GetDataServicesById(serviceId);
             txtServiceId.Text       = serviceId;
             txtServiceName.Text     = tb.Rows[0][2].ToString();
             txtServiceTypeName.Text = tb.Rows[0][4].ToString();
             spPrices.EditValue      = decimal.Parse(tb.Rows[0][5].ToString());
             spQuantity.EditValue    = decimal.Parse("1");;
         }
         else
         {
             XtraCustomMessageBox.Show("Mã dịch vụ không đúng. Vui lòng nhập lại!", "Cảnh báo", true, 3);
             txtServiceId.Text       = null;
             txtServiceName.Text     = null;
             txtServiceTypeName.Text = null;
             spQuantity.EditValue    = 0;
             spPrices.EditValue      = 0;
             spAmount.EditValue      = 0;
         }
     }
 }
예제 #4
0
 //Ham thay doi mat khau
 private void ChangePassWord()
 {
     if (Utils.GetMD5(txtPassOld.Text.Trim()).Equals(frmHomePage.staffLogin.Password))
     {
         if (txtPassReplay.Text.Equals(txtPassNew.Text.Trim()))
         {
             //thục hiện Update mật khẩu
             frmHomePage.staffLogin.Password = Utils.GetMD5(txtPassReplay.Text.Trim());
             //
             if (staffBUS.UpdateStaffForPassword(frmHomePage.staffLogin.StaffID, frmHomePage.staffLogin.Password))
             {
                 XtraCustomMessageBox.Show("Đổi mật khẩu thành công!", "Thông báo", true, 1);
                 this.Close();
             }
             else
             {
                 txtPassNew.Text = txtPassOld.Text = txtPassReplay.Text = "";
                 XtraCustomMessageBox.Show("Đổi mậu khẩu thất bại!", "Lỗi", true, 4);
             }
         }
         else
         {
             txtPassNew.Text = txtPassReplay.Text = "";
             XtraCustomMessageBox.Show("Mật khẩu mới và xác nhận không hợp lệ. Vui lòng nhập lại!", "Cảnh báo", true, 3);
         }
     }
     else
     {
         XtraCustomMessageBox.Show("Sai mật khẩu. Vui lòng nhập lại!", "Cảnh báo", true, 3);
     }
 }
예제 #5
0
 private void dateRevenueValue_EditValueChanged(object sender, EventArgs e)
 {
     if (dateMonthYear.DateTime > DateTime.Now)
     {
         XtraCustomMessageBox.Show("Ngày báo cáo không được lớn hơn ngày hiện tại!", "Thông báo", true, 2);
         dateMonthYear.EditValue = null;
     }
 }
예제 #6
0
 private void spinDeposit_EditValueChanged(object sender, EventArgs e)
 {
     if (spinDeposit.Value > spintotalEstimate.Value)
     {
         XtraCustomMessageBox.Show("Số tiền đặt cọc không thể lơn hơn số tiền ước tính!", "Thông báo", true, 4);
         spinDeposit.Value = spintotalEstimate.Value;
     }
 }
예제 #7
0
        private void btnAddInListServiceDetail_Click(object sender, EventArgs e)
        {
            if (spQuantity.Value == 0)
            {
                XtraCustomMessageBox.Show("Số lượng dịch vụ phải lớn hơn 0", "Lỗi", true, 4);
                spQuantity.Focus();
                return;
            }
            //try
            //{
            DataRow _rowValue = serviceDetailDataTable.NewRow();

            _rowValue["ServicesID"]    = txtServiceId.Text.Trim();
            _rowValue["ServicesName"]  = txtServiceName.Text;
            _rowValue["OrderDetailID"] = lblOrderValue.Text;
            _rowValue["Quantity"]      = spQuantity.Value;
            _rowValue["Price"]         = spPrices.Value;
            _rowValue["Monetized"]     = Math.Round(spAmount.Value);
            if (serviceDetailDataTable.Rows.Count != 0)
            {
                if (serviceDetailDataTable.Rows.Contains(txtServiceId.Text.Trim()))
                {
                    if (XtraMessageBox.Show("Dịch vụ này đã tồn tại trong danh sách!\nBạn có muốn cập nhật thông tin hay không?",
                                            "Thông báo",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Warning).Equals(DialogResult.Yes))
                    {
                        for (int i = 0; i < listServiceDetailObject.Count; i++)
                        {
                            if (listServiceDetailObject[i].ServicesID == txtServiceId.Text.Trim())
                            {
                                listServiceDetailObject.Remove(listServiceDetailObject[i]);
                            }
                        }
                        serviceDetailDataTable.Rows.Remove(serviceDetailDataTable.Rows.Find(txtServiceId.Text.Trim()));
                    }
                    else
                    {
                        return;
                    }
                }
            }
            serviceDetailDataTable.Rows.Add(_rowValue);
            gvServiceDetail.DataSource = serviceDetailDataTable;
            listServiceDetailObject.Add(new DTOServiceDetail(_rowValue["OrderDetailID"].ToString().Trim(), _rowValue["ServicesID"].ToString().Trim(), Int32.Parse(_rowValue["Quantity"].ToString()), Int32.Parse(_rowValue["Monetized"].ToString())));

            updateEnableButtonAndResetValueOfControl(ref btnAddInListServiceDetail);

            //Chỗ này lỗi ko sum dc
            txtTotalMoney.Text = grdvServiceDetail.Columns["Monetized"].SummaryItem.SummaryValue.ToString();
            //}//
            //catch (System.Exception)
            //{

            //}
        }
예제 #8
0
        private void SaveDataToDatabase()
        {
            if (!checkData())
            {
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    String roomName     = Utils.standardNamePerson(txtRoomName.Text);
                    String roomType     = lkRoomType.EditValue.ToString();
                    int    numberOfBeds = Int32.Parse(spNumberOfBeds.Value.ToString());
                    String Description  = rtxtDecription.Text;
                    String status       = lkStatus.EditValue.ToString();

                    roomObject = new DTORoom("PH00000000", roomName, roomType, numberOfBeds, Description, status);

                    if (roomBUS.InsertRoom(roomObject))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    String roomName     = Utils.standardNamePerson(txtRoomName.Text);
                    String roomType     = lkRoomType.EditValue.ToString();
                    int    numberOfBeds = Int32.Parse(spNumberOfBeds.Value.ToString());
                    String Description  = rtxtDecription.Text;
                    String status       = lkStatus.EditValue.ToString();

                    roomObject = new DTORoom(txtRoomId.Text, roomName, roomType, numberOfBeds, Description, status);

                    if (roomBUS.UpdateRoom(roomObject))
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
            }
            catch (System.Exception ex)
            {
                XtraCustomMessageBox.Show(ex.ToString(), "Lỗi", true, 3);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }
        /*
        * Type: 1: information
        * Type: 2: Question
        * Type: 3: Warning
        * Type: 4: Error
        * */
        public static DialogResult Show(String Text, String Caption, bool useDefault, int iType)
        {
            m_message = new XtraCustomMessageBox();
            m_message.labInfo.Text = Text;
            m_message.StartPosition = FormStartPosition.CenterParent;
            if (m_message.labInfo.Location.Y + m_message.labInfo.Height > m_message.panelView.Location.Y + m_message.panelView.Height)
                m_message.Height = m_message.Height + m_message.labInfo.Location.Y + m_message.labInfo.Height - m_message.panelView.Location.Y - m_message.panelView.Height;
            m_message.Text = Caption;
            if (useDefault)
            {
                m_message.btnYes.Location = m_message.btnOK.Location;
                m_message.btnNo.Visible = false;
                m_message.btnOK.Visible = false;
                m_message.btnYes.Text = "Vâng";
            }
            //Image for Dialog
            switch (iType)
            {
                case 1://Information
                    m_message.picBoxImageShow.Image = Properties.Resources.ic_information;
                    m_message.btnOK.Visible = true;
                    m_message.btnYes.Visible = false;
                    m_message.btnNo.Visible = false;
                    break;
                case 2://Question
                    m_message.picBoxImageShow.Image = Properties.Resources.ic_question;
                    //m_message.btnYes.Location = m_message.btnOK.Location;
                    m_message.btnOK.Visible = false;
                    m_message.btnYes.Visible = true;
                    m_message.btnNo.Visible = true;
                    break;
                case 3://Warning
                    m_message.picBoxImageShow.Image = Properties.Resources.ic_warning_circle;
                    m_message.btnOK.Visible = true;
                    m_message.btnYes.Visible = false;
                    m_message.btnNo.Visible = false;
                    break;
                case 4://Error
                    m_message.picBoxImageShow.Image = Properties.Resources.ic_error;
                    m_message.btnOK.Visible = true;
                    m_message.btnYes.Visible = false;
                    m_message.btnNo.Visible = false;
                    break;
                case 0:
                    m_message.picBoxImageShow.Image = null;
                    m_message.btnOK.Visible = true;
                    m_message.btnYes.Visible = false;
                    m_message.btnNo.Visible = false;
                    break;
            }

            m_message.ShowDialog();
            return m_result;
        }
예제 #10
0
        private void SaveDataToDatabase()
        {
            if (!checkData())
            {
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    String servicesName = Utils.standardNamePerson(txtServicesName.Text);
                    String servicesType = lkServicesType.EditValue.ToString();
                    String unit         = lkUnit.EditValue.ToString();
                    int    price        = Int32.Parse(spPrice.Value.ToString());

                    servicesObject = new DTOServices("DV00000000", servicesName, servicesType, unit, price);

                    if (servicesBUS.InsertServices(servicesObject))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    String servicesName = Utils.standardNamePerson(txtServicesName.Text);
                    String servicesType = lkServicesType.EditValue.ToString();
                    String unit         = lkUnit.EditValue.ToString();
                    int    price        = Int32.Parse(spPrice.Value.ToString());

                    servicesObject = new DTOServices(txtServicesId.Text, servicesName, servicesType, unit, price);

                    if (servicesBUS.UpdateServices(servicesObject))
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
            }
            catch (System.Exception ex)
            {
                XtraCustomMessageBox.Show(ex.ToString(), "Lỗi", true, 3);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }
예제 #11
0
 private void frmUnit_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (btnSave.Enabled)
     {
         if (XtraCustomMessageBox.Show("Dữ liệu chưa được lưu!\nBạn có thực sự muốn thoát hay không?", "Cảnh báo", false, 3) == DialogResult.No)
         {
             e.Cancel = true;
             return;
         }
     }
 }
예제 #12
0
 private void dateStart_EditValueChanged(object sender, EventArgs e)
 {
     if (!CheckInformationEntered.checkDate(dateStart.DateTime, DateTime.Now))
     {
         if (dateStart.EditValue != null)
         {
             dateStart.EditValue = DateTime.Now;
             XtraCustomMessageBox.Show("Ngày đến không được nhỏ hơn ngày hiện tại! \nXin vui lòng nhập lại", "Thông báo", true, 4);
         }
     }
 }
예제 #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!checkData())
            {
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    String _user = createUserName(txtStaffName.Text, dateBirthDay.DateTime.ToString());
                    String _pass = Utils.GetMD5("123456789");

                    staffObject = new DTOStaff("NV000000", txtStaffName.Text, cmbStaffGender.Text, dateBirthDay.DateTime, txtStaffAddress.Text, txtStaffPhone.Text, txtStaffEmail.Text,
                                               dateToWork.DateTime, lkStaffCharge.EditValue.ToString(), _user, _pass);

                    if (staffBUS.InsertStaff(staffObject))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    staffObject = new DTOStaff(txtStaffId.Text, txtStaffName.Text, cmbStaffGender.Text, dateBirthDay.DateTime,
                                               txtStaffAddress.Text, txtStaffPhone.Text, txtStaffEmail.Text,
                                               dateToWork.DateTime, lkStaffCharge.EditValue.ToString(), null, null);

                    if (staffBUS.UpdateStaffNoUsernamePassword(staffObject))
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!\nVui lòng thiết lập quyền truy cập hệ thống cho nhân viên '" + staffObject.Name + "'!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
            }
            catch (System.Exception)
            {
                XtraCustomMessageBox.Show("Lưu dữ liệu thất bại!", "Lỗi", true, 4);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }
예제 #14
0
        private void SaveDataToDatabase()
        {
            if (!checkData())
            {
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    String  roomTypeName   = Utils.standardNamePerson(txtRoomTypeName.Text);
                    decimal roomTypePrices = Math.Round(spPrices.Value);
                    roomTypeObject = new DTORoomType("LP00000000", roomTypeName, roomTypePrices);

                    if (roomTypeBUS.InsertRoomType(roomTypeObject))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    String  roomTypeName   = Utils.standardNamePerson(txtRoomTypeName.Text);
                    decimal roomTypePrices = Math.Round(spPrices.Value);
                    roomTypeObject = new DTORoomType(txtRoomTypeId.Text, roomTypeName, roomTypePrices);

                    if (roomTypeBUS.UpdateRoomType(roomTypeObject))
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
            }
            catch (System.Exception ex)
            {
                XtraCustomMessageBox.Show(ex.ToString(), "Lỗi", true, 3);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }
예제 #15
0
 private void btnView_Click(object sender, EventArgs e)
 {
     if (!CheckData())
     {
         XtraCustomMessageBox.Show("Vui lòng chọn thời gian lập báo cáo!", "Thông báo", true, 2);
     }
     else
     {
         //
         ReportByDate();
         //
         revenueReport.DataSource      = revenueDataTable;
         docRevenueView.PrintingSystem = revenueReport.PrintingSystem;
         revenueReport.CreateDocument();
     }
 }
예제 #16
0
 private void dateTo_EditValueChanged(object sender, EventArgs e)
 {
     if (dateTo.DateTime > DateTime.Now)
     {
         XtraCustomMessageBox.Show("Ngày kết thúc không được lớn hơn ngày hiện tại!", "Thông báo", true, 2);
         dateTo.EditValue = null;
     }
     if (!dateFrom.Text.Equals(""))
     {
         if (dateFrom.DateTime > dateTo.DateTime)
         {
             XtraCustomMessageBox.Show("Ngày kết thúc không được nhỏ hơn ngày bắt đầu!", "Thông báo", true, 2);
             dateFrom.EditValue = null;
         }
     }
 }
예제 #17
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!checkData())
            {
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    customerObject = new DTOCustomer("KH000000", txtCustomerName.Text, cmbCustomerGender.Text, dateBirthDay.DateTime,
                                                     txtCustomerAddress.Text, txtCustomerPhone.Text, txtCustomerEmail.Text, txtCMND.Text);

                    if (customerBUS.InsertCustomer(customerObject))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    customerObject = new DTOCustomer(txtCustomerId.Text, txtCustomerName.Text, cmbCustomerGender.Text, dateBirthDay.DateTime,
                                                     txtCustomerAddress.Text, txtCustomerPhone.Text, txtCustomerEmail.Text, txtCMND.Text);

                    if (customerBUS.UpdateCustomer(customerObject))
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
            }
            catch (System.Exception)
            {
                XtraCustomMessageBox.Show("Lưu dữ liệu thất bại!", "Lỗi", true, 4);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }
예제 #18
0
        private void SaveDataToDatabase()
        {
            if (!checkData())
            {
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    String unitName = Utils.standardNamePerson(txtUnitName.Text);
                    unitObject = new DTOUnit("DOV0000000", unitName);

                    if (unitBUS.InsertUnit(unitObject))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    String unitName = Utils.standardNamePerson(txtUnitName.Text);
                    unitObject = new DTOUnit(txtUnitId.Text, unitName);

                    if (unitBUS.UpdateUnit(unitObject))
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
            }
            catch (System.Exception ex)
            {
                XtraCustomMessageBox.Show(ex.ToString(), "Lỗi", true, 3);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }
예제 #19
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (unitMulitiSelect.Selection.Count == 0)
     {
         XtraCustomMessageBox.Show("Chưa có dòng dữ liệu nào được chọn!", "Thông báo", true, 1);
         return;
     }
     try
     {
         System.Collections.ArrayList _listunitObjectInDelibility = new System.Collections.ArrayList();
         foreach (object _rowObjectItem in unitMulitiSelect.Selection)
         {
             grdvListUnit.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             unitObject = new DTOUnit(_rowObjectDetail.Row["UnitID"].ToString(), _rowObjectDetail.Row["UnitName"].ToString());
             if (!unitBUS.DeleteUnit(unitObject.UnitID))
             {
                 _listunitObjectInDelibility.Add(_rowObjectDetail.Row["UnitID"]);
             }
         }
         String _erroContent = "Không thể xóa thông tin các thế loại sách có mã số: \n";
         if (_listunitObjectInDelibility.Count != 0)
         {
             foreach (var item in _listunitObjectInDelibility)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true, 4);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công", "Thông báo", true, 1);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại", "Lỗi", true, 4);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
예제 #20
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (customerMultiSelect.Selection.Count == 0)
     {
         XtraCustomMessageBox.Show("Chưa có dòng dữ liệu nào được chọn!", "Cảnh báo", true, 3);
         return;
     }
     try
     {
         ArrayList _listCustomerId = new ArrayList();
         grdvListCustomer.FocusedRowHandle -= 1;
         foreach (DataRowView _rowData in customerMultiSelect.Selection)
         {
             customerObject            = new DTOCustomer();
             customerObject.CustomerID = _rowData["CustomerID"].ToString();
             if (!customerBUS.DeleteCustomer(customerObject.CustomerID))
             {
                 _listCustomerId.Add(_rowData["CustomerID"]);
             }
         }
         if (_listCustomerId.Count != 0)
         {
             String _erroContent = "Không thể xóa các khách hàng có mã: \n";
             foreach (var item in _listCustomerId)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true, 4);
         }
         else
         {
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công!", "Thông báo", true, 1);
         }
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại", "Lỗi", true, 4);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
예제 #21
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            roomMulitiSelect.ClearSelection();
            roomResultDataTable = roomBUS.GetAllRoomByDateFromTo(dateStart.DateTime, dateEnd.DateTime);
            if (roomResultDataTable == null || roomResultDataTable.Rows.Count == 0)
            {
                XtraCustomMessageBox.Show("Không tìm thấy dữ liệu nào!", "Thông báo", true, 1);
                return;
            }
            string[] roomTypeIDs = (chkCmbRoomTypeName.EditValue.ToString()).Split(',');
            if (roomTypeIDs.Count() == 0)
            {
                XtraCustomMessageBox.Show("Bạn chưa chọn loại phòng!", "Thông báo", true, 1);
                return;
            }
            string expression = "RoomTypeID IN(";

            for (int i = 0; i < roomTypeIDs.Count(); ++i)
            {
                expression += "'" + roomTypeIDs[i].Trim() + "'";
                if (i < roomTypeIDs.Count() - 1)
                {
                    expression += ",";
                }
            }
            expression += ")";
            DataRow[] foundRows;
            foundRows = roomResultDataTable.Select(expression);
            //  DataRow newRow = roomResultDataTable.NewRow();
            roomResultDataTableClone = roomResultDataTableClone.Clone();
            foreach (DataRow row in foundRows)
            {
                if (!this.checkRowValue(ref roomSelectsDataTable, row))
                {
                    DataRow newRow = this.copyToRow(row, ref roomResultDataTableClone, false);
                    roomResultDataTableClone.Rows.Add(newRow);
                }
            }
            roomResultDataTableClone       = DataTableCustomize.AutoNumberedTable(roomResultDataTableClone);
            grdSearchRoomResult.DataSource = roomResultDataTableClone;
        }
예제 #22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            staffDTO          = frmHomePage.staffLogin;
            staffDTO.Name     = Utils.standardNamePerson(txtStaffName.Text.Trim());
            staffDTO.Phone    = txtStaffPhone.Text.Trim();
            staffDTO.Email    = txtStaffEmail.Text.Trim();
            staffDTO.Birthday = dateBirthDay.DateTime;
            staffDTO.Address  = Utils.standardNamePerson(txtStaffAddress.Text.Trim());
            staffDTO.Gender   = cmbStaffGender.Text.Trim();

            if (staffBUS.UpdateStaffNoUsernamePassword(staffDTO))
            {
                XtraCustomMessageBox.Show("Cập nhật thành công!", "Thông báo", false, 1);
                frmHomePage.staffLogin = staffDTO;
                InitDisplay(false);
                InitfrmInfoStaff();
            }
            else
            {
                XtraCustomMessageBox.Show("Cập nhật thất bại!", "Lỗi", false, 4);
            }
        }
예제 #23
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ruleObject1 = new DTORule("1", "DoTuoiNhanVienToiThieu", spMinimumAge.Value.ToString());
            ruleObject2 = new DTORule("2", "DoTuoiNhanVienToiDa", spMaximumAge.Value.ToString());
            //
            ruleObject3 = new DTORule("3", "ThueTNDN", spTax.Value.ToString());
            //
            ruleObject4  = new DTORule("4", "TenKhachSan", txtNameSystem.Text.Trim());
            ruleObject5  = new DTORule("5", "DiaChi", txtAddress.Text.Trim());
            ruleObject6  = new DTORule("6", "Email", txtEmail.Text.Trim());
            ruleObject7  = new DTORule("7", "DienThoai", txtPhone.Text.Trim());
            ruleObject8  = new DTORule("8", "Fax", txtFaxNumber.Text.Trim());
            ruleObject9  = new DTORule("9", "MaSoThue", txtTaxId.Text.Trim());
            ruleObject10 = new DTORule("10", "Website", txtWebsite.Text.Trim());

            if (ruleBUS.UpdateRule(ruleObject1) && ruleBUS.UpdateRule(ruleObject2) &&
                ruleBUS.UpdateRule(ruleObject3) && ruleBUS.UpdateRule(ruleObject4) &&
                ruleBUS.UpdateRule(ruleObject5) && ruleBUS.UpdateRule(ruleObject6) &&
                ruleBUS.UpdateRule(ruleObject7) && ruleBUS.UpdateRule(ruleObject8) &&
                ruleBUS.UpdateRule(ruleObject9) && ruleBUS.UpdateRule(ruleObject10))
            {
                XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true, 1);
            }
            else
            {
                XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
            }

            //
            btnCancelUpdate.Enabled = false;
            btnCancelUpdate.Visible = false;
            btnUpdate.Visible       = true;
            btnUpdate.Enabled       = true;
            btnSave.Enabled         = false;
            //
            btnCancelUpdate_Click(null, null);
        }
예제 #24
0
        private DataRow copyToRow(DataRow sourceRow, ref DataTable destDataTable, bool isListRoomTable)
        {
            DataRow newRow = destDataTable.NewRow();

            newRow["RoomID"]       = sourceRow["RoomID"];
            newRow["RoomName"]     = sourceRow["RoomName"];
            newRow["RoomTypeName"] = sourceRow["RoomTypeName"];
            newRow["NumberOfBeds"] = sourceRow["NumberOfBeds"];
            newRow["StatusName"]   = sourceRow["StatusName"];
            newRow["Price"]        = sourceRow["Price"];
            if (isListRoomTable)
            {
                newRow["StartDate"] = dateStart.DateTime;
                newRow["EndDate"]   = dateEnd.DateTime;
                double dateDiff = (dateEnd.DateTime - dateStart.DateTime).Days;
                object price    = newRow["Price"];
                try
                {
                    if (price != null && price.ToString().Trim() != "")
                    {
                        newRow["Monetized"] = ((dateDiff == 0) ? 1 : dateDiff + 1) * int.Parse(price.ToString().Trim());
                    }
                    else
                    {
                        newRow["Monetized"] = 0;
                    }
                }
                catch (Exception)
                {
                    newRow["Monetized"] = 0;
                    XtraCustomMessageBox.Show("Thông báo", "Bạn chưa thiết lập giá phòng!", true, 4);
                    throw;
                }
            }
            return(newRow);
        }
예제 #25
0
 private void bbtnLogout_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (xtraTabbedMdiManagerMenu.FloatForms.Count != 0)
     {
         XtraCustomMessageBox.Show("Vui lòng đóng tất cả các của sổ trước khi đăng xuất!", "Thông báo", false, 1);
     }
     else
     {
         DialogResult rs = XtraCustomMessageBox.Show("Bạn có muốn đăng xuất khỏi hệ thông?", "Thông báo", false, 2);
         if (rs == DialogResult.Yes)
         {
             new frmLogin().Show();
             staffLogin        = null;
             rolePermissionObj = null;
             //
             this.Dispose();
             this.Close();
         }
         else
         {
             return;
         }
     }
 }
예제 #26
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            updateEnableButtonAndResetValueOfControl(ref btnSave);
            try
            {
                serviceDetailBUS.DeleteAllServiceDetailByOrderID(lblOrderValue.Text.Trim());
                int Total = 0;
                for (int i = 0; i < listServiceDetailObject.Count; i++)
                {
                    listServiceDetailObject[i].ServicesDetailID = "DVC0000000";
                    listServiceDetailObject[i].OrderDetailID    = lblOrderValue.Text.Trim();
                    if (!serviceDetailBUS.InsertServiceDetail(listServiceDetailObject[i]))
                    {
                        XtraCustomMessageBox.Show("Thêm thất bại dịch vụ có mã: " + listServiceDetailObject[i].ServicesID, "Lỗi", true, 1);
                    }
                    else
                    {
                        Total += listServiceDetailObject[i].Total;
                    }
                }

                orderDetailBUS.UpdateServiceMoneyOrderDetailById(lblOrderValue.Text.Trim(), Total);
                orderBUS.UpdateTotalOrderById(orderDetailBUS.GetOrderIDByOrderDetailID(lblOrderValue.Text.Trim()).Trim());
                orderDetailDataTable   = orderDetailBUS.GetAllOrderDetailFromNow();
                gvRoomOrder.DataSource = orderDetailDataTable;
                //Cập nhật controls của form
                updateEnableButtonAndResetValueOfControl(ref btnSave);

                XtraCustomMessageBox.Show("Ghi dữ liệu thành công!", "Thông báo", true, 1);
                listServiceDetailObject.Clear();
            }
            catch (System.Exception)
            {
                XtraCustomMessageBox.Show("Không thể ghi dữ liệu!", "Lỗi", true, 4);
            }
        }
예제 #27
0
        private void SaveDataToDatabase()
        {
            if (!checkData())
            {
                return;
            }
            if (roomSelectsDataTable.Rows.Count <= 0)
            {
                XtraCustomMessageBox.Show("Bạn chưa chọn phòng!", "Thông báo", false, 4);
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    String   customerID     = lkCustomer.EditValue.ToString();
                    String   staffID        = "NV000001";//Utils.standardNamePerson(frmHomePage.staffLogin.StaffID);
                    DateTime orderOfDate    = DateTime.Now;
                    int      numberOfPeople = (int)spinTotalPeople.Value;
                    int      estimate       = (int)spintotalEstimate.Value;
                    int      deposit        = (int)spinDeposit.Value;
                    int      total          = 0;
                    int      orderStatus    = (int)ORDERSTATUS.UNPAID;
                    dtoOrder = new DTOOrder("DP0000000",
                                            customerID,
                                            staffID,
                                            orderOfDate,
                                            numberOfPeople,
                                            estimate,
                                            deposit,
                                            total,
                                            orderStatus);

                    if (orderBUS.InsertOrder(dtoOrder))
                    {
                        //XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                        String   orderMaxID     = orderBUS.GetOrderMaxID();
                        DateTime dateStartValue = dateStart.DateTime;
                        DateTime dateEndValue   = dateEnd.DateTime;
                        String   roomID         = "";
                        int      estimateValue  = 0;
                        int      serviceMoney   = 0;
                        foreach (DataRow row in roomSelectsDataTable.Rows)
                        {
                            roomID = row["RoomID"].ToString();
                            try
                            {
                                estimateValue = int.Parse(row["Monetized"].ToString().Trim());
                            }
                            catch (Exception)
                            {
                                estimateValue = 0;
                                throw;
                            }
                            serviceMoney = 0;

                            DTOOrderDetail dtoOderDetail = new DTOOrderDetail("CDP0000000",
                                                                              orderMaxID,
                                                                              roomID,
                                                                              dateStartValue,
                                                                              dateEndValue,
                                                                              estimateValue,
                                                                              serviceMoney);
                            if (!orderDetailBUS.InsertOrderDetails(dtoOderDetail))
                            {
                                //Khi them chi tiet that bai
                                //Xoa du lieu hien tai
                                orderDetailBUS.DeleteOrderDetails(orderMaxID);
                                orderBUS.DeteleOrder(orderMaxID);
                                XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);

                                return;
                            }
                        }
                        //Update button view
                        btnChangeToView.Enabled = true;
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    String   orderID        = "";
                    String   customerID     = lkCustomer.EditValue.ToString();
                    String   staffID        = "NV000001";// frmHomePage.staffLogin.StaffID;
                    DateTime orderOfDate    = DateTime.Now;
                    int      numberOfPeople = (int)spinTotalPeople.Value;
                    int      estimate       = (int)spintotalEstimate.Value;
                    int      deposit        = (int)spinDeposit.Value;
                    int      total          = estimate;
                    int      orderStatus    = (int)ORDERSTATUS.UNPAID;
                    dtoOrder = new DTOOrder(orderID,
                                            customerID,
                                            staffID,
                                            orderOfDate,
                                            numberOfPeople,
                                            estimate,
                                            deposit,
                                            total,
                                            orderStatus);

                    if (orderBUS.UpdateOrder(dtoOrder))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
            }
            catch (System.Exception ex)
            {
                XtraCustomMessageBox.Show(ex.ToString(), "Lỗi", true, 3);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }