Ejemplo n.º 1
0
        private void EditFormRoom_Load(object sender, EventArgs e)
        {
            this.cbRoomType.SelectedIndexChanged -= new EventHandler(CbRoomType_SelectedIndexChanged);
            this.cbRoomType.DataSource = RoomTypeBUS.GetRoomTypeList();
            this.cbRoomType.DisplayMember = "MaLoaiPhong";

            DataTable dt = RoomStatusBUS.GetRoomStatusList();
            Dictionary<string, string> status = new Dictionary<string, string>();
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["TenTinhTrang"].ToString() != "Thuê")
                {
                    status.Add(dr["TenTinhTrang"].ToString(), dr["MaTinhTrang"].ToString());
                }
            }

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

            switch (this.Tag)
            {
                case "AddForm":
                    {
                        this.lbRoomHeader.Text = this.Text = "THÊM THÔNG TIN PHÒNG";
                        this.cbRoomType.SelectedIndex = 0;
                        this.cbRoomStatus.SelectedIndex = 0;
                        break;
                    }

                case "EditForm":
                    {
                        MainForm mainForm = (MainForm)Owner;
                        var room = mainForm.GetSelectedRoom();

                        this.LoadSelectedRoomData(room);
                        this.lbRoomHeader.Text = this.Text = "THAY ĐỔI THÔNG TIN PHÒNG";
                        this.tbRoomID.ReadOnly = true;
                        this.tbRoomID.TabStop = false;
                        break;
                    }
            }

            this.lbRoomHeader.Left = (this.ClientSize.Width - lbRoomHeader.Size.Width) / 2 + 32;
            this.imgEditRoom.Left = this.lbRoomHeader.Left - 45;
            this.tbRoomPrice.Text = Convert.ToInt64(RoomTypeBUS.GetRoomPriceByType(cbRoomType.Text)).ToString("N0") + " VND";
            this.cbRoomType.SelectedIndexChanged += new EventHandler(CbRoomType_SelectedIndexChanged);
        }
Ejemplo n.º 2
0
 private void CbFindRoomType_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         var RoomType = cbFindRoomType.Text;
         if (RoomType != "Tất cả loại phòng")
         {
             this.cbFindRoomPrice.Text = RoomTypeBUS.GetRoomPriceByType(RoomType).ToString("N0") + " VND";
         }
         else
         {
             this.cbFindRoomPrice.Text = "Tất cả đơn giá";
         }
     }
     catch (Exception) { }
 }
Ejemplo n.º 3
0
 private void CbRoomType_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.tbRoomPrice.Text = Convert.ToInt64(RoomTypeBUS.GetRoomPriceByType(cbRoomType.Text)).ToString("N0") + " VND";
 }