public MainPageViewModel(INavigationService navigationService) { Tags = new ObservableCollection<TagViewModel>(); Accounts = new ObservableCollection<AccountViewModel>(); _navigationService = navigationService; var selectedDatastore = IsolatedStorageHelper.GetApplicationSetting("dataStore") as IDatastore; if (selectedDatastore == null) { var app = Application.Current as App; if (app != null) { _dataStore = app.Datastores.GetSelectedDatastore(); } else { var init = new Init(); _dataStore = init.GetDatastores().GetSelectedDatastore(); } var fakeData = new FakeDataGenerator(); fakeData.GenerateFakeData(_dataStore); } else { _dataStore = selectedDatastore; } _accounts = new Accounts(_dataStore); UpdateUi(); // _dataStore.OnSaved += RepositoryChanged; }
public List<Accounts> BuildList() { var list = new List<Accounts>(); DbCommand command = db.GetStoredProcCommand("Users_BuildList"); using (var reader = db.ExecuteReader(command)) { while (reader.Read()) { var account = new Accounts(); if (!reader.IsDBNull(reader.GetOrdinal("Userid"))) { account.Userid = reader.GetInt32(reader.GetOrdinal("Userid")); } if (!reader.IsDBNull(reader.GetOrdinal("Type"))) { account.Type = reader.GetString(reader.GetOrdinal("Type")); } if (!reader.IsDBNull(reader.GetOrdinal("Username"))) { account.Username = reader.GetString(reader.GetOrdinal("Username")); } if (!reader.IsDBNull(reader.GetOrdinal("Pass"))) { account.Pass = reader.GetString(reader.GetOrdinal("Pass")); } list.Add(account); } } return list; }
public void insert_admin_account() { var hospitals = new Hospitals().All<Hospital>(); foreach (var hospital in hospitals) { var account = new Account(true); account.AddProfessionalRegistration(new ProfessionalRegistration { Number = "123" + hospital.Id, State = hospital.State, Type = ProfessionalRegistrationTypeEnum.CRM }); account.ToEnterPassword("123"); account.ToEnterFirstName(hospital.Name); account.ToEnterLastName("Admin"); account.ToEnterGender(GenderEnum.Male); account.ToEnterEmail(RemoveSpecialCharacters(hospital.Name) + "@workker.com.br"); account.ToEnterBirthday(new DateTime(1989, 7, 17)); account.AddHospital(hospital); var accounts = new Accounts(); accounts.Save(account); } }
void Window1_Loaded(object sender, RoutedEventArgs e) { if ((String.IsNullOrEmpty(ConfigurationManager.AppSettings["PrimaryLabUserId"])) || (String.IsNullOrEmpty(ConfigurationManager.AppSettings["SecondaryLabUserId"])) || (String.IsNullOrEmpty(ConfigurationManager.AppSettings["ApplicationGuid"])) || (String.IsNullOrEmpty(ConfigurationManager.AppSettings["ApplicationName"]))) { MessageBox.Show("Please provide values for all keys in app.config", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Close(); } _primaryLabUserId = ConfigurationManager.AppSettings["PrimaryLabUserId"]; _secondaryLabUserId = ConfigurationManager.AppSettings["SecondaryLabUserId"]; _applicationGuid = ConfigurationManager.AppSettings["ApplicationGuid"]; _applicationName = ConfigurationManager.AppSettings["ApplicationName"]; _accounts = new Accounts(); accountsList.ItemsSource = _accounts; try { _lyncClient = Microsoft.Lync.Model.LyncClient.GetClient(); if (App.CommandLineArgs.Count > 0 && App.CommandLineArgs["AccountId"] != null) { LoadSelectedAccount(Convert.ToInt32(App.CommandLineArgs["AccountId"])); } InitializeClient(); } catch (Exception) { throw; } }
static void Main() { Core.Erroo.Config.LoadFromXml(); Core.Erroo.Config.LogPath = Application.UserAppDataPath + "\\ErrorLogs"; Core.Erroo.Config.DoShowDialog = Properties.Settings.Default.Debug; Core.Crypto.Config.Key = Core.Crypto.Hash.MD5(Environment.UserName); Application.ThreadException += Core.Erroo.ErrorHandler.OnThreadException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); TwitterManager.Load(); if (Properties.Settings.Default.FirstRun) { MaintenanceManager.UpgradeFromPrevious(); Properties.Settings.Default.Upgrade(); Properties.Settings.Default.FirstRun = true; } if (!String.IsNullOrEmpty(Properties.Settings.Default.Culture)) { SetCulture(new CultureInfo(Properties.Settings.Default.Culture), false); } CurrentAccounts = new Accounts(); CurrentAccounts.Load(); FormPostInstance = new FormPost(); Application.Run(FormPostInstance); }
public string GetDefaultLink(Accounts.Store currentStore) { string result = ""; result = currentStore.RootUrl(); result += "?" + WebAppSettings.AffiliateQueryStringName + "=" + this.ReferralId; return result; }
public object Get(Accounts request) { if (string.IsNullOrEmpty(request.domainName)) throw new Exception("Domain name missing."); return string.IsNullOrEmpty(request.accountName) ? Engine.GetAccounts(request.domainName) : Engine.GetAccounts(request.domainName).Where(o => o.AccountName == request.accountName).ToList(); }
public AccountList(Accounts accounts) { this.accountList = new ListStore(typeof(string), typeof(string)); this.buildColumns(); this.addAccounts(accounts); this.Model = this.accountList; this.Selection.Changed += OnSelectionChanged; }
public ParkingReservation(CustomerAccount cust, Accounts.Vehicle veh, DateTime date, int durationMinutes) { Customer = cust; ReservationVehicle = veh; Date = date; DurationMinutes = durationMinutes; IsCheckedIn = false; }
public Chart(Double height, Double width, Accounts.GroupBy groupBy) { InitializeComponent(); canvas.Height = height; canvas.Width = width; mRowsCollection = new List<ChartRow>(); mGroupBy = groupBy; }
public static IShippingService FindById(string id, Accounts.Store currentStore) { foreach (IShippingService svc in FindAll(currentStore)) { if (svc.Id == id) { return svc; } } return null; }
public static PayPalAPI GetPaypalAPI(Accounts.Store currentStore) { com.paypal.sdk.profiles.IAPIProfile APIProfile = Utilities.PaypalExpressUtilities.CreateAPIProfile(currentStore.Settings.PayPal.UserName, currentStore.Settings.PayPal.Password, currentStore.Settings.PayPal.Signature, currentStore.Settings.PayPal.FastSignupEmail, currentStore.Settings.PayPal.Mode); return new PayPalAPI(APIProfile); }
/// <summary> /// �A�J�E���g����ꗗ����폜���܂��B /// </summary> /// <param name="id">�A�J�E���gID</param> /// <param name="site">�T�C�gID</param> public void DeleteAccount(string id, Accounts.AccountProperties.LoginSite site) { Accounts.AccountProperties props = this.ContainAccount(id, site); if (props.Equals(null)) { SimpleLogger.WriteLine("ID: \"" + id + "\" is already deleted or nothing."); MessageBox.Show("ID: \" " + id + " \"�͑��݂��܂���B", "TricksterTools", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AccountData.Remove(props); SimpleLogger.WriteLine("ID: \"" + id + "\" is deleted."); }
public ParkingReservation(int resID, CustomerAccount cust, Accounts.Vehicle veh, DateTime date, int durationMinutes, int spotID, int ticketKey, bool isCheckedIn) { ReservationID = resID; Customer = cust; ReservationVehicle = veh; Date = date; DurationMinutes = durationMinutes; ParkingSpotID = spotID; TicketKey = ticketKey; IsCheckedIn = isCheckedIn; }
public static Credentials createFromAccount(Accounts account) { Credentials cred = new Credentials(); cred.acctType = account.acctType; cred.fName = account.fName; cred.lName = account.lName; cred.UserName = account.Username; cred.ID = account.ID; cred.Password = ""; return cred; }
public void Connect() { oApp = OutlookCalendar.AttachToOutlook(); log.Debug("Setting up Outlook connection."); // Get the NameSpace and Logon information. NameSpace oNS = oApp.GetNamespace("mapi"); //Log on by using a dialog box to choose the profile. //oNS.Logon("", Type.Missing, true, true); //Implicit logon to default profile, with no dialog box //If 1< profile, a dialogue is forced unless implicit login used exchangeConnectionMode = oNS.ExchangeConnectionMode; if (exchangeConnectionMode != OlExchangeConnectionMode.olNoExchange) { log.Info("Exchange server version: " + oNS.ExchangeMailboxServerVersion.ToString()); } //Logon using a specific profile. Can't see a use case for this when using OGsync //If using this logon method, change the profile name to an appropriate value: //HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles //oNS.Logon("YourValidProfile", Type.Missing, false, true); log.Info("Exchange connection mode: " + exchangeConnectionMode.ToString()); currentUserSMTP = GetRecipientEmail(oNS.CurrentUser); currentUserName = oNS.CurrentUser.Name; if (currentUserName == "Unknown") { log.Info("Current username is \"Unknown\""); if (Settings.Instance.AddAttendees) { System.Windows.Forms.MessageBox.Show("It appears you do not have an Email Account configured in Outlook.\r\n" + "You should set one up now (Tools > Email Accounts) to avoid problems syncing meeting attendees.", "No Email Account Found", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); } } //Get the accounts configured in Outlook accounts = oNS.Accounts; // Get the Calendar folders useOutlookCalendar = getDefaultCalendar(oNS); if (MainForm.Instance.IsHandleCreated) { //resetting connection, so pick up selected calendar from GUI dropdown //***This might be cross thread, so don't rely on MainForm MainForm.Instance.cbOutlookCalendars.DataSource = new BindingSource(calendarFolders, null); KeyValuePair<String, MAPIFolder> calendar = (KeyValuePair<String, MAPIFolder>)MainForm.Instance.cbOutlookCalendars.SelectedItem; calendar = (KeyValuePair<String, MAPIFolder>)MainForm.Instance.cbOutlookCalendars.SelectedItem; useOutlookCalendar = calendar.Value; } // Done. Log off. oNS.Logoff(); }
/// <summary> /// ���ݕێ����Ă���A�J�E���g���ꗗ�̒�����w��̕������ID���܂܂�Ă��邩�������܂��B /// �������@�ɂ��Ă͊��S��v�݂̂��s���܂��B /// </summary> /// <param name="ID">��������ID</param> /// <param name="site">�T�C�g</param> /// <returns>���������ꍇ�Ώۂ�AccountProperties��Ԃ��܂��B������Ȃ������ꍇ��null��Ԃ��܂��B</returns> public Accounts.AccountProperties ContainAccount(string ID, Accounts.AccountProperties.LoginSite site) { IEnumerator ienum = AccountData.GetEnumerator(); while (ienum.MoveNext()) { Accounts.AccountProperties acprop = (Accounts.AccountProperties)ienum.Current; if (acprop.ID == ID && acprop.Site == site) { return acprop; } } SimpleLogger.WriteLine("\"" + ID + "\" was not found."); return null; }
public OrderService(RequestContext c, OrderRepository orders, TaxRepository taxes, TaxScheduleRepository taxSchedules, ZoneRepository shippingZones, OrderTransactionRepository transactions, ShippingMethodRepository shippingMethods, Accounts.StoreSettingsRepository settings) { context = c; Orders = orders; Taxes = taxes; TaxSchedules = taxSchedules; ShippingZones = shippingZones; Transactions = transactions; ShippingMethods = shippingMethods; this.storeSettings = settings; }
public Collection<DisplayPaymentMethod> EnabledMethods(Accounts.Store currentStore) { Collection<DisplayPaymentMethod> result = new Collection<DisplayPaymentMethod>(); Dictionary<string, string> enabledList = currentStore.Settings.PaymentMethodsEnabled; if (enabledList != null) { for (int i = 0; i <= Methods.Count - 1; i++) { if (enabledList.ContainsKey(Methods[i].MethodId)) { result.Add(Methods[i]); } } } return result; }
public static void SSLRedirect(MerchantTribeApplication app, Accounts.Store currentStore, SSLRedirectTo RedirectTo) { string CurrentUrl = app.CurrentRequestContext.RoutingContext.HttpContext.Request.RawUrl.ToLower(); //UrlRewriter.GetRewrittenUrlFromRequest(page.Request).ToLower(); string StandardURL = app.StoreUrl(false, true).ToLowerInvariant(); string SecureURL = app.StoreUrl(true, false).ToLowerInvariant(); string sessionId = WebAppSettings.SessionId; string cartId = WebAppSettings.CartId; string currentSessionId = SessionManager.GetCurrentUserId(currentStore, app.CurrentRequestContext.RoutingContext.HttpContext.Request.Cookies); string currentCartId = SessionManager.GetCurrentCartID(currentStore); string url = BuildUrlForRedirect(CurrentUrl, StandardURL, SecureURL, RedirectTo, sessionId, cartId, currentSessionId, currentCartId, false ); //if the urls match, then for some reason we aren't replacing anything //so if we redirect then we will go into a loop if (url != CurrentUrl) { app.CurrentRequestContext.RoutingContext.HttpContext.Response.Redirect(url); } }
public static List<IShippingService> FindAll(Accounts.Store currentStore) { List<IShippingService> result = new List<IShippingService>(); result = Service.FindAll(); //result.Add(new MerchantTribe.Shipping.Fedex.FedExProvider()); //FedEx MerchantTribe.Shipping.FedEx.FedExGlobalServiceSettings fedexGlobal = new FedExGlobalServiceSettings(); fedexGlobal.UserKey = currentStore.Settings.ShippingFedExKey; fedexGlobal.UserPassword = currentStore.Settings.ShippingFedExPassword; fedexGlobal.AccountNumber = currentStore.Settings.ShippingFedExAccountNumber; fedexGlobal.MeterNumber = currentStore.Settings.ShippingFedExMeterNumber; fedexGlobal.DefaultDropOffType = (MerchantTribe.Shipping.FedEx.DropOffType)currentStore.Settings.ShippingFedExDropOffType; fedexGlobal.DefaultPackaging = (MerchantTribe.Shipping.FedEx.PackageType)currentStore.Settings.ShippingFedExDefaultPackaging; fedexGlobal.DiagnosticsMode = currentStore.Settings.ShippingFedExDiagnostics; fedexGlobal.ForceResidentialRates = currentStore.Settings.ShippingFedExForceResidentialRates; fedexGlobal.UseListRates = currentStore.Settings.ShippingFedExUseListRates; result.Add(new MerchantTribe.Shipping.FedEx.FedExProvider(fedexGlobal, new EventLog())); // Load US Postal MerchantTribe.Shipping.USPostal.USPostalServiceGlobalSettings uspostalGlobal = new MerchantTribe.Shipping.USPostal.USPostalServiceGlobalSettings(); uspostalGlobal.DiagnosticsMode = currentStore.Settings.ShippingUSPostalDiagnostics; result.Add(new MerchantTribe.Shipping.USPostal.DomesticProvider(uspostalGlobal, new EventLog())); result.Add(new MerchantTribe.Shipping.USPostal.InternationalProvider(uspostalGlobal, new EventLog())); // Load UPS MerchantTribe.Shipping.Ups.UPSServiceGlobalSettings upsglobal = new MerchantTribe.Shipping.Ups.UPSServiceGlobalSettings(); upsglobal.AccountNumber = currentStore.Settings.ShippingUpsAccountNumber; upsglobal.LicenseNumber = currentStore.Settings.ShippingUpsLicense; upsglobal.Username = currentStore.Settings.ShippingUpsUsername; upsglobal.Password = currentStore.Settings.ShippingUpsPassword; upsglobal.DefaultPackaging = (MerchantTribe.Shipping.Ups.PackagingType)currentStore.Settings.ShippingUpsDefaultPackaging; upsglobal.DiagnosticsMode = currentStore.Settings.ShippingUPSDiagnostics; upsglobal.ForceResidential = currentStore.Settings.ShippingUpsForceResidential; upsglobal.IgnoreDimensions = currentStore.Settings.ShippingUpsSkipDimensions; upsglobal.PickUpType = (MerchantTribe.Shipping.Ups.PickupType)currentStore.Settings.ShippingUpsPickupType; result.Add(new MerchantTribe.Shipping.Ups.UPSService(upsglobal, new EventLog())); return result; }
/// <summary> /// Gets the corresponding category for <see cref="Accounts"/> value. /// </summary> /// <param name="accounts">The account.</param> /// <returns>the corresponding <see cref="Category"/>.</returns> public static Category GetCategoryFromAccount(Accounts accounts) { switch (accounts) { case Accounts.Facebook: return Category.Cat10; case Accounts.Google: return Category.Cat11; case Accounts.Instagram: return Category.Cat12; case Accounts.Skype: return Category.Cat13; case Accounts.WhatsApp: return Category.Cat14; case Accounts.All: return Category.All; default: throw new NotSupportedException("Account is not Supported"); } }
protected void btnSignUp_Click(object sender, EventArgs e) { Accounts newAccount = new Accounts(); if (tbAccountName.Text == "" || tbPassword.Text == "") { return; } int result = newAccount.registerAccount(this.tbAccountName.Text, this.tbPassword.Text, 1); if (result == 0) { lResult.Text = "Successfully signed up!"; btnSignUp.Enabled = false; } else if (result == 1) { lResult.Text = "We already have the same account name."; } else { lResult.Text = "Failed!"; } }
internal void Remove(int index) { Accounts.RemoveAt(index); }
/// <summary> /// Set the given value for the category in the tangibleObject /// </summary> /// <param name="value">Value for active/inactive</param> /// <param name="account">Account which should be set</param> private void SetCategory(bool value, Accounts account) { if (value) tangibleObjectControl.SetCategory(CategoryMappings.GetCategoryFromAccount(account)); else tangibleObjectControl.RemoveCategory(CategoryMappings.GetCategoryFromAccount(account)); }
public void Remove(Account account) { Accounts.Remove(account); }
private static bool GiveItemToAccounts(Item item, int amount) { bool success = true; foreach (Account acct in Accounts.GetAccounts()) { if (acct[0] != null) { if (!CopyItem(item, amount, acct[0].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[0].Name); success = false; } } else if (acct[0] == null) { if (acct[1] != null) { if (!CopyItem(item, amount, acct[1].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[1].Name); success = false; } } } else if (acct[0] == null) { if (acct[2] != null) { if (!CopyItem(item, amount, acct[2].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[2].Name); success = false; } } } else if (acct[0] == null) { if (acct[3] != null) { if (!CopyItem(item, amount, acct[3].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[3].Name); success = false; } } } else if (acct[0] == null) { if (acct[4] != null) { if (!CopyItem(item, amount, acct[4].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[4].Name); success = false; } } } else if (acct[0] == null) { if (acct[5] != null) { if (!CopyItem(item, amount, acct[5].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[5].Name); success = false; } } } else if (acct[0] == null) { if (acct[6] != null) { if (!CopyItem(item, amount, acct[6].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[6].Name); success = false; } } } else if (acct[0] == null) { if (acct[7] != null) { if (!CopyItem(item, amount, acct[7].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[7].Name); success = false; } } } else if (acct[0] == null) { if (acct[8] != null) { if (!CopyItem(item, amount, acct[8].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[8].Name); success = false; } } } else if (acct[0] == null) { if (acct[9] != null) { if (!CopyItem(item, amount, acct[9].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[9].Name); success = false; } } } else if (acct[0] == null) { if (acct[10] != null) { if (!CopyItem(item, amount, acct[10].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[10].Name); success = false; } } } else if (acct[0] == null) { if (acct[11] != null) { if (!CopyItem(item, amount, acct[11].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[11].Name); success = false; } } } else if (acct[0] == null) { if (acct[12] != null) { if (!CopyItem(item, amount, acct[12].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[12].Name); success = false; } } } else if (acct[0] == null) { if (acct[13] != null) { if (!CopyItem(item, amount, acct[13].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[13].Name); success = false; } } } else if (acct[0] == null) { if (acct[14] != null) { if (!CopyItem(item, amount, acct[14].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[14].Name); success = false; } } } else if (acct[0] == null) { if (acct[15] != null) { if (!CopyItem(item, amount, acct[15].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[15].Name); success = false; } } } else if (acct[0] == null) { if (acct[16] != null) { if (!CopyItem(item, amount, acct[16].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[16].Name); success = false; } } } } return(success); }
public ActionResult Create(Accounts accounts) { if (ModelState.IsValid) { if (accounts.UserName != accounts.ConfirmUsername) { ViewBag.AccountStatus = "UserName Mismatched!"; return(View()); } bool isExist = db.Accounts.Any(x => x.UserName == accounts.UserName); if (isExist) { ViewBag.AccountStatus = "UserName Already Exist!"; return(View()); } accounts.role = "emp"; db.Accounts.Add(accounts); db.SaveChanges(); //sending Email MailMessage mail = new MailMessage(); //mail.To = accounts.UserName; mail.To.Add(accounts.UserName); mail.From = new MailAddress("*****@*****.**"); mail.Subject = "Your Password for HRMS"; string htmlString = @"<html> <body> <br><br><br> <p><i>Regards,</i><br><b>Team HRMS<b></p> </body> </html> "; //mail.Body = "password:"******"<html> <b>Your UserName : <b> </html> " + accounts.UserName + @"<html> <br> <b>Your Password : <b> </html> " + accounts.password + htmlString; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; // smtp.UseDefaultCredentials = false; smtp.UseDefaultCredentials = true; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Aniket@Vikalp"); // Enter seders User name and password smtp.EnableSsl = true; smtp.Send(mail); return(RedirectToAction("Index")); } return(View(accounts)); }
public async Task Distribute(IEntityRepository repository, IFlowDistributor distributor) { var accountIds = Accounts.Select(x => x.Id).ToList(); var accountsQueries = repository.GetQuery <Account>(); var accounts = await accountsQueries .Where(x => accountIds.Contains(x.Id)) .Select(x => x.ToModel()) .ToListAsync() .ConfigureAwait(false); accounts.ForEach(x => { var account = Accounts.First(a => a.Id == x.Id); account.Balance = x.AvailBalance; (x as IFlowEndPoint).FlowRule = new DistributionFlowRule { CanFlow = account.CanFlow, Destination = FlowDestination.Source }; }); var flowIds = ExpenseFlows.Select(x => x.Id).ToList(); var flowQueries = repository.GetQuery <ExpenseFlow>(); var flows = await flowQueries .Where(x => flowIds.Contains(x.Id)) .Select(x => x.ToModel()) .ToListAsync() .ConfigureAwait(false); flows.ForEach(x => { var expenseFlow = ExpenseFlows.First(s => s.Id == x.Id); expenseFlow.Balance = x.Balance; x.FlowRule = new DistributionFlowRule { CanFlow = expenseFlow.CanFlow, Destination = FlowDestination.Recipient, Rule = expenseFlow.Rule, Amount = expenseFlow.Amount }; }); var endPoints = new List <IFlowEndPoint>(); endPoints.AddRange(accounts); endPoints.AddRange(flows); distributor.Distribute(endPoints); DistributionFlows = distributor.FlowRecords .Select(x => new DistributionFlowModel { SourceId = x.Source.Id, SourceName = x.Source.Name, RecipientId = x.Recipient.Id, RecipientName = x.Recipient.Name, Amount = x.Amount, AmountFormatted = x.Amount.ToMoney() }).ToList(); Accounts.ForEach(x => { if (!x.CanFlow) { return; } var withdrawTotal = distributor.FlowRecords.Where(f => f.Source.Id == x.Id).Sum(f => f.Amount); if (withdrawTotal > 0) { x.WithdrawTotal = $"\u2013{withdrawTotal.ToMoney()}"; } x.Result = (x.Balance - withdrawTotal).ToMoney(); }); ExpenseFlows.ForEach(x => { if (!x.CanFlow) { return; } var topupTotal = distributor.FlowRecords.Where(f => f.Recipient.Id == x.Id).Sum(f => f.Amount); if (topupTotal > 0) { x.TopupTotal = $"+{topupTotal.ToMoney()}"; } x.Result = (x.Balance + topupTotal).ToMoney(); }); }
public List <AccountViewModel> GetAccountsPreview(int amount) { return(Accounts.OrderBy(i => i.IsBlocked).TakeWhile(x => x.IsBlocked == false).Take(5).ToList()); }
public Job(JobInfo.JobInfo jobInfo, ConversionProfile profile, JobTranslations jobTranslations, Accounts accounts) { JobTranslations = jobTranslations; JobInfo = jobInfo; Profile = profile; Accounts = accounts; }
public MemContext() { var account = new Account { Id = 1, Name = "My Test Account", Paid = true, PaidUtc = new DateTime(2016, 1, 1), AccountType = AccountType.Gold }; Accounts.Add(account); var user = new User { Id = 1, Name = "Joe User", AccountId = 1, Account = account, Active = true }; Users.Add(user); account.Users = new List <User> { user }; var account2 = new Account { Id = 2, Name = "Another Test Account", Paid = false, AccountType = AccountType.Silver }; Accounts.Add(account2); var user2 = new User { Id = 2, Name = "Late Paying User", AccountId = 2, Account = account2 }; Users.Add(user2); MutateMes.Add(new MutateMe { Id = 1, Value = 0, }); account2.Users = new List <User> { user2 }; var human = new Human { Id = 1, Name = "Han Solo", Height = 5.6430448 }; Heros.Add(human); var stormtrooper = new Stormtrooper { Id = 2, Name = "FN-2187", Height = 4.9, Specialization = "Imperial Snowtrooper" }; Heros.Add(stormtrooper); var droid = new Droid { Id = 3, Name = "R2-D2", PrimaryFunction = "Astromech" }; Heros.Add(droid); var vehicle = new Vehicle { Id = 1, Name = "Millennium falcon", OwnerId = human.Id }; Vehicles.Add(vehicle); human.Vehicles = new List <Vehicle> { vehicle }; var vehicle2 = new Vehicle { Id = 2, Name = "Speeder bike", OwnerId = stormtrooper.Id }; Vehicles.Add(vehicle2); stormtrooper.Vehicles = new List <Vehicle> { vehicle2 }; }
public static void EventSink_AccountLogin(AccountLoginEventArgs e) { if (!IPLimiter.SocketBlock && !IPLimiter.Verify(e.State.Address)) { e.Accepted = false; e.RejectReason = ALRReason.InUse; Console.WriteLine("Login: {0}: Past IP limit threshold", e.State); using (StreamWriter op = new StreamWriter("ipLimits.log", true)) op.WriteLine("{0}\tPast IP limit threshold\t{1}", e.State, DateTime.UtcNow); return; } string un = e.Username; string pw = e.Password; e.Accepted = false; Account acct = Accounts.GetAccount(un) as Account; if (acct == null) { if (AutoAccountCreation && un.Trim().Length > 0) // To prevent someone from making an account of just '' or a bunch of meaningless spaces { e.State.Account = acct = CreateAccount(e.State, un, pw); e.Accepted = acct == null ? false : acct.CheckAccess(e.State); if (!e.Accepted) { e.RejectReason = ALRReason.BadComm; } } else { Console.WriteLine("Login: {0}: Invalid username '{1}'", e.State, un); e.RejectReason = ALRReason.Invalid; } } else if (!acct.HasAccess(e.State)) { Console.WriteLine("Login: {0}: Access denied for '{1}'", e.State, un); e.RejectReason = (m_LockdownLevel > AccessLevel.Player ? ALRReason.BadComm : ALRReason.BadPass); } else if (!acct.CheckPassword(pw)) { Console.WriteLine("Login: {0}: Invalid password for '{1}'", e.State, un); e.RejectReason = ALRReason.BadPass; } else if (acct.Banned) { Console.WriteLine("Login: {0}: Banned account '{1}'", e.State, un); e.RejectReason = ALRReason.Blocked; } else { Console.WriteLine("Login: {0}: Valid credentials for '{1}'", e.State, un); e.State.Account = acct; e.Accepted = true; acct.LogAccess(e.State); } if (!e.Accepted) { AccountAttackLimiter.RegisterInvalidAccess(e.State); } }
public DataStorage Add(params Account[] accounts) { Accounts.AddRange(accounts); return(this); }
public DataStorage EditAccounts(Predicate <Account> predicate, Action <Account> action) { Accounts.FindAll(predicate).ForEach(action); return(this); }
public async Task <ActionResult> ShowExam(int courseID) { var accountID = HttpContext.Session.GetInt32("UserID"); using (var context = new ExamPlatformDbContext()) { try { Accounts SelectedAccount = await context.Account .Where(a => a.AccountsID == accountID) .Select(a => a).SingleAsync(); Course SelectedCourse = await context.Course .Include(c => c.ClosedQuestionsList) .Include(q => q.OpenedQuestionsList) .Where(course => course.CourseID == courseID) .Select(seleceteCourse => seleceteCourse).SingleAsync(); var CQuestions = SelectedCourse.ClosedQuestionsList.DistinctBy(q => q.Question).ToList(); var OQuestions = SelectedCourse.OpenedQuestionsList.DistinctBy(q => q.Question).ToList(); CQuestions = SelectClosedQuestions(CQuestions, 7); OQuestions = SelectOpenedQuestions(OQuestions, 6); var ExamCQuestions = CreateExamClosedQuestions(CQuestions); var ExamOQuestions = CreateExamOpenedQuestions(OQuestions); Exams exam = new Exams() { AmountClosedQuestions = CQuestions.Count(), AmountOpenedQuestions = OQuestions.Count(), ExamTimeInMinute = 30, DateOfExam = DateTime.Now, ExamClosedQuestions = ExamCQuestions, ExamOpenedQuestions = ExamOQuestions, CourseID = SelectedCourse.CourseID, AccountID = SelectedAccount.AccountsID, ExamResult = new Results() { ifResultSent = false } }; ExamCQuestions.ForEach(x => exam.ExamResult.MaxExamPoints += 1); ExamOQuestions.ForEach(x => exam.ExamResult.MaxExamPoints += x.OpenedQuestions.MaxPoints); context.Exam.Add(exam); context.SaveChanges(); HttpContext.Session.SetInt32("ExamID", exam.ExamsID); return(View("ExamClosedQuestions", exam)); } catch (Exception ex) { logger.Error("ExamsController - ShowExam " + ex.Message); return(View()); } } }
private void OnEvent(BackendEvent newEvent) { if (newEvent is BackendEventError) { var error = newEvent as BackendEventError; if (error.Policy == ErrorPolicyType.Deactivate) { try { var accounts = new Accounts(); var account = accounts[error.Id]; if (account != null) { account.persistantState = AccountState.Disabled; account.forceDisabled = true; } } catch { } } } if (_notifier != null) { // Returns true if user relevant if (_notifier.Push(newEvent)) newEvent.Persist = true; } _events.Enqueue(newEvent); }
public bool IsAccountExist(string id) { return(Accounts.Any(account => account.Id == id)); }
public Account AddAccount(Accounts accounts, string sAddress, string sPassword) { Account oAccount = accounts.Add(); oAccount.Address = sAddress; oAccount.Password = sPassword; oAccount.Active = true; oAccount.Save(); return oAccount; }
public Account GetAccount(string id) { return(Accounts.Find(account => account.Id == id)); }
public async Task ShowAntiSpamAsync() { var guild = Accounts.GetOrCreateGuildAccount(Context.Guild.Id); await ReplyAsync($"Current limit is **{guild.AutoMod.SpamSettings.MaxMessages}** messages per **{guild.AutoMod.SpamSettings.Seconds}** seconds.\nSet messages to 0 to disable."); }
public static void EventSink_AccountLogin(AccountLoginEventArgs e) { if (!IPLimiter.SocketBlock && !IPLimiter.Verify(e.State.Address, e.State.Account as Account)) { e.Accepted = false; e.RejectReason = ALRReason.InUse; log.Info("Login: {0}: Past IP limit threshold", e.State); using (StreamWriter op = new StreamWriter(Path.Combine(Core.Config.LogDirectory, "ipLimits.log"), true)) op.WriteLine("{0}\tPast IP limit threshold\t{1}", e.State, DateTime.UtcNow); return; } string un = e.Username; string pw = e.Password; e.Accepted = false; Account acct = Accounts.GetAccount(un); if (acct == null) { if (AutoAccountCreation) { e.State.Account = acct = CreateAccount(e.State, un, pw); e.Accepted = acct == null ? false : acct.CheckAccess(e.State); if (!e.Accepted) { e.RejectReason = ALRReason.BadComm; } } else { log.Info("Login: {0}: Invalid username '{1}'", e.State, un); e.RejectReason = ALRReason.Invalid; } } else if (!acct.HasAccess(e.State)) { log.Info("Login: {0}: Access denied for '{1}'", e.State, un); e.RejectReason = (m_LockdownLevel > AccessLevel.Player ? ALRReason.BadComm : ALRReason.Invalid); } else if (!acct.CheckPassword(pw)) { log.Info("Login: {0}: Invalid password for '{1}'", e.State, un); e.RejectReason = ALRReason.Invalid; } else if (acct.Banned) { log.Info("Login: {0}: Banned account '{1}'", e.State, un); e.RejectReason = ALRReason.Blocked; } else { log.Info("Login: {0}: Valid credentials for '{1}'", e.State, un); e.State.Account = acct; e.Accepted = true; acct.LogAccess(e.State); } if (!e.Accepted) { AccountAttackLimiter.RegisterInvalidAccess(e.State); } }
public AccountsAttribute(Accounts accounts) { m_accounts = accounts; }
public BankUserInterface(Accounts accounts) { _accounts = accounts; }
public async Task Save(IEntityRepository repository, DateTime dateTime) { var accountSettingsQueries = repository.GetQuery <AccountFlowSettings>(); var accountIds = Accounts.Select(x => x.Id).ToList(); var accountSettings = await accountSettingsQueries .Where(x => accountIds.Contains(x.AccountId)) .ToListAsync() .ConfigureAwait(false); Accounts.ForEach(x => { var settings = accountSettings.FirstOrDefault(s => s.AccountId == x.Id); if (settings == null) { settings = new AccountFlowSettings { AccountId = x.Id, CanFlow = x.CanFlow }; repository.Create(settings); } else { settings.CanFlow = x.CanFlow; repository.Update(settings); } }); var flowSettingsQueries = repository.GetQuery <ExpenseFlowSettings>(); var flowIds = ExpenseFlows.Select(x => x.Id).ToList(); var flowSettings = await flowSettingsQueries .Where(x => flowIds.Contains(x.ExpenseFlowId)) .ToListAsync() .ConfigureAwait(false); ExpenseFlows.ForEach(x => { var settings = flowSettings.FirstOrDefault(s => s.ExpenseFlowId == x.Id); if (settings == null) { settings = new ExpenseFlowSettings { ExpenseFlowId = x.Id, CanFlow = x.CanFlow, Rule = x.Rule, Amount = x.Amount }; repository.Create(settings); } else { settings.CanFlow = x.CanFlow; settings.Rule = x.Rule; settings.Amount = x.Amount; repository.Update(settings); } }); var distribution = new DataAccess.Model.Distribution.Distribution() { DateTime = dateTime, SumFlow = DistributionFlows.Sum(x => x.Amount) }; repository.Create(distribution); var accountQueries = repository.GetQuery <Account>(); var flowQueries = repository.GetQuery <ExpenseFlow>(); var accounts = await accountQueries .Where(x => accountIds.Contains(x.Id)) .ToListAsync() .ConfigureAwait(false); var expenseFlows = await flowQueries .Where(x => flowIds.Contains(x.Id)) .ToListAsync() .ConfigureAwait(false); DistributionFlows.ForEach(x => { var flow = new Flow { Distribution = distribution, SourceId = x.SourceId, RecipientId = x.RecipientId, Amount = x.Amount }; repository.Create(flow); var account = accounts.First(a => a.Id == x.SourceId); var expenseFlow = expenseFlows.First(f => f.Id == x.RecipientId); account.AvailBalance -= x.Amount; repository.Update(account); expenseFlow.Balance += x.Amount; repository.Update(expenseFlow); }); await repository.SaveChangesAsync().ConfigureAwait(false); }
public TransferAccountView(Accounts accounts) { InitializeComponent(); this.DataContext = new TransferAccountViewModel(accounts); }
/// <summary> /// This method provides the main entry point for the background thread that keeps ethereum wallet information synchronised. /// </summary> private void NetworkCheckThreadEntry() { Logger.ApplicationInstance.Info("Network status thread started"); bool connectedYet = false; DateTime nextContractCheckTime = DateTime.UtcNow; while (_isAlive) { try { // Get a list of all accounts currently know about by our wallet string[] addresses = _web3.Eth.Accounts.SendRequestAsync().Result; // First remove any existing accounts that do not exist in our new list if (addresses != null) { EthereumAccount[] removedAccounts = Accounts.Where(ac => !addresses.Contains(ac.Address)).ToArray(); foreach (EthereumAccount removedAccount in removedAccounts) { Accounts.Remove(removedAccount); } // Process each of these accounts foreach (string address in addresses) { // Get the current balance for this account decimal balance = decimal.Parse(_web3.Eth.GetBalance.SendRequestAsync(address).Result.Value.ToString()); // And check the SIFT balance ulong siftBalance = _tokenService.GetBalanceOfAsync <ulong>(address).Result; // See if we have an existing account - if not we'll need to create a new one EthereumAccount existingAccount = Accounts.FirstOrDefault(ac => ac.Address == address); if (existingAccount == null) { Accounts.Add(new EthereumAccount(address, balance, siftBalance)); Logger.ApplicationInstance.Info("Found new account " + address + " with " + balance + " ETH / " + siftBalance + " SIFT"); } else { if (existingAccount.BalanceWei != balance) { existingAccount.BalanceWei = balance; Logger.ApplicationInstance.Info("Account " + address + " now has " + balance + " ETH"); } if (existingAccount.SiftBalance != siftBalance) { existingAccount.SiftBalance = siftBalance; Logger.ApplicationInstance.Info("Account " + address + " now has " + siftBalance + " SIFT"); } } } } // Let's get the block number and check if we're syncing to just set some basics bits and bobs up BlockNumber = ulong.Parse(_web3.Eth.Blocks.GetBlockNumber.SendRequestAsync().Result.Value.ToString()); IsSyncing = _web3.Eth.Syncing.SendRequestAsync().Result.IsSyncing; // Ask the contract our status but first check we've got the right contract if (DateTime.UtcNow >= nextContractCheckTime) { // First check the ICO contract Logger.ApplicationInstance.Debug("Checking ICO contract version"); decimal icoContractVersion = decimal.Parse(_icoContract.GetFunction("contractVersion").CallAsync <ulong>().Result.ToString()); if (icoContractVersion == IcoContractVersion) { // Get the phase of the ICO bool isIcoPhase = _icoContract.GetFunction("icoPhase").CallAsync <bool>().Result; ContractPhase = isIcoPhase ? ContractPhase.Ico : ContractPhase.Trading; // Check if the ICO is abandoned IsIcoAbandoned = _icoContract.GetFunction("icoAbandoned").CallAsync <bool>().Result; // Check the ICO dates IcoStartDate = DateFromTimestamp(_icoContract.GetFunction("icoStartTime").CallAsync <ulong>().Result); IcoEndDate = DateFromTimestamp(_icoContract.GetFunction("icoEndTime").CallAsync <ulong>().Result); // Whilst we're here we also want to check the gas cost to send DefaultGasInfo = CalculateGasCostForEtherSend("0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", IcoContractAddress, 1000000000000000000m).Result; Logger.ApplicationInstance.Error("Default gas calculating for sending as " + DefaultGasInfo.Gas + " at " + DefaultGasInfo.GasPrice + " = " + DefaultGasInfo.GasCost); } else { ContractPhase = ContractPhase.Unknown; Logger.ApplicationInstance.Error("ICO contract mismatch - expected " + IcoContractVersion + " but got " + icoContractVersion + " at " + IcoContractAddress); } // Now check SIFT contract Logger.ApplicationInstance.Debug("Checking SIFT contract version"); decimal siftContractVersion = decimal.Parse(_siftContract.GetFunction("contractVersion").CallAsync <ulong>().Result.ToString()); if (siftContractVersion != SiftContractVersion) { ContractPhase = ContractPhase.Unknown; Logger.ApplicationInstance.Error("SIFT contract mismatch - expected " + SiftContractVersion + " but got " + siftContractVersion + " at " + SiftContractAddress); } // Now check the SIFT contract nextContractCheckTime = DateTime.UtcNow.AddSeconds(10); } // If valid contract check total supply if (ContractPhase != ContractPhase.Unknown) { Logger.ApplicationInstance.Debug("Checking total supply and shareholding"); TotalSupply = _tokenService.GetTotalSupplyAsync <ulong>().Result; foreach (EthereumAccount account in Accounts) { account.ShareholdingPercentage = TotalSupply == 0 ? 0 : (decimal)account.SiftBalance / TotalSupply * 100; } } // Signify a successful loop LastChecksSuccessful = true; if (!connectedYet) { connectedYet = true; Logger.ApplicationInstance.Info("Completed first successful network check, we should be good to go"); } } catch (Exception ex) { LastChecksSuccessful = false; Logger.ApplicationInstance.Error("There was an unexpected error updating Ethereum network information", ex); } // Wait to try again DateTime nextTime = DateTime.UtcNow.AddSeconds(3); while (DateTime.UtcNow < nextTime && _isAlive) { Thread.Sleep(100); } } }
public IEnumerable <Account> Create(IEnumerable <Account> items) { return(Accounts.Create(items)); }
public override void OnDoubleClick(Mobile from) { int runes = HasCompassion + HasHonesty + HasHonor + HasHumility + HasJustice + HasSacrifice + HasSpirituality + HasValor; bool inVirtues = (from.Map == Map.Sosaria && from.X >= 2587 && from.Y >= 3846 && from.X <= 2604 && from.Y <= 3863); bool inCorrupt = (from.Map == Map.Sosaria && from.X >= 2858 && from.Y >= 3463 && from.X <= 2875 && from.Y <= 3478); if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. } else if (RuneBoxOwner != from) { from.SendMessage("This chest does not belong to you so it vanishes!"); bool remove = true; foreach (Account a in Accounts.GetAccounts()) { if (a == null) { break; } int index = 0; for (int i = 0; i < a.Length; ++i) { Mobile m = a[i]; if (m == null) { continue; } if (m == RuneBoxOwner) { m.AddToBackpack(this); remove = false; } ++index; } } if (remove) { this.Delete(); } } else if ((inVirtues || inCorrupt) && runes > 7) { string side = "good"; int morality = 0; int color = 0; int tint = 0; string virtue1 = "Compassion"; string virtue2 = "Honesty"; string virtue3 = "Honor"; string virtue4 = "Humility"; string virtue5 = "Justice"; string virtue6 = "Sacrifice"; string virtue7 = "Spirituality"; string virtue8 = "Valor"; VirtueStoneChest box = new VirtueStoneChest(); if (inVirtues) { from.Fame = 15000; from.Karma = 15000; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You have cleansed the Runes in the Chamber of Virtue."); from.FixedParticles(0x3709, 10, 30, 5052, 0x480, 0, EffectLayer.LeftFoot); from.PlaySound(0x208); CharacterDatabase.SetKeys(from, "Virtue", true); from.Kills = 0; from.Criminal = false; if (((PlayerMobile)from).Profession == 1) { ((PlayerMobile)from).Profession = 0; from.Profile = ""; CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(from); DB.BardsTaleQuest = "0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#"; } from.SendMessage("You have gained a really large amount of fame and karma."); } else { from.Fame = 15000; from.Karma = -15000; side = "evil"; morality = 1; color = 0xB20; tint = 0x8B3; from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You have corrupted the Runes of Virtue."); Effects.SendLocationEffect(from.Location, from.Map, 0x2A4E, 30, 10, 0xB00, 0); from.PlaySound(0x029); CharacterDatabase.SetKeys(from, "Corrupt", true); box.Name = "chest of corruption"; box.Hue = color; from.SendMessage("You have gain a really large amount of fame and lost a really large amount of karma."); virtue1 = "Cruelty"; virtue2 = "Deceit"; virtue3 = "Scorn"; virtue4 = "Arrogance"; virtue5 = "Oppression"; virtue6 = "Neglect"; virtue7 = "Sacrilege"; virtue8 = "Fear"; } QuestSouvenir.GiveReward(from, "Rune of " + virtue1, color, 0x5319); QuestSouvenir.GiveReward(from, "Rune of " + virtue2, color, 0x530F); QuestSouvenir.GiveReward(from, "Rune of " + virtue3, color, 0x531B); QuestSouvenir.GiveReward(from, "Rune of " + virtue4, color, 0x5313); QuestSouvenir.GiveReward(from, "Rune of " + virtue5, color, 0x5311); QuestSouvenir.GiveReward(from, "Rune of " + virtue6, color, 0x5315); QuestSouvenir.GiveReward(from, "Rune of " + virtue7, color, 0x530D); QuestSouvenir.GiveReward(from, "Rune of " + virtue8, color, 0x5317); List <Item> belongings = new List <Item>(); foreach (Item i in from.Backpack.Items) { if (i is QuestSouvenir && (i.Name).Contains("Rune of")) { belongings.Add(i); } } foreach (Item stuff in belongings) { box.DropItem(stuff); BaseContainer.DropItemFix(stuff, from, box.ItemID, box.GumpID); } DDRelicPainting tapestry1 = new DDRelicPainting(); tapestry1.Name = "Tapestry of " + virtue1; tapestry1.ItemID = 0x49A8; tapestry1.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry1.Hue = tint; box.DropItem(tapestry1); BaseContainer.DropItemFix(tapestry1, from, box.ItemID, box.GumpID); DDRelicPainting tapestry2 = new DDRelicPainting(); tapestry2.Name = "Tapestry of " + virtue2; tapestry2.ItemID = 0x49A2; tapestry2.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry2.Hue = tint; box.DropItem(tapestry2); BaseContainer.DropItemFix(tapestry2, from, box.ItemID, box.GumpID); DDRelicPainting tapestry3 = new DDRelicPainting(); tapestry3.Name = "Tapestry of " + virtue3; tapestry3.ItemID = 0x49B2; tapestry3.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry3.Hue = tint; box.DropItem(tapestry3); BaseContainer.DropItemFix(tapestry3, from, box.ItemID, box.GumpID); DDRelicPainting tapestry4 = new DDRelicPainting(); tapestry4.Name = "Tapestry of " + virtue4; tapestry4.ItemID = 0x49A3; tapestry4.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry4.Hue = tint; box.DropItem(tapestry4); BaseContainer.DropItemFix(tapestry4, from, box.ItemID, box.GumpID); DDRelicPainting tapestry5 = new DDRelicPainting(); tapestry5.Name = "Tapestry of " + virtue5; tapestry5.ItemID = 0x49A7; tapestry5.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry5.Hue = tint; box.DropItem(tapestry5); BaseContainer.DropItemFix(tapestry5, from, box.ItemID, box.GumpID); DDRelicPainting tapestry6 = new DDRelicPainting(); tapestry6.Name = "Tapestry of " + virtue6; tapestry6.ItemID = 0x49A0; tapestry6.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry6.Hue = tint; box.DropItem(tapestry6); BaseContainer.DropItemFix(tapestry6, from, box.ItemID, box.GumpID); DDRelicPainting tapestry7 = new DDRelicPainting(); tapestry7.Name = "Tapestry of " + virtue7; tapestry7.ItemID = 0x49A1; tapestry7.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry7.Hue = tint; box.DropItem(tapestry7); BaseContainer.DropItemFix(tapestry7, from, box.ItemID, box.GumpID); DDRelicPainting tapestry8 = new DDRelicPainting(); tapestry8.Name = "Tapestry of " + virtue8; tapestry8.ItemID = 0x49B3; tapestry8.RelicGoldValue = Utility.RandomMinMax(10, 20) * 50; tapestry8.Hue = tint; box.DropItem(tapestry8); BaseContainer.DropItemFix(tapestry8, from, box.ItemID, box.GumpID); RuneOfVirtue reward = new RuneOfVirtue(); reward.ItemOwner = from; reward.ItemSide = morality; RuneOfVirtue.RuneLook(reward); box.DropItem(reward); BaseContainer.DropItemFix(reward, from, box.ItemID, box.GumpID); Item crystals = new Crystals(Utility.RandomMinMax(1000, 2000)); box.DropItem(crystals); BaseContainer.DropItemFix(crystals, from, box.ItemID, box.GumpID); Item jewels = new DDJewels(Utility.RandomMinMax(2000, 4000)); box.DropItem(jewels); BaseContainer.DropItemFix(jewels, from, box.ItemID, box.GumpID); Item gold = new Gold(Utility.RandomMinMax(4000, 6000)); box.DropItem(gold); BaseContainer.DropItemFix(gold, from, box.ItemID, box.GumpID); Item silver = new DDSilver(Utility.RandomMinMax(6000, 8000)); box.DropItem(silver); BaseContainer.DropItemFix(silver, from, box.ItemID, box.GumpID); Item copper = new DDCopper(Utility.RandomMinMax(8000, 10000)); box.DropItem(copper); BaseContainer.DropItemFix(copper, from, box.ItemID, box.GumpID); Item gemstones = new DDGemstones(Utility.RandomMinMax(1000, 2000)); box.DropItem(gemstones); BaseContainer.DropItemFix(gemstones, from, box.ItemID, box.GumpID); Item goldnuggets = new DDGoldNuggets(Utility.RandomMinMax(2000, 30000)); box.DropItem(goldnuggets); BaseContainer.DropItemFix(goldnuggets, from, box.ItemID, box.GumpID); from.AddToBackpack(box); LoggingFunctions.LogRuneOfVirtue(from, side); this.Delete(); } else { from.SendSound(0x5AA); from.CloseGump(typeof(RuneBoxGump)); from.SendGump(new RuneBoxGump(this, from)); } }
public IEnumerable <Account> Update(IEnumerable <Account> items) { return(Accounts.Update(items)); }
public void Dispose() { if (_wsApplication != null) { _wsApplication.Dispose(); _wsApplication = null; } if (_wsAccounts != null) { for (int i = 0; i < _wsAccounts.Count; i++) _wsAccounts[i].Dispose(); _wsAccounts.Clear(); } if (_accounts != null) { Marshal.ReleaseComObject(_accounts); _accounts = null; } }
public Account Create(Account item) { return(Accounts.Create(item)); }
/// <summary> /// Sets the toggle buttons depending on the given accounts. /// </summary> /// <param name="accounts"></param> private void SetToggleButtons(Accounts accounts) { if (accounts.HasFlag(Accounts.Facebook)) FaceBookIsActive = true; if (accounts.HasFlag(Accounts.Skype)) SkypeIsActive = true; if (accounts.HasFlag(Accounts.Instagram)) InstagramIsActive = true; if (accounts.HasFlag(Accounts.WhatsApp)) WhatsappIsActive = true; if (accounts.HasFlag(Accounts.Google)) GoogleCircleIsActive = true; }
public Account Update(Account item) { return(Accounts.Update(item)); }
public bool AdminUserResetRequest(string email, Accounts.Store store) { UserAccount u = AdminUsers.FindByEmail(email); if (u == null) { return false; } u.ResetKey = System.Guid.NewGuid().ToString(); AdminUsers.Update(u); Utilities.MailServices.SendAdminUserResetLink(u, store); return true; }
internal static void AppendBlock(Block b) { int lastBlock = -1; if (GetLastBlock() != null) { if (b.BlockNumber <= GetLastBlock().BlockNumber) { return; } lastBlock = (int)GetLastBlock().BlockNumber; } CheckPointBlock checkPointBlock = new CheckPointBlock { AccountKey = b.AccountKey }; uint accNumber = (uint)(lastBlock + 1) * 5; if (accNumber == 0) { Log.Info("NULL"); } ulong accWork = WorkSum; for (int i = 0; i < 5; i++) { checkPointBlock.Accounts.Add(new Account { AccountNumber = accNumber, Balance = (i == 0 ? 1000000ul + (ulong)b.Fee : 0ul), BlockNumber = b.BlockNumber, UpdatedBlock = b.BlockNumber, NumberOfOperations = 0, AccountType = 0, Name = "", UpdatedByBlock = b.BlockNumber, AccountInfo = new AccountInfo { AccountKey = b.AccountKey, State = AccountState.Normal } }); accNumber++; } accWork += b.CompactTarget; WorkSum += b.CompactTarget; checkPointBlock.AccumulatedWork = accWork; checkPointBlock.AvailableProtocol = b.AvailableProtocol; checkPointBlock.BlockNumber = b.BlockNumber; checkPointBlock.BlockSignature = 2; checkPointBlock.CheckPointHash = b.CheckPointHash; checkPointBlock.CompactTarget = b.CompactTarget; checkPointBlock.Fee = b.Fee; checkPointBlock.Nonce = b.Nonce; checkPointBlock.Payload = b.Payload; checkPointBlock.ProofOfWork = b.ProofOfWork; checkPointBlock.ProtocolVersion = b.ProtocolVersion; checkPointBlock.Reward = b.Reward; checkPointBlock.Timestamp = b.Timestamp; checkPointBlock.TransactionHash = b.TransactionHash; foreach (var t in b.Transactions) { ApplyTransaction(t, b); } Current.Add(checkPointBlock); Accounts.AddRange(checkPointBlock.Accounts); if ((checkPointBlock.BlockNumber + 1) % 100 == 0) { SaveNext(); } OldCheckPointHash = CheckPointHash(Current); }
public Account GetAccountByCredentials(string mail, string password) => Accounts.TryGetValue(new KeyValuePair <string, string>(mail, password), out Account account) ? account : null;
public Account GetCustomerAccount(Customer customer) { return(Accounts.FirstOrDefault(a => a.Customers.Contains(customer))); }
public List <Account> GetAccountsByAuthority(int authority) { return(Accounts.FindAll(account => account.Authority == authority)); }