private bool BindProduct(PDT_Product p)
    {
        if (p != null)
        {
            ViewState["ID"] = p.ID;
            select_ProductCode.SelectText = p.FactoryCode;
            select_ProductCode.SelectValue = p.ID.ToString();

            lb_ProductName.Text = p.FullName;
            lb_ProductName.ForeColor = System.Drawing.Color.Black;

            return true;
        }
        else
        {
            lb_ProductName.Text = "该产品不存在!!";
            lb_ProductName.ForeColor = System.Drawing.Color.Red;
            return false;
        }
    }
    void ddl_State_SelectedIndexChanged(object sender, EventArgs e)
    {
        MCSSelectControl select_MasterProduct = (MCSSelectControl)pl_detail.FindControl("PDT_Product_MasterProduct");
        if (select_MasterProduct == null) return;

        PDT_Product m = new PDT_Product();
        pl_detail.GetData(m);

        if (m.State != 3)
        {
            select_MasterProduct.SelectText = "";
            select_MasterProduct.SelectValue = "";
            select_MasterProduct.Enabled = false;
        }
        else
        {
            select_MasterProduct.Enabled = true;
            select_MasterProduct.PageUrl = "~/SubModule/Product/Pop_Search_Product.aspx?ID=" + select_MasterProduct.SelectValue +
                "&IsOpponent=" + ViewState["IsOpponent"].ToString() +
                "&ExtCondition=\"Brand=" + m.Brand.ToString() + " AND Classify=" + m.Classify.ToString() + "\"";
        }
    }
    private bool BindProduct(PDT_Product product)
    {
        if (product != null)
        {
            #region 判断是否是竞品
            //仅能录入本公司产品及促销品
            if (new PDT_BrandBLL(product.Brand).Model.IsOpponent == "2")
            {
                lb_ProductName.Text = "对不起,只能录入本公司产品及促销品!";
                ViewState["Product"] = 0;
                return false;
            }
            #endregion

            ViewState["Product"] = product.ID;

            select_ProductCode.SelectValue = product.Code;
            select_ProductCode.SelectText = product.Code;

            lb_ProductName.Text = product.FullName;
            lb_ProductName.ForeColor = System.Drawing.Color.Black;
            lb_FactoryPrice.Text = product.FactoryPrice.ToString();
            //获取该产品的最小计量单位
            //lbl_TrafficPackaging.Text = DictionaryBLL.GetDicCollections("PDT_Packaging")[product.TrafficPackaging.ToString()].Name;

            //tbx_StdPrice.Text = product.StdPrice.ToString();PDT_ProductPriceBLL.GetPriceByClientAndType((int)ViewState["ClientID"], product.ID, (int)ViewState["Type"]).ToString();

            tbx_BuyingPrice.Focus();
            return true;
        }
        else
        {
            lb_ProductName.Text = "该产品编码不存在!!";
            lb_ProductName.ForeColor = System.Drawing.Color.Red;
            //tbx_StdPrice.Text = "0";

            ViewState["Product"] = 0;
            return false;
        }
    }
Example #4
0
        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
        }
Example #5
0
 public Product(PDT_Product m, int TDP)
 {
     if (m != null) FillModel(m, TDP);
 }
    private bool BindProduct(PDT_Product product)
    {
        if (product != null)
        {
            ViewState["Product"] = product.ID;

            select_ProductCode.SelectValue = product.Code;
            select_ProductCode.SelectText = product.Code;

            lb_ProductName.Text = product.FullName;
            lb_ProductName.ForeColor = System.Drawing.Color.Black;
            lbl_FactoryPrice.Text = product.FactoryPrice.ToString();
            tbx_CostPrice.Focus();

            return true;
        }
        else
        {
            lb_ProductName.Text = " 该产品编码不存在!!";
            lb_ProductName.ForeColor = System.Drawing.Color.Red;
            ViewState["Product"] = null;
            lbl_FactoryPrice.Text = "";

            return false;
        }
    }