public ActionResult Opens(string strIds, ListAccounts request) { var dealway = _dealWayService.Query().FirstOrDefault(); if (dealway == null) { throw new Exception("请先创建支付方式"); } ResultMsg result = new ResultMsg(); int successCount = 0; int errorCount = 0; if (!string.IsNullOrEmpty(strIds)) { string[] sId = strIds.Split(','); foreach (var id in sId) { int intId = 0; if (int.TryParse(id, out intId)) { result = request.Open(intId, dealway); if (result.Code == 1) { successCount += 1; } else { errorCount += 1; } } } } result.CodeText = "批量会员卡发放成功" + successCount + "个会员,失败" + errorCount + "个"; return(Json(result)); }
public ActionResult Resumes(string strIds, ListAccounts request) { ResultMsg result = new ResultMsg(); int successCount = 0; int errorCount = 0; if (!string.IsNullOrEmpty(strIds)) { string[] sId = strIds.Split(','); foreach (var id in sId) { int intId = 0; if (int.TryParse(id, out intId)) { result = request.Resume(intId); if (result.Code == 1) { successCount += 1; } else { errorCount += 1; } } } } result.CodeText = "启用成功" + successCount + "个会员,失败" + errorCount + "个"; return(Json(result)); }
public ActionResult Create(string strIds, ListAccounts request) { ResultMsg result = new ResultMsg(); strIds = System.Web.HttpContext.Current.Request["data"]; if (!string.IsNullOrEmpty(strIds)) { int[] ids; string[] sId = strIds.Split(','); ids = Array.ConvertAll <string, int>(sId, s => int.Parse(s)); var items = _accountService.Query(new AccountRequest() { State = AccountStates.Initialized, Ids = ids }).ToList(); return(View("Create", new CreateAccount() { List = items })); } return(View("Create", new CreateAccount() { List = null })); }
public ListAccountsResponse ListAccounts(ListAccountsRequest request) { var command = new ListAccounts(_apiKey, _secret, _baseUri, _authenticator, _builder) { Parameters = request }; return((ListAccountsResponse)((ICommandExecutor)this).Execute(command)); }
public Account CreateAccount() { var account = new Account(); ListAccounts.Add(account); account.OnCallHandler += CallConnection; account.OnCallHandler += EndCall; account.OnSmsHandler += SmsConnection; account.OnSmsHandler += ReceiveSms; return(account); }
void DisplayAccounts() { //create an instance of the County Collection CarClasses.clsAccountsCollection Account = new CarClasses.clsAccountsCollection(); //set the data source to the list of counties in the collection ListAccounts.DataSource = Account.AccountsList; //set the name of the primary key ListAccounts.DataValueField = "AccountNr"; //set the data field to display ListAccounts.DataTextField = "AccountNr"; //bind the data to the list ListAccounts.DataBind(); }
public Account CreateMobileAccount() { var mobileAccount = new Account(); ListAccounts.Add(mobileAccount); mobileAccount.OnCallHandler += CallConnection; mobileAccount.OnCallHandler += EndCall; mobileAccount.OnSmsHandler += SmsConnection; mobileAccount.OnSmsHandler += ReceiveSms; return(mobileAccount); }
public ActionResult List(ListAccounts request) { string pageHtml = string.Empty; if (ModelState.IsValid) { ModelState.Clear(); request.New_Query(out pageHtml); ViewBag.pageHtml = MvcHtmlString.Create(pageHtml); } request.Ready(); return(View("List", request)); }
private void SmsConnection(object sender, AccountEventArgs e) { LogSmsEvent("Try to send sms.", e, MessageType.Message); try { accountSender = sender as Account; accountReceiver = ListAccounts.FirstOrDefault(account => e.ReceiverNumber.Equals(account.User.Number)); if (string.IsNullOrEmpty(accountSender?.ToString()) || string.IsNullOrEmpty(accountReceiver?.ToString())) { throw new NullReferenceException(); } if (accountSender.User.Number < OperatorNumber || accountReceiver.User.Number < OperatorNumber) { throw new ArgumentException(); } } catch (NullReferenceException) { e.IsHandled = true; LogSmsEvent("Sms wasn't send.", e); return; } catch (ArgumentException) { e.IsHandled = true; LogSmsEvent("Sms wasn't send.", e); return; } catch (Exception) { e.IsHandled = true; LogSmsEvent("Sms wasn't send.", e); return; } LogSmsEvent("Sending.", e, MessageType.Message); accountReceiver.ReceiveSms(accountSender.User.Number); }
public Account FindAccountByName(string name) { // more than one user var account = ListAccounts.SingleOrDefault(mobileAcc => mobileAcc.User.Name == name); if (account == null) { return(null); } account.OnCallHandler += CallConnection; account.OnCallHandler += EndCall; account.OnSmsHandler += SmsConnection; account.OnSmsHandler += ReceiveSms; return(account); }
private void CallConnection(object sender, AccountEventArgs e) { LogCallEvent("Try to call.", e, MessageType.Call); try { accountSender = sender as Account; accountReceiver = ListAccounts.FirstOrDefault(mobileAccount => e.ReceiverNumber.Equals(mobileAccount.User.Number)); if (string.IsNullOrEmpty(accountSender?.ToString()) || string.IsNullOrEmpty(accountReceiver?.ToString())) { throw new NullReferenceException(); } if (accountSender.User.Number < OperatorNumber || accountReceiver.User.Number < OperatorNumber) { throw new ArgumentException(); } } catch (NullReferenceException) { e.IsHandled = true; LogCallEvent("Call crashed.", e); return; } catch (ArgumentException) { e.IsHandled = true; LogCallEvent("Call crashed.", e); return; } catch (Exception) { e.IsHandled = true; LogCallEvent("Call crashed.", e); return; } LogCallEvent("Speaking.", e, MessageType.Call); accountReceiver.ReceiveCall(accountSender.User.Number); }
//导出txt public ActionResult DeriveTXT(ListAccounts request) { var list = request.Querys(); string str = ""; foreach (var item in list) { str += item.Name + "=" + item.AccountToken + "\r\n"; } Response.Clear(); Response.Buffer = true; Response.Charset = "GB2312"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.AddHeader("Content-Disposition", "attachment;filename=Accounts.txt"); //指定返回的是一个不能被客户端读取的流,必须被下载 Response.ContentType = "text/plain"; //把文件流发送到客户端 Response.Write(str.ToString()); //停止页面的执行 Response.End(); return(List(request)); }
public ActionResult SendSmsMessage(ListAccounts request) { request.SendMessage(); return(List(request)); }
public ActionResult Export(ListAccounts request) { _logger.LogWithSerialNo(LogTypes.AccountExport, SerialNoHelper.Create(), 0); return(List(request)); }
public ActionResult Approve(int id, ListAccounts request) { request.Approve(id); return(List(request)); }
public ActionResult Delete(int id, ListAccounts request) { return(Json(request.Delete(id))); }
public void Handle(Core.Boundaries.List.Response response) { ListAccounts.Add(response); }
public string DispatchCommand(string[] commandParameters) { string commandName = commandParameters[0]; commandParameters = commandParameters.Skip(1).ToArray(); string result = string.Empty; SavingService savingService = new SavingService(); CheckingService checkingService = new CheckingService(); UserService userService = new UserService(); switch (commandName) { case "Exit": ExitCommand exit = new ExitCommand(); result = exit.Execute(); break; case "Deposit": DepositCommand deposit = new DepositCommand(savingService); result = deposit.Execute(commandParameters); break; case "Withdraw": WithdrawCommand withdeow = new WithdrawCommand(savingService); result = withdeow.Execute(commandParameters); break; case "AddInterest": AddInterestCommand addInterest = new AddInterestCommand(savingService); result = addInterest.Execute(commandParameters); break; case "DeductFee": DeductCommand deduct = new DeductCommand(checkingService); result = deduct.Execute(commandParameters); break; case "Register": RegisterCommand register = new RegisterCommand(userService); result = register.Execute(commandParameters); break; case "Login": LoginCommand login = new LoginCommand(); result = login.Execute(commandParameters); break; case "Logout": Logout logout = new Logout(); result = logout.Execute(); break; case "AddSavingAccount": AddSavingAccountCommand addAccount = new AddSavingAccountCommand(savingService); result = addAccount.Execute(commandParameters); break; case "ListAccounts": ListAccounts listAccounts = new ListAccounts(savingService, checkingService); result = listAccounts.Execute(); break; } return(result); }
/// <summary> /// 会员列表 /// </summary> /// <returns></returns> public ActionResult AccountList(ListAccounts request) { request.Query(); return(View(request)); }