public async Task <IActionResult> Edit(int id, [Bind("Id,Number,Balance,PrepaidCustomerId")] MobileAccount mobileAccount) { if (id != mobileAccount.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mobileAccount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MobileAccountExists(mobileAccount.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PrepaidCustomerId"] = new SelectList(_context.Set <PrepaidCustomer>(), "Id", "Id", mobileAccount.PrepaidCustomerId); return(View(mobileAccount)); }
static void Main(string[] args) { // First task string[] strArray = { "Hello there", "Wonderful", "Did it!", "I am clever", "End of test" }; Test test = new Test(strArray); MyTestDelegate1 delegate1 = new MyTestDelegate1(Test.StaticMainDiag); MyTestDelegate2 delegate2 = new MyTestDelegate2(test.ExMainDiag); print(delegate1, strArray); print(delegate2); // End of the first task Console.WriteLine("----------------------------------------"); // Second task MobileAccount account = new MobileAccount("Test"); account.Activate(); Console.WriteLine("Your account has been activated!"); account.AddMoney(100); Console.WriteLine("Now you have {0} gryvnas.", account.AddMoney(100)); account.MyEvent += EndOfMoney; Console.WriteLine("You talked during 4 days."); account.Talk(4); Console.WriteLine("You talked during 6 days."); account.Talk(6); Console.ReadKey(); // End of the second task }
public void MakeACall(MobileAccount anotherMobileAccount) { if (CallEvent != null) { CallEvent(this, anotherMobileAccount); } }
public void SendAMessage(MobileAccount anotherMobileAccount) { if (SmsEvent != null) { SmsEvent(this, anotherMobileAccount); } }
public void Should_getMobileResponse() { string username = RandomString(); string password = RandomString(); string msgInstance = RandomString(); string msgKey = RandomString(); bool useMobileMessages = true; User user = CreateUser(username, password); MobileMessage message = new MobileMessage { device = (int)MobileMessage.Device.ANDROID, argString = $"/Person2/{user.PeopleId}/Resources", instance = msgInstance, key = msgKey }; MobileAccount account = new MobileAccount(db); account.setDeepLinkFields(message.device, message.instance, message.key, message.argString); account.sendDeepLink(); MobileMessage response = account.getMobileResponse(useMobileMessages); response.ShouldNotBe(null); }
static void Main(string[] args) { var firstMobile = new MobileAccount("050-001-00-01"); var secondMobile = new MobileAccount("050-002-00-02"); firstMobile.SendAMessage(secondMobile); secondMobile.MakeACall(firstMobile); }
public static MobileAccount[] CreateSubscribers(MobileOperator mobileOperator, int number) { MobileAccount[] result = new MobileAccount[number]; for (int i = 0; i < result.Length; i++) { result[i] = new MobileAccount(mobileOperator); } return(result); }
protected override void OnInitialized() { if (MobileSubscription == null) { MobileSubscription = new MobileSubscription(); Account = new MobileAccount(); MobileSubscription.User = ADUser; } _editContext = new EditContext(MobileSubscription); }
public ActionResult Test(int?id) { // var script = System.IO.File.ReadAllText(Server.MapPath($"~/test{id}.py")); // if (!CanRunScript(script)) // return Message("Not Authorized to run this script"); // ViewBag.text = PythonModel.RunScript(Util.Host, script); var m1 = MobileAccount.Create("David", "Carroll", "*****@*****.**", "9017581862", "5/30/52"); var m2 = MobileAccount.Create("David", "Carroll", "*****@*****.**", "9017581862", "5/30/52"); var m3 = MobileAccount.Create("Delaine", "Carroll", "*****@*****.**", "9017581862", "5/30/52"); return(View()); }
public async Task <IActionResult> Create([Bind("Id,Number,Balance,PrepaidCustomerId")] MobileAccount mobileAccount) { if (ModelState.IsValid) { _context.Add(mobileAccount); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PrepaidCustomerId"] = new SelectList(_context.Set <PrepaidCustomer>(), "Id", "Id", mobileAccount.PrepaidCustomerId); return(View(mobileAccount)); }
public async void SubmitButtonClicked(object sender, EventArgs args) { statusMessage.Text = ""; User systemUser = await DataService.GetUserAccount(schoolId.Text); if (systemUser != null) { string userComfirmMsg = string.Format("Are you {0} {1}?", systemUser.FirstName, systemUser.LastName); bool answer = await DisplayAlert("Account Found", userComfirmMsg, "Yes", "No"); if (answer) { // Add user information to their local database await UserRepository.AddUserAsync(systemUser); System.Diagnostics.Debug.WriteLine(UserRepository.StatusMessage); // Create a Mobile Account for the User MobileAccount m = new MobileAccount() { MobileId = systemUser.UserId, IsActive = true }; await MobileAccountRepository.AddAccountAsync(m); await DisplayAlert("Success", "Your Mobile Token Account has been activated.", "OK"); App.Current.MainPage = new Home(); // We do not want to enable Users to navigate back to SelectType page } else { statusMessage.Text = "Please see a UHCL Credential Authority for further assitance."; } } else { await DisplayAlert("Account Not Found", "Sorry, we could not find your information in the school system. You cannot make a Mobile Account as this time.", "OK"); statusMessage.Text = "Please see a UHCL Credential Authority for further assitance"; } // add logic to display information about credential authority if (systemUser.UserType == UserType.Student) { statusMessage.Text = "Please go to the Office of Admissions to add credentials to your account"; } else { statusMessage.Text = "Please go to the Human Resources Office to add credentials to your account"; } }
static void Main(string[] args) { var mobileOperator = new MobileOperator(); var mobileAccount1 = new MobileAccount(123); var mobileAccount2 = new MobileAccount(456); mobileOperator.AddNumber(mobileAccount1); mobileOperator.AddNumber(mobileAccount2); mobileAccount1.MakeCall(456); mobileAccount2.SendMessage(123, "Hello"); }
protected void DeleteAccount() { MobileAccount acc = _accounts.FirstOrDefault(a => a.Id == _selectedAccount); if (acc != null) { UserRepository.Delete(acc); _accounts.Remove(acc); Account = new MobileAccount(); MobileSubscription.MobileAccount = null; _selectedAccount = null; } }
public static async Task AddAccountAsync(MobileAccount m) { try { await db.InsertAsync(m); StatusMessage = string.Format("Success! Added Mobile Token Account belonging to user {0}", m.MobileId); System.Diagnostics.Debug.WriteLine(StatusMessage); } catch (Exception ex) { StatusMessage = string.Format("Failure. Could not add Mobile Token Account fo user {0}. Error: {1}", m.MobileId, ex.Message); System.Diagnostics.Debug.WriteLine(StatusMessage); } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } MobileAccount = await _context.MobileAccount .Include(m => m.PrepaidCustomer).FirstOrDefaultAsync(m => m.Id == id); if (MobileAccount == null) { return(NotFound()); } return(Page()); }
public static void AddAccount(MobileAccount m) { try { using (var dbconn = new WebSystemData()) { dbconn.MobileAccounts.Add(m); dbconn.SaveChanges(); } StatusMessage = string.Format("Success! Added new Mobile Account for User '{0}'.", m.MobileId); } catch (Exception ex) { StatusMessage = string.Format("Failure. Could not add Mobile Account for User '{0}'. Error: {1}", m.MobileId, ex.Message); StatusMessage = ex.Message; } }
public static async Task <MobileAccount> GetMobileTokenAccountAsync() { try { MobileAccount m = await db.Table <MobileAccount>().FirstAsync(); StatusMessage = string.Format("Success! Added Mobile Token Account belonging to user {0}", m.MobileId); System.Diagnostics.Debug.WriteLine(StatusMessage); return(m); } catch (Exception ex) { StatusMessage = string.Format("Failed to get the Mobile Token Account. Error: {0}", ex.Message); System.Diagnostics.Debug.WriteLine(StatusMessage); return(null); } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } MobileAccount = await _context.MobileAccount .Include(m => m.PrepaidCustomer).FirstOrDefaultAsync(m => m.Id == id); if (MobileAccount == null) { return(NotFound()); } ViewData["PrepaidCustomerId"] = new SelectList(_context.Set <PrepaidCustomer>(), "Id", "Name"); return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } MobileAccount = await _context.MobileAccount.FindAsync(id); if (MobileAccount != null) { _context.MobileAccount.Remove(MobileAccount); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public static MobileAccount FindAccountById(string id) { MobileAccount m = new MobileAccount(); try { using (var dbconn = new WebSystemData()) { m = dbconn.MobileAccounts.Find(id); } StatusMessage = string.Format("Success! Found Mobild Account belonging to User {0}.", m.MobileId); System.Diagnostics.Debug.WriteLine(StatusMessage); return(m); } catch (Exception ex) { StatusMessage = string.Format("Failure. Could not find Mobile Account for User {0}. Error: {1}", m.MobileId, ex.Message); return(null); } }
protected void SubmitAccount() { _accError = false; if (!string.IsNullOrWhiteSpace(Account.AccountName) && !string.IsNullOrWhiteSpace(Account.AccountNumber)) { MobileSubscription.MobileAccount = Account; UserRepository.Save(Account); if (!_accounts.Any(a => a.Id == Account.Id)) { _accounts.Add(Account); } _selectedAccount = Account.Id; MobileSubscription.MobileAccount = Account; _addMode = false; _hasSubs = false; _selectedAccount = Account.Id; Account = new MobileAccount(); } else { _accError = true; } }
static void Main(string[] args) { List <IPayable> accountList = new List <IPayable>(); BankAccount bankAccount = new BankAccount(1500, 1000, "Visa"); BankAccount bankAccount2 = new BankAccount(1950, 3000, "American"); MobileAccount mobileAccount = new MobileAccount("+385950000000", 57.5, 0.50); MobileAccount mobileAccount2 = new MobileAccount("+385950000001", 67.5, 0.40); Random random = new Random(); accountList.Add(bankAccount); accountList.Add(bankAccount2); accountList.Add(mobileAccount); accountList.Add(mobileAccount2); foreach (IPayable account in accountList) { Console.WriteLine(account.getIznos() + "\t"); account.addToIznos(random.Next(1, 10)); Console.WriteLine(account.getIznos() + "\t"); account.subtractFromIznos(random.Next(1, 10)); Console.WriteLine(account.getIznos() + "\t"); Console.WriteLine("\n"); } }
public Log(MobileAccount sender, MobileAccount receiver, double rate) { Sender = sender; Receiver = receiver; Rate = rate; }
protected void SwitchAddMode() { Account = new MobileAccount(); _selectedAccount = null; _addMode = !_addMode; }
public ActionLog(MobileAccount a, MobileAccount b, Action action) { MobileAccount1 = a; MobileAccount2 = b; Action = action; }
public AccountListener(MobileAccount mobileAccount) { _mobileAccount = mobileAccount; }
public Calls(MobileAccount from, MobileAccount forWhom) { From = from; ForWhom = forWhom; }