コード例 #1
0
        public List <BuyPriceListVModel> GetList(string cls = null)
        {
            List <BuyPriceListVModel> rv = new List <BuyPriceListVModel>();
            List <BuyFlowModel>       rf = new List <BuyFlowModel>();
            List <BuyVendorModel>     bv = new List <BuyVendorModel>();
            BuyEvaluateModel          e;
            BuyPriceListVModel        p;
            AppUserModel    u;
            DepartmentModel c;

            bv = db.BuyVendors.Where(b => b.Status == "?").ToList();
            foreach (BuyVendorModel f in bv)
            {
                p           = new BuyPriceListVModel();
                p.DocType   = "評估";
                p.DocId     = f.DocId;
                e           = db.BuyEvaluates.Find(f.DocId);
                p.UserId    = e.UserId;
                p.UserName  = e.UserName;
                p.PlantCnam = e.PlantCnam;
                p.PlantEnam = e.PlantEnam;
                u           = db.AppUsers.Find(e.UserId);
                c           = db.Departments.Find(u.DptId);
                p.CustId    = c.DptId;
                p.CustNam   = c.Name_C;
                p.Amt       = e.Amt;
                p.Unit      = e.Unit;
                p.VendorNo  = f.VendorNo;
                p.UniteNo   = f.UniteNo;
                p.VendorNam = f.VendorNam;
                rv.Add(p);
            }
            return(rv);
        }
コード例 #2
0
        public List <BuyPriceListVModel> GetHomeList(string cls = null)
        {
            List <BuyPriceListVModel> rv = new List <BuyPriceListVModel>();
            List <BuyFlowModel>       rf = new List <BuyFlowModel>();
            List <BuyVendorModel>     bv = new List <BuyVendorModel>();
            List <BuyVendorModel>     bv2;
            BuyEvaluateModel          e;
            BuyPriceListVModel        p;
            AppUserModel    u;
            DepartmentModel c;
            string          str = "";

            bv = db.BuyVendors.Where(b => b.Status == "?").ToList();
            foreach (BuyVendorModel f in bv)
            {
                p           = new BuyPriceListVModel();
                p.DocType   = "評估";
                p.DocId     = f.DocId;
                e           = db.BuyEvaluates.Find(f.DocId);
                p.UserId    = e.UserId;
                p.UserName  = e.UserName;
                p.PlantCnam = e.PlantCnam;
                p.PlantEnam = e.PlantEnam;
                u           = db.AppUsers.Find(e.UserId);
                c           = db.Departments.Find(u.DptId);
                if (c != null)
                {
                    p.CustId  = c.DptId;
                    p.CustNam = c.Name_C;
                }
                p.Amt       = e.Amt;
                p.Unit      = e.Unit;
                p.VendorNo  = f.VendorNo;
                p.UniteNo   = f.UniteNo;
                p.VendorNam = f.VendorNam;
                u           = db.AppUsers.Find(e.PurchaserId);
                if (u != null)
                {
                    p.buyer = u.FullName;
                    p.tel   = u.Mobile;
                    p.email = u.Email;
                }
                if (rv.Where(v => v.DocId == p.DocId).Count() == 0)
                {
                    rv.Add(p);
                }
                else
                {
                    str = rv.Find(v => v.DocId == p.DocId).VendorNam;
                    rv.Find(v => v.DocId == p.DocId).VendorNam = str + "<br />" + p.VendorNam;
                }
            }
            return(rv);
        }