private void LoadGoodsType() { Entities.GoodsType goodsType = RetrieveGoodsType(); if (goodsType != null) { txtDescription.Text = goodsType.Description; txtShortCode.Text = goodsType.ShortCode; chkHazardous.Checked = goodsType.IsHazardous; chkDefault.Checked = goodsType.IsDefault; btnAdd.Text = "Update Goods Type"; } }
void btnAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { Entities.GoodsType goodsType = PopulateGoodsType(); if (_goodsTypeId > 0) { Facade.GoodsType.Update(goodsType, ((Entities.CustomPrincipal)Page.User).UserName); } else { Facade.GoodsType.Create(goodsType, ((Entities.CustomPrincipal)Page.User).UserName); } Response.Redirect("ListGoodsTypes.aspx"); } }
private Entities.GoodsType PopulateGoodsType() { Entities.GoodsType goodsType; if (_goodsTypeId > 0) { goodsType = RetrieveGoodsType(); } else { goodsType = new Entities.GoodsType(); } goodsType.Description = txtDescription.Text; goodsType.ShortCode = txtShortCode.Text; goodsType.IsDefault = chkDefault.Checked; goodsType.IsHazardous = chkHazardous.Checked; return(goodsType); }
private Entities.GoodsType RetrieveGoodsType() { Entities.GoodsType goodsType = Facade.GoodsType.GetForGoodsTypeId(_goodsTypeId); return(goodsType); }