Esempio n. 1
0
        private List <string> GetSampleProductList()
        {
            SampleDAL dal  = new SampleDAL();
            var       list = from s in dal.GetAllSamples()
                             select s.SampleCode;

            return(list.ToList());
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.BindDataToDropdown(ddlSupplier, Utility.GetSupplierNameList(true));
                Utility.BindDataToDropdown(ddlColor, Utility.GetColorList(true));
                Utility.BindDataToDropdown(ddlLocation, Utility.GetLookupList("样品位置", true));
                Utility.BindDataToDropdown(ddlTexure, Utility.GetLookupList("纹理", true));
                var dal          = new SampleDAL();
                var samples      = dal.GetAllSamples();
                var productCodes = samples.Distinct(new SampleComparer()).ToList();
                productCodes.Insert(0, new Sample()
                {
                    MaterialCode = string.Empty, MaterialName = string.Empty
                });
                ddlProductCode.DataSource     = productCodes;
                ddlProductCode.DataTextField  = "MaterialCode";
                ddlProductCode.DataValueField = "MaterialCode";
                ddlProductCode.DataBind();

                var productNames = samples.Distinct(new SampleNameComparer()).ToList();
                productNames.Insert(0, new Sample()
                {
                    MaterialName = string.Empty, MaterialCode = string.Empty
                });
                ddlProductName.DataSource     = productNames;
                ddlProductName.DataTextField  = "MaterialName";
                ddlProductName.DataValueField = "MaterialName";
                ddlProductName.DataBind();

                samples.Insert(0, new Sample()
                {
                    SampleCode = string.Empty
                });
                ddlSampleCode.DataSource     = samples;
                ddlSampleCode.DataTextField  = "SampleCode";
                ddlSampleCode.DataValueField = "SampleCode";
                ddlSampleCode.DataBind();

                BindControl();
            }
        }
Esempio n. 3
0
        public override void BindControl()
        {
            SampleDAL            sampleDAL  = new SampleDAL();
            var                  samples    = sampleDAL.GetAllSamples();
            List <NameValueItem> sampleList = new List <NameValueItem>();

            foreach (var item in samples)
            {
                sampleList.Add(new NameValueItem()
                {
                    Name = item.SampleCode + "/" + item.MaterialName, Value = item.SampleCode
                });
            }
            Utility.BindDataToDropdown(ddlProductFrom, sampleList);
            Utility.BindDataToDropdown(ddlProduct, sampleList);

            SampleProvidDAL dal  = new SampleProvidDAL();
            var             list = dal.GetSampleBySource(SourceType, SourceNo);

            this.rpSampleFromCustomer.DataSource = list.Where(l => l.SampleDirection == SysConst.SampleDirectionFrom);
            this.rpSampleFromCustomer.DataBind();
            this.rpSampleToCustomer.DataSource = list.Where(l => l.SampleDirection == SysConst.SampleDirectionTo);
            this.rpSampleToCustomer.DataBind();
        }