| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Documents;
- using GalaSoft.MvvmLight;
- using GalaSoft.MvvmLight.Command;
- //----------------------------------------------------------------
- //Module Name: $safeprojectname$
- //Purpose:
- //CopyRight: Muchinfo
- //History:
- //----------------------------------------------------------------
- //DateTime 2015/11/12 13:46:09
- //Author ouyang.hongbin
- //Description Create
- //----------------------------------------------------------------
- using System.Windows;
- using GalaSoft.MvvmLight.Ioc;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Model;
- using Muchinfo.MTPClient.Infrastructure.Helpers;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- using Muchinfo.MTPClient.IService;
- using Muchinfo.MTPClient.Resources;
- using Muchinfo.MTPClient.Infrastructure.Cache;
- namespace Muchinfo.MTPClient.UI.ViewModels
- {
- public class RateNoticeViewModel : ViewModelBase
- {
- private ILoginService loginService;
- private const string c_paramId = "226";
- private bool _isNotice=true;
- /// <summary>
- /// 是否提示
- /// </summary>
- public bool IsNotice
- {
- get { return _isNotice; }
- set { Set(() => IsNotice, ref _isNotice, value); }
- }
- private bool _isBusy;
- public bool IsBusy
- {
- get { return _isBusy; }
- set { Set(() => IsBusy, ref _isBusy, value); }
- }
-
- private string _noticeText;
- /// <summary>
- /// 显示内容
- /// </summary>
- public string NoticeText
- {
- get { return _noticeText; }
- set { Set(() => NoticeText, ref _noticeText, value); }
- }
- /// <summary>
- /// 是否显示
- /// </summary>
- public bool IsShowCheckedBox
- {
- get
- {
- return ApplicationParameter.IsShowRateTips == 2;
- }
- }
- /// <summary>
- /// 同意
- /// </summary>
- public RelayCommand<Window> AgreeCommand
- {
- get
- {
- return new RelayCommand<Window>((view) =>
- {
-
-
- loginService.SystemRateComfrim(UserManager.CurrentTradeAccount.AccountId, ComfrimType.AgreeAndComfrim, RateComfrimSuccess, RateComfrimError);
-
-
- view.DialogResult = true;
- });
- }
- }
- /// <summary>
- /// 不同意
- /// </summary>
- public RelayCommand<Window> RefuseCommond
- {
- get
- {
- return new RelayCommand<Window>((view) =>
- {
- view.DialogResult = false;
- });
- }
- }
- /// <summary>
- /// 加载风险提示内容
- /// </summary>
- public void LoadNotices()
- {
- IsBusy = true;
- loginService = SimpleIoc.Default.GetInstance<ILoginService>();
- //loginService.SystemClientParamterConfigByID(c_paramId, RateNoticeContent, QueryNoticeError);
- ulong lastUpdateTimeUTC = CacheManager.GetLastUpdateTimeBy(Muchinfo.MTPClient.Data.Enums.LastUpdateTimeType.RiskMsgUTime);
- loginService.RiskTipQuerySearch(lastUpdateTimeUTC, RateNoticeContent, QueryNoticeError);
- }
- private void RateComfrimSuccess(bool rateComfrim)
- {
-
- }
- private void RateComfrimError(ErrorEntity errorEntity)
- {
- var format = "风险提示确认" + string.Format(ErrorManager.FormatErrorMsg(errorEntity));
- NoticeText = Client_Resource.RateNotice_Content;
- LogInfoHelper.WriteInfo(format);
- }
- /// <summary>
- /// 显示内容
- /// </summary>
- /// <param name="parameter"></param>
- private void RateNoticeContent(RiskTipQueryRspModel parameter,ulong risktipStamp=0)
- {
- IsBusy = false;
- if (parameter != null)
- {
- if (string.IsNullOrWhiteSpace(parameter.TipMsg))
- {
- NoticeText = Client_Resource.RateNotice_Content;
- }
- else
- {
- NoticeText = parameter.TipMsg;
- }
-
- }
- else
- {
- NoticeText = Client_Resource.RateNotice_Content;
- }
-
- }
- /// <summary>
- /// 风险提示出错
- /// </summary>
- /// <param name="errorEntity"></param>
- private void QueryNoticeError(ErrorEntity errorEntity)
- {
- IsBusy = false;
- var format = "查询:" + string.Format(ErrorManager.FormatErrorMsg(errorEntity));
- LogInfoHelper.WriteInfo(format);
- }
- }
- }
|