private void btConfirm_Click(object sender, EventArgs e)
        {
            string  roomType = tbRoomType.Text.ToString().Trim();
            decimal price    = Convert.ToDecimal(nudPrice.Value);

            if (roomType == "" || roomType == null)
            {
                MessageBox.Show("不能有空!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (new BLL.RoomType().Exists(roomType))
                {
                    MessageBox.Show("房间已存在!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    Model.RoomType model = new Model.RoomType();
                    model.roomTypeID    = roomType;
                    model.roomTypePrice = price;
                    if (new BLL.RoomType().Add(model))
                    {
                        MessageBox.Show("添加成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ((Main_Admin)this.Owner).LoadData_RoomTypeInfo();
                        Main_Admin.roomType = new Model.RoomType();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("添加失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
示例#2
0
        private void dgvRoomType_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                roomType.roomTypeID = dgv.Rows[e.RowIndex].Cells[0].Value.ToString();
                string priceString = dgv.Rows[e.RowIndex].Cells[1].Value.ToString();
                roomType.roomTypePrice = decimal.Parse(priceString.Remove(priceString.Length - 1));
            }
            else
            {
                roomType = new Model.RoomType();
                if (sortOrder == 0)
                {
                    dgv.Sort(dgv.Columns[e.ColumnIndex], ListSortDirection.Descending);
                    sortOrder++;
                }
                else
                {
                    dgv.Sort(dgv.Columns[e.ColumnIndex], ListSortDirection.Ascending);
                    sortOrder--;
                }
            }
        }
示例#3
0
        public List <Model.Room> GetAllRoomsByType(Model.RoomType roomType)
        {
            List <Model.Room> rooms       = GetAllRooms();
            List <Model.Room> roomsOfType = new List <Model.Room>();

            foreach (Model.Room r in rooms)
            {
                if (r.RoomType == roomType)
                {
                    roomsOfType.Add(r);
                }
            }
            return(roomsOfType);
        }
示例#4
0
        public void UpdateRoom(int roomId, String description, double area, Model.RoomType roomType)
        {
            List <Model.Room> rooms = GetAllRooms();

            foreach (Model.Room r in rooms)
            {
                if (r.RoomId == roomId)
                {
                    r.Description = description;
                    r.Area        = area;
                    r.RoomType    = roomType;
                    roomRepository.SaveRoom(rooms);
                    return;
                }
            }
        }
示例#5
0
        private void btConfirm_Click(object sender, EventArgs e)
        {
            Model.RoomType model = new Model.RoomType();
            model.roomTypeID    = tbRoomType.Text.ToString();
            model.roomTypePrice = nudPrice.Value;

            if (new BLL.RoomType().Update(model))
            {
                MessageBox.Show("修改成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ((Main_Admin)this.Owner).LoadData_RoomTypeInfo();
                Main_Admin.roomType = new Model.RoomType();
                this.Close();
            }
            else
            {
                MessageBox.Show("修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#6
0
        public void LoadData_RoomTypeInfo()
        {
            roomType   = new Model.RoomType();
            dsRoomType = new BLL.RoomType().GetListRoomType("");

            dgvRoomType.DataSource = dsRoomType.Tables["ds"];
            int columnNumber = dgvRoomType.ColumnCount;

            foreach (DataGridViewColumn col in dgvRoomType.Columns)
            {
                col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                col.SortMode   = DataGridViewColumnSortMode.NotSortable;
                col.FillWeight = 100 / columnNumber;
            }
            dgvRoomType.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvRoomType.AllowUserToAddRows = false;
            dgvRoomType.RowHeadersVisible  = false;
            dgvRoomType.ReadOnly           = true;
        }
示例#7
0
 private void Button_Click_Ok(object sender, RoutedEventArgs e)
 {
     if (tbuDescription.Text == "" || tbuDescription.Text == null || tbuArea.Text == "" || tbuArea.Text == null ||
         cbRoomType.Text == "")
     {
         MessageBox.Show("Niste popunili sva polja!", "Upozorenje!", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         roomList = new RoomList();
         int            rID         = int.Parse(lbuID.Content.ToString());
         double         area        = double.Parse(tbuArea.Text);
         String         description = tbuDescription.Text;
         Model.RoomType rt          = (Model.RoomType)Enum.Parse(typeof(Model.RoomType), cbRoomType.Text);
         roomList.control.UpdateRoom(rID, description, area, rt);
         roomList.Load();
         roomList.Show();
         this.Close();
         MessageBox.Show("Uspešno ste izmenili salu!", "Uspešno!", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
 //submit button
 private void btnsubmit_Click(object sender, EventArgs e)
 {
     Model.RoomType rt = new Model.RoomType();
     rt.rTypeName = txtroomtype.Text;
     try
     {
         rt.rTypePrice = Convert.ToDecimal(txtprice.Text);
     }
     catch
     {
         MessageBox.Show("input right number");
         return;
     }
     rt.rTypeRemark = txtRemark.Text;
     if (rtm.Insert(rt) > 0)
     {
         MessageBox.Show("add successfully");
     }
     LoadList("normal");
     panel1.Visible = false;
 }
示例#9
0
 public List <Model.Room> GetAllRoomsByType(Model.RoomType roomType)
 {
     return(roomService.GetAllRoomsByType(roomType));
 }
示例#10
0
 public void UpdateRoom(int roomId, String description, double area, Model.RoomType roomType)
 {
     roomService.UpdateRoom(roomId, description, area, roomType);
 }