Exemplo n.º 1
0
        public FundingLine SelectFundingLineByName(string name)
        {
            FundingLine fundingLine = null;

            string q =
                @"SELECT FundingLines.[id],
                         FundingLines.[name], 
                         FundingLines.[deleted],
                         FundingLines.[amount],
                         FundingLines.[begin_date],
                         FundingLines.[end_date],
                         FundingLines.[purpose], 
                         FundingLines.[currency_id],
                         Currencies.[name] as currency_name, 
                         Currencies.[code] as currency_code, 
                         Currencies.[is_pivot] as currency_is_pivot,
                         Currencies.[is_swapped] as currency_is_swapped
                        FROM [FundingLines] 
                        LEFT JOIN Currencies ON FundingLines.currency_id = Currencies.id
                        WHERE FundingLines.[name]=@name AND [deleted]=0";

            using (SqlConnection conn = GetConnection())
                using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
                {
                    c.AddParam("@name", name);

                    using (OpenCbsReader r = c.ExecuteReader())
                    {
                        if (r != null)
                        {
                            if (!r.Empty)
                            {
                                r.Read();
                                fundingLine           = new FundingLine();
                                fundingLine.Id        = r.GetInt("id");
                                fundingLine.Name      = r.GetString("name");
                                fundingLine.Deleted   = r.GetBool("deleted");
                                fundingLine.StartDate = r.GetDateTime("begin_date");
                                fundingLine.Purpose   = r.GetString("purpose");
                                fundingLine.EndDate   = r.GetDateTime("end_date");
                                fundingLine.Amount    = r.GetMoney("amount");
                                fundingLine.Currency  = new Currency
                                {
                                    Id        = r.GetInt("currency_id"),
                                    Name      = r.GetString("currency_name"),
                                    Code      = r.GetString("currency_code"),
                                    IsPivot   = r.GetBool("currency_is_pivot"),
                                    IsSwapped = r.GetBool("currency_is_swapped")
                                };
                            }
                        }
                    }
                }
            SetLazyLoader(fundingLine);

            return(fundingLine);
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
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;
 }
Exemplo n.º 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")
         };;
 }
Exemplo n.º 7
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")
         };;
 }
Exemplo n.º 8
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)
     }; ;
 }