protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RoomComponent roomServ = new RoomComponent();

                ddlRoom.DataSource = roomServ.GetEnabledList();
                ddlRoom.DataTextField = "Name";
                ddlRoom.DataValueField = "ID";
                ddlRoom.DataBind();

                ddlRoom.Items.Insert(0,new ListItem("- Please Select -", "", true));

                AssetComponent assetServ = new AssetComponent();

                List<Asset> assetLst = assetServ.GetEnabledList();
                Session["AllAsset"] = assetLst;

                lstAssetList.DataSource = assetLst;
                lstAssetList.DataTextField = "Name";
                lstAssetList.DataValueField = "ID";
                lstAssetList.DataBind();

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            IRoomComponent roomservice = new RoomComponent();
            GridView1.DataSource = roomservice.GetList();
            GridView1.DataBind();

        }
 public void Delete(Room room)
 {
     IRoomComponent component = new RoomComponent();
     try
     {
         component.Delete(room);
     }
     catch (Exception e)
     {
         throw new FaultException(e.Message);
     }
 }
 public Room Save(Room room)
 {
     IRoomComponent component = new RoomComponent();
     try
     {
         component.Save(room);
     }
     catch (Exception e)
     {
         throw new FaultException(e.Message);
     }
     return room;
 }
 public IEnumerable<Room> GetList(bool enabledOnly)
 {
     IRoomComponent component = new RoomComponent();
     IEnumerable<Room> results = null;
     if (enabledOnly)
     {
         results = component.GetEnabledList();
     }
     else
     {
         results = component.GetList();
     }
     return results;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblID.Text = "4";

                using (IRoomComponent roomService = new RoomComponent())
                {
                    Room room = new Room();
                    room = roomService.GetRoomByID(int.Parse(lblID.Text));

                    txtName.Text = room.Name;
                    txtLocation.Text = room.Location;
                    txtCapacity.Text = room.Capacity.ToString();
                    chkIsEnabled.Checked = room.IsEnabled;
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (IRoomComponent roomService = new RoomComponent())
                {
                    Room myRoom = new Room();
                    myRoom.Name = txtName.Text;
                    myRoom.Location = txtLocation.Text;
                    myRoom.Capacity = int.Parse(txtCapacity.Text);
                    myRoom.IsEnabled = chkIsEnabled.Checked;
                    roomService.Save(myRoom);
                    lblMessage.Text = "Success";

                }
            }
            catch (Exception)
            {
                lblMessage.Text = "Fail";
                throw;
            }
        }