public void AddContractRuleForEconomicActivity() { Account genericAccount = _accountManager.Select(1); Account specificAccount = _accountManager.Select(2); EconomicActivity economicActivty = _economicActivityManager.SelectEconomicActivity(1); EventType eventType = _eventManager.SelectEventTypeByEventType("RGLE"); EventAttribute eventAttribute = _eventManager.SelectEventAttributeByCode("principal"); ContractAccountingRule rule = new ContractAccountingRule { DebitAccount = genericAccount, CreditAccount = specificAccount, ProductType = OProductTypes.All, ClientType = OClientTypes.Village, EconomicActivity = economicActivty, BookingDirection = OBookingDirections.Credit, EventType = eventType, EventAttribute = eventAttribute }; rule.Id = _accountingRuleManager.AddAccountingRule(rule); Assert.AreNotEqual(0, rule.Id); ContractAccountingRule retrievedRule = _accountingRuleManager.Select(rule.Id) as ContractAccountingRule; _compareRules(rule, retrievedRule); }
public void SelectEconomicActivityByIdWithChildren() { _economicActivityManager = (EconomicActivityManager)container["EconomicActivityManager"]; EconomicActivity activityParent = new EconomicActivity { Name = "Services", Parent = null }; activityParent.Id = _economicActivityManager.AddEconomicActivity(activityParent); EconomicActivity activityA = new EconomicActivity { Name = "ServicesA", Parent = activityParent, }; activityA.Id = _economicActivityManager.AddEconomicActivity(activityA); EconomicActivity activityB = new EconomicActivity { Name = "ServicesB", Parent = activityParent, }; activityB.Id = _economicActivityManager.AddEconomicActivity(activityB); EconomicActivity selectedActivity = _economicActivityManager.SelectEconomicActivity(activityParent.Id); Assert.AreEqual(activityParent.Id, selectedActivity.Id); Assert.AreEqual("Services", selectedActivity.Name); Assert.AreEqual(true, selectedActivity.HasChildrens); Assert.AreEqual(2, selectedActivity.Childrens.Count); Assert.AreEqual(false, selectedActivity.Deleted); }
public void SelectEconomicActivityByIdWithoutChildren() { _economicActivityManager = (EconomicActivityManager)container["EconomicActivityManager"]; EconomicActivity activity = new EconomicActivity { Name = "Services", Parent = null }; activity.Id = _economicActivityManager.AddEconomicActivity(activity); Assert.AreNotEqual(0, activity.Id); EconomicActivity selectedActivity = _economicActivityManager.SelectEconomicActivity(activity.Id); Assert.AreEqual(activity.Id, selectedActivity.Id); Assert.AreEqual("Services", selectedActivity.Name); Assert.AreEqual(false, selectedActivity.HasChildrens); Assert.AreEqual(0, selectedActivity.Childrens.Count); }
public void UpdateEconomicActivity() { _economicActivityManager = (EconomicActivityManager)container["EconomicActivityManager"]; EconomicActivity activity = new EconomicActivity { Name = "Services", Parent = null }; activity.Id = _economicActivityManager.AddEconomicActivity(activity); activity.Name = "NewServices"; activity.Deleted = true; _economicActivityManager.UpdateEconomicActivity(activity); EconomicActivity selectedActivity = _economicActivityManager.SelectEconomicActivity(activity.Id); Assert.AreEqual(activity.Id, selectedActivity.Id); Assert.AreEqual("NewServices", selectedActivity.Name); Assert.AreEqual(true, selectedActivity.Deleted); }
public EconomicActivity FindEconomicActivity(int doaId) { return(_doam.SelectEconomicActivity(doaId)); }
private ContractAccountingRule SelectContractAccountingRule(int pId) { const string sqlText = @"SELECT AccountingRules.id, AccountingRules.debit_account_number_id, AccountingRules.credit_account_number_id, AccountingRules.booking_direction, AccountingRules.event_type, AccountingRules.event_attribute_id, AccountingRules.[order], AccountingRules.[description] AS rule_description, EventAttributes.name AS attribute_name, EventTypes.description AS event_description, ContractAccountingRules.product_type, ContractAccountingRules.loan_product_id, ContractAccountingRules.savings_product_id, ContractAccountingRules.client_type, ContractAccountingRules.activity_id, ContractAccountingRules.currency_id FROM AccountingRules INNER JOIN EventAttributes ON EventAttributes.id = AccountingRules.event_attribute_id INNER JOIN EventTypes ON AccountingRules.event_type = EventTypes.event_type LEFT JOIN ContractAccountingRules ON AccountingRules.id = ContractAccountingRules.id WHERE AccountingRules.id = @id"; ContractAccountingRule rule; using (SqlConnection conn = GetConnection()) { using (OpenCbsCommand select = new OpenCbsCommand(sqlText, conn)) { select.AddParam("@id", pId); using (OpenCbsReader reader = select.ExecuteReader()) { if (reader.Empty) { return(null); } reader.Read(); rule = GetContractAccountingRule(reader); } } } if (rule.LoanProduct != null) { rule.LoanProduct = _loanProductManager.Select(rule.LoanProduct.Id); } if (rule.Currency != null) { rule.Currency = _currencyManager.SelectCurrencyById(rule.Currency.Id); } if (rule.Currency == null) { rule.Currency = null; } if (rule.SavingProduct != null) { rule.SavingProduct = _savingProductManager.SelectSavingProduct(rule.SavingProduct.Id); } if (rule.EconomicActivity != null) { rule.EconomicActivity = _economicActivityManager.SelectEconomicActivity(rule.EconomicActivity.Id); } if (rule.PaymentMethod.Id != 0) { rule.PaymentMethod = _paymentMethodManager.SelectPaymentMethodById(rule.PaymentMethod.Id); } return(rule); }