public async Task <IActionResult> HttpClientDownloadTest3Async()
        {
            var urlStr = @"http://*****:*****@"D:/ProjecDoc/result.json", FileMode.Create);
                        await httpFileResult.Stream.CopyToAsync(fileStream);

                        fileStream.Close();
                        return(Json(httpFileResult.IsSuccess));
                    }
                }
                else
                {
                    return(Json(httpFileResult));
                }
                //return new FileStreamResult(httpFileResult.Stream, "text/plain; charset=utf-8");
            }
            else
            {
                return(Json(httpFileResult));
            }
        }
Пример #2
0
        public JsonResult GetAppLogList(LogQueryModel model)
        {
            QueryParamModel query = GetQueryModel(model);
            var             list  = LogUtil.GetListPage(query);

            return(Json(new { total = list.Total, rows = list.Rows }));
        }
Пример #3
0
        private void serviceClient_GetGlobalRegionCompleted(object sender, GetGlobalRegionCompletedEventArgs e)
        {
            if (this.Window.FaultHandle.Handle(e))
            {
                return;
            }

            if (e.Result.ResultList != null)
            {
                LogGlobalRegionBody firstItem = new LogGlobalRegionBody()
                {
                    GlobalID   = null,
                    GlobalName = CommonResource.ComboBox_ExtraAllText
                };
                List <LogGlobalRegionBody> list = e.Result.ResultList.ToList();
                list.Insert(0, firstItem);

                this.ddlGlobal.ItemsSource = list;

                LogQueryModel queryModel = e.UserState as LogQueryModel;
                if (queryModel != null)
                {
                    this.ddlGlobal.SelectedValue = queryModel.GlobalID;
                }
                else
                {
                    this.ddlGlobal.SelectedIndex = 0;
                }
            }

            this.DataGridLogList.QueryCriteria = GridSearchArea.DataContext;
            this.DataGridLogList.Bind();
        }
Пример #4
0
        private void serviceClient_GetCategoryConfigsCompleted(object sender, GetCategoryConfigsCompletedEventArgs e)
        {
            if (this.Window.FaultHandle.Handle(e))
            {
                return;
            }

            if (e.Result.ResultList != null)
            {
                LogCategoryBody firstItem = new LogCategoryBody()
                {
                    GlobalID            = null,
                    LocalID             = null,
                    CategoryName        = null,
                    CategoryDescription = CommonResource.ComboBox_ExtraAllText
                };
                List <LogCategoryBody> list = e.Result.ResultList.ToList();
                list.ForEach(item => item.CategoryDescription = item.CategoryName);
                list.Insert(0, firstItem);

                this.ddlCategory.ItemsSource = list;
                this.ddlCategory.IsEnabled   = true;

                LogQueryModel queryModel = e.UserState as LogQueryModel;
                if (queryModel != null)
                {
                    this.ddlCategory.SelectedValue = queryModel.CategoryName;
                }
                else
                {
                    this.ddlCategory.SelectedIndex = 0;
                }
            }
        }
Пример #5
0
 public void GetInfoByWhereTest()
 {
     LogQueryModel qModel = new LogQueryModel
     {
         ID = Guid.Parse("37689F18-E5F2-42AE-9610-273DA251A80B")
     };
     List <LogModel> listM = logDal.GetInfoByWhere(qModel);
 }
        public async Task <IActionResult> GetPageAsync(LogQueryModel qModel)
        {
            var result = await _logSvc.GetPageDataAsync(qModel);

            var json = JsonConvert.SerializeObject(result);

            return(Json(result));
        }
        public void EntityToDictionaryTest()
        {
            var qModel = new LogQueryModel()
            {
                PageSize = 10
            };
            var dict = _mapUtil.EntityToDictionary(qModel);

            Assert.Equal(dict["pageSize"], 10.ToString());
        }
        public async Task Test()
        {
            var qModel = new LogQueryModel()
            {
                PageSize = 10
            };

            //var t = MapExtensions.GetDescription()
            Assert.Equal(1, 1);
        }
        public async Task <dynamic> HttpClientUtilTestAsync()
        {
            var urlStr = @"http://localhost:54238/API/Log/Page";
            var param  = new LogQueryModel()
            {
                PageSize = 1000
            };
            var httpResult = await _httpClientUtil.SendAsync(param, urlStr, "get", MediaTypeEnum.UrlQuery);

            return(httpResult);
        }
Пример #10
0
        public async Task Test()
        {
            var param = new LogQueryModel()
            {
                OrderByColumn = "Id",
                IsDesc        = false
            };
            var result = await _logSvc.GetPageDataAsync(param);

            Assert.LessOrEqual(result.Data.Count, 20);
        }
Пример #11
0
        private QueryParamModel GetQueryModel(LogQueryModel model)
        {
            QueryParamModel data = new QueryParamModel();

            data.KeyWord   = model.KeyWord ?? "";
            data.BeginDate = LogUtil.GetDateFormName(model.BeginDate, DateTime.MinValue);
            data.EndDate   = LogUtil.GetDateFormName(model.EndDate, DateTime.MaxValue);

            data.Limit  = model.Limit;
            data.Offset = model.Offset;

            return(data);
        }
Пример #12
0
 public void GetInfoByWhereTest1()
 {
     LogQueryModel qModel = new LogQueryModel
     {
         ID     = Guid.Parse("37689F18-E5F2-42AE-9610-273DA251A80B"),
         GroupM = new GroupModel(GroupType.Asc, "CreateTime")
     };
     MPagingModel pageM = new MPagingModel()
     {
         PagingIndex = 1,
         PagingSize  = 20
     };
     MPagingData <List <LogModel> > listM = logDal.GetInfoByWhere(qModel, pageM);
 }
Пример #13
0
        public async Task <dynamic> GetPageDataAsync(LogQueryModel qModel)
        {
            var query = _testDB.Log.AsNoTracking();

            query = !string.IsNullOrEmpty(qModel.OrderByColumn) ? query.OrderBy(qModel.OrderByColumn, qModel.IsDesc) : query.OrderByDescending(o => o.Id);
            query = query.Skip((qModel.PageIndex - 1) * qModel.PageSize).Take(qModel.PageSize);
            var result = new ResultDto <dynamic>()
            {
                ActionResult = true,
                Message      = "Success",
                Data         = await query.ToListAsync()
            };

            return(result);
        }
        public async Task <dynamic> HttpClientDownloadTestAsync()
        {
            var urlStr = @"http://*****:*****@"D:/ProjecDoc/result.json", FileMode.Create);
                            //await stream.CopyToAsync(fileStream);
                            //fileStream.Close();
                            await stream.CopyToAsync(memoryStream);
                        }
                        memoryStream.Seek(0, SeekOrigin.Begin);
                        Response.Headers.Add("Content-Disposition", "attachment; filename=result.json");
                        return(new FileStreamResult(memoryStream, "text/plain; charset=utf-8"));
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                }
                else
                {
                    return(response.StatusCode);
                }
            }
        }
Пример #15
0
        private void dgLog_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            LogQueryModel queryModel = e.QueryCriteria as LogQueryModel;

            if (queryModel != null)
            {
                LogQueryCriteria queryCriteria = queryModel.ToQueryCriteria();
                queryCriteria.PagingInfo = new Newegg.Oversea.Silverlight.CommonDomain.QueryLogService.PagingInfo()
                {
                    PageSize      = e.PageSize,
                    StartRowIndex = e.PageIndex * e.PageSize,
                    SortField     = e.SortField
                };

                this.ButtonSearch.IsEnabled = false;

                this.m_queryLogEntryClient.GetLogsAsync(queryCriteria);
            }
        }
Пример #16
0
        private void serviceClient_GetLocalRegionCompleted(object sender, GetLocalRegionCompletedEventArgs e)
        {
            if (this.Window.FaultHandle.Handle(e))
            {
                return;
            }

            if (e.Result.ResultList != null)
            {
                LogLocalRegionBody firstItem = new LogLocalRegionBody()
                {
                    GlobalID  = null,
                    LocalID   = null,
                    LocalName = CommonResource.ComboBox_ExtraAllText
                };
                List <LogLocalRegionBody> list = e.Result.ResultList.ToList();
                for (int i = list.Count - 1; i >= 0; i--)
                {
                    if (list[i].Status == Status.Inactive)
                    {
                        list.Remove(list[i]);
                    }
                }
                list.Insert(0, firstItem);

                this.ddlLocal.ItemsSource = list;
                this.ddlLocal.IsEnabled   = true;


                this.ddlCategory.IsEnabled = false;

                LogQueryModel queryModel = e.UserState as LogQueryModel;
                if (queryModel != null)
                {
                    this.ddlLocal.SelectedValue = queryModel.LocalID;
                }
                else
                {
                    this.ddlLocal.SelectedIndex = 0;
                }
            }
        }