protected void ddl_Brand_SelectedIndexChanged(object sender, EventArgs e) { ddl_Classify.DataSource = PDT_ClassifyBLL.GetModelList("Brand=" + ddl_Brand.SelectedValue); ddl_Classify.DataBind(); ddl_Classify.Items.Insert(0, new ListItem("所有", "0")); BindGrid(); }
private void BindData() { MCSFramework.Model.Pub.PDT_Classify md = new PDT_ClassifyBLL((int)ViewState["ID"]).Model; pl_detail.BindData(md); bt_OK.Text = "修改"; bt_OK.ForeColor = System.Drawing.Color.Red; }
protected void dl_brand_SelectedIndexChanged(object sender, EventArgs e) { IList <PDT_Classify> _classify = PDT_ClassifyBLL.GetModelList("Pdt_classify.brand=" + dl_brand.SelectedValue); dl_classify.DataSource = _classify; dl_classify.DataBind(); dl_classify_SelectedIndexChanged(null, null); }
protected string GetPDTClassifyName(int product) { PDT_Product p = new PDT_ProductBLL(product, true).Model; PDT_Classify c = new PDT_ClassifyBLL(p.Classify).Model; if (c != null) return c.Name; else return ""; }
protected void bt_AddProduct_Click(object sender, EventArgs e) { int product = 0; if (int.TryParse(select_Product.SelectValue, out product) && product > 0) { PDT_Product pdt = new PDT_ProductBLL(product).Model; if (pdt == null) { return; } int quantity = int.Parse(tbx_Q1.Text) * pdt.ConvertFactor + int.Parse(tbx_Q2.Text); DataTable dt = (DataTable)ViewState["DTDetail"]; DataRow[] drs = dt.Select("ID=" + product.ToString()); if (drs.Length > 0) { drs[0]["Quantity"] = quantity; } else { DataRow dr = dt.NewRow(); decimal factoryprice = 0, price = 0; PDT_ProductPriceBLL.GetPriceByClientAndType((int)ViewState["ClientID"], product, (int)ViewState["Type"], out factoryprice, out price); dr["ID"] = product; dr["Code"] = pdt.Code; dr["FullName"] = pdt.FullName; dr["ShortName"] = pdt.ShortName; dr["Brand"] = pdt.Brand; dr["Spec"] = pdt["Spec"]; dr["Classify"] = pdt.Classify; dr["ConvertFactor"] = pdt.ConvertFactor; dr["FactoryPrice"] = factoryprice; dr["Price"] = price; dr["Quantity"] = quantity; try { dr["BrandName"] = new PDT_BrandBLL(pdt.Brand).Model.Name; dr["ClassifyName"] = new PDT_ClassifyBLL(pdt.Classify).Model.Name; dr["TrafficPackaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.TrafficPackaging.ToString()].Name; dr["Packaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.Packaging.ToString()].Name; } catch { } dt.Rows.Add(dr); } BindGrid(); } }
private void BindTree() { //获取品牌 string condition = ""; if (Request.QueryString["IsOpponent"] != null) { condition = "IsOpponent=" + Request.QueryString["IsOpponent"]; } IList <PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition); dl_brand.DataSource = _brands; dl_brand.DataBind(); dl_brand.Items.Insert(0, new ListItem("请选择", "0")); dl_brand_SelectedIndexChanged(null, null); foreach (PDT_Brand brand in _brands) { TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString()); tr_Product.Nodes.Add(tn_brand); IList <PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString()); foreach (PDT_Classify classify in _classifys) { TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString()); tn_brand.ChildNodes.Add(tn_classify); string ConditionStr = "PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString() + "and pdt_product.approveflag=1"; if (Request.QueryString["ExtCondition"] != null) { ConditionStr += " AND (" + Request.QueryString["ExtCondition"].Replace("\"", "").Replace('~', '\'') + ")"; } IList <PDT_Product> _products = PDT_ProductBLL.GetModelList(ConditionStr); foreach (PDT_Product product in _products) { TreeNode tn = new TreeNode(); tn.Text = product.Code + " " + product.FullName; tn.Value = product.ID.ToString(); tn_classify.ChildNodes.Add(tn); if (tn.Value == ViewState["ID"].ToString()) { tn_classify.Expand(); tn.Select(); tbx_SelectedProductID.Text = tn.Value; tbx_SelectedProductName.Text = tn.Text; } } } } }
void ddl_Brand_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl_Brand = (DropDownList)pl_detail.FindControl("PDT_Product_Brand"); DropDownList ddl_Classify = (DropDownList)pl_detail.FindControl("PDT_Product_Classify"); if (ddl_Brand != null && ddl_Classify != null) { ddl_Classify.DataSource = PDT_ClassifyBLL.GetModelList("Brand=" + ddl_Brand.SelectedValue); ddl_Classify.DataTextField = "Name"; ddl_Classify.DataValueField = "ID"; ddl_Classify.DataBind(); ddl_Classify_SelectedIndexChanged(null, null); } }
protected string GetPDTClassifyName(int product) { PDT_Product p = new PDT_ProductBLL(product, true).Model; PDT_Classify c = new PDT_ClassifyBLL(p.Classify).Model; if (c != null) { return(c.Name); } else { return(""); } }
protected void bt_AddProduct_Click(object sender, EventArgs e) { int product = 0; if (int.TryParse(select_Product.SelectValue, out product) && product > 0) { PDT_Product pdt = new PDT_ProductBLL(product).Model; if (pdt == null) return; int quantity = int.Parse(tbx_Q1.Text) * pdt.ConvertFactor + int.Parse(tbx_Q2.Text); DataTable dt = (DataTable)ViewState["DTDetail"]; DataRow[] drs = dt.Select("ID=" + product.ToString()); if (drs.Length > 0) { drs[0]["Quantity"] = quantity; } else { DataRow dr = dt.NewRow(); decimal factoryprice = 0, price = 0; PDT_ProductPriceBLL.GetPriceByClientAndType((int)ViewState["ClientID"], product, (int)ViewState["Type"], out factoryprice, out price); dr["ID"] = product; dr["Code"] = pdt.Code; dr["FullName"] = pdt.FullName; dr["ShortName"] = pdt.ShortName; dr["Brand"] = pdt.Brand; dr["Spec"] = pdt["Spec"]; dr["Classify"] = pdt.Classify; dr["ConvertFactor"] = pdt.ConvertFactor; dr["FactoryPrice"] = factoryprice; dr["Price"] = price; dr["Quantity"] = quantity; try { dr["BrandName"] = new PDT_BrandBLL(pdt.Brand).Model.Name; dr["ClassifyName"] = new PDT_ClassifyBLL(pdt.Classify).Model.Name; dr["TrafficPackaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.TrafficPackaging.ToString()].Name; dr["Packaging"] = DictionaryBLL.GetDicCollections("PDT_Packaging")[pdt.Packaging.ToString()].Name; } catch { } dt.Rows.Add(dr); } BindGrid(); } }
private void BindTree() { //获取品牌 string condition = ""; if (Request.QueryString["IsOpponent"] != null) { condition = "IsOpponent=" + Request.QueryString["IsOpponent"]; } IList <PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition); foreach (PDT_Brand brand in _brands) { TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString()); tr_Product.Nodes.Add(tn_brand); IList <PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString()); foreach (PDT_Classify classify in _classifys) { TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString()); tn_brand.ChildNodes.Add(tn_classify); IList <PDT_Product> _products = new PDT_ProductBLL()._GetModelList("PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString()); foreach (PDT_Product product in _products) { TreeNode tn = new TreeNode(); tn.Text = product.Code + " " + product.FullName; tn.Value = product.Code; tn_classify.ChildNodes.Add(tn); if (tn.Value == ViewState["ERPCode"].ToString()) { tn_classify.Expand(); tn.Select(); tbx_SelectedProductCode.Text = tn.Value; tbx_SelectedProductName.Text = tn.Text; } } } } }
private void BindTree() { //获取品牌 string condition = ""; if (Request.QueryString["IsOpponent"] != null) condition = "IsOpponent=" + Request.QueryString["IsOpponent"]; IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition); foreach (PDT_Brand brand in _brands) { TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString()); tr_Product.Nodes.Add(tn_brand); IList<PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString()); foreach (PDT_Classify classify in _classifys) { TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString()); tn_brand.ChildNodes.Add(tn_classify); IList<PDT_Product> _products = new PDT_ProductBLL()._GetModelList("PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString()); foreach (PDT_Product product in _products) { TreeNode tn = new TreeNode(); tn.Text = product.Code + " " + product.FullName; tn.Value = product.Code; tn_classify.ChildNodes.Add(tn); if (tn.Value == ViewState["ERPCode"].ToString()) { tn_classify.Expand(); tn.Select(); tbx_SelectedProductCode.Text = tn.Value; tbx_SelectedProductName.Text = tn.Text; } } } } }
protected void bt_OK_Click(object sender, EventArgs e) { PDT_ClassifyBLL _Classify = null; if (bt_OK.Text == "添加") { _Classify = new PDT_ClassifyBLL(); } else { _Classify = new PDT_ClassifyBLL((int)ViewState["ID"]); } pl_detail.GetData(_Classify.Model); if (bt_OK.Text == "添加") { ViewState["ID"] = _Classify.Add(); } else { _Classify.Update(); } Response.Redirect("ClassifyManage.aspx?ID=" + ViewState["ID"].ToString() + "&BrandID=" + ViewState["BrandID"].ToString()); }
private void FillModel(PDT_Product m, int TDP) { ID = m.ID; FullName = m.FullName; ShortName = m.ShortName; Code = m.Code; BarCode = m.BarCode; BoxBarCode = m.BoxBarCode; ConvertFactor = m.ConvertFactor; Spec = m.Spec; Remark = m.Remark; Grade = m.Grade; Category = m.Category; FactoryCode = m.FactoryCode; FactoryName = m.FactoryName; #region 获取商品的TDP扩展管理信息 if (TDP != 0) { IList<PDT_ProductExtInfo> exts = PDT_ProductExtInfoBLL.GetModelList("Supplier=" + TDP.ToString() + " AND Product=" + m.ID.ToString()); if (exts.Count > 0) { TDPCode = exts[0].Code; if (exts[0].Category != 0) Category = exts[0].Category; BuyPrice = exts[0].BuyPrice; SalesPrice = exts[0].SalesPrice; } } #endregion #region 获取品牌、系列、类别名称 if (m.Brand > 0) { PDT_Brand brand = new PDT_BrandBLL(m.Brand).Model; if (brand != null) BrandName = brand.Name; } if (m.Classify > 0) { PDT_Classify classify = new PDT_ClassifyBLL(m.Classify).Model; if (classify != null) ClassifyName = classify.Name; } if (Category > 0) { CategoryName = PDT_CategoryBLL.GetFullCategoryName(Category); } #endregion #region 获取字典表名称 try { if (m.Grade > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Grade")[m.Grade.ToString()]; if (dic != null) GradeName = dic.Name; } if (m.TrafficPackaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.TrafficPackaging.ToString()]; if (dic != null) TrafficPackagingName = dic.Name; } if (m.Packaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.Packaging.ToString()]; if (dic != null) PackagingName = dic.Name; } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.Product", err); } #endregion #region 获取首要图片 string condition = " RelateType=11 AND RelateID=" + m.ID.ToString() + " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',1)='Y'"; IList<ATMT_Attachment> lists = ATMT_AttachmentBLL.GetModelList(condition); if (lists.Count > 0 && ATMT_AttachmentBLL.IsImage(lists[0].ExtName)) { ImageGUID = lists[0].GUID; } #endregion #region 获取附件明细 Atts = new List<Attachment>(); IList<ATMT_Attachment> atts = ATMT_AttachmentBLL.GetAttachmentList(11, m.ID, new DateTime(1900, 1, 1), new DateTime(2100, 1, 1)); foreach (ATMT_Attachment item in atts.OrderBy(p => p.Name)) { Atts.Add(new Attachment(item)); } #endregion }
private void FillModel(PDT_Product m, int TDP) { ID = m.ID; FullName = m.FullName; ShortName = m.ShortName; Code = m.Code; BarCode = m.BarCode; BoxBarCode = m.BoxBarCode; ConvertFactor = m.ConvertFactor; Spec = m.Spec; Remark = m.Remark; Grade = m.Grade; Category = m.Category; FactoryCode = m.FactoryCode; FactoryName = m.FactoryName; #region 获取商品的TDP扩展管理信息 if (TDP != 0) { IList <PDT_ProductExtInfo> exts = PDT_ProductExtInfoBLL.GetModelList("Supplier=" + TDP.ToString() + " AND Product=" + m.ID.ToString()); if (exts.Count > 0) { TDPCode = exts[0].Code; if (exts[0].Category != 0) { Category = exts[0].Category; } BuyPrice = exts[0].BuyPrice; SalesPrice = exts[0].SalesPrice; } } #endregion #region 获取品牌、系列、类别名称 if (m.Brand > 0) { PDT_Brand brand = new PDT_BrandBLL(m.Brand).Model; if (brand != null) { BrandName = brand.Name; } } if (m.Classify > 0) { PDT_Classify classify = new PDT_ClassifyBLL(m.Classify).Model; if (classify != null) { ClassifyName = classify.Name; } } if (Category > 0) { CategoryName = PDT_CategoryBLL.GetFullCategoryName(Category); } #endregion #region 获取字典表名称 try { if (m.Grade > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Grade")[m.Grade.ToString()]; if (dic != null) { GradeName = dic.Name; } } if (m.TrafficPackaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.TrafficPackaging.ToString()]; if (dic != null) { TrafficPackagingName = dic.Name; } } if (m.Packaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.Packaging.ToString()]; if (dic != null) { PackagingName = dic.Name; } } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.Product", err); } #endregion #region 获取首要图片 string condition = " RelateType=11 AND RelateID=" + m.ID.ToString() + " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',1)='Y'"; IList <ATMT_Attachment> lists = ATMT_AttachmentBLL.GetModelList(condition); if (lists.Count > 0 && ATMT_AttachmentBLL.IsImage(lists[0].ExtName)) { ImageGUID = lists[0].GUID; } #endregion #region 获取附件明细 Atts = new List <Attachment>(); IList <ATMT_Attachment> atts = ATMT_AttachmentBLL.GetAttachmentList(11, m.ID, new DateTime(1900, 1, 1), new DateTime(2100, 1, 1)); foreach (ATMT_Attachment item in atts.OrderBy(p => p.Name)) { Atts.Add(new Attachment(item)); } #endregion }
private void BindTree() { //获取品牌 string condition = ""; if (Request.QueryString["IsOpponent"] != null) condition = "IsOpponent=" + Request.QueryString["IsOpponent"]; IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition); dl_brand.DataSource = _brands; dl_brand.DataBind(); dl_brand.Items.Insert(0, new ListItem("请选择", "0")); dl_brand_SelectedIndexChanged(null, null); foreach (PDT_Brand brand in _brands) { TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString()); tr_Product.Nodes.Add(tn_brand); IList<PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString()); foreach (PDT_Classify classify in _classifys) { TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString()); tn_brand.ChildNodes.Add(tn_classify); string ConditionStr = "PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString()+"and pdt_product.approveflag=1"; if (Request.QueryString["ExtCondition"] != null) { ConditionStr += " AND (" + Request.QueryString["ExtCondition"].Replace("\"", "").Replace('~', '\'') + ")"; } IList<PDT_Product> _products = PDT_ProductBLL.GetModelList(ConditionStr); foreach (PDT_Product product in _products) { TreeNode tn = new TreeNode(); tn.Text = product.Code + " " + product.FullName; tn.Value = product.ID.ToString(); tn_classify.ChildNodes.Add(tn); if (tn.Value == ViewState["ID"].ToString()) { tn_classify.Expand(); tn.Select(); tbx_SelectedProductID.Text = tn.Value; tbx_SelectedProductName.Text = tn.Text; } } } } }