public void SetOnline_AccessTokenInvalid_ThrowAccessTokenInvalidException() { // TODO как то я сомневаюсь в необходимости таких проверок, нужно закрыть инициализацию объектов только внутри библиотеки var account = new AccountCategory(new VkApi()); Assert.Throws <AccessTokenInvalidException>(() => account.SetOnline()); }
public void GetProfileInfo_AccessTokenInvalid_ThrowAccessTokenInvalidException() { // TODO как то я сомневаюсь в необходимости таких проверок, нужно закрыть инициализацию объектов только внутри библиотеки var account = new AccountCategory(new VkApi()); Assert.That(() => account.GetProfileInfo(), Throws.InstanceOf <AccessTokenInvalidException>()); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); Markets = new MarketsCategory(this); RequestsPerSecond = 3; }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,TypeId,CreatedBy,CreatedOn,ModifiedBy,ModifiedOn")] AccountCategory accountCategory) { if (id != accountCategory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(accountCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountCategoryExists(accountCategory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TypeId"] = new SelectList(_context.AccountTypes, "Id", "Code", accountCategory.TypeId); return(View(accountCategory)); }
public override int GetHashCode() { int hash = 1; if (entityId_ != null) { hash ^= EntityId.GetHashCode(); } if (AccountNumber.Length != 0) { hash ^= AccountNumber.GetHashCode(); } if (Description.Length != 0) { hash ^= Description.GetHashCode(); } if (AccountCategory != 0) { hash ^= AccountCategory.GetHashCode(); } if (QuickbooksIdentifier.Length != 0) { hash ^= QuickbooksIdentifier.GetHashCode(); } if (QuickbooksIncidentalIdentifier.Length != 0) { hash ^= QuickbooksIncidentalIdentifier.GetHashCode(); } return(hash); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi(ICaptchaSolver captchaSolver = null) { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Board = new BoardCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); Markets = new MarketsCategory(this); Execute = new ExecuteCategory(this); RequestsPerSecond = 3; MaxCaptchaRecognitionCount = 5; _captchaSolver = captchaSolver; }
public Result <List <AccountInfo> > GetPageAccountCategory(AccountCategory accountCategory = AccountCategory.ALL) { ApiResponse response = AccountsApi.GetPageAccountCategory((int)accountCategory).Result; var result = GetResult <List <AccountInfo> >(response); return(result); }
public void SetInfo_IncorrectUserID_ThrowInvalidParameterException() { var account = new AccountCategory(Api); Url = "https://api.vk.com/method/account.setInfo"; Json = @"{ error: { error_code: 100, error_msg: 'One of the parameters specified was missing or invalid: value should be positive', request_params: [{ key: 'oauth', value: '1' }, { key: 'method', value: 'account.setInfo' }, { key: 'name', value: 'intro' }, { key: 'v', value: '5.50' }, { key: 'value', value: '-10' }] } }" ; Assert.That(() => account.SetInfo("intro", "-10"), Throws.InstanceOf <ParameterMissingOrInvalidException>()); }
public void UnregisterDevice_AccessTokenInvalid_ThrowAccessTokenInvalidException() { // TODO как то я сомневаюсь в необходимости таких проверок, нужно закрыть инициализацию объектов только внутри библиотеки var account = new AccountCategory(vk: new VkApi()); Assert.Throws <AccessTokenInvalidException>(code: () => account.UnregisterDevice(deviceId: "tokenVal")); }
private void AddAccount() { FrmAccount frmAddAccount = new FrmAccount(true); if (frmAddAccount.ShowDialog(this) == DialogResult.OK) { try { if (frmAddAccount.Mode == 0) { Account account = frmAddAccount.Account; ServicesProvider.GetInstance().GetChartOfAccountsServices().Insert(account); IntializeTreeViewChartOfAccounts(); } else if (frmAddAccount.Mode == 1) { AccountCategory accountCategory = frmAddAccount.AccountCategory; ServicesProvider.GetInstance().GetChartOfAccountsServices().InsertAccountCategory(accountCategory); IntializeTreeViewChartOfAccounts(); } } catch (Exception ex) { frmAddAccount.Show(this); new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); frmAddAccount.Hide(); } } }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); Pages = new PagesCategory(this); Gifts = new GiftsCategory(this); Apps = new AppsCategory(this); NewsFeed = new NewsFeedCategory(this); Stats = new StatsCategory(this); Auth = new AuthCategory(this); RequestsPerSecond = 3; }
public ActionResult _CreateCategoryFor([Bind(Include = "AccountCategorID,Name")] AccountCategory accountcategory) { errordata data = new errordata(); data.type = "error"; Session["err"] = "Error, Please Check Input Fields"; Session["msg"] = ""; if (ModelState.IsValid) { AccountCategory exist = db.AccountCategorys.Where(c => c.Name == accountcategory.Name).FirstOrDefault(); if (exist != null) { Session["err"] = "Category already exists"; data.message = Session["err"].ToString(); return(Json(data, JsonRequestBehavior.AllowGet)); } db.AccountCategorys.Add(accountcategory); db.SaveChanges(); ModelState.Clear(); Session["err"] = ""; Session["msg"] = "Created Successfully"; } data.message = "/AccountHead/Index"; data.type = "success"; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult _CreateCategory() { AccountCategory accountcategory = new AccountCategory(); accountcategory.Name = ""; return(PartialView(accountcategory)); }
public ActionResult EditCategory(int id) { AccountCategory accountcategory = db.AccountCategorys.Find(id); ViewBag.Existing = accountcategory.Name; return(View(accountcategory)); }
public void GetBanned_AccessTokenInvalid_ThrowAccessTokenInvalidException() { var account = new AccountCategory(new VkApi()); int res; account.GetBanned(out res); }
private bool GetAccountAndCategoryFromLinkIDs(List <Account> ownerAccounts, Guid accountLinkId, Guid?accountCategoryLinkId, out Account account, out AccountCategory accountCategory) { account = ownerAccounts.FirstOrDefault(a => a.Id.CompareTo(accountLinkId) == 0); accountCategory = null; if (account != null && account.AccountCategories.Count > 0) { // Get specifically linked category. if (accountCategoryLinkId.HasValue) { accountCategory = account.AccountCategories.FirstOrDefault(ac => ac.Id.CompareTo(accountCategoryLinkId) == 0); } // Get default category if not specifically linked. if (accountCategory == null) { accountCategory = account.AccountCategories.FirstOrDefault(ac => ac.IsDefault); } // Get first category if not specifically the default category. if (accountCategory == null) { accountCategory = account.AccountCategories.ToList()[0]; } return(true); } return(false); }
public void SaveProfileInfo_AccessTokenInvalid_ThrowAccessTokenInvalidException() { var account = new AccountCategory(new VkApi()); Assert.That(() => account.SaveProfileInfo(out var request, new AccountSaveProfileInfoParams()), Throws.InstanceOf <AccessTokenInvalidException>()); Assert.That(() => account.SaveProfileInfo(10), Throws.InstanceOf <AccessTokenInvalidException>()); }
public void GetBanned_AccessTokenInvalid_ThrowAccessTokenInvalidException() { var account = new AccountCategory(new VkApi()); int res; This.Action(() => account.GetBanned(out res)).Throws <AccessTokenInvalidException>(); }
public void LoadDetails() { lblResponsibilityCode.Text = clsRC.GetRCName(Request.QueryString["rccode"]); lblAccountCategory.Text = AccountCategory.GetCategoryName(Convert.ToInt16(Request.QueryString["accnt_cat_code"])); lblAccountItem.Text = AccountItems.GetItemName(Convert.ToInt16(Request.QueryString["accnt_items_code"])); lblAccountItemName.Text = AccountItems.GetItemName(Convert.ToInt16(Request.QueryString["accnt_items_code"])); }
public Account(string AccountNumber, string AccountLogin, float AccountBalance, AccountCategory AccountType) { accountNumber = AccountNumber; accountLogin = AccountLogin; accountBalance = AccountBalance; accountType = AccountType; }
public AccountBaseEntitie(int id, string name, int businessId, AccountCategory cat) { Id = id; Name = name; BusinessId = businessId; Category = cat; }
/// <summary> /// Preload data into the system /// </summary> /// <param name="connection"></param> internal static void Setup(SqlConnection connection) { AccountCategory.Load(connection); AccountType.Load(connection); Account.Load(connection); Tag.Load(connection); }
public void UnbanUser_AccessTokenInvalid_ThrowAccessTokenInvalidException() { // TODO как то я сомневаюсь в необходимости таких проверок, нужно закрыть инициализацию объектов только внутри библиотеки var account = new AccountCategory(vk: new VkApi()); Assert.That(del: () => account.UnbanUser(userId: 42), expr: Throws.InstanceOf <AccessTokenInvalidException>()); }
public void LoadDLLs() { ddlCategory.DataSource = AccountCategory.GetDSLAccountCategory(); ddlCategory.DataValueField = "pvalue"; ddlCategory.DataTextField = "ptext"; ddlCategory.DataBind(); }
public void SetSilenceMode_AccessTokenInvalid_ThrowAccessTokenInvalidException() { // TODO как то я сомневаюсь в необходимости таких проверок, нужно закрыть инициализацию объектов только внутри библиотеки var account = new AccountCategory(new VkApi()); //This.Action(() => account.SetSilenceMode("tokenVal")).Throws<AccessTokenInvalidException>(); Assert.That(() => account.SetSilenceMode("tokenVal"), Throws.InstanceOf <AccessTokenInvalidException>()); }
public void GetBanned_IncorrectParameters_ThrowArgumentException() { // TODO как то я сомневаюсь в необходимости таких проверок, нужно закрыть инициализацию объектов только внутри библиотеки var account = new AccountCategory(Api); Assert.That(() => account.GetBanned(offset: -1), Throws.InstanceOf <ArgumentException>().And.Property("ParamName").EqualTo("offset")); Assert.That(() => account.GetBanned(count: -1), Throws.InstanceOf <ArgumentException>().And.Property("ParamName").EqualTo("count")); }
public ActionResult DeleteConfirmed(int id) { AccountCategory accountCategory = db.AccountCategories.Find(id); db.AccountCategories.Remove(accountCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public void SetInfo_IncorrectUserID_ThrowArgumentException() { var account = new AccountCategory(new VkApi { AccessToken = "token", Browser = null }); Assert.That(() => account.SetInfo(-10), Throws.InstanceOf <ArgumentException>().And.Property("ParamName").EqualTo("intro")); }
public void SaveAccount(AccountViewModel vmAccount) { Account account = new Account(); if (vmAccount.AccId > 0) { account = _ledger.Accounts.Where(a => a.AccId == vmAccount.AccId).FirstOrDefault(); } else { account.AccCode = vmAccount.AccCode; account.ParentAccCode = vmAccount.ParentAccCode; account.AccountBook = _acctBook.GetCurrentBook(); account.State = AccountState.Normal; account.Creator = ((ClaimsIdentity)_context.User.Identity).GetUserName(); account.CreateTime = DateTime.Now; _ledger.Accounts.Add(account); } AccountCategory Cate = this.GetAccountCategory(vmAccount.AcId); if (Cate == null) { throw new Exception("科目类型为空"); } account.AccountCategory = Cate; account.AccName = vmAccount.AccName; account.Direction = vmAccount.Direction; account.IsAuxiliary = vmAccount.IsAuxiliary; if (account.IsAuxiliary) { account.AuxTypeIds = vmAccount.AuxTypeIds; account.AuxTypeNames = vmAccount.AuxTypeNames; } else { account.AuxTypeIds = string.Empty; account.AuxTypeNames = string.Empty; } account.IsQuantity = vmAccount.IsQuantity; if (account.IsQuantity) { account.Unit = vmAccount.Unit; } else { account.Unit = string.Empty; } _ledger.SaveChanges(); _cache.ClearAccountCache(_cache.GetUserCache().AccountBookID); }
public void Update(AccountCategory accountCategory) { using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.Update(accountCategory); transaction.Commit(); } }
private void CreateAccountCategory(string description, string name) { AccountCategory category = ObjectSpace.CreateObject <AccountCategory>(); category.Description = description; category.Name = name; category.Save(); category.Session.CommitTransaction(); }
public void SaveProfileInfo_AccessTokenInvalid_ThrowAccessTokenInvalidException() { var account = new AccountCategory(new VkApi()); ChangeNameRequest request; Assert.That(() => account.SaveProfileInfo(firstName: null), Throws.InstanceOf <AccessTokenInvalidException>()); Assert.That(() => account.SaveProfileInfo(out request), Throws.InstanceOf <AccessTokenInvalidException>()); Assert.That(() => account.SaveProfileInfo(10), Throws.InstanceOf <AccessTokenInvalidException>()); }
/// <summary> /// 添加或编辑消费记录 /// </summary> /// <param name="record">消费记录实体对象</param> /// <param name="category"></param> private void AddOrEditRecord(AccountRecord record, AccountCategory category) { var win = new CreateEditRecordWindow(record, category); win.Closing += delegate { if (win.DialogResult.HasValue && win.DialogResult.Value) { QueryRecords(); } }; win.Show(); }
public List<AccountType> GetAccountSubTypes(AccountCategory category) { string cmdText = string.Format(@"SELECT *,(SELECT [TypeName] FROM [AccountType] WHERE [TypeId] = T.[ParentTypeId]) AS ParentTypeName FROM [AccountType] T WHERE [ParentTypeId] <> 0"); if (category != AccountCategory.Undefined) { cmdText = string.Format("{0} AND [Category]={1}", cmdText, (int)category); } var reader = SqliteHelper.ExecuteReader(cmdText); return reader.ToConsumeTypeList(); }
public void Can_add_new_accountCategory() { var accountCategory = new AccountCategory { Name = "Savings", Colour = "Yellow", IsValid = true }; IAccountCategoryRepository repository = new AccountCategoryRepository(); repository.Add(accountCategory); using (ISession session = SessionFactory.OpenSession()) { var fromDb = session.Get<AccountCategory>(accountCategory.Id); Assert.IsNotNull(fromDb); Assert.AreNotSame(accountCategory, fromDb); Assert.AreEqual(accountCategory.Name, fromDb.Name); Assert.AreEqual(accountCategory.Colour, fromDb.Colour); Assert.AreEqual(accountCategory.IsValid, fromDb.IsValid); } }
public void Account_count_returns_the_correct_result() { Account account1; Account account2; account1 = new Account { Name = "Bank Account", IsValid = true, }; account2 = new Account { Name = "Bank Account", IsValid = true, }; var accountCategory = new AccountCategory { Name = "Other", Colour = "Orange", IsValid = true, }; Assert.AreEqual(accountCategory.AccountCount(), 0); account1.setCategory(accountCategory); Assert.AreEqual(accountCategory.AccountCount(), 1); account2.setCategory(accountCategory); Assert.AreEqual(accountCategory.AccountCount(), 2); var accountCategory2 = new AccountCategory { Name = "New One", Colour = "Pink", IsValid = true, }; account1.setCategory(accountCategory2); Assert.AreEqual(accountCategory.AccountCount(), 1); Assert.AreEqual(accountCategory2.AccountCount(), 1); }
public CreateEditRecordWindow(AccountRecord record, AccountCategory category) { InitializeComponent(); _category = category; _isUpdateRecord = record.Id > 0; if (_isUpdateRecord) { Title = string.Format("Update {0} Record", category); BtnSave.Content = "Update"; BtnSaveAdd.Visibility = Visibility.Collapsed; } else { Title = string.Format("Create {0} Record", category); } this.DataContext = record; this.Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(CreateEditRecordWindowClosing); }
public List<AccountType> GetAccountSubTypes(AccountCategory categoty) { return _consumeTypedDal.GetAccountSubTypes(categoty); }
public void List_of_categories_updated_correctly() { AccountCategory accountCategory1 = new AccountCategory { Name = "Other", Colour = "Orange", IsValid = true, }; AccountCategory accountCategory2 = new AccountCategory { Name = "Other2", Colour = "Blue", IsValid = true, }; var account = new Account { IsValid = true, Name = "Test Account", }; Assert.AreEqual(0, accountCategory1.AccountCount()); Assert.AreEqual(0, accountCategory2.AccountCount()); account.setCategory(accountCategory1); Assert.AreEqual(1, accountCategory1.AccountCount()); Assert.AreEqual(0, accountCategory2.AccountCount()); account.setCategory(accountCategory2); Assert.AreEqual(0, accountCategory1.AccountCount()); Assert.AreEqual(1, accountCategory2.AccountCount()); }
public List<AccountType> GetAccountTypes(int parentTypeId, AccountCategory categoty) { return _consumeTypedDal.GetAccountTypes(parentTypeId,categoty); }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); }
public List<AccountType> GetAccountSubTypes(AccountCategory category) { return _accountTypeBLL.GetAccountSubTypes(category); }
public void TestFixtureSetUp() { _accountType1 = new AccountType { Name = "Asset", IsDestination = true, IsSource = true, IsValid = true, }; _accountType2 = new AccountType { Name = "Expense", IsDestination = true, IsSource = true, IsValid = true, }; _accountType3 = new AccountType { Name = "NotSource", IsDestination = true, IsSource = false, IsValid = true, }; _accountType4 = new AccountType { Name = "NotDestination", IsDestination = false, IsSource = true, IsValid = true, }; _accountCategory = new AccountCategory { Name = "Other", Colour = "Orange", IsValid = true, }; _account1 = new Account { Name = "Bank Account", IsValid = true, }; _account1.setType(_accountType1); _account1.setCategory(_accountCategory); _account2 = new Account { Name = "Food", IsValid = true, }; _account2.setType(_accountType2); _account2.setCategory(_accountCategory); _account3 = new Account { Name = "Not Source", IsValid = true, }; _account3.setType(_accountType3); _account3.setCategory(_accountCategory); _account4 = new Account { Name = "Not Destination", IsValid = true, }; _account4.setType(_accountType4); _account4.setCategory(_accountCategory); DateTime tempDate = new DateTime(2009, 2, 5); _transaction1 = new Transaction { Date = tempDate, Description = "Some payment", IsVerified = false, }; _transaction2 = new Transaction { Date = tempDate, Description = "Some other payment", IsVerified = true, }; _transaction3 = new Transaction { Date = tempDate, Description = "A further payment", IsVerified = true, }; }
private void CmbCategorySelectionChanged(object sender, SelectionChangedEventArgs e) { if(CmbAccountType != null && e.AddedItems.Count>0) { switch(e.AddedItems[0].ToString()) { case "支出": _accountCategory = AccountCategory.Expense; CmbAccountType.ItemsSource = AccountBookContext.Instance.ExtExpenseTypeList; break; case "收入": _accountCategory = AccountCategory.Income; CmbAccountType.ItemsSource = AccountBookContext.Instance.ExtIncomeTypeList; break; default: _accountCategory = AccountCategory.Undefined; CmbAccountType.ItemsSource = AccountBookContext.Instance.ExtAccountTypeList; break; } CmbAccountType.SelectedIndex = 0; } }
public void TestFixtureSetUp() { _accountType1 = new AccountType { Name = "Asset", IsDestination = true, IsSource = true, IsValid = true, }; _accountType2 = new AccountType { Name = "Expense", IsDestination = true, IsSource = true, IsValid = true, }; _accountCategory = new AccountCategory { Name = "Other", Colour = "Orange", IsValid = true, }; _item = new Item { Value = 0.01M, Description = "Add Test", IsVerified = true, }; _item2 = new Item { Value = 100.01M, Description = "Item test", IsVerified = false, }; }
private void CreateInitialData() { _accountCategory = new AccountCategory { Name = "Test", Colour = "Green", IsValid = true }; _accountCategory2 = new AccountCategory { Name = "SomethingElse", Colour = "Green", IsValid = true }; _accountType1 = new AccountType { Name = "Asset", IsDestination = true, IsSource = true, IsValid = true }; _accountType2 = new AccountType { Name = "SourceOnly", IsDestination = false, IsSource = true, IsValid = true }; _accountType3 = new AccountType { Name = "DestinationOnly", IsDestination = true, IsSource = false, IsValid = true }; _account1 = new Account { Name = "Bank Account", IsValid = true, }; _account1.setType(_accountType1); _account1.setCategory(_accountCategory); _account2 = new Account { Name = "Savings", IsValid = true, }; _account2.setType(_accountType1); _account2.setCategory(_accountCategory); _account3 = new Account { Name = "SourceOnly", IsValid = true, }; _account3.setType(_accountType2); _account3.setCategory(_accountCategory); _account4 = new Account { Name = "DestinationOnly", IsValid = true, }; _account4.setType(_accountType3); _account4.setCategory(_accountCategory); using (ISession session = SessionFactory.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.Save(_accountType1); session.Save(_accountType2); session.Save(_accountType3); session.Save(_accountCategory); session.Save(_accountCategory2); session.Save(_account1); session.Save(_account2); session.Save(_account3); session.Save(_account4); transaction.Commit(); } }
private static void ImportAccountCategories(OleDbConnection dbConnection, IDictionary<string, AccountCategory> ac) { OleDbDataAdapter dataAdapter; DataSet dataSet = new DataSet(); dataAdapter = new OleDbDataAdapter("SELECT * FROM [AccountCategories$]", dbConnection); dataAdapter.Fill(dataSet); foreach (DataRow row in dataSet.Tables[0].Rows) { AccountCategory accountCategory = new AccountCategory { Name = row["Name"].ToString(), Colour = row["Colour"].ToString(), IsValid = bool.Parse(row["IsValid"].ToString()), }; ac.Add(accountCategory.Name, accountCategory); } }
private void CreateInitialData() { _accountType1 = new AccountType { Name = "Asset", IsDestination = true, IsSource = true, IsValid = true, }; _accountType2 = new AccountType { Name = "Expense", IsDestination = true, IsSource = true, IsValid = true, }; _accountType3 = new AccountType { Name = "Income", IsDestination = false, IsSource = true, IsValid = true, }; _accountType4 = new AccountType { Name = "Fail test", IsDestination = true, IsSource = false, IsValid = true, }; _accountCategory = new AccountCategory { Name = "Other", Colour = "Orange", IsValid = true, }; _account1 = new Account { Name = "Bank Account", IsValid = true }; _account1.setType(_accountType1); _account1.setCategory(_accountCategory); _account2 = new Account { Name = "Food", IsValid = true }; _account2.setType(_accountType2); _account2.setCategory(_accountCategory); _account3 = new Account { Name = "Pay", IsValid = true }; _account3.setType(_accountType3); _account3.setCategory(_accountCategory); _account4 = new Account { Name = "Test", IsValid = true, }; _account4.setType(_accountType4); _account4.setCategory(_accountCategory); DateTime tempDate = new DateTime(2009, 2, 5); _transaction = new Transaction { Date = tempDate, Description = "Some payment", IsVerified = false, }; _item1 = new Item { Value = 123.0M, IsVerified = true, Description = "Payment 1", }; _item1.SetTransaction(_transaction); _item1.SetSource(_account1); _item1.SetDestination(_account2); _item2 = new Item { Value = 456.0M, IsVerified = true, Description = "Payment 2", }; _item2.SetTransaction(_transaction); _item2.SetSource(_account2); _item2.SetDestination(_account1); using (ISession session = SessionFactory.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.Save(_accountType1); session.Save(_accountType2); session.Save(_accountType3); session.Save(_accountType4); session.Save(_accountCategory); session.Save(_account1); session.Save(_account2); session.Save(_account3); session.Save(_account4); session.Save(_transaction); session.Save(_item1); session.Save(_item2); transaction.Commit(); } }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="VkApi"/>. /// </summary> public VkApi() { Browser = new Browser(); Users = new UsersCategory(this); Friends = new FriendsCategory(this); Status = new StatusCategory(this); Messages = new MessagesCategory(this); Groups = new GroupsCategory(this); Audio = new AudioCategory(this); Wall = new WallCategory(this); Database = new DatabaseCategory(this); Utils = new UtilsCategory(this); Fave = new FaveCategory(this); Video = new VideoCategory(this); Account = new AccountCategory(this); Photo = new PhotoCategory(this); Docs = new DocsCategory(this); Likes = new LikesCategory(this); RequestsPerSecond = 3; MaxCaptchaRecognitionCount = 5; AutoTokenRefresh = false; }
public static AccountCategoryWapper GetWapperByType(AccountCategory accountCategory) { return AccountCategories.FirstOrDefault<AccountCategoryWapper>(p => (p.Category == accountCategory)); }
public void Can_create_new_accountCategory() { Account account; account = new Account { Name = "Bank Account", IsValid = true, }; var accountCategory = new AccountCategory { Name = "Other", Colour = "Orange", IsValid = true, }; account.setCategory(accountCategory); Assert.AreEqual(accountCategory.Id, Guid.Empty); Assert.AreEqual(account.Category, accountCategory); }
private bool IsInCollection(AccountCategory account, ICollection<AccountCategory> fromDb) { foreach (var item in fromDb) if (item.Id == account.Id) return true; return false; }
public AccountCategoryWapper(AccountCategory category, string color) { this.Category = category; this.Color = color; }
private void QueryPanelQueryConditionChanged(object sender, Silverlight.Events.QueryConditionChangedEventArgs e) { _beginDate = e.BeginTime; _endDate = e.EndTime; _accountType = e.AccountType; _consumer = e.Consumer; _keyword = e.Keyword; _accountCategory = e.AccountCategory; _showAccessorial = e.ShowAccessorial; QueryRecords(); }
public List<AccountType> GetAccountTypes(int parentTypeId, AccountCategory category) { return _accountTypeBLL.GetAccountTypes(parentTypeId, category); }
private void QueryPanelQueryConditionChanged(object sender, QueryConditionChangedEventArgs e) { _begigDate = e.BeginTime; _endDate = e.EndTime; _consumer = e.Consumer; _accountType = e.AccountType; _keyword = e.Keyword; _showAccessorial = e.ShowAccessorial; if(e.AccountCategory != _accountCategory) { _accountCategory = e.AccountCategory; RecordsPager.PageIndex = 0; } QueryRecords(); }
internal AccountCategoryExtended(AccountCategory accountCategory, VkApi vk) { _account = accountCategory; _vk = vk; }