Exemplo n.º 1
0
        public ActionResult SetState(string ids, short state)
        {
            var sId  = ids.Split(',').Select(o => int.Parse(o));
            var list = MembersService.FindList(o => sId.Contains(o.Id));

            #region 操作日志状态记录
            var _oList = new List <Members>();
            foreach (var item in list)
            {
                var _member = new Members();
                ExtendHelper.CopyProperty <Members>(_member, item);
                _oList.Add(_member);
            }
            #endregion

            list.ForEach(o => { o.Status = state; });
            var re = MembersService.Update(list);
            #region 操作日志
            if (re.Successed)
            {
                for (int i = 0; i < list.Count(); i++)
                {
                    var msg = Sys.LogEngine.CompareModelToLog <Members>(Sys.LogModule.会员管理, list[i], _oList[i]);
                    new Sys.LogEngine().WriteUpdate(msg, Sys.LogModule.会员管理);
                }
            }
            #endregion
            return(new JsonNetResult(re));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 积分分期
        /// </summary>
        private void IntalmentTimeOut()
        {
            var date = DateTime.Now.Date;
            var list = BaseService <InstalmentRecord> .FindList(o => o.InstalmentDT <= date && o.State == 0);

            var memberInstalments = list.GroupBy(o => o.MemberId);
            var memberids         = memberInstalments.Select(o => o.Key).ToList();
            var members           = MembersService.FindList(o => memberids.Any(p => p == o.MemberId));

            foreach (var item in members)
            {
                var memberDatas = memberInstalments.FirstOrDefault(o => o.Key == item.MemberId);
                item.UsableIntegral += memberDatas.Sum(o => o.Integral);
                foreach (var instalment in memberDatas)
                {
                    instalment.State = 1;
                }
            }
            MembersService.CurrentRepository._context.SaveChanges();
        }