Exemple #1
0
 public SavingServices(User pUser)
 {
     _user = pUser;
     _savingManager = new SavingManager(pUser);
     _savingEventManager = new SavingEventManager(pUser);
     _ePS = new EventProcessorServices(pUser);
 }
 public NonWorkingDateManagement(User pUser)
     : base(pUser)
 {
     _user = pUser;
     dbParam = ApplicationSettings.GetInstance(pUser.Md5);
     nonWorkingDateHelper = NonWorkingDateSingleton.GetInstance(_user.Md5);
 }
Exemple #3
0
 public ProjectServices(User pUser)
 {
     _user = pUser;
     _ProjectManager = new ProjectManager(pUser, true);
     _ClientServices = new ClientServices(pUser);
     _branchService = new BranchService(pUser);
 }
 public AccountingTransactionManager(User pUser)
     : base(pUser)
 {
     _accountManagement = new AccountManager(pUser);
     _currencyManager = new CurrencyManager(pUser);
     _branchManager = new BranchManager(pUser);
 }
Exemple #5
0
 public ProjectServices(User pUser,string testDB)
 {
     _user = pUser;
     _ProjectManager = new ProjectManager(testDB, pUser);
     _ClientServices = new ClientServices(pUser, testDB);
     _branchService = new BranchService(pUser);
 }
 public ClientServices(User pUser, string testDB)
 {
     _user = pUser;
     _clientManagement = new ClientManager(testDB);
     _dataParam = ApplicationSettings.GetInstance(pUser.Md5);
     _picturesServices = new PicturesServices(testDB);
 }
        public int AddUser(User pUser)
        {
            const string sqlText = @"INSERT INTO [Users] (
                                       [deleted],
                                       [role_code],
                                       [user_name],
                                       [user_pass],
                                       [first_name],
                                       [last_name],
                                       [mail],
                                       [sex],
                                       [phone])
                                     VALUES(
                                       @deleted,
                                       @roleCode,
                                       @username,
                                       @userpass,
                                       @firstname,
                                       @lastname,
                                       @mail,
                                       @sex,
                                       @phone)
                                     SELECT SCOPE_IDENTITY()";

            using (SqlConnection conn = GetConnection())
            using (OpenCbsCommand sqlCommand = new OpenCbsCommand(sqlText, conn))
            {
                sqlCommand.AddParam("@deleted", false);
                SetUser(sqlCommand, pUser);
                pUser.Id = int.Parse(sqlCommand.ExecuteScalar().ToString());
                SaveUsersRole(pUser.Id, pUser.UserRole.Id);
            }
            return pUser.Id;
        }
 public UserServices(User pUser, string pTestDb)
 {
     _userManager = new UserManager(pTestDb);
     _tellerManager = new TellerManager(pTestDb);
     roleServices = ServicesProvider.GetInstance().GetRoleServices();
     branchServices = ServicesProvider.GetInstance().GetBranchService();
 }
        public void BookManualEntry(Booking booking, User currentUser)
        {
            using (SqlConnection conn = _movementSetManagement.GetConnection())
            {
                SqlTransaction sqlTransac = conn.BeginTransaction();
                try
                {
                    if (booking.Amount <= 0)
                        throw new OpenCbsAccountException(OpenCbsAccountExceptionsEnum.IncorrectAmountFormat);

                    if (booking.DebitAccount.Id == booking.CreditAccount.Id)
                    {
                        throw new OpenCbsAccountException(OpenCbsAccountExceptionsEnum.EqualAccounts);
                    }

                    _movementSetManagement.InsertManualMovment(booking, sqlTransac);
                    sqlTransac.Commit();
                }
                catch (Exception ex)
                {
                    sqlTransac.Rollback();
                    throw ex;
                }
            }
        }
Exemple #10
0
 public SavingServices(User pUser)
 {
     _user = pUser;
     _savingManager = new SavingManager(pUser);
     _savingEventManager = new SavingEventManager(pUser);
     _ePS = new EventProcessorServices(pUser);
     MefContainer.Current.Bind(this);
 }
 public ApplicationSettingsServices(User pUser)
 {
     _user = pUser;
     _dataParamManager = new ApplicationSettingsManager(pUser);
     _nonWorkingDateManager = new NonWorkingDateManagement(pUser);
     _provisioningRuleManager = new ProvisioningRuleManager(pUser);
     _loanScaleManager = new LoanScaleManager(_user);
 }
 public StandardBookingManager(User pUser)
     : base(pUser)
 {
     _user = pUser;
     AccountManager _accountManagement =  new AccountManager(pUser);
     _chartOfAccounts = new ChartOfAccounts();
     _chartOfAccounts.Accounts = _accountManagement.SelectAllAccounts();
 }
 public ClientServices(User pUser)
 {
     _user = pUser;
     _clientManagement = new ClientManager(pUser, true, true);
     _clientManagement.ClientSelected += ClientSelected;
     _dataParam = ApplicationSettings.GetInstance(pUser.Md5);
     _picturesServices = new PicturesServices(pUser);
 }
        public FundingLineServices(User user)
        {
            _user = user;
            fundingLinesWithAmounts = new Hashtable();

            _fundingLineManager = new FundingLineManager(_user);
            _ePS = new EventProcessorServices(user);
        }
Exemple #15
0
 public SavingManager(string pTestDB)
     : base(pTestDB)
 {
     _savingProductManager = new SavingProductManager(pTestDB);
     _savingEventManager = new SavingEventManager(pTestDB);
     _loanManager = new LoanManager(pTestDB);
     _user = new User();
 }
Exemple #16
0
 public ProductServices(User user)
 {
     _user = user;
     _productManager = new LoanProductManager(user);
     _installmentTypeManager = new InstallmentTypeManager(user);
     _fundingLineManager = new FundingLineManager(user);
     _productManager.ProductLoaded += ProductLoaded;
 }
Exemple #17
0
 public TellerManager(User user)
     : base(user)
 {
     accountManager = new AccountManager(user);
     branchManager = new BranchManager(user);
     userManager = new UserManager(user);
     currencyManager = new CurrencyManager(user);
 }
Exemple #18
0
 private static void AssertSelectedUser(User pUserToTest, string pExpectedUserName, User.Roles pExpectedRole, string pExpectedFirstName, string pExpectedLastName, char pExpectedSex)
 {
     Assert.AreEqual(pExpectedUserName, pUserToTest.UserName);
     Assert.IsNull(pUserToTest.Password);
     Assert.AreEqual(pExpectedRole, pUserToTest.Role);
     Assert.AreEqual(pExpectedFirstName, pUserToTest.FirstName);
     Assert.AreEqual(pExpectedLastName,pUserToTest.LastName);
     Assert.AreEqual(pExpectedSex, pUserToTest.Sex);
 }
Exemple #19
0
 public SavingManager(User pUser)
     : base(pUser)
 {
     _savingProductManager = new SavingProductManager(pUser);
     _savingEventManager = new SavingEventManager(pUser);
     _loanManager = new LoanManager(pUser);
     _clientManager = new ClientManager(pUser, false, false);
     _user = pUser;
 }
 public ChartOfAccountsServices(User pUser)
 {
     _user = pUser;
     _accountManagement = new AccountManager(pUser);
     _tellerManager = new TellerManager(pUser);
     _provisionningRuleManager = new ProvisioningRuleManager(pUser);
     _loanScaleManager = new LoanScaleManager(pUser);
     _currencyManager = new CurrencyManager(pUser);
 }
Exemple #21
0
        public void PostingInterests_12Posting()
        {
            //            Assert.Ignore();
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfMonth,
                Periodicity = new InstallmentType("Monthly", 0, 1)

            };

            User user = new User() {Id = 1};
            DateTime creationDate = new DateTime(2009, 01, 01);
            SavingBookContract saving = new SavingBookContract(
                                                                    ApplicationSettings.GetInstance(""),
                                                                    user,
                                                                    creationDate,
                                                                    null
                                                                )
                                                            {
                                                                Product = product,
                                                                InterestRate = 0.1
                                                            };
            DateTime closureDate = new DateTime(2010, 01, 01);
            saving.NextMaturity = saving.CreationDate.Date;
            saving.NumberOfPeriods = 1;
            saving.FirstDeposit(1000, creationDate, 0, user, new Teller());
            saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(
                                                                        saving.CreationDate.Date,
                                                                        saving.Product.Periodicity,
                                                                        saving.NumberOfPeriods);
            List<SavingInterestsAccrualEvent> interestsAccrualEvents =
                                    saving.CalculateInterest(closureDate, new User {Id = 1});
            foreach (var accrualEvent in interestsAccrualEvents)
            {
                saving.Events.Add(accrualEvent);
            }
            List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
            List<SavingInterestsPostingEvent> postingEvents = new List<SavingInterestsPostingEvent>();

            while (saving.NextMaturity.Value <= closureDate)
            {
                list = saving.PostingInterests(saving.NextMaturity.Value, new User() {Id = 1});
                postingEvents.AddRange(list);
                foreach (var postingEvent in list)
                {
                    saving.Events.Add(postingEvent);
                }
                saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(saving.NextMaturity.Value, saving.Periodicity, 1);
            }

            list = saving.PostingInterests(new DateTime(2010, 01, 01), new User { Id = 1 });

            Assert.AreEqual(12, postingEvents.Count);
        }
Exemple #22
0
 public ProjectManager(User pUser, bool pInitializeAll)
     : base(pUser)
 {
     if (pInitializeAll)
     {
         _creditManager = new LoanManager(pUser);
         _locations = new LocationsManager(pUser);
     }
     else
         _clientManager = new ClientManager(pUser, false, false);
 }
 public AccountingRuleManager(User pUser)
     : base(pUser)
 {
     _accountManager = new AccountManager(pUser);
     _loanProductManager = new LoanProductManager(pUser);
     _savingProductManager = new SavingProductManager(pUser);
     _economicActivityManager = new EconomicActivityManager(pUser);
     _fundingLineManager = new FundingLineManager(pUser);
     _currencyManager = new CurrencyManager(pUser);
     _paymentMethodManager = new PaymentMethodManager(pUser);
 }
Exemple #24
0
 public ClientManager(User pUser, bool pInitializeProject, bool pInitializeSavings)
     : base(pUser)
 {
     _doam = new EconomicActivityManager(pUser);
     _locations = new LocationsManager(pUser);
     if (pInitializeProject)
         _projectManager = new ProjectManager(pUser, true);
     if (pInitializeSavings)
         _savingManager = new SavingManager(pUser);
     _userManager = new UserManager(pUser);
 }
 public EventProcessorServices(User pUser)
 {
     _user = pUser;
     _eventManagement = new EventManager(_user);
     _savingEventManagement = new SavingEventManager(_user);
     _movementSetManagement = new AccountingTransactionManager(_user);
     _loanManager = new LoanManager(_user);
     _packageManager = new LoanProductManager(_user);
     _accountingServices = new Accounting.AccountingServices(_user);
     _clientManagement = new ClientManager(_user, false, false);
     _InitializeEventProcessor();
 }
Exemple #26
0
        public bool Delete(User user)
        {
            if (user.Id == 0)
                throw new OpenCbsUserDeleteException(OpenCbsUserDeleteExceptionEnum.UserIsNull);

            if (user.Id == 1)
                throw new OpenCbsUserDeleteException(OpenCbsUserDeleteExceptionEnum.AdministratorUser);

            if (_tellerManager.SelectTellerOfUser(user.Id).Id != null)
                throw new OpenCbsUserDeleteException(OpenCbsUserDeleteExceptionEnum.UserHasTeller);

            user.IsDeleted = true;
            _userManager.DeleteUser(user);
            return true;
        }
Exemple #27
0
 public ContractCodeForm()
 {
     InitializeComponent();
     _user = new User();
     ApplicationSettings appSettings = ApplicationSettings.GetInstance(_user.Md5);
     string code = ServicesProvider.GetInstance().GetGeneralSettings().ContractCodeTemplate;
     chkBranchCode.Checked = code.IndexOf("BC") > -1;
     chkDistrict.Checked = code.IndexOf("DT") > -1;
     chkYear.Checked = code.IndexOf("YY") > -1;
     chkLoanOfficer.Checked = code.IndexOf("LO") > -1;
     chkProductCode.Checked = code.IndexOf("PC") > -1;
     chkLoanCycle.Checked = code.IndexOf("LC") > -1;
     chkClientId.Checked = code.IndexOf("ID") > -1;
     tbCode.Text = appSettings.ContractCodeTemplate;
 }
Exemple #28
0
 public LoanManager(User pUser)
     : base(pUser)
 {
     _user = pUser;
     _userManager = new UserManager(pUser);
     _paymentMethodManager = new PaymentMethodManager(pUser);
     _packageManager = new LoanProductManager(pUser);
     _installmentTypeManagement = new InstallmentTypeManager(pUser);
     _installmentManagement = new InstallmentManager(pUser);
     _eventManagement = new EventManager(pUser);
     _fundingLineManager = new FundingLineManager(pUser);
     _projectManager = new ProjectManager(pUser, false);
     _clientManager = new ClientManager(pUser, false, false);
     _collateralProductManager = new CollateralProductManager(pUser);
     _economicActivityManager = new EconomicActivityManager(pUser);
 }
        public void SuccessfulAuthenticationTest()
        {
            // create mock objects
            var mockContainer = MockRepository.GenerateStub<IContainer>();
            var mockAuthService = MockRepository.GenerateStub<IAuthService>();
            var mockAccessTokenCreator = MockRepository.GenerateStub<IAccessTokenCreator>();

            var user = new User
            {
                FirstName = "Peter",
                Id = 1,
                LastName = "Pan",
                Password = "******",
                Sex = 'M',
                UserRole = new Role { Id = 1, Description = "Admin", RoleName = "Admin"},
                Role = User.Roles.ADMIN,
                UserName = "******",
                IsDeleted = false
            };

            var accessToken = new AccessToken
            {
                IssuedAt = new DateTime(2014, 10, 21, 14, 34, 21),
                Token = "encrypted-token"
            };

            // define mock calls
            mockAuthService.Stub(x => x.Login("user", "success-password")).Return(user);
            mockAccessTokenCreator.Stub(x => x.Create(user.Id)).Return(accessToken);
            mockContainer.Stub(x => x.GetInstance<IAuthenticationResult>()).Return(new AuthenticationResult());
            
            // create test object
            var authenticationService = new AuthenticationService(mockContainer, mockAccessTokenCreator, mockAuthService);
            
            // run the test
            var result = authenticationService.Authenticate("user", "success-password");

            mockAuthService.AssertWasCalled(x => x.Login("user", "success-password"));
            mockAccessTokenCreator.AssertWasCalled(x => x.Create(user.Id));
            mockContainer.AssertWasCalled(x => x.GetInstance<IAuthenticationResult>());
            
            Assert.AreEqual(true, result.IsValid);
            Assert.AreEqual(Resources.Content.AuthenticationResult_Success, result.Message);
            Assert.AreEqual("encrypted-token", result.AccessToken);
            Assert.AreEqual(new DateTime(2014, 10, 21, 14, 34, 21), result.IssuedAt);
        }
        public void AddUserTest()
        {
                        
            var role = new Role
            {
                RoleName = "CASHI",
                Id = 2,
                IsDeleted = false,
                Description = "Cashier role"
            };
                        
            var userManager = new UserManager();
            var user = new User
            {
                FirstName = "Test2",
                LastName = "User2",
                Mail = "[email protected]",
                UserName = "******",
                Password = "******",
                Role = User.Roles.CASHI,
                UserRole = role,
                Phone = "+987654321",
                Sex = 'F'
            };            

            int userId = userManager.AddUser(user);

            var userResult = userManager.SelectUser(userId, true);

            Assert.AreEqual(userId, userResult.Id);
            Assert.AreEqual(user.FirstName, userResult.FirstName);
            Assert.AreEqual(user.LastName, userResult.LastName);
            Assert.AreEqual(user.UserName, userResult.UserName);
            Assert.AreEqual(user.UserRole.Id, userResult.UserRole.Id);
            Assert.AreEqual(user.UserRole.RoleName, userResult.UserRole.RoleName);
            //Assert.AreEqual(user.Password, userResult.Password);
            Assert.AreEqual(user.Mail, userResult.Mail);
            Assert.AreEqual(user.Role, userResult.Role);
            Assert.AreEqual(user.Phone, userResult.Phone);
            Assert.AreEqual(user.Sex, userResult.Sex);



        }