Exemplo n.º 1
0
        public QueryPageModel <CapitalDetailInfo> GetCapitalDetails(CapitalDetailQuery query)
        {
            //var capitalDetail = Context.CapitalDetailInfo.Where(item => item.Mall_Capital.MemId == query.memberId);

            //var capital = DbFactory.Default.Get<CapitalInfo>().Where(p => p.MemId == query.memberId).Select(p => p.Id).ToList<long>();
            var capitalDetail = DbFactory.Default
                                .Get <CapitalDetailInfo>()
                                .InnerJoin <CapitalInfo>((cdi, ci) => cdi.CapitalID == ci.Id && ci.MemId == query.memberId);

            if (query.capitalType.HasValue && query.capitalType.Value != 0)
            {
                capitalDetail.Where(e => e.SourceType == query.capitalType.Value);
            }
            if (query.startTime.HasValue)
            {
                capitalDetail.Where(e => e.CreateTime >= query.startTime);
            }
            if (query.endTime.HasValue)
            {
                capitalDetail.Where(e => e.CreateTime < query.endTime);
            }
            //int total = 0;
            //var model = capitalDetail.GetPage(p => p.OrderByDescending(e => e.CreateTime), out total, query.PageNo, query.PageSize);
            var model = capitalDetail.OrderByDescending(e => e.CreateTime).Select().ToPagedList(query.PageNo, query.PageSize);

            QueryPageModel <CapitalDetailInfo> result = new QueryPageModel <CapitalDetailInfo> {
                Models = model, Total = model.TotalRecordCount
            };

            return(result);
        }
Exemplo n.º 2
0
        public ObsoletePageModel <CapitalDetailInfo> GetCapitalDetails(CapitalDetailQuery query)
        {
            var capitalDetail = Context.CapitalDetailInfo.Where(item => item.Himall_Capital.MemId == query.memberId);

            if (query.capitalType.HasValue && query.capitalType.Value != 0)
            {
                capitalDetail = capitalDetail.Where(e => e.SourceType == query.capitalType.Value);
            }
            if (query.startTime.HasValue)
            {
                capitalDetail = capitalDetail.Where(e => e.CreateTime >= query.startTime);
            }
            if (query.endTime.HasValue)
            {
                capitalDetail = capitalDetail.Where(e => e.CreateTime < query.endTime);
            }
            int total = 0;
            var model = capitalDetail.GetPage(out total, query.PageNo, query.PageSize, p => p.OrderByDescending(e => e.CreateTime));

            ObsoletePageModel <CapitalDetailInfo> result = new ObsoletePageModel <CapitalDetailInfo> {
                Models = model, Total = total
            };

            return(result);
        }
Exemplo n.º 3
0
        public object GetList(int pageNo = 1, int pageSize = 10)
        {
            CheckUserLogin();
            var query = new CapitalDetailQuery
            {
                memberId = CurrentUser.Id,
                PageSize = pageSize,
                PageNo   = pageNo
            };
            var pageMode = MemberCapitalApplication.GetCapitalDetails(query);
            var model    = pageMode.Models.ToList().Select(e => new CapitalDetailModel
            {
                Id            = e.Id,
                Amount        = e.Amount + e.PresentAmount,
                PresentAmount = e.PresentAmount,
                CapitalID     = e.CapitalID,
                CreateTime    = e.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                SourceData    = e.SourceData,
                SourceType    = e.SourceType,
                Remark        = GetRemark(e),
                PayWay        = e.Remark
            });

            return(Json(new { rows = model, total = pageMode.Total }));
        }
Exemplo n.º 4
0
        public object GetList(int pageNo = 1, int pageSize = 10)
        {
            CheckUserLogin();
            var capitalService = ServiceApplication.Create <IMemberCapitalService>();

            var query = new CapitalDetailQuery
            {
                memberId = CurrentUser.Id,
                PageSize = pageSize,
                PageNo   = pageNo
            };
            var pageMode = capitalService.GetCapitalDetails(query);
            var model    = pageMode.Models.ToList().Select(e => new CapitalDetailModel
            {
                Id            = e.Id,
                Amount        = e.Amount + e.PresentAmount,
                PresentAmount = e.PresentAmount,
                CapitalID     = e.CapitalID,
                CreateTime    = e.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                SourceData    = e.SourceData,
                SourceType    = e.SourceType,
                Remark        = e.SourceType == CapitalDetailInfo.CapitalDetailType.Brokerage ? GetBrokerageRemark(e) : e.Remark,
                PayWay        = e.Remark
            });
            dynamic result = SuccessResult();

            result.rows  = model;
            result.total = pageMode.Total;

            return(result);
        }
Exemplo n.º 5
0
        public JsonResult List(CapitalDetailInfo.CapitalDetailType capitalType, int page, int rows)
        {
            IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>();
            CapitalDetailQuery    capitalDetailQuery   = new CapitalDetailQuery()
            {
                memberId    = base.CurrentUser.Id,
                capitalType = new CapitalDetailInfo.CapitalDetailType?(capitalType),
                PageSize    = rows,
                PageNo      = page
            };
            PageModel <CapitalDetailInfo> capitalDetails = memberCapitalService.GetCapitalDetails(capitalDetailQuery);
            List <CapitalDetailModel>     list           = (
                from e in capitalDetails.Models.ToList()
                select new CapitalDetailModel()
            {
                Id = e.Id,
                Amount = e.Amount,
                CapitalID = e.CapitalID,
                CreateTime = e.CreateTime.Value.ToString(),
                SourceData = e.SourceData,
                SourceType = e.SourceType,
                Remark = string.Concat(e.SourceType.ToDescription(), ",单号:", e.Id),
                PayWay = e.Remark
            }).ToList();
            DataGridModel <CapitalDetailModel> dataGridModel = new DataGridModel <CapitalDetailModel>()
            {
                rows  = list,
                total = capitalDetails.Total
            };

            return(Json(dataGridModel));
        }
Exemplo n.º 6
0
        public JsonResult List(CapitalDetailInfo.CapitalDetailType capitalType, long userid, string startTime, string endTime, int page, int rows)
        {
            IMemberCapitalService service = this._iMemberCapitalService;
            CapitalDetailQuery    query   = new CapitalDetailQuery
            {
                memberId    = userid,
                capitalType = new CapitalDetailInfo.CapitalDetailType?(capitalType),
                PageSize    = rows,
                PageNo      = page
            };

            if (!string.IsNullOrWhiteSpace(startTime))
            {
                query.startTime = new DateTime?(DateTime.Parse(startTime));
            }
            if (!string.IsNullOrWhiteSpace(endTime))
            {
                query.endTime = new DateTime?(DateTime.Parse(endTime).AddDays(1.0).AddSeconds(-1.0));
            }
            ObsoletePageModel <CapitalDetailInfo> capitalDetails = service.GetCapitalDetails(query);
            List <CapitalDetailModel>             list           = (from e in capitalDetails.Models.ToList <CapitalDetailInfo>() select new CapitalDetailModel {
                Id = e.Id, Amount = e.Amount, CapitalID = e.CapitalID, CreateTime = e.CreateTime.Value.ToString(), SourceData = e.SourceData, SourceType = e.SourceType, Remark = e.SourceType.ToDescription() + ",单号:" + e.Id, PayWay = e.Remark
            }).ToList <CapitalDetailModel>();
            DataGridModel <CapitalDetailModel> data = new DataGridModel <CapitalDetailModel>
            {
                rows  = list,
                total = capitalDetails.Total
            };

            return(base.Json(data));
        }
Exemplo n.º 7
0
        public JsonResult List(CapitalDetailInfo.CapitalDetailType capitalType, int page, int rows)
        {
            var capitalService = _iMemberCapitalService;

            var query = new CapitalDetailQuery
            {
                memberId    = CurrentUser.Id,
                capitalType = capitalType,
                PageSize    = rows,
                PageNo      = page
            };
            var pageMode = capitalService.GetCapitalDetails(query);
            var model    = pageMode.Models.ToList().Select(e => new CapitalDetailModel
            {
                Id         = e.Id,
                Amount     = e.Amount,
                CapitalID  = e.CapitalID,
                CreateTime = e.CreateTime.Value.ToString(),
                SourceData = e.SourceData,
                SourceType = e.SourceType,
                Remark     = e.SourceType.ToDescription() + ",单号:" + e.Id,
                PayWay     = e.Remark
            }).ToList();

            var models = new DataGridModel <CapitalDetailModel>
            {
                rows  = model,
                total = pageMode.Total
            };

            return(Json(models));
        }
Exemplo n.º 8
0
        public JsonResult List(int page, int rows)
        {
            var capitalService = _iMemberCapitalService;

            var query = new CapitalDetailQuery
            {
                memberId = CurrentUser.Id,
                PageSize = rows,
                PageNo   = page
            };
            var pageMode = capitalService.GetCapitalDetails(query);
            var model    = pageMode.Models.ToList().Select(e => new CapitalDetailModel
            {
                Id         = e.Id,
                Amount     = e.Amount,
                CapitalID  = e.CapitalID,
                CreateTime = e.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                SourceData = e.SourceData,
                SourceType = e.SourceType,
                Remark     = e.SourceType.ToDescription(),
                PayWay     = e.Remark
            });

            return(Json(new { model = model, total = pageMode.Total }));
        }
Exemplo n.º 9
0
        public JsonResult List(Mall.Entities.CapitalDetailInfo.CapitalDetailType capitalType, int page, int rows)
        {
            var capitalService = _iMemberCapitalService;

            var query = new CapitalDetailQuery
            {
                memberId    = CurrentUser.Id,
                capitalType = capitalType,
                PageSize    = rows,
                PageNo      = page
            };
            var pageMode = capitalService.GetCapitalDetails(query);
            var model    = pageMode.Models.ToList().Select(e => new CapitalDetailModel
            {
                Id            = e.Id,
                Amount        = e.Amount + (e.PresentAmount > 0 ? e.PresentAmount : 0),
                CapitalID     = e.CapitalID,
                CreateTime    = e.CreateTime.ToString(),
                SourceData    = e.SourceData,
                SourceType    = e.SourceType,
                PresentAmount = e.PresentAmount,
                Remark        = GetCapitalRemark(e.SourceType, e.SourceData, e.Id.ToString(), e.Remark),
                PayWay        = e.Remark,
                IsExitRefund  = IsExitRefound(e.SourceData, e.SourceType)
            }).ToList();

            var models = new DataGridModel <CapitalDetailModel>
            {
                rows  = model,
                total = pageMode.Total
            };

            return(Json(models));
        }
Exemplo n.º 10
0
        public JsonResult List(int page, int rows)
        {
            IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>();
            CapitalDetailQuery    capitalDetailQuery   = new CapitalDetailQuery()
            {
                memberId = base.CurrentUser.Id,
                PageSize = rows,
                PageNo   = page
            };
            PageModel <CapitalDetailInfo>    capitalDetails = memberCapitalService.GetCapitalDetails(capitalDetailQuery);
            IEnumerable <CapitalDetailModel> list           =
                from e in capitalDetails.Models.ToList()
                select new CapitalDetailModel()
            {
                Id         = e.Id,
                Amount     = e.Amount,
                CapitalID  = e.CapitalID,
                CreateTime = e.CreateTime.Value.ToString(),
                SourceData = e.SourceData,
                SourceType = e.SourceType,
                Remark     = e.SourceType.ToDescription(),
                PayWay     = e.Remark
            };

            return(Json(list));
        }
Exemplo n.º 11
0
        public JsonResult List(int page, int rows)
        {
            IMemberCapitalService service = this._iMemberCapitalService;
            CapitalDetailQuery    query   = new CapitalDetailQuery
            {
                memberId = base.CurrentUser.Id,
                PageSize = rows,
                PageNo   = page
            };
            ObsoletePageModel <CapitalDetailInfo> capitalDetails = service.GetCapitalDetails(query);
            IEnumerable <CapitalDetailModel>      enumerable     = from e in capitalDetails.Models.ToList <CapitalDetailInfo>() select new CapitalDetailModel {
                Id = e.Id, Amount = e.Amount, CapitalID = e.CapitalID, CreateTime = e.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), SourceData = e.SourceData, SourceType = e.SourceType, Remark = e.SourceType.ToDescription(), PayWay = e.Remark
            };

            return(base.Json(new { model = enumerable, total = capitalDetails.Total }));
        }
Exemplo n.º 12
0
        public JsonResult List(CapitalDetailInfo.CapitalDetailType capitalType, long userid, string startTime, string endTime, int page, int rows)
        {
            IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>();
            CapitalDetailQuery    capitalDetailQuery   = new CapitalDetailQuery()
            {
                memberId    = userid,
                capitalType = new CapitalDetailInfo.CapitalDetailType?(capitalType),
                PageSize    = rows,
                PageNo      = page
            };
            CapitalDetailQuery nullable = capitalDetailQuery;

            if (!string.IsNullOrWhiteSpace(startTime))
            {
                nullable.startTime = new DateTime?(DateTime.Parse(startTime));
            }
            if (!string.IsNullOrWhiteSpace(endTime))
            {
                DateTime dateTime = DateTime.Parse(endTime).AddDays(1);
                nullable.endTime = new DateTime?(dateTime.AddSeconds(-1));
            }
            PageModel <CapitalDetailInfo> capitalDetails = memberCapitalService.GetCapitalDetails(nullable);
            List <CapitalDetailModel>     list           = (
                from e in capitalDetails.Models.ToList()
                select new CapitalDetailModel()
            {
                Id = e.Id,
                Amount = e.Amount,
                CapitalID = e.CapitalID,
                CreateTime = e.CreateTime.Value.ToString(),
                SourceData = e.SourceData,
                SourceType = e.SourceType,
                Remark = string.Concat(e.SourceType.ToDescription(), ",单号:", e.Id),
                PayWay = e.Remark
            }).ToList();
            DataGridModel <CapitalDetailModel> dataGridModel = new DataGridModel <CapitalDetailModel>()
            {
                rows  = list,
                total = capitalDetails.Total
            };

            return(Json(dataGridModel));
        }
Exemplo n.º 13
0
        public List <CapitalDetailInfo> GetCapitalDetailList(CapitalDetailQuery query)
        {
            var capitalDetail = Context.CapitalDetailInfo.Where(item => item.Himall_Capital.MemId == query.memberId);

            if (query.capitalType.HasValue && query.capitalType.Value != 0)
            {
                capitalDetail = capitalDetail.Where(e => e.SourceType == query.capitalType.Value);
            }
            if (query.startTime.HasValue)
            {
                capitalDetail = capitalDetail.Where(e => e.CreateTime >= query.startTime);
            }
            if (query.endTime.HasValue)
            {
                capitalDetail = capitalDetail.Where(e => e.CreateTime < query.endTime);
            }

            return(capitalDetail.ToList());
        }
Exemplo n.º 14
0
        public JsonResult List(Himall.Entities.CapitalDetailInfo.CapitalDetailType capitalType, long userid, string startTime, string endTime, int page, int rows)
        {
            var capitalService = _iMemberCapitalService;

            var query = new CapitalDetailQuery
            {
                memberId    = userid,
                capitalType = capitalType,
                PageSize    = rows,
                PageNo      = page
            };

            if (!string.IsNullOrWhiteSpace(startTime))
            {
                query.startTime = DateTime.Parse(startTime);
            }
            if (!string.IsNullOrWhiteSpace(endTime))
            {
                query.endTime = DateTime.Parse(endTime).AddDays(1).AddSeconds(-1);
            }
            var pageMode = capitalService.GetCapitalDetails(query);
            var model    = pageMode.Models.ToList().Select(e => new CapitalDetailModel
            {
                Id            = e.Id,
                Amount        = e.Amount + e.PresentAmount,
                CapitalID     = e.CapitalID,
                CreateTime    = e.CreateTime.ToString(),
                SourceData    = e.SourceData,
                SourceType    = e.SourceType,
                Remark        = GetCapitalRemark(e.SourceType, e.SourceData, e.Id.ToString(), e.Remark),
                PayWay        = GetPayWay(e.SourceData, e.SourceType),
                PresentAmount = e.PresentAmount
            }).ToList();

            var models = new DataGridModel <CapitalDetailModel>
            {
                rows  = model,
                total = pageMode.Total
            };

            return(Json(models));
        }
Exemplo n.º 15
0
        public PageModel <CapitalDetailInfo> GetCapitalDetails(CapitalDetailQuery query)
        {
            IQueryable <CapitalDetailInfo> capitalDetailInfo =
                from item in context.CapitalDetailInfo
                where item.ChemCloud_Capital.MemId == query.memberId
                select item;

            if (query.capitalType.HasValue && query.capitalType.Value != 0)
            {
                capitalDetailInfo =
                    from e in capitalDetailInfo
                    where (int)e.SourceType == (int)query.capitalType.Value
                    select e;
            }
            if (query.startTime.HasValue)
            {
                capitalDetailInfo =
                    from e in capitalDetailInfo
                    where e.CreateTime >= query.startTime
                    select e;
            }
            if (query.endTime.HasValue)
            {
                capitalDetailInfo =
                    from e in capitalDetailInfo
                    where e.CreateTime < query.endTime
                    select e;
            }
            int num = 0;
            IQueryable <CapitalDetailInfo> page = capitalDetailInfo.GetPage(out num, query.PageNo, query.PageSize, (IQueryable <CapitalDetailInfo> p) =>
                                                                            from e in p
                                                                            orderby e.CreateTime descending
                                                                            select e);

            return(new PageModel <CapitalDetailInfo>()
            {
                Models = page,
                Total = num
            });
        }
Exemplo n.º 16
0
        /// <summary>
        /// 获取用户奖励信息
        /// </summary>
        /// <returns></returns>
        public object GetCapitalInfo()
        {
            CheckUserLogin();
            if (CurrentUser != null)
            {
                CapitalDetailQuery query = new CapitalDetailQuery();
                query.memberId    = CurrentUser.Id;
                query.capitalType = null;

                List <CapitalDetailInfo> list = ServiceProvider.Instance <IMemberCapitalService> .Create.GetCapitalDetailList(query);

                var data = new {
                    CanWithDraw   = list.Sum(a => a.Amount),                                                                                                                                                                                                                            //可提现
                    Rewards       = list.Where(a => a.SourceType == CapitalDetailInfo.CapitalDetailType.OpenGroupReward || a.SourceType == CapitalDetailInfo.CapitalDetailType.InvitationReward || a.SourceType == CapitalDetailInfo.CapitalDetailType.ReturnMoney).Sum(a => a.Amount), //累计奖励
                    HasSettlement = list.Where(a => a.SourceType == CapitalDetailInfo.CapitalDetailType.WithDraw).Sum(a => a.Amount)                                                                                                                                                    //已结算
                };

                return(Json(new { Success = true, Data = data }));
            }
            else
            {
                return(Json(new { Success = false, Message = "未登录" }));
            }
        }
 /// <summary>
 /// 取多个会员资产明细
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public static ObsoletePageModel <CapitalDetailInfo> GetCapitalDetails(CapitalDetailQuery query)
 {
     return(_iMemberCapitalService.GetCapitalDetails(query));
 }
Exemplo n.º 18
0
 /// <summary>
 /// 取多个会员资产明细
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public static QueryPageModel <CapitalDetailInfo> GetCapitalDetails(CapitalDetailQuery query)
 {
     return(Service.GetCapitalDetails(query));
 }
Exemplo n.º 19
0
        /// <summary>
        /// 获取用户奖励列表
        /// </summary>
        /// <param name="cType"></param>
        /// <param name="pageNo"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public object GetCapitalDetails(int cType = 0, int pageNo = 1, int pageSize = 10)
        {
            CheckUserLogin();
            if (CurrentUser != null)
            {
                IMemberCapitalService _iMemberCapitalService = ServiceProvider.Instance <IMemberCapitalService> .Create;
                CapitalDetailQuery    query = new CapitalDetailQuery();
                query.memberId    = CurrentUser.Id;
                query.capitalType = (CapitalDetailInfo.CapitalDetailType)cType;
                query.PageNo      = pageNo;
                query.PageSize    = pageSize;

                ObsoletePageModel <CapitalDetailInfo> list = ServiceProvider.Instance <IMemberCapitalService> .Create.GetCapitalDetails(query);

                List <CapitalDetailInfo> data = new List <CapitalDetailInfo>();
                DataTable dt = new DataTable();
                dt.Columns.Add("Id");
                dt.Columns.Add("CapitalID");
                dt.Columns.Add("Amount");
                dt.Columns.Add("CreateTime");
                dt.Columns.Add("Remark");
                dt.Columns.Add("SourceData");
                dt.Columns.Add("SourceType");
                dt.Columns.Add("ShopName");
                dt.Columns.Add("Status");
                dt.Columns.Add("UserLogo");
                foreach (CapitalDetailInfo detail in list.Models)
                {
                    DataRow dr = dt.NewRow();
                    dr["Id"]         = detail.Id;
                    dr["CapitalID"]  = detail.CapitalID;
                    dr["Amount"]     = detail.Amount;
                    dr["CreateTime"] = detail.CreateTime;
                    dr["Remark"]     = detail.Remark;
                    dr["SourceData"] = detail.SourceData;
                    dr["SourceType"] = detail.SourceType;
                    dr["ShopName"]   = "";
                    dr["Status"]     = "";
                    dr["UserLogo"]   = CurrentUser.Photo;

                    if (detail.SourceType == CapitalDetailInfo.CapitalDetailType.WithDraw)
                    {
                        dr["Status"] = _iMemberCapitalService.GetWithDraw(Convert.ToInt64(detail.SourceData)).ApplyStatus.ToDescription();
                    }
                    else
                    {
                        var order = ServiceProvider.Instance <IOrderService> .Create.GetOrder(Convert.ToInt64(detail.SourceData));

                        if (order != null)
                        {
                            dr["ShopName"] = order.ShopName;
                        }
                    }


                    dt.Rows.Add(dr);
                }

                return(Json(new { Success = true, Data = dt, Total = list.Total }));
            }
            else
            {
                return(Json(new { Success = false, Message = "未登录" }));
            }
        }