Esempio n. 1
0
 /// <summary>
 /// 付款
 /// </summary>
 public void Paid()
 {
     this.OrderDetail = orderDetailRepository.GetModel(i => i.Id == this.Id).ToList();
     foreach (var item in this.OrderDetail)
     {
         EventBus.Instance.Publish(new OrderPaidEvent
         {
             UserId  = item.UserInfoId,
             OrderId = this.Id
         });
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 递归得到它的所有祖宗以selectlist的形式进行拼接
        /// </summary>
        /// <param name="son"></param>
        /// <param name="sbr"></param>
        protected void GetSelectList(WebDepartments son, StringBuilder sbr)
        {
            StringBuilder inSbr = new StringBuilder();

            if (son != null)
            {
                if (son.Level == 0)
                {
                    inSbr.Append("<select name='Parent' onchange = 'areaOnSelect(this)'><option value=''>全部</option>");
                }
                else
                {
                    inSbr.Append("<select name='Sub' onchange = 'areaOnSelect(this)'><option value=''>全部</option>");
                }

                departmentsRepository.GetModel(i => i.ParentID == son.Id).ToList().ForEach(i =>
                {
                    if (i.Id == son.Id)
                    {
                        inSbr.Append("<option value='" + i.Id + "' selected='true'>" + i.Name + "</option>");
                    }
                    else
                    {
                        inSbr.Append("<option value='" + i.Id + "'>" + i.Name + "</option>");
                    }
                });

                inSbr.Append("</select>");
                sbr.Insert(0, inSbr);
                //   GetSelectList(son.Father, sbr);
            }
        }
Esempio n. 3
0
        public ActionResult Index(string keyword, int page = 1)
        {
            ViewBag.keyword = keyword;
            Expression <Func <UserInfo, bool> > predicate = i => true;

            if (!string.IsNullOrWhiteSpace(keyword))
            {
                predicate = ExpressionBuilder.And(predicate, (i => i.UserName == keyword));
            }

            //entity include
            var linq = userRepository.GetModel()
                       .Include(i => i.UserExtension)
                       .Include(i => i.UserAccount)
                       .Where(predicate);

            return(View(linq.OrderBy(i => i.Id).AsQueryable().ToPagedList(page, PageSize)));
        }
Esempio n. 4
0
        public void RepositoryEditList()
        {
            var dogList = repository.GetModel().ToList();

            dogList.ForEach(dog =>
            {
                dog.Type           = "ddud";
                dog.Foods          = new string[] { "1", "2", "3" };
                dog.AddressHistory = new List <Adderss>();
                dog.AddressHistory.Add(new Adderss("zzl", "lr", "123"));
                dog.AddressHistory.Add(new Adderss("zzl2", "lr2", "1232"));
                dog.AddressHistory.Add(new Adderss("zzl3", "lr3", "1233"));
                dog.DogHistory = new List <DogHistory>();
                dog.DogHistory.Add(new DogHistory
                {
                    SortNum     = 3,
                    HistoryName = "大毛",
                    IsHealth    = true,
                    Foods       = new string[] { "肉" },
                    AddressList = new List <Adderss> {
                        new Adderss("china", "beijing", "fangshan"), new Adderss("china", "shanghai", "pujiang")
                    }
                });
                dog.DogHistory.Add(new DogHistory
                {
                    SortNum     = 1,
                    HistoryName = "毛仔",
                    IsHealth    = true,
                    Foods       = new string[] { "饲料" },
                    AddressList = new List <Adderss> {
                        new Adderss("usa", "jiazhou", "no.1")
                    }
                });
                dog.Des.Worker     = new string[] { "engineer", "coder" };
                dog.DefaultAdderss = new Adderss("1", "2", "3");
                dog.Des.Address    = new List <Adderss>
                {
                    new Adderss("beijing", "fangshan", "liangxiang", new string[] { "zhaojiaogan", "Road100", "No.300" }),
                    new Adderss("美国", "加州", "1区", new string[] { "Road1", "Room4", "No.1" }),
                };
            });
            repository.Update(dogList);//没有被赋值的字段被null,建议先获取再更新
        }
        // GET: Evaluation
        public ActionResult Index(int page = 1, int pageSize = 10)
        {
            var linq = evaluationRepository.GetModel();

            ViewBag.TotalRecord = linq.Count();

            return(View(linq.OrderBy(i => i.Id)
                        .ToPagedList(new Paging.PageParameters(page, pageSize))
                        .ToList()));
        }
Esempio n. 6
0
        /// <summary>
        /// 填充区域数据
        /// </summary>
        /// <param name="id">角色ID</param>
        protected void FillRoleAreaData(int[] id)
        {
            var typeArr = webDataCtrlRepository.GetModel(i => i.DataCtrlType == areaType).Select(i => i.Id);

            if (typeArr != null && typeArr.Count() > 0)
            {
                var valueArr = webDataSettingRepository.GetModel(i => id.Contains(i.WebManageRolesId) && typeArr.Contains(i.WebDataCtrlId))
                               .Select(i => i.ObjectIdArr);
                if (valueArr != null && valueArr.Count() > 0)
                {
                    var areaSel = new List <int>();
                    foreach (var item in valueArr)
                    {
                        var arr = item.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        areaSel.AddRange(Array.ConvertAll(arr, i => Convert.ToInt32(i)));
                    }
                    ViewBag.areaSel = areaSel;
                }
            }
        }
Esempio n. 7
0
 public ProductController()
 {
     productRepository  = ServiceLocator.Instance.GetService <IExtensionRepository <Product> >();
     categoryRepository = ServiceLocator.Instance.GetService <IExtensionRepository <Category> >();
     cateList           = new List <SelectListItem>();
     foreach (var i in categoryRepository
              .GetModel()
              .ToDictionary(i => i.Id.ToString(), j => j.Name))
     {
         cateList.Add(new SelectListItem {
             Text = i.Value, Value = i.Key
         });
     }
 }
Esempio n. 8
0
        /// <summary>
        /// 产品列表
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult Index(string keyword, int page = 1)
        {
            ViewBag.keyword = keyword;
            var model = productRepository.GetModel().Include(i => i.Category);

            if (Request.HttpMethod == "POST")
            {
                if (!string.IsNullOrWhiteSpace(keyword))
                {
                    model = model.Where(i => i.Name.Contains(keyword.Trim()));
                }
            }

            return(View(model.OrderBy(i => i.Id).ToPagedList(page, PageSize)));
        }
Esempio n. 9
0
        /// <summary>
        /// 我的订单
        /// </summary>
        /// <param name="orderStatus"></param>
        /// <returns></returns>
        public ActionResult MyOrder(string orderStatus)
        {
            ViewBag.OrderStatus = orderStatus;
            int id   = Convert.ToInt16(CurrentUser.UserID);
            var linq = orderRepository.GetModel(i => i.UserInfo.Id == id);

            if (Request.HttpMethod == "POST")
            {
                if (!string.IsNullOrWhiteSpace(orderStatus))
                {
                    int status;
                    int.TryParse(orderStatus, out status);
                    linq = linq.Where(i => (int)i.OrderStatus == status);
                }
            }
            return(View(linq));
        }
Esempio n. 10
0
        public ActionResult OrderList(string orderStatus)
        {
            ViewBag.OrderStatus = orderStatus;

            var linq = orderInfoRepository.GetModel()
                       .Include(i => i.OrderDetail);

            if (Request.HttpMethod == "POST")
            {
                if (!string.IsNullOrWhiteSpace(orderStatus))
                {
                    int status;
                    int.TryParse(orderStatus, out status);
                    linq = linq.Where(i => (int)i.OrderStatus == status);
                }
            }
            return(View(linq));
        }
Esempio n. 11
0
        /// <summary>
        /// 得到数据集
        /// </summary>
        /// <param name="type"></param>
        /// <param name="field"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        string GetDataSet(string type = "", string field = "", int userId = 0)
        {
            userId = userId == 0 ? Current_UserId : userId;
            var    roleIdArr = roleRepository.GetModel(i => i.WebManageUsers.Where(j => j.Id == userId).Count() > 0).Select(i => i.Id);
            string result    = string.Empty;
            var    model     = webDataSettingRepository.GetModel()
                               .Include(i => i.WebDataCtrl)
                               .Where(i => i.WebDataCtrl.DataCtrlType.ToLower() == type.ToLower() &&
                                      i.WebDataCtrl.DataCtrlField.ToLower() == field.ToLower() &&
                                      roleIdArr.Contains(i.WebManageRolesId))
                               .ToList();

            if (model != null && model.Count > 0)
            {
                result = string.Join(",", model.Select(i => i.ObjectIdArr));
            }
            return(result);
        }
Esempio n. 12
0
 /// <summary>
 /// 订单列表
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult Index(int id)
 {
     return(View(productRepository.GetModel().Include(i => i.Category).FirstOrDefault(i => i.Id == id)));
 }
Esempio n. 13
0
 public ActionResult Index()
 {
     return(View(productRepository.GetModel().Include(i => i.Category)));
 }
Esempio n. 14
0
        /// <summary>
        /// 验证用户是否存在
        /// </summary>
        /// <returns></returns>
        public bool IsExistUser()
        {
            userRepository = ServiceLocator.Instance.GetService <IExtensionRepository <UserInfo> >();

            return(userRepository.GetModel(i => i.UserName == this.UserName || i.RealName == this.RealName).Count() > 0);
        }