private static EconomicActivity GetEconomicActivity(OpenCbsReader pReader)
 {
     EconomicActivity doa = new EconomicActivity();
     if (pReader != null)
     {
         if (!pReader.Empty)
         {
             pReader.Read();
             doa.Id = pReader.GetInt("id");
             doa.Name = pReader.GetString("name");
             doa.Deleted = pReader.GetBool("deleted");
         }
     }
     return doa;
 }
Example #2
0
        private Project GetProject(OpenCbsReader reader)
        {
            Project project = new Project();
            project.Id = reader.GetInt("id");
            project.ProjectStatus = (OProjectStatus)reader.GetSmallInt("status");
            project.Code = reader.GetString("code");
            project.Name = reader.GetString("name");
            project.Aim = reader.GetString("aim");
            project.BeginDate = reader.GetDateTime("begin_date");
            project.Abilities = reader.GetString("abilities");
            project.Experience = reader.GetString("experience");
            project.Market = reader.GetString("market");
            project.Concurrence = reader.GetString("concurrence");
            project.Purpose = reader.GetString("purpose");

            project.CorporateName = reader.GetString("corporate_name");
            project.CorporateJuridicStatus = reader.GetString("corporate_juridicStatus");
            project.CorporateFiscalStatus = reader.GetString("corporate_FiscalStatus");
            project.CorporateSIRET = reader.GetString("corporate_siret");
            project.CorporateRegistre = reader.GetString("corporate_registre");
            project.CorporateCA = reader.GetMoney("corporate_CA");

            project.CorporateNbOfJobs = reader.GetNullInt("corporate_nbOfJobs");
            project.CorporateFinancialPlanType = reader.GetString("corporate_financialPlanType");
            project.CorporateFinancialPlanAmount = reader.GetMoney("corporateFinancialPlanAmount");
            project.CorporateFinancialPlanTotalAmount = reader.GetMoney("corporate_financialPlanTotalAmount");
            project.Address = reader.GetString("address");
            project.City = reader.GetString("city");
            project.ZipCode = reader.GetString("zipCode");
            int? districtId = reader.GetNullInt("district_id");
            if (districtId.HasValue)
                project.District = new District { Id = districtId.Value };

            project.HomePhone = reader.GetString("home_phone");
            project.PersonalPhone = reader.GetString("personalPhone");
            project.Email = reader.GetString("Email");
            project.HomeType = reader.GetString("hometype");

            return project;
        }
Example #3
0
 private PaymentMethod GetPaymentMethodFromReader(OpenCbsReader r)
 {
     //Do not change this calling of constructor by Object initializer
     PaymentMethod pm = new PaymentMethod(
                                             r.GetInt("id"),
                                             r.GetString("name"),
                                             r.GetString("description"),
                                             r.GetBool("pending")
                                         );
     pm.Account = _accountManager.Select(r.GetInt("account_id"));
     return pm;
 }
 private static InstallmentType GetInstallmentTypeFromReader(OpenCbsReader r)
 {
     return new InstallmentType
                {
                    Id = r.GetInt("id"),
                    Name = r.GetString("name"),
                    NbOfDays = r.GetInt("nb_of_days"),
                    NbOfMonths = r.GetInt("nb_of_months")
                };
 }
Example #5
0
        private static User _GetUser(OpenCbsReader pReader)
        {
            User user = new User
                            {
                                Id = pReader.GetInt("user_id"),
                                UserName = pReader.GetString("user_name"),
                                FirstName = pReader.GetString("first_name"),
                                LastName = pReader.GetString("last_name"),
                                Mail = pReader.GetString("mail"),
                                IsDeleted = pReader.GetBool("deleted"),
                                HasContract = (pReader.GetInt("contract_count") != 0),
                                Sex = pReader.GetChar("sex"),
                                Phone = pReader.GetString("phone")
                            };
            user.SetRole(pReader.GetString("role_code"));

            user.UserRole = new Role
                            {
                                RoleName = pReader.GetString("role_name"),
                                Id = pReader.GetInt("role_id")
                            };

            return user;
        }
Example #6
0
 private static Role GetRole(OpenCbsReader r)
 {
     return new Role
         {
             Id = r.GetInt("id"),
             RoleName = r.GetString("code"),
             IsDeleted = r.GetBool("deleted"),
             Description = r.GetString("description"),
             IsRoleForLoan = r.GetBool("role_of_loan"),
             IsRoleForSaving = r.GetBool("role_of_saving"),
             IsRoleForTeller = r.GetBool("role_of_teller")
         };;
 }
Example #7
0
 private static Installment GetInstallmentHistoryFromReader(OpenCbsReader r)
 {
     var i = new Installment
                 {
                     Number = r.GetInt("number"),
                     ExpectedDate = r.GetDateTime("expected_date"),
                     StartDate = r.GetDateTime("start_date"),
                     CapitalRepayment = r.GetMoney("capital_repayment"),
                     InterestsRepayment = r.GetMoney("interest_repayment"),
                     PaidInterests = r.GetMoney("paid_interest"),
                     PaidCapital = r.GetMoney("paid_capital"),
                     PaidFees = r.GetMoney("paid_fees"),
                     FeesUnpaid = r.GetMoney("fees_unpaid"),
                     PaidDate = r.GetNullDateTime("paid_date"),
                     Comment = r.GetString("comment"),
                     OLB = r.GetMoney("olb"),
                     IsPending = r.GetBool("pending")
                 };
     return i;
 }
Example #8
0
        private Project GetProject(OpenCbsReader reader)
        {
            Project project = new Project();

            project.Id            = reader.GetInt("id");
            project.ProjectStatus = (OProjectStatus)reader.GetSmallInt("status");
            project.Code          = reader.GetString("code");
            project.Name          = reader.GetString("name");
            project.Aim           = reader.GetString("aim");
            project.BeginDate     = reader.GetDateTime("begin_date");
            project.Abilities     = reader.GetString("abilities");
            project.Experience    = reader.GetString("experience");
            project.Market        = reader.GetString("market");
            project.Concurrence   = reader.GetString("concurrence");
            project.Purpose       = reader.GetString("purpose");

            project.CorporateName          = reader.GetString("corporate_name");
            project.CorporateJuridicStatus = reader.GetString("corporate_juridicStatus");
            project.CorporateFiscalStatus  = reader.GetString("corporate_FiscalStatus");
            project.CorporateSIRET         = reader.GetString("corporate_siret");
            project.CorporateRegistre      = reader.GetString("corporate_registre");
            project.CorporateCA            = reader.GetMoney("corporate_CA");

            project.CorporateNbOfJobs                 = reader.GetNullInt("corporate_nbOfJobs");
            project.CorporateFinancialPlanType        = reader.GetString("corporate_financialPlanType");
            project.CorporateFinancialPlanAmount      = reader.GetMoney("corporateFinancialPlanAmount");
            project.CorporateFinancialPlanTotalAmount = reader.GetMoney("corporate_financialPlanTotalAmount");
            project.Address = reader.GetString("address");
            project.City    = reader.GetString("city");
            project.ZipCode = reader.GetString("zipCode");
            int?districtId = reader.GetNullInt("district_id");

            if (districtId.HasValue)
            {
                project.District = new District {
                    Id = districtId.Value
                }
            }
            ;

            project.HomePhone     = reader.GetString("home_phone");
            project.PersonalPhone = reader.GetString("personalPhone");
            project.Email         = reader.GetString("Email");
            project.HomeType      = reader.GetString("hometype");

            return(project);
        }
Example #9
0
        public List <User> SellectAllWithoutTellerOfBranch(Branch branch, User user)
        {
            const string q = @"SELECT 
                                u.id, 
                                u.deleted, 
                                u.user_name, 
                                u.first_name,
                                u.last_name, 
                                u.user_pass,
                                u.mail, 
                                u.sex,
                                u.phone,
                                (SELECT COUNT(*)
                                FROM dbo.Credit 
                                WHERE loanofficer_id = u.id) AS num_contracts
                                FROM dbo.Users AS u
                                INNER JOIN dbo.UsersBranches ub ON ub.user_id = u.id
                                INNER JOIN UserRole ur ON ur.user_id = u .id
                                INNER JOIN Roles r ON r.id = ur.role_id
                                WHERE u.deleted = 0 AND r.role_of_teller = 1
                                AND (u.id NOT IN (SELECT user_id FROM Tellers WHERE deleted = 0) OR u.id = @user_id)
                                AND ub.branch_id = @branch_id AND u.id IN (SELECT @boss_id
								                                           UNION ALL
								                                           SELECT subordinate_id
								                                           FROM dbo.UsersSubordinates
								                                           WHERE user_id = @boss_id)"                                ;

            List <User> users = new List <User>();

            using (SqlConnection conn = GetConnection())
                using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
                {
                    c.AddParam("@branch_id", branch.Id);
                    c.AddParam("@boss_id", User.CurrentUser.Id);
                    c.AddParam("@user_id", user == null ? 0 : user.Id);
                    using (OpenCbsReader r = c.ExecuteReader())
                    {
                        if (r.Empty)
                        {
                            return(users);
                        }

                        while (r.Read())
                        {
                            User u = new User
                            {
                                Id          = r.GetInt("id"),
                                FirstName   = r.GetString("first_name"),
                                LastName    = r.GetString("last_name"),
                                IsDeleted   = r.GetBool("deleted"),
                                UserName    = r.GetString("user_name"),
                                Password    = r.GetString("user_pass"),
                                Mail        = r.GetString("mail"),
                                Sex         = r.GetChar("sex"),
                                HasContract = r.GetInt("num_contracts") > 0
                            };
                            users.Add(u);
                        }
                    }
                }
            return(users);
        }
Example #10
0
 private static Role GetRole(OpenCbsReader r)
 {
     return new Role
         {
             Id = r.GetInt("id"),
             RoleName = r.GetString("code"),
             IsDeleted = r.GetBool("deleted"),
             Description = r.GetString("description")
         };;
 }
Example #11
0
        public OStartPages.StartPages GetRolesDefaultStartPageByRoleId(int roleId)
        {
            string q = @"SELECT [default_start_view]
                                    FROM [Roles] WHERE [id] = @id ";

            using (SqlConnection conn = GetConnection())
                using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
                {
                    c.AddParam("@id", roleId);
                    using (OpenCbsReader r = c.ExecuteReader())
                    {
                        r.Read();
                        OStartPages.StartPages startPage =
                            (OStartPages.StartPages)Enum.Parse(typeof(OStartPages.StartPages), r.GetString("default_start_view"));
                        return(startPage);
                    }
                }
        }
Example #12
0
 private static Role GetRoleForFrmRoles(OpenCbsReader r)
 {
     return new Role
     {
         Id = r.GetInt("id"),
         RoleName = r.GetString("code"),
         IsDeleted = r.GetBool("deleted"),
         Description = r.GetString("description"),
         DefaultStartPage = (OStartPages.StartPages)Enum.Parse(typeof(OStartPages.StartPages), (r.GetString("default_start_view")), true)
     }; ;
 }