SelectAndCreateSaleBargain(int saleContractId, int salesmanId,
                                   AtlanticDXContext db)
        {
            var contract = db.SaleContracts.Find(saleContractId);

            if (contract != null)
            {
                YuShang.ERP.Entities.Sale.SaleBargain bargain = db.SaleBargains.Create();
                if (contract.SelectedSaleBargain != null)
                {
                    bargain = contract.SelectedSaleBargain;
                }
                else
                {
                    db.SaleBargains.Add(bargain);
                }

                var items = db.SaleBargainItems.Where(item => item.SalesmanId == salesmanId &&
                                                      item.SaleProductItem.SaleContractId == saleContractId);
                bargain.BargainItems         = items.ToList();
                bargain.BargainSalesmanId    = salesmanId;
                bargain.SaleContractId       = saleContractId;
                contract.SelectedSaleBargain = bargain;
                return(bargain);
            }

            return(null);
        }
예제 #2
0
 public ActionResult Main()
 {
     //用户信息
     using (AtlanticDXContext context = new AtlanticDXContext())
     {
         ViewBag.CurrentUser = context.Users.Where(m => m.UserName == HttpContext.User.Identity.Name).FirstOrDefault();
     }
     return(View());
 }
예제 #3
0
        public JsonResult Index(int page = 1, int rows = 10)
        {
            using (AtlanticDXContext context = new AtlanticDXContext())
            {
                var list = db.StoreHouses.Where(m => m.IsDeleted == false)
                           .OrderBy(m => m.StoreHouseId).Skip((page - 1) * rows).Take(rows).ToList();

                return(Json(new { total = db.StoreHouses.Count(), rows = list }));
            }
        }
 public JsonResult Index(int page = 1, int rows = 10)
 {
     using (AtlanticDXContext context = new AtlanticDXContext())
     {
         IEnumerable <SysUser> users = users = context.Users.Where(u => u.Id > 0)//小于等于0的用户不允许修改,是系统内置的
                                               .OrderBy(m => m.CTIME).Skip((page - 1) * rows).Take(rows).ToList();
         IEnumerable <SysUserViewModel> userViewModels = users.Select(m => new SysUserViewModel(m));
         return(Json(new { total = context.Users.Count(), rows = userViewModels }));
     }
 }
예제 #5
0
        public JsonResult Index(int page = 1, int rows = 10)
        {
            using (AtlanticDXContext context = new AtlanticDXContext())
            {
                var list = db.Products.Where(m => m.IsDeleted == false)
                           .OrderBy(m => m.ProductId).Skip((page - 1) * rows).Take(rows).ToList();

                return(Json(new { total = db.Products.Count(), rows = list }));
                //IEnumerable<SysUser> users = users = context.Users.OrderBy(m => m.CTIME).Take(rows).Skip((page - 1) * rows).ToList();
                //IEnumerable<SysUserViewModel> userViewModels = users.Select(m => new SysUserViewModel(m));
                //return Json(userViewModels);
            }
        }
        /// <summary>
        /// 根据SaleProductItemId获取还价
        /// </summary>
        /// <param name="saleProductItemId"></param>
        /// <returns></returns>
        public static SaleProductItemBargainsViewModel GetBargainsItemBySaleProductItemId(
            int saleProductItemId)
        {
            using (AtlanticDXContext context = new AtlanticDXContext())
            {
                var salebargainItems = context.SaleBargainItems.Where(
                    m => m.SaleProductItemId == saleProductItemId);
                if (salebargainItems != null && salebargainItems.Count() > 0)
                {
                    var resultItem = from one in salebargainItems
                                     select new SaleProductItemBargainItemViewModel(one);

                    return(new SaleProductItemBargainsViewModel(resultItem));
                }
            }

            return(null);
        }
예제 #7
0
 // GET: Public/Home
 public ActionResult Index()
 {
     ViewBag.Title = "大西洋贸易ERP系统";
     using (AtlanticDXContext context = new AtlanticDXContext())
     {
         //用户信息
         ViewBag.CurrentUser = context.Users.Where(m => m.UserName == HttpContext.User.Identity.Name).FirstOrDefault();
         //左侧菜单
         ViewBag.TopMenus = context.SysMenus.Where(m => m.ParentId == 0).ToList();
         if (ViewBag.TopMenus != null)
         {
             foreach (SysMenu topMenu in ViewBag.TopMenus)
             {
                 IList <SysMenu> subMenus = context.SysMenus.Where(m => m.ParentId == topMenu.SysMenuId &&
                                                                   m.IsShowInNavTree > 0).OrderBy(m => m.IsShowInNavTree).ToList();
                 ViewData["SubMenu" + topMenu.SysMenuId] = subMenus.Count() > 0 ? subMenus : null;
             }
         }
     }
     return(View());
 }
예제 #8
0
 public AccountsReceivableViewModel(AccountsReceivable m, AtlanticDXContext db)
 {
     // TODO: Complete member initialization
     this.m  = m;
     this.db = db;
 }
예제 #9
0
 protected void SeedCore(AtlanticDXContext context)
 {
     //throw new NotImplementedException();
 }