Exemplo n.º 1
0
        /// <summary>
        /// 加载数据
        /// </summary>
        public async void Init()
        {
            Items.Clear();
            await Task.Run(() =>
            {
                try
                {
                    Entity.EFOperation.TitleInfo titleInfo = new Entity.EFOperation.TitleInfo();
                    TitleInfoRequest request = new TitleInfoRequest();
                    request.PageIndex        = 0;
                    request.PageSize         = 20;
                    //request.IsOccupy = 0;
                    request.UserNo = No;
                    var str        = titleInfo.SelectAllTitleInfoList(request);
                    if (str.RowCount > 0)
                    {
                        PageMax   = str.PageMax;
                        var tList = str.mainWindowModels.ToList();
                        ObservableCollection <MainWindowModel> oc = new ObservableCollection <MainWindowModel>();
                        tList.ForEach(x => oc.Add(x));
                        Items = oc;

                        //foreach (var item in tList)
                        //{
                        //    Items.Add(item);
                        //}

                        //foreach (var item in Items)
                        //{
                        //    item.IsHandle = 0;
                        //}
                    }
                    else
                    {
                        return;
                    }
                    //var result = new ActionResult();
                    //result.Result = true;
                }
                catch (Exception e)
                {
                    var str = e.Message;
                }
                finally
                {
                }
            });
        }
Exemplo n.º 2
0
 private void Handle_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Entity.EFOperation.TitleInfo titleInfo = new Entity.EFOperation.TitleInfo();
         TitleHandleRequest           request   = new TitleHandleRequest();
         //request.PageIndex = 0;
         //request.PageSize = 20;
         ////request.IsOccupy = 0;
         //PageNo = request.PageIndex;
         //request.UserNo = No;
         request.ID = ViewModel.SelectItem.ID;
         var str = titleInfo.TitleHandle(request);
         if (str == 1)
         {
             //Entity.EFOperation.TitleInfo titleInfo = new Entity.EFOperation.TitleInfo();
             TitleInfoRequest requestTitleInfo = new TitleInfoRequest();
             requestTitleInfo.PageIndex = ViewModel.PageNo;
             requestTitleInfo.PageSize  = 20;
             //request.IsOccupy = 0;
             requestTitleInfo.UserNo = ViewModel.No;
             var strTitleInfo = titleInfo.SelectAllTitleInfoList(requestTitleInfo);
             if (strTitleInfo.RowCount > 0)
             {
                 ViewModel.PageMax = strTitleInfo.PageMax;
                 var tList = strTitleInfo.mainWindowModels.ToList();
                 ObservableCollection <MainWindowModel> oc = new ObservableCollection <MainWindowModel>();
                 tList.ForEach(x => oc.Add(x));
                 ViewModel.Items = oc;
             }
         }
         else
         {
             return;
         }
         //var result = new ActionResult();
         //result.Result = true;
     }
     catch (Exception)
     {
     }
     finally
     {
     }
 }