| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- //----------------------------------------------------------------
- //Module Name: $safeprojectname$
- //Purpose:
- //CopyRight: Muchinfo
- //History:
- //----------------------------------------------------------------
- //DateTime 2017/1/11 23:53:59
- //Author
- //Description Create
- //----------------------------------------------------------------
- using System.Windows;
- using GalaSoft.MvvmLight;
- using GalaSoft.MvvmLight.Command;
- using GalaSoft.MvvmLight.Ioc;
- using Microsoft.Practices.ServiceLocation;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Helper;
- using Muchinfo.MTPClient.Data.Model;
- using Muchinfo.MTPClient.Data.Model.Sale;
- using Muchinfo.MTPClient.Infrastructure.Cache;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- using Muchinfo.MTPClient.IService;
- using Muchinfo.MTPClient.Resources;
- using Muchinfo.MTPClient.Sale.Views;
- namespace Muchinfo.MTPClient.Sale.ViewModels
- {
- public class DepositPlanViewModel:ViewModelBase
- {
- private IDepositService _iDepositService;
- #region 构造函数
- public DepositPlanViewModel()
- {
- _iDepositService = SimpleIoc.Default.GetInstance<IDepositService>();
- QueryDesositPlan();
-
- }
- #endregion
- #region 成员变量
- private DepositPlan _currentDataGridItem;
- /// <summary>
- /// 当前选中DataGridItem
- /// </summary>
- public DepositPlan CurrentDataGridItem
- {
- get { return _currentDataGridItem; }
- set
- {
- Set(() => CurrentDataGridItem, ref _currentDataGridItem, value);
-
- }
- }
- /// <summary>
- /// 发行托管
- /// </summary>
- private List<DepositPlan> _depositPlanList;
- public List<DepositPlan> DepositPlanList
- {
- get { return _depositPlanList; }
- set { Set(() => DepositPlanList, ref _depositPlanList, value); }
- }
-
- #endregion
-
- /// <summary>
- /// 查询
- /// </summary>
- public RelayCommand SelectCommand
- {
- get
- {
- return new RelayCommand(() =>
- {
- QueryDesositPlan();
- });
- }
- }
-
- /// <summary>
- /// 申购
- /// </summary>
- public RelayCommand DetailCommand
- {
- get
- {
- return new RelayCommand(() =>
- {
- if (CurrentDataGridItem == null)
- {
- //todo:提示无选择商品
- return;
- }
- var win = new DepositApplyView(CurrentDataGridItem, DepositPlanList)
- {
- Owner = Application.Current.MainWindow,
- WindowStartupLocation = WindowStartupLocation.CenterOwner
- };
- win.ShowDialog();
- });
- }
- }
-
- /// <summary>
- /// 错误处理
- /// </summary>
- /// <param name="error">错误内容</param>
- private void QueryErrorFunc(ErrorEntity error)
- {
- DepositPlanList = null;
- Application.Current.Dispatcher.BeginInvoke(new Action(() =>
- {
- ErrorManager.ShowReturnError(error, Client_Resource.UI2014_Tips, true);
- }));
- }
-
- public void QueryDesositPlan()
- {
- _iDepositService.QueryDepositPlanGoods(QuerySuccess,QueryErrorFunc);
- }
- public void QuerySuccess(List<DepositPlan> list)
- {
- DepositPlanList = list;
- }
-
-
- }
- }
|