using FineUIPro; using iWareCommon.Common.Entity; using iWareDataCore.BASE.Entity; using iWareDataCore.BASE.EnumType; using iWareDataCore.BASE.Service; using iWareWms; using System; using System.Collections.Generic; namespace iWareWms.View.MATERIAL.Material { /// /// 汪亮 /// 2019.07 /// 物料类型增加修改页面(弹窗) /// public partial class MaterialTypeDetail : PageBase { protected override void Save(out string msg) { MaterialTypeService.GetInstance().Save(GetMaterialType(), out msg); WriteLog("物料类型新增" + msg, "物料管理"); } protected override void Update(out string msg) { var type = GetMaterialType(); type.Id = Convert.ToInt32(Request.QueryString["Id"]); MaterialTypeService.GetInstance().Update(type, out msg); WriteLog("物料类型更新" + msg, "物料管理"); } private MaterialTypeEntity GetMaterialType() { return new MaterialTypeEntity { Name = tbName.Text.Trim(), Type = int.Parse(ddlType.SelectedValue), Remark = tbRemark.Text.Trim() }; } /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { foreach (var type in Enum.GetValues(typeof(EMaterialType))) { ddlType.Items.Add(type.ToString(), ((int)type).ToString()); } if (!string.IsNullOrEmpty(Request.QueryString["IsEdit"])) { string msg; var types = MaterialTypeService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Id", Request.QueryString["Id"] } } }, out msg); if (!string.IsNullOrEmpty(msg)) { Alert.ShowInTop(msg); return; } tbName.Text = types.Count > 0 ? types[0].Name : ""; tbRemark.Text = types.Count > 0 ? types[0].Remark : ""; ddlType.SelectedValue = types.Count > 0 ? types[0].Type.ToString() : "0"; } } } } }