示例#1
0
        public ActionResult InvIndex(string userId)
        {
            marketShopApp shopApp = new marketShopApp();
            List <marketSalesShopEntity> shops = new List <marketSalesShopEntity>();

            shops.AddRange(shopApp.getShopByUserId(userId));
            marketSalesApp      userapp  = new marketSalesApp();
            UserInfoResultModel userinfo = userapp.GetUserInfo(userId);

            shops.AddRange(shopApp.getAllShopByEmpCode(userinfo.SalesNo));

            var t = from e in shops
                    group e by new { Code = e.CUSTOMER_CODE, Name = e.CUSTOMER_NAME } into g
                select new CusModel {
                CustomerCode = g.Key.Code, CustomerName = g.Key.Name
            };

            /*
             * marketShopApp shopApp = new marketShopApp();
             * List<marketSalesShopEntity> shops = shopApp.getShopByUserId(userId);
             * List<CusModel> vModel = new List<CusModel>();
             * foreach (var shop in shops)
             * {
             *  if (vModel.Find(p => p.CustomerCode.Equals(shop.CUSTOMER_CODE)) == null)
             *  {
             *      vModel.Add(new CusModel() { CustomerCode = shop.CUSTOMER_CODE, CustomerName = shop.CUSTOMER_NAME });
             *  }
             * }*/
            ViewData["vModel"] = t.OrderBy(p => p.CustomerName).ToList();;
            ViewData["userId"] = userId;
            return(View("InvQinView"));
        }
示例#2
0
        public PartialViewResult CustomerView(string userId)
        {
            marketShopApp shopApp = new marketShopApp();
            List <marketSalesShopEntity> shops = new List <marketSalesShopEntity>();

            shops.AddRange(shopApp.getShopByUserId(userId));
            marketSalesApp      userapp  = new marketSalesApp();
            UserInfoResultModel userinfo = userapp.GetUserInfo(userId);

            shops.AddRange(shopApp.getAllShopByEmpCode(userinfo.SalesNo));

            var t = from e in shops
                    group e by new { Code = e.CUSTOMER_CODE, Name = e.CUSTOMER_NAME } into g
                select new CusModel {
                CustomerCode = g.Key.Code, CustomerName = g.Key.Name
            };

            return(PartialView("_InvQinCustomerPartialPage", t.OrderBy(p => p.CustomerName).ToList()));
        }