Ejemplo n.º 1
0
        public string IWantToBuyList_User(QueryCommon <IWantToBuyQuery> query)
        {
            if (base.CurrentUser != null)
            {
                query.ParamInfo.PurchaseID = base.CurrentUser.Id;
            }
            Result_List_Pager <Result_IWantToBuy> res     = new Result_List_Pager <Result_IWantToBuy>();
            Result_List_Pager <IWantToBuy>        resList = iWantToBuyService.IWantToBuyList_User(query);

            if (resList.Msg.IsSuccess)
            {
                var listHash = hashSet.Get_DictionariesList();

                res.PageInfo = resList.PageInfo;
                res.Msg      = resList.Msg;
                res.List     = resList.List.Select(x => new Result_IWantToBuy()
                {
                    Id          = x.Id,
                    PurchaseID  = x.PurchaseID,
                    ProductName = x.ProductName,
                    PurchaseNum = x.PurchaseNum,
                    Quantity    = x.Quantity,
                    Remarks     = x.Remarks,
                    TotalPrice  = x.TotalPrice,
                    Unit        = x.Unit,
                    UnitPrice   = x.UnitPrice,
                    Address     = x.Address,
                    Status      = x.Status,
                    StatusStr   = listHash.Where(y => y.DictionaryTypeId == 107 && y.DKey == x.Status.ToString()).FirstOrDefault().DValue,
                    //SupplyModel = GetObjectById_Web_Supply(x.Id),
                    //SupplyList = GetObjectById_Web_SupplyList(x.Id).List,

                    DeliveryDate = x.DeliveryDate.ToString("yyyy-MM-dd hh:mm"),
                    CreateDate   = x.CreateDate.ToString("yyyy-MM-dd hh:mm"),
                    StartDate    = x.StartDate.ToString("yyyy-MM-dd hh:mm"),
                    EndDate      = x.EndDate.ToString("yyyy-MM-dd hh:mm"),
                    UpdateDate   = x.UpdateDate.ToString("yyyy-MM-dd hh:mm"),

                    TypeOfCurrency = listHash.Where(y => y.DictionaryTypeId == 1 && y.DValue == x.TypeOfCurrency.ToString()).FirstOrDefault().Remarks
                }).ToList();
            }
            else
            {
                res.Msg = resList.Msg;
            }

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