private VoucherEditDto FetchVoucherEdit(SafeDataReader dr)
        {
            var voucherEdit = new VoucherEditDto();
            // Value properties
            voucherEdit.Id = dr.GetInt32("tran_id");
            voucherEdit.Amount = (Decimal?)dr.GetValue("tran_amount");
            voucherEdit.PersonId = !dr.IsDBNull("person_id") ? dr.GetString("person_id") : null;
            voucherEdit.NamePrefix = !dr.IsDBNull("name_prefix") ? dr.GetString("name_prefix") : null;
            voucherEdit.First = !dr.IsDBNull("first_name") ? dr.GetString("first_name") : null;
            voucherEdit.Middle = !dr.IsDBNull("middle_name") ? dr.GetString("middle_name") : null;
            voucherEdit.Last = !dr.IsDBNull("last_name") ? dr.GetString("last_name") : null;
            voucherEdit.Suffix = !dr.IsDBNull("name_suffix") ? dr.GetString("name_suffix") : null;
            voucherEdit.Title = !dr.IsDBNull("title") ? dr.GetString("title") : null;
            voucherEdit.Company = !dr.IsDBNull("company") ? dr.GetString("company") : null;
            voucherEdit.AddressLine1 = !dr.IsDBNull("address_1") ? dr.GetString("address_1") : null;
            voucherEdit.AddressLine2 = !dr.IsDBNull("address_2") ? dr.GetString("address_2") : null;
            voucherEdit.Municipality = !dr.IsDBNull("municipality") ? dr.GetString("municipality") : null;
            voucherEdit.Region = !dr.IsDBNull("region") ? dr.GetString("region") : null;
            voucherEdit.PostalCode = !dr.IsDBNull("postal_code") ? dr.GetString("postal_code") : null;
            voucherEdit.Country = !dr.IsDBNull("country") ? dr.GetString("country") : null;
            voucherEdit.PhoneNumber = !dr.IsDBNull("phone_number") ? dr.GetString("phone_number") : null;
            voucherEdit.EmailAddress = !dr.IsDBNull("email") ? dr.GetString("email") : null;
            voucherEdit.Updated = !dr.IsDBNull("updated") ? dr.GetSmartDate("updated", true) : null;

            return voucherEdit;
        }
 public VoucherEditDto Fetch(int id)
 {
     var voucherEdit = new VoucherEditDto();
     using (var ctx = ConnectionManager<SqlConnection>.GetManager("CoopCheck"))
     {
         using (var cmd = new SqlCommand("dbo.dsa_GetVoucher", ctx.Connection))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@tran_id", id).DbType = DbType.Int32;
             var dr = new SafeDataReader(cmd.ExecuteReader());
             dr.Read();
             voucherEdit.Id = dr.GetInt32("tran_id");
             voucherEdit.Amount = (Decimal?)dr.GetValue("tran_amount");
             voucherEdit.PersonId = !dr.IsDBNull("person_id") ? dr.GetString("person_id") : null;
             voucherEdit.NamePrefix = !dr.IsDBNull("name_prefix") ? dr.GetString("name_prefix") : null;
             voucherEdit.First = !dr.IsDBNull("first_name") ? dr.GetString("first_name") : null;
             voucherEdit.Middle = !dr.IsDBNull("middle_name") ? dr.GetString("middle_name") : null;
             voucherEdit.Last = !dr.IsDBNull("last_name") ? dr.GetString("last_name") : null;
             voucherEdit.Suffix = !dr.IsDBNull("name_suffix") ? dr.GetString("name_suffix") : null;
             voucherEdit.Title = !dr.IsDBNull("title") ? dr.GetString("title") : null;
             voucherEdit.Company = !dr.IsDBNull("company") ? dr.GetString("company") : null;
             voucherEdit.AddressLine1 = !dr.IsDBNull("address_1") ? dr.GetString("address_1") : null;
             voucherEdit.AddressLine2 = !dr.IsDBNull("address_2") ? dr.GetString("address_2") : null;
             voucherEdit.Municipality = !dr.IsDBNull("municipality") ? dr.GetString("municipality") : null;
             voucherEdit.Region = !dr.IsDBNull("region") ? dr.GetString("region") : null;
             voucherEdit.PostalCode = !dr.IsDBNull("postal_code") ? dr.GetString("postal_code") : null;
             voucherEdit.Country = !dr.IsDBNull("country") ? dr.GetString("country") : null;
             voucherEdit.PhoneNumber = !dr.IsDBNull("phone_number") ? dr.GetString("phone_number") : null;
             voucherEdit.EmailAddress = !dr.IsDBNull("email") ? dr.GetString("email") : null;
             voucherEdit.Updated = !dr.IsDBNull("updated") ? dr.GetSmartDate("updated", true) : null;
         }
     }
     return voucherEdit;
 }
 private AccountDto Fetch(IDataReader data)
 {
     var account = new AccountDto();
     using (var dr = new SafeDataReader(data))
     {
         if (dr.Read())
         {
             account.Id = dr.GetInt32("account_id");
             account.Name = dr.GetString("account_name");
             account.Description = !dr.IsDBNull("account_dscr") ? dr.GetString("account_dscr") : null;
             account.Number = !dr.IsDBNull("account_number") ? dr.GetString("account_number") : null;
             account.Balance = (Decimal?)dr.GetValue("balance");
             account.LastReconciliationDate = !dr.IsDBNull("last_rec_date") ? dr.GetSmartDate("last_rec_date", true) : null;
             account.LastReconciliationBalance = (Decimal?)dr.GetValue("last_rec_balance");
         }
     }
     return account;
 }
 private BatchEditDto Fetch(IDataReader data)
 {
     var batchEdit = new BatchEditDto();
     using (var dr = new SafeDataReader(data))
     {
         if (dr.Read())
         {
             batchEdit.Num = dr.GetInt32("batch_num");
             batchEdit.Date = !dr.IsDBNull("batch_date") ? dr.GetSmartDate("batch_date", true) : null;
             batchEdit.PayDate = !dr.IsDBNull("pay_date") ? dr.GetSmartDate("pay_date", true) : null;
             batchEdit.Amount = (Decimal?)dr.GetValue("batch_amount");
             batchEdit.JobNum = (int?)dr.GetValue("job_num");
             batchEdit.Description = !dr.IsDBNull("batch_dscr") ? dr.GetString("batch_dscr") : null;
             batchEdit.Updated = !dr.IsDBNull("updated") ? dr.GetSmartDate("updated", true) : null;
             batchEdit.ThankYou1 = !dr.IsDBNull("thank_you_1") ? dr.GetString("thank_you_1") : null;
             batchEdit.StudyTopic = !dr.IsDBNull("study_topic") ? dr.GetString("study_topic") : null;
             batchEdit.ThankYou2 = !dr.IsDBNull("thank_you_2") ? dr.GetString("thank_you_2") : null;
             batchEdit.MarketingResearchMessage = !dr.IsDBNull("marketing_research_message") ? dr.GetString("marketing_research_message") : null;
         }
         FetchChildren(dr);
     }
     return batchEdit;
 }
Exemple #5
0
        /// <summary>
        /// Reads metrics.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="sr">The reader.</param>
        private static void ReadMetrics(ProcessEditDto process, SafeDataReader sr)
        {
            sr.NextResult();

            while (sr.Read())
            {
                process.Metrics.Add(new ProcessMetricEditDto
                {
                    Id = sr.GetInt32(0),
                    ProcessId = sr.GetInt32(1),
                    LastModifiedOn = sr.GetDateTime(2),
                    GuidId = sr.GetString(3),
                    Name = sr.GetString(4),
                    Documentation = sr.GetString(5),
                    SummaryType = sr.GetString(6),
                    LockFilter = sr.GetBool(7),
                    SnapshotFrequency = sr.GetString(8),
                    MetricFieldSystemName = sr.GetString(9),
                    GroupFieldOneSystemName = sr.GetString(10),
                    GroupFieldTwoSystemName = sr.GetString(11),
                    GroupFieldThreeSystemName = sr.GetString(12),
                    GroupFieldFourSystemName = sr.GetString(13),
                    FilterGuid = sr.GetGuid(14),
                    OrderByMetricField = sr.GetString(15),
                    OrderByAscending = (bool?)sr.GetValue(16),
                    FilterDefinition = sr.GetString(17)
                });
            }
        }