/// <summary> /// 初始化数据 /// </summary> public override void Initialize() { if (!_result) { return; } _result = false; IsBuyDetail = true; CommunicateManager.Invoke <IBusinessmanService>(p => { var tuple = p.GetSystemInfo(); if (tuple == null) { return; } BuySmsPrice = tuple.Item3; RemainCount = tuple.Item1; SendCount = tuple.Item2; }, UIManager.ShowErr); SendDetailViewModel = SendDetailViewModel.CreateInstance(); BuyDetailViewModel = BuyDetailViewModel.CreateInstance(); GiveDetailViewModel = GiveDetailViewModel.CreateInstance(); _result = true; }
internal void Init() { if (!_result) { return; } _result = false; IsWait = true; List.Clear(); Action action = () => CommunicateManager.Invoke <IBusinessmanService>(p => { var endTime = EndTime.HasValue ? EndTime.Value.AddDays(1) : EndTime; var dataPack = p.BuyRecordByPage(CurrentPageIndex, PageSize, StartTime, endTime, OutTradeNo); TotalCount = dataPack.TotalCount; dataPack.List.ForEach(x => DispatcherHelper.UIDispatcher.Invoke(new Action <BuyDetailDto>(List.Add), x)); }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(param => { Action setIsWait = () => { IsWait = false; _result = true; }; DispatcherHelper.UIDispatcher.Invoke(setIsWait); }); }
public JsonResult QueryAllFinancialProduct() { IEnumerable <FinancialProductDto> onSales = null; IEnumerable <FinancialProductDto> salesOut = null; CommunicateManager.Invoke <IFinancialService>(p => { var result = p.GetActiveProduct(null); onSales = result; }); CommunicateManager.Invoke <IFinancialService>(p => { var result = p.GetShelfProducts("5"); if (result != null) { foreach (var item in result) { item.MaxAmount = 0; item.CurrentAmount = 0; } salesOut = result; } }); return(Json(new { Sales = onSales, SalesOut = salesOut }, JsonRequestBehavior.AllowGet)); }
//理财账户 // GET: /Finance/ public ActionResult Index() { decimal FinancialMoney = 0; CommunicateManager.Invoke <IAccountService>(service => { FinancialMoney = service.GetAccountInfo().FinancialInfo.FinancialMoney; }); var model = new { searchForm = new { }, editForm = new { }, urls = new { search = "/Financial/QueryFinancial", financialLogIndex = "/Financial/FinancialLogIndex", abortFinancial = "/Financial/AbortFinancial", getFinancialMoney = "/Financial/GetFinancialMoney", queryExpectProfit = "/Financial/QueryExpectProfit", querySingleProductInfo = "/Financial/QuerySingleProductInfo", }, financialMoney = FinancialMoney }; return(View(model)); }
/// <summary> /// 查询方法 /// </summary> private void Search() { if (StartTime != null & EndTime != null) { if (DateTime.Compare(StartTime.Value, EndTime.Value) > 0) { UIManager.ShowMessage("结束时间大于开始时间"); return; } } IsBusy = true; DispatcherHelper.UIDispatcher.Invoke(new Action(() => { Action action = () => CommunicateManager.Invoke <IMyMessageService>(service => { GlobalData.ClientMainVm.TipCount = service.GetUnReadMsgCount(); var data = service.FindMyMsgList(CurrentPageIndex, PageSize); TotalCount = data.TotalCount; if (data.TotalCount <= 0) { return; } MyMessageModels = data.List; }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); })); }
public PartialViewResult SupplierDetail(string code) { SupplierDataObject supplierDetail = null; CommunicateManager.Invoke <IConsoBusinessmanService>(p => supplierDetail = p.FindSupplierByCode(code)); return(PartialView(supplierDetail)); }
/// <summary> /// 组织tree-josn数据 /// </summary> /// <returns></returns> public JsonResult GetJsonDate() { string path = AppDomain.CurrentDomain.BaseDirectory + "Menu.config"; XElement root = XElement.Load(path); int Share = 0; CommunicateManager.Invoke <IConsoBusinessmanService>(p => { Share = p.GetCurrentUser().Type == "Supplier" ? 2 : 1; }); var list = root.Descendants("Module").Select(p => new { id = int.Parse(p.Attribute("Code").Value), text = p.Attribute("Name").Value, state = "closed", Share = int.Parse(p.Attribute("Share").Value), children = p.Elements("Menus").Select(n => new { id = int.Parse(n.Attribute("Code").Value), text = n.Attribute("Name").Value, state = "closed", Share = int.Parse(n.Attribute("Share").Value), children = n.Elements("Menu").Select(m => new { id = int.Parse(m.Attribute("Code").Value), text = m.Attribute("Name").Value, Share = int.Parse(m.Attribute("Share").Value) }).Where(x => x.Share == 0 || x.Share == Share).ToList() }).Where(x => x.Share == 0 || x.Share == Share).ToList() }).Where(x => x.Share == 0 || x.Share == Share).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public SmsBuyViewModel() { if (IsInDesignMode) { return; } CommunicateManager.Invoke <IBusinessmanService>(p => { SmsBuyPrice = p.GetSystemInfo().Item3; //BuyCount = 100; var tuple = p.GetRecieveAndCreditMoney(); if (tuple != null) { RecieveMoney = tuple.Item1; CreditMoney = tuple.Item2; _balance = tuple.Item1; } var model = p.GetAllChargeSet(); SmsChargeModels = model.Select(sms => new SmsChargeModel { ID = sms.ID, Code = sms.Code, Count = sms.Count, CreateTime = sms.CreateTime, IsChecked = false, Price = sms.Price, State = sms.State, TotalPrice = sms.TotalPrice }).OrderBy(s => s.Count).ToList(); }, UIManager.ShowErr); }
public ProductBuyViewModel(FinancialProductDto currentProduct) { IsBusy = true; CurrentProduct = currentProduct; BuyPrice = currentProduct.LimitAmount; var action = new Action(() => { RefreshRecieveMoney(true); CommunicateManager.Invoke <IBusinessmanService>(service => { var serverTime = service.GetServerTime(); CountdownTimeSpan = currentProduct.EndDate - serverTime; //小于等于5天显示支付 IsShowCountdown = _countdownTimeSpan <= TimeSpan.FromDays(5); }, UIManager.ShowErr); }); Task.Factory.StartNew(action).ContinueWith(task => { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { IsBusy = false; })); }); }
public JsonResult GetEditPolicy(Guid id) { RequestPolicy model = null; CommunicateManager.Invoke <IConsoLocalPolicyService>(p => model = p.EditFind(id)); return(Json(model, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 政策详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public PartialViewResult ShowDetail(Guid id) { ResponseFullPolicy fullPolicy = null; CommunicateManager.Invoke <IConsoLocalPolicyService>(p => fullPolicy = p.Find(id)); return(PartialView(fullPolicy)); }
public JsonResult GetPolicyInfo(string guid) { ResponseLocalPolicy pageInfo = null; CommunicateManager.Invoke <IConsoLocalPolicyService>(p => pageInfo = p.Find(Guid.Parse(guid), 0)); return(Json(pageInfo, JsonRequestBehavior.DenyGet)); }
public void Init() { if (StartTime != null & EndTime != null) { if (DateTime.Compare(StartTime.Value, EndTime.Value) > 0) { UIManager.ShowMessage("结束时间大于开始时间"); return; } } IsBusy = true; Action action = () => CommunicateManager.Invoke <IBusinessmanService>(service => { var data = service.GetSmsGiveDetail(CurrentPageIndex, PageSize, StartTime, EndTime); if (data.TotalCount <= 0) { return; } TotalCount = data.TotalCount; GiveDetailDtos = data.List; }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); }
private void ExecuteSaveCommand() { IsBusy = true; Action action = () => CommunicateManager.Invoke <IBusinessmanService>(p => { if (!IsAddMode) { p.UpdateOperator(Operator); } else { p.AddOperator(Operator); } //Messenger.Default.Send<bool>(true, "CloseAddOperator"); IsOk = true; }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { DispatcherHelper.UIDispatcher.BeginInvoke(new Action(() => { IsBusy = false; })); }); }
public ActionResult SetDefaultPolicy() { List <DefaultPolicyDataObject> list = null; CommunicateManager.Invoke <IConsoBusinessmanService>(p => list = p.GetDefaultPolicy()); return(View(list)); }
/// <summary> /// 执行查询命令 /// </summary> protected override void ExecuteQueryCommand() { IsBusy = true; RePayDetailList.Clear(); Action action = () => CommunicateManager.Invoke <IAccountService>(service => { var status = SelectedStatus == BillStatus.All ? null : (SelectedStatus == BillStatus.Paid ? "1" : "0"); var result = service.GetRePayDetail(StartTime, EndTime, RepayStartDate, RepayEndDate, PayNo, status, (CurrentPageIndex - 1) * PageSize, PageSize, OutTradeNo); DispatcherHelper.UIDispatcher.Invoke(new Action(() => { TotalCount = result.TotalCount; })); if (result.List != null) { foreach (var item in result.List) { DispatcherHelper.UIDispatcher.Invoke(new Action <RePayDetailListDto>(RePayDetailList.Add), item); } } }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setBusyAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setBusyAction); }); }
public JsonResult GetEditInfo(string code) { RequestSupplier supplier = null; CommunicateManager.Invoke <IConsoBusinessmanService>(p => supplier = p.EditFind(code)); return(Json(supplier, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取单条通知信息 /// </summary> /// <param name="id"></param> private void GetNoticeInfo(int id) { IsBusy = true; DispatcherHelper.UIDispatcher.Invoke(new Action(() => { Action action = () => CommunicateManager.Invoke <IMyMessageService>(service => { var model = service.FindMyMsgById(id); if (model == null) { return; } InitData(model); if (!model.State) { service.ModifyMsgState(model.ID); } }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); })); }
public ActionResult AutoTicketSet() { AutoIssueTicketViewModel model = null; CommunicateManager.Invoke <IConsoBusinessmanService>(p => model = p.GetAutoIssueTicket()); return(View(model)); }
public JsonResult Login(LoginModel login) { CommunicateManager.Invoke <IConsoLoginService>(p => { string token = p.ConsoLogin(login.Code, login.UserName, login.Password, Request.Url.Host); var cookie = new HttpCookie("auth"); cookie.Values["token"] = token; cookie.Expires = DateTime.Now.AddMonths(1); Response.Cookies.Add(cookie); if (login.RememberMe) { var cookieUser = new HttpCookie("User"); cookieUser.Expires = DateTime.Now.AddMonths(1); cookieUser.Values["code"] = login.Code; cookieUser.Values["password"] = login.Password; cookieUser.Values["account"] = login.UserName.Trim(); cookieUser.Values["remember"] = login.RememberMe.ToString(); Response.Cookies.Add(cookieUser); } else { var cookieUser = new HttpCookie("User"); cookieUser.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(cookieUser); } }); return(Json(new { Url = Url.Action("Index", "Home") }, JsonRequestBehavior.DenyGet)); }
public void ExecuteQueryStopTextRemarkCommand(FlightInfoModel model) { //查询航班经停止信息 Action action = () => CommunicateManager.Invoke <IFlightDestineService>(service => { var m = service.GetLegStop(LoginInfo.Code, model.CarrayCode + model.FlightNumber, model.StartDateTime); var leg = new LegStopModel { FlightCodeNumber = m.CarrayCodeFlightNum, StartDate = m.StopDate + " " + m.FromTime, ToDate = m.StopDate + " " + m.ToTime, MiddleDate = m.StopDate + " " + m.MiddleTime1, FromCity = m.FromCity, ToCity = m.ToCity, MiddleCity = m.MiddleCity }; model.LegStopModel = leg; }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setBusyAction = () => { }; DispatcherHelper.UIDispatcher.Invoke(setBusyAction); }); }
private void Refresh(ResponseBusinessmanInfo merchant) { IsBusy = true; Action action = () => { CommunicateManager.Invoke <ITPosService>(service => { var result = service.GetBusinessmanInfo(merchant.Id); var index = Merchants.IndexOf(merchant); if (index >= 0) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { Merchants[index] = result; })); } }, UIManager.ShowErr); }; Task.Factory.StartNew(action).ContinueWith((task) => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); }
private void Query() { if (!_result) { return; } _result = false; IsBusy = true; OpList.Clear(); Action action = () => CommunicateManager.Invoke <IBusinessmanService>(p => { var temp = p.GetAllOperators(SearchRealName, SearchAccount, SelectedOperatorStatus); //分开写方便调试 if (temp != null) { temp.ForEach(x => DispatcherHelper.UIDispatcher.Invoke(new Action <OperatorDto>(OpList.Add), x)); } }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(p => { Action setIsWait = () => { IsBusy = false; _result = true; }; DispatcherHelper.UIDispatcher.Invoke(setIsWait); }); }
private void ExecuteDeleteCommand(ResponseBusinessmanInfo info) { var result = UIManager.ShowMessageDialog("确认删除商户?"); if (result == null || result.Value == false) { return; } IsBusy = true; Action action = () => { CommunicateManager.Invoke <ITPosService>(service => { service.DeleteBusinessman(info.Id); UIManager.ShowMessage("删除成功"); if (Merchants.Contains(info)) { DispatcherHelper.UIDispatcher.Invoke(new Action(() => { Merchants.Remove(info); })); } }, UIManager.ShowErr); }; Task.Factory.StartNew(action).ContinueWith((task) => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); }
public JsonResult Query(BehaviorStatModel query) { RequestQueryBehaviorStatQuery queryCon = new RequestQueryBehaviorStatQuery(); queryCon.BusinessmanCode = query.BusinessmanCode; queryCon.BusinessmanName = query.BusinessmanName; queryCon.BusinessmanType = query.BusinessmanType; queryCon.StartDateTime = Convert.ToDateTime(query.StartDateTime); queryCon.EndDateTime = Convert.ToDateTime(query.EndDateTime); queryCon.PageIndex = query.page; queryCon.PageSize = query.rows; queryCon.Sort = query.sort; queryCon.Order = query.order; DataPack <ResponseBehaviorStat> dpList = null; CommunicateManager.Invoke <IBehaviorStatService>(service => { dpList = service.Query(queryCon); }); if (dpList == null) { return(Json(new { total = 0, rows = new List <ResponseBehaviorStat>() }, JsonRequestBehavior.AllowGet)); } return(Json(new { total = dpList.TotalCount, rows = dpList.List }, JsonRequestBehavior.AllowGet)); }
protected override void ExecuteQueryCommand() { IsBusy = true; Merchants.Clear(); Action action = () => { CommunicateManager.Invoke <ITPosService>(service => { //获取商户列表 var temp = service.GetPosBusinessman(InputName, InputPosNo, (CurrentPageIndex - 1) * PageSize, PageSize); TotalCount = temp.TotalCount; if (temp.List != null) { foreach (var item in temp.List) { DispatcherHelper.UIDispatcher.Invoke(new Action <ResponseBusinessmanInfo>(Merchants.Add), item); } } }, UIManager.ShowErr); }; Task.Factory.StartNew(action).ContinueWith((task) => { Action setAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setAction); }); }
//理财产品 // GET: /FinancialProduct/ public ActionResult Index() { decimal _readyBalance = 0; CommunicateManager.Invoke <IAccountService>(service => { _readyBalance = service.GetAccountInfo().ReadyInfo.ReadyBalance; }); var model = new { searchForm = new { }, editForm = new { }, urls = new { searchOnSale = "/FinancialProduct/QueryOnSale", searchSaleOut = "/FinancialProduct/QuerySaleOut", queryAllFinancialProduct = "/FinancialProduct/QueryAllFinancialProduct", buy = "/FinancialProduct/BuyProduct" }, readyBalance = _readyBalance, financialProduct = new FinancialProductModel() }; return(View(model)); }
//导出excel public ActionResult ExportExcel(string code, string name, DateTime?startTime, DateTime?endTime, string exportType) { ExportExcelContext export = new ExportExcelContext(exportType); DataTable dt = new DataTable("商户信息"); List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("商户名称", typeof(string)), new KeyValuePair <string, Type>("业务员", typeof(string)), new KeyValuePair <string, Type>("业务员电话", typeof(string)), new KeyValuePair <string, Type>("联系人", typeof(string)), new KeyValuePair <string, Type>("联系电话", typeof(string)), new KeyValuePair <string, Type>("联系地址", typeof(string)), new KeyValuePair <string, Type>("状态", typeof(string)), new KeyValuePair <string, Type>("创建时间", typeof(string)) }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); CommunicateManager.Invoke <IConsoBusinessmanService>(p => { p.GetBusinessmanBuyerByCode(code, name, startTime, endTime, 1, 1000).Rows.ForEach(n => { dt.Rows.Add(n.Code, n.Name, n.ContactName, n.Phone, n.ContactWay.Contact, n.ContactWay.Tel, n.ContactWay.Address, n.IsEnable ? "正常" : "禁用", n.CreateTime); }); }); return(File(export.GetMemoryStream(dt), "application/ms-excel", HttpUtility.UrlEncode(string.Format("{1}.{0}", export.TypeName, dt.TableName + DateTime.Now.ToString("yyyyMMdd")), System.Text.Encoding.UTF8))); }
private void ExecutePayOrderByBankCommand(string bankCode) { IsPaying = true; Action action = () => CommunicateManager.Invoke <IOrderService>(service => { var uri = service.SaleOrderPayByBank(SourceOrder.Id, bankCode); if (uri == "True") { var info = service.QueryAfterSaleOrderPayStatus(SourceOrder.Id); if (info == "已支付") { UIManager.ShowMessage("订单已支付"); IsPaid = true; } return; } LocalUIManager.OpenDefaultBrowser(uri); var isOk = UIManager.ShowPayWindow(); if (isOk == null || !isOk.Value) { return; } IsPaid = true; }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setBusyAction = () => { IsPaying = false; }; DispatcherHelper.UIDispatcher.Invoke(setBusyAction); }); }
//刷新指定订单 private void RefreshOrders(ResponseAfterSaleOrder order) { IsBusy = true; Action action = () => CommunicateManager.Invoke <IOrderService>(service => { var data = service.GetSaleOrderBySearch(1, 1, "", "", null, null, null, null, "", null, null, order.Id); if (data.List == null) { return; } DispatcherHelper.UIDispatcher.Invoke(new Action(() => { try { var index = Orders.IndexOf(Orders.FirstOrDefault(p => p.Id == order.Id)); Orders[index] = data.List[0]; } catch (Exception ex) { Console.WriteLine(ex.Message); //throw; } })); }, UIManager.ShowErr); Task.Factory.StartNew(action).ContinueWith(task => { Action setBusyAction = () => { IsBusy = false; }; DispatcherHelper.UIDispatcher.Invoke(setBusyAction); }); }