public partial classPages_ItemDetail_EditItemDetail : BasePage
{protected override voidOnInit(EventArgs e)
{base.OnInit(e);this.IsFunctionControl = true;this.FunctionID = "ItemDetail/Edit";
}private voidBindData()
{try{string id = Request.QueryString["ID"];if(!string.IsNullOrEmpty(id))
{
ItemDetailInfo info= BLLFactory.Instance.FindByID(id);if(info != null)
{this.txtItemNo.Text =info.ItemNo;this.txtItemName.Text =info.ItemName;this.txtManufacture.Text =info.Manufacture;this.txtMapNo.Text =info.MapNo;this.txtSpecification.Text =info.Specification;this.txtMaterial.Text =info.Material;this.txtItemBigType.Text =info.ItemBigType;this.txtItemType.Text =info.ItemType;this.txtUnit.Text =info.Unit;this.txtPrice.Text =info.Price.ToString();this.txtSource.Text =info.Source;this.txtStoragePos.Text =info.StoragePos;this.txtUsagePos.Text =info.UsagePos;this.txtNote.Text =info.Note;this.txtWareHouse.Text =info.WareHouse;this.txtDept.Text =info.Dept;
}
}
}catch(Exception ex)
{
Helper.ShowError(this, ex, false);return;
}
}protected void Page_Load(objectsender, EventArgs e)
{if(!this.IsPostBack)
{
BindData();
}
}///
///获取数据///
privateItemDetailInfo SetData(ItemDetailInfo info)
{
info.ItemNo= this.txtItemNo.Text;
info.ItemName= this.txtItemName.Text;
info.Manufacture= this.txtManufacture.Text;
info.MapNo= this.txtMapNo.Text;
info.Specification= this.txtSpecification.Text;
info.Material= this.txtMaterial.Text;
info.ItemBigType= this.txtItemBigType.Text;
info.ItemType= this.txtItemType.Text;
info.Unit= this.txtUnit.Text;
info.Price= Helper.SafeConvertDecimal(this.txtPrice.Text);
info.Source= this.txtSource.Text;
info.StoragePos= this.txtStoragePos.Text;
info.UsagePos= this.txtUsagePos.Text;
info.Note= this.txtNote.Text;
info.WareHouse= this.txtWareHouse.Text;
info.Dept= this.txtDept.Text;returninfo;
}protected void imgSubmit_Click(objectsender, ImageClickEventArgs e)
{try{string id = Request.QueryString["ID"];if(string.IsNullOrEmpty(id))
{
ItemDetailInfo info= newItemDetailInfo();
SetData(info);
BLLFactory.Instance.Insert(info);
}else{
ItemDetailInfo info= BLLFactory.Instance.FindByID(id);if(info != null)
{
SetData(info);
BLLFactory.Instance.Update(info, id);
}
}
}catch(Exception ex)
{
Helper.ShowError(this, ex, false);return;
}
Response.Redirect("ListItemDetail.aspx");
}protected void imgBack_Click(objectsender, ImageClickEventArgs e)
{
Response.Redirect("ListItemDetail.aspx");
}
}