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(); } }
public bool Save(Entity.Model.Asset asset) { IAssetComponent component = new AssetComponent(); try { component.Save(asset); } catch (Exception ex) { throw new FaultException(ex.Message); } return true; // throw new NotImplementedException(); }
public IEnumerable<Entity.Model.Asset> GetList(bool Enabled) { IAssetComponent component = new AssetComponent(); IEnumerable<Asset> result = null; if (Enabled) { result = component.GetEnabledList(); } else { result = component.GetList(); } return result; // throw new NotImplementedException(); }
protected void Button3_Click(object sender, EventArgs e) { try { using (IAssetComponent assetservice = new AssetComponent()) { Asset myasset = new Asset(); myasset.ID = int.Parse(txtassetID.Text); myasset = assetservice.SelectAsset(myasset); txtroomid.Text = myasset.RoomID.ToString(); txtname.Text = myasset.Name; CheckBox1.Checked = myasset.IsEnabled; } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { IAssetComponent assetservice = new AssetComponent(); GridView1.DataSource = assetservice.GetList(); GridView1.DataBind(); }