/// <summary>
        /// 加载首页Banner
        /// </summary>
        /// <returns></returns>
        public Result_List1 <Result_TransactionRecord> GetTransactionRecordList_Web(int count)
        {
            Result_List1 <Result_TransactionRecord> resList = new Result_List1 <Result_TransactionRecord>();

            try
            {
                //1:代理采购;
                var list1 = (from p in context.TransactionRecord where p.CurveType == 1 select p).OrderByDescending(x => x.YearMonth).Take(count).ToList();
                resList.List1 = list1.Select(x => new Result_TransactionRecord()
                {
                    Id               = x.Id,
                    CurveType        = HashSet_Common.hashCurveType.Where(y => y.Key == x.CurveType).FirstOrDefault().Value,
                    XName_CN         = x.XName_CN,
                    XName_Eng        = x.XName_Eng,
                    Y_CompleteAmount = x.Y_CompleteAmount,
                    Y_OrderAmount    = x.Y_OrderAmount,
                    Y_CompleteNumber = x.Y_CompleteNumber,
                    Y_OrderQuantity  = x.Y_OrderQuantity,
                    YearMonth        = x.YearMonth.ToString("yyyy-MM"),
                    IsTrue           = x.IsTrue
                }).ToList();

                //2:定制合成
                var list2 = (from p in context.TransactionRecord where p.CurveType == 2 select p).OrderByDescending(x => x.YearMonth).Take(count).ToList();
                resList.List2 = list2.Select(x => new Result_TransactionRecord()
                {
                    Id               = x.Id,
                    CurveType        = HashSet_Common.hashCurveType.Where(y => y.Key == x.CurveType).FirstOrDefault().Value,
                    XName_CN         = x.XName_CN,
                    XName_Eng        = x.XName_Eng,
                    Y_CompleteAmount = x.Y_CompleteAmount,
                    Y_OrderAmount    = x.Y_OrderAmount,
                    Y_CompleteNumber = x.Y_CompleteNumber,
                    Y_OrderQuantity  = x.Y_OrderQuantity,
                    YearMonth        = x.YearMonth.ToString("yyyy-MM"),
                    IsTrue           = x.IsTrue
                }).ToList();
                resList.Msg = new Result_Msg()
                {
                    IsSuccess = true
                };
            }
            catch (Exception ex)
            {
                resList.Msg = new Result_Msg()
                {
                    IsSuccess = false, Message = "查询交易记录失败,失败原因:" + ex.Message
                };
            }
            return(resList);
        }
Пример #2
0
        public string Get_TransactionRecord_List()
        {
            Result_List1 <Result_TransactionRecord> res = ServiceHelper.Create <ITransactionRecordService>().GetTransactionRecordList_Web(6);

            return(Newtonsoft.Json.JsonConvert.SerializeObject(res));
        }