public Order(PBM_Order m) { if (m != null) { FillModel(m.ID); } }
protected void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 ViewState["ID"] = Request.QueryString["ID"] != null?int.Parse(Request.QueryString["ID"]) : 0; #endregion BindDropDown(); if ((int)ViewState["ID"] != 0) { //修改 BindData(); } else { //新增 ViewState["Client"] = Request.QueryString["Client"] != null?int.Parse(Request.QueryString["Client"]) : 0; ViewState["Salesman"] = Request.QueryString["Salesman"] != null?int.Parse(Request.QueryString["Salesman"]) : 0; PBM_Order d = new PBM_Order(); d.Supplier = (int)Session["OwnerClient"]; d.Client = (int)ViewState["Client"]; d.SalesMan = (int)ViewState["Salesman"]; d.Classify = 1; pl_detail.BindData(d); ViewState["Details"] = new ListTable <PBM_OrderDetail>(new List <PBM_OrderDetail>(), "ID"); } } }
private void FillModel(int OrderID) { PBM_OrderBLL bll = new PBM_OrderBLL(OrderID); if (bll.Model == null) { ID = -1; return; } PBM_Order m = bll.Model; ID = m.ID; SheetCode = m.SheetCode; Supplier = m.Supplier; Client = m.Client; SalesMan = m.SalesMan; Classify = m.Classify; StandardPrice = m.StandardPrice; State = m.State; DiscountAmount = m.DiscountAmount; WipeAmount = m.WipeAmount; ActAmount = m.ActAmount; ArriveTime = m.ArriveTime; SubmitTime = m.SubmitTime; ConfirmTime = m.ConfirmTime; InsertTime = m.InsertTime; Remark = m.Remark; WorkList = m.WorkList; ApproveFlag = m.ApproveFlag; int.TryParse(m["OrderSource"], out OrderSource); //订货单明细 Items = new List <OrderDetail>(); foreach (PBM_OrderDetail item in bll.Items) { Items.Add(new OrderDetail(item)); } //预收款信息列表 PayInfos = new List <OrderPayInfo>(); foreach (PBM_OrderPayInfo item in bll.GetPayInfoList()) { PayInfos.Add(new OrderPayInfo(item)); } #region 获取各字段ID对应的名称 if (Supplier > 0) { CM_Client c = new CM_ClientBLL(Supplier).Model; if (c != null) { SupplierName = c.FullName; } } if (Client > 0) { CM_Client c = new CM_ClientBLL(Client).Model; if (c != null) { ClientName = c.FullName; } } if (SalesMan > 0) { Org_Staff s = new Org_StaffBLL(SalesMan).Model; if (s != null) { SalesManName = s.RealName; } } if (StandardPrice > 0) { PDT_StandardPrice s = new PDT_StandardPriceBLL(StandardPrice).Model; if (s != null) { StandardPriceName = s.Name; } } #endregion #region 获取字典表名称 try { if (m.Classify > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_OrderClassify")[m.Classify.ToString()]; if (dic != null) { ClassifyName = dic.Name; } } if (m.State > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_OrderState")[m.State.ToString()]; if (dic != null) { StateName = dic.Name; } } if (OrderSource > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_OrderSource")[OrderSource.ToString()]; if (dic != null) { OrderSourceName = dic.Name; } } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.Order", err); } #endregion }