Exemple #1
0
        public static MixERP.Net.Common.Models.Office.CashRepository GetCashRepository(int? cashRepositoryId)
        {
            MixERP.Net.Common.Models.Office.CashRepository cashRepository = new Common.Models.Office.CashRepository();

            if (cashRepositoryId != null || cashRepositoryId != 0)
            {
                string sql = "SELECT * FROM office.cash_repositories WHERE [email protected];";
                using (NpgsqlCommand command = new NpgsqlCommand(sql))
                {
                    command.Parameters.Add("@CashRepositoryId", cashRepositoryId);

                    using (DataTable table = MixERP.Net.DBFactory.DBOperations.GetDataTable(command))
                    {
                        if (table != null)
                        {
                            if (table.Rows.Count.Equals(1))
                            {
                                cashRepository = GetCashRepository(table.Rows[0]);
                            }
                        }
                    }
                }
            }

            return cashRepository;
        }
Exemple #2
0
        private static MixERP.Net.Common.Models.Office.CashRepository GetCashRepository(DataRow row)
        {
            MixERP.Net.Common.Models.Office.CashRepository cashRepository = new Common.Models.Office.CashRepository();

            cashRepository.CashRepositoryId = MixERP.Net.Common.Conversion.TryCastInteger(Helpers.ConversionHelper.GetColumnValue(row, "cash_repository_id"));
            cashRepository.OfficeId = MixERP.Net.Common.Conversion.TryCastInteger(Helpers.ConversionHelper.GetColumnValue(row, "office_id"));
            cashRepository.Office = Office.Offices.GetOffice(cashRepository.OfficeId);
            cashRepository.CashRepositoryCode = MixERP.Net.Common.Conversion.TryCastString(Helpers.ConversionHelper.GetColumnValue(row, "cash_repository_code"));
            cashRepository.CashRepositoryName = MixERP.Net.Common.Conversion.TryCastString(Helpers.ConversionHelper.GetColumnValue(row, "cash_repository_name"));
            cashRepository.ParentCashRepositoryId = MixERP.Net.Common.Conversion.TryCastInteger(Helpers.ConversionHelper.GetColumnValue(row, "parent_cash_repository_id"));
            cashRepository.ParentCashRepository = Office.CashRepositories.GetCashRepository(cashRepository.ParentCashRepositoryId);
            cashRepository.Description = MixERP.Net.Common.Conversion.TryCastString(Helpers.ConversionHelper.GetColumnValue(row, "description"));

            return cashRepository;
        }