Ejemplo n.º 1
0
        private void BtnConfirm_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.tbCustomerType.Text))
            {
                MessageBox.Show("Các thông tin không được để trống",
                    "THÊM LOẠI KHÁCH THẤT BẠI",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
            else
            {
                var customerType = this.tbCustomerType.Text;

                if (CustomerTypeBUS.InsertCustomerType(customerType))
                {
                    MessageBox.Show(
                    "Thêm loại khách " + customerType + " thành công!",
                    "THÊM LOẠI KHÁCH THÀNH CÔNG!",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);

                    var mainForm = (MainForm)Owner;
                    mainForm.ReLoadCustomerTypeList();
                    this.Close();
                }
                else
                {
                    MessageBox.Show(
                    "Loại khách " + customerType + " đã tồn tại!",
                    "THÊM LOẠI KHÁCH THẤT BẠI!",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 2
0
 private void BtnAddLeaseCustomer_Click(object sender, EventArgs e)
 {
     if (CustomerTypeBUS.GetCustomerTypeList().Rows.Count > 0)
     {
         if (this.dgvLeaseCustomer.Rows.Count == RoomBUS.GetMaxCustomerInRoom())
         {
             MessageBox.Show(
                 "Số khách trong phòng đã đạt mức tối đa!",
                 "THÊM KHÁCH THẤT BẠI",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Warning);
         }
         else
         {
             var CustomerForm = new CustomerForm();
             CustomerForm.Tag = "AddForm";
             CustomerForm.ShowDialog(this);
         }
     }
     else
     {
         MessageBox.Show(
             "Chưa có loại khách!",
             "THÊM KHÁCH THẤT BẠI",
             MessageBoxButtons.OK,
             MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 3
0
        private void BtnConfirm_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.tbNewCustomerType.Text))
            {
                MessageBox.Show("Các thông tin không được để trống",
                                "SỬA LOẠI KHÁCH THẤT BẠI",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
            else
            {
                var oldType = this.tbOldCustomerType.Text;
                var newType = this.tbNewCustomerType.Text;
                if (CustomerTypeBUS.UpdateCustomerType(oldType, newType))
                {
                    MessageBox.Show(
                        "Sửa loại khách thành công!",
                        "SỬA LOẠI KHÁCH THÀNH CÔNG!",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);

                    var mainForm = (MainForm)Owner;
                    mainForm.ReLoadCustomerTypeList();
                    this.Close();
                }
                else
                {
                    MessageBox.Show(
                        $"Loại khách {newType} đã tồn tại!",
                        "SỬA LOẠI KHÁCH THẤT BẠI!",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 4
0
 public void AddCustomer(RoomLeaseDetailDTO customer)
 {
     this.dgvLeaseCustomer.Rows.Add(
         customer.CustomerName,
         customer.CustomerTypeID,
         CustomerTypeBUS.GetCustomerTypeByID(customer.CustomerTypeID),
         customer.CustomerPassportID,
         customer.CustomerAddress);
 }
Ejemplo n.º 5
0
        public void ReLoadCustomerTypeList()
        {
            this.dgvCustomerType.DataSource = CustomerTypeBUS.GetCustomerTypeList();

            if (dgvCustomerType.Rows.Count > 0)
            {
                this.btnDelCustomerType.Enabled = this.btnEditCustomerType.Enabled = true;
            }
            else
            {
                this.btnDelCustomerType.Enabled = this.btnEditCustomerType.Enabled = false;
            }
        }
Ejemplo n.º 6
0
        //Tab 06: Room-Rule Edit
        private void ReLoadRuleRoom()
        {
            this.lbMaxCustomerValue.Text = RoomBUS.GetMaxCustomerInRoom().ToString();
            this.lbAdditionalCustomerSurchargeValue.Text = RoomLeaseBUS.GetOverCustomerTaxPercent().ToString() + "%";
            this.lbForeignCustomerSurchargeValue.Text    = RoomLeaseBUS.GetForeignCustomerTaxPercent().ToString() + "%";
            this.dgvCustomerType.DataSource = CustomerTypeBUS.GetCustomerTypeList();

            var dt = RoomTypeBUS.GetRoomTypeList();

            foreach (DataRow dr in dt.Rows)
            {
                this.dgvRoomType.Rows.Add
                    (dr["MaLoaiPhong"].ToString(),
                    Convert.ToInt64(dr["DonGia"]).ToString("N0"));
            }
        }
Ejemplo n.º 7
0
        public void EditCustomer(RoomLeaseDetailDTO customer)
        {
            this.dgvLeaseCustomer.CurrentRow.SetValues(
                customer.CustomerName,
                customer.CustomerTypeID,
                CustomerTypeBUS.GetCustomerTypeByID(customer.CustomerTypeID),
                customer.CustomerPassportID,
                customer.CustomerAddress);

            var row = this.dgvLeaseCustomer.CurrentRow;

            this.tbCustomerName.Text     = row.Cells["CustomerName"].Value.ToString();
            this.tbCustomerPassport.Text = row.Cells["CustomerPassportID"].Value.ToString();
            this.tbCustomerType.Text     = row.Cells["CustomerType"].Value.ToString();
            this.rtbCustomerAddress.Text = row.Cells["CustomerAddress"].Value.ToString();
        }
Ejemplo n.º 8
0
        private void BtnDelCustomerType_Click(object sender, EventArgs e)
        {
            var row          = this.dgvCustomerType.CurrentRow;
            var customerType = row.Cells["EditCustomerTypeName"].Value.ToString();

            if (customerType == "Nước ngoài")
            {
                MessageBox.Show(
                    "Không thể xoá loại khách 'Nước ngoài'!",
                    "XOÁ LOẠI KHÁCH THẤT BẠI",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                return;
            }

            var dialogResult = MessageBox.Show(
                "Bạn có muốn xoá loại khách '" + customerType + "'?",
                "XÁC NHẬN XOÁ LOẠI KHÁCH KHÁCH",
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Question);

            if (dialogResult == DialogResult.Yes)
            {
                if (CustomerTypeBUS.DeleteCustomerType(customerType))
                {
                    MessageBox.Show(
                        "Xoá loại khách " + customerType + " thành công!",
                        "XOÁ LOẠI PHÒNG THÀNH CÔNG",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);

                    this.ReLoadCustomerTypeList();
                }
                else
                {
                    MessageBox.Show(
                        "XOÁ LOẠI KHÁCH THẤT BẠI!",
                        "XOÁ LOẠI KHÁCH THẤT BẠI",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 9
0
        private void CustomerForm_Load(object sender, EventArgs e)
        {
            var dt = CustomerTypeBUS.GetCustomerTypeList();

            Dictionary <string, int> type = new Dictionary <string, int>();

            foreach (DataRow dr in dt.Rows)
            {
                type.Add(dr["TenLoaiKhach"].ToString(), Convert.ToInt32(dr["MaLoaiKhach"]));
            }

            this.cbCustomerType.DataSource    = new BindingSource(type, null);
            this.cbCustomerType.DisplayMember = "Key";
            this.cbCustomerType.ValueMember   = "Value";


            switch (this.Tag)
            {
            case "AddForm":
            {
                this.lbCustomerHeader.Text = this.Text = "THÊM THÔNG TIN KHÁCH";
                break;
            }

            case "EditForm":
            {
                MainForm mainForm = (MainForm)Owner;
                var      customer = mainForm.GetSelectedCustomer();

                this.lbCustomerHeader.Text   = this.Text = "THAY ĐỔI THÔNG TIN KHÁCH";
                this.tbCustomerName.Text     = customer.CustomerName;
                this.tbCustomerPassport.Text = customer.CustomerPassportID;
                this.cbCustomerType.Text     = CustomerTypeBUS.GetCustomerTypeByID(customer.CustomerTypeID);
                this.rtbCustomerAddress.Text = customer.CustomerAddress;
                break;
            }
            }
            this.lbCustomerHeader.Left = (this.ClientSize.Width - lbCustomerHeader.Size.Width) / 2 + 32;
            this.imgCustomer.Left      = this.lbCustomerHeader.Left - 45;
        }