예제 #1
0
 public MyListPage(MainWindow window)
 {
     this.mainWindow = window;
     InitializeComponent();
     viewmodel        = new MyListViewModel(window);
     this.DataContext = viewmodel;
 }
        public MyListViewModel GetMyList(GetMyListRequest request,
                                         IEnumerable <KeyValuePair <string, string> > pairs)
        {
            var viewModel = new MyListViewModel();

            #region 参数校验
            //校验请求串
            var baseRequest = new AppBaseRequest()
            {
                Agent      = request.Agent,
                SecCode    = request.SecCode,
                CustKey    = request.CustKey,
                BhToken    = request.BhToken,
                ChildAgent = request.ChildAgent
            };
            //校验返回值
            var baseResponse = _appVerifyService.Verify(baseRequest, pairs);
            if (baseResponse.ErrCode != 1)
            {
                viewModel.BusinessStatus = baseResponse.ErrCode;
                viewModel.StatusMessage  = baseResponse.ErrMsg;
                return(viewModel);
            }
            #endregion

            #region 业务逻辑
            viewModel = _bjdService.GetMyList(request);
            #endregion
            return(viewModel);
        }
예제 #3
0
 // public List<string> MyListData { get; set; }
 public MainPage()
 {
     // MyListData = new List<string>()
     // {
     //     "Learn",
     //     "Hard work",
     //     "Smart Work",
     //     "Praying",
     //     "Praying"
     //
     // };
     InitializeComponent();
     BindingContext = new MyListViewModel();
     //  MyList.ItemSource = MyListData;
 }
예제 #4
0
        public HttpResponseMessage GetMyList([FromUri] GetMyListRequest request)
        {
            _logAppInfo.Info(string.Format("请求报价续保列表接口请求串:{0}", Request.RequestUri));
            var viewModel = new MyListViewModel();

            if (!ModelState.IsValid)
            {
                viewModel.BusinessStatus = -10000;
                string msg = ModelState.Values.Where(a => a.Errors.Count == 1).Aggregate(string.Empty, (current, a) => current + (a.Errors[0].ErrorMessage + ";   "));
                viewModel.StatusMessage = "输入参数错误," + msg;
                return(viewModel.ResponseToJson());
            }
            viewModel = _appAchieveService.GetMyList(request, Request.GetQueryNameValuePairs());
            //_logAppInfo.Info(string.Format("请求报价续保列表接口返回值:{0}", viewModel.ToJson()));
            return(viewModel.ResponseToJson());
        }
예제 #5
0
        public async Task <ActionResult> MyLists()
        {
            var token    = Session["token"].ToString();
            var sortType = Session["sortType"].ToString();
            var id       = Session["userId"].ToString();

            var model = await caller.GetWithAuthorization <IEnumerable <ListViewModel> >(apiMethods.ListsBaseUrl(), string.Concat(apiMethods.GetListsByUserId, id), token);

            var displayModel = new List <MyListViewModel>();

            foreach (var val in model)
            {
                var myDatamart = await caller.GetWithAuthorization <DatamartViewModel>(apiMethods.FiltersBaseUrl(), string.Concat(apiMethods.GetAvailableDatamartById, val.Datamart), token);

                var myModel = new MyListViewModel
                {
                    SavedFilterId = val.SavedFilterId,
                    ListName      = val.ListName,
                    Datamart      = myDatamart.DisplayName,
                    DatamartId    = myDatamart.DatamartId,
                    Count         = val.Count,
                    CreatedDate   = val.CreatedDate,
                    StatusName    = val.StatusName
                };

                displayModel.Add(myModel);
            }

            switch (sortType)
            {
            case "date":
                displayModel.OrderBy(l => l.CreatedDate);
                break;

            case "market":
                displayModel.OrderBy(l => l.Datamart);
                break;

            default:
                break;
            }

            return(View(displayModel));
        }
예제 #6
0
        //Главное окно
        public ActionResult MyBudget(string id)
        {
            string UserGuid = User.Identity.GetUserId();
            var    user     = _context.Users.Single(u => u.Id == UserGuid);



            DateTime dt;

            if (String.IsNullOrEmpty(id))
            {
                dt = DateTime.Now; //по умолчанию текущий месяц
            }
            else
            {
                dt = DateTime.ParseExact(id, "MMyyyy", CultureInfo.InvariantCulture, DateTimeStyles.None);
            }

            //Ежемесячные платежи
            if (UpdateDateExpired(user.UpdateDate))
            {
                if (user.CarryoverRests)
                {
                    AddRestTransaction(UserGuid);
                }

                user.UpdateDate = DateTime.Now;
                _context.SaveChanges();
            }



            var viewModel = new MyListViewModel
            {
                MyGoals     = _context.Goals.Where(m => m.UserId == UserGuid).ToList(),
                ListDate    = dt.ToString("Y", new CultureInfo("ru-RU")),
                DefCurrency = user.DefCurrency
            };

            return(View(viewModel));
        }
예제 #7
0
    public MyDataGridView(MyListViewModel viewModel)
    {
        InitializeComponent();

        DataContext = viewModel;
    }
 public ListItem(MyListViewModel parent)
 {
     _parent = parent;
 }
        public MyListPage()
        {
            InitializeComponent();

            BindingContext = new MyListViewModel();
        }
예제 #10
0
 public Peruana()
 {
     InitializeComponent();
     BindingContext = new MyListViewModel();
 }
예제 #11
0
        public async Task <IActionResult> List(string id)
        {
            AppUser user = null;

            if ((id == null || id == ""))
            {
                user = await GetCurrentUserAsync();
            }
            else
            {
                user = await _context.Users
                       .SingleOrDefaultAsync(x => x.NormalizedUserName == id.ToUpper());
            }
            // double check after getting id user
            if (user == null)
            {
                return(RedirectToAction("Error", "Home", new { id = 404 }));
            }
            var myList = await _context.MyList
                         .Include(m => m.MyListShows)
                         .SingleOrDefaultAsync(x => x.User.Id == user.Id);

            List <MyListShows> complete = new List <MyListShows>();
            List <MyListShows> watching = new List <MyListShows>();
            List <MyListShows> want     = new List <MyListShows>();;

            if (myList == null)
            {
                // just make an empty list, so no errors appear
                myList = new MyList()
                {
                    MyListShows = new List <MyListShows>(),
                };
            }
            else
            {
                myList.MyListShows = await _context.MyListShows
                                     .Include(m => m.MyList)
                                     .Include(m => m.Show)
                                     .Include(m => m.Movie)
                                     .Where(x => x.MyList.Id == myList.Id)
                                     .ToListAsync();

                complete = myList.MyListShows
                           .Where(x => x.Status == (int)ShowStatus.COMPLETED)
                           .ToList();
                watching = myList.MyListShows
                           .Where(x => x.Status == (int)ShowStatus.WATCHING)
                           .ToList();
                want = myList.MyListShows
                       .Where(x => x.Status == (int)ShowStatus.WANT_TO_WATCH)
                       .ToList();
            }
            var model = new MyListViewModel()
            {
                Username    = user.UserName,
                Complete    = complete,
                WantToWatch = want,
                Watching    = watching
            };

            return(View(model));
        }