private static void ReadExecuteReader(List <QuoteAssign> comList, SqlCommand cmd)
 {
     using (SqlDataReader sdr = cmd.ExecuteReader())
     {
         if (sdr.HasRows)
         {
             while (sdr.Read())
             {
                 var sbj = new QuoteAssign();
                 sbj.QuoteId = Convert.ToInt32(sdr["QuoteID"].ToString());
                 //  sbj.QuotedById = Convert.ToInt32(sdr["QuoteByID"].ToString());
                 sbj.QuotedDate         = Convert.ToDateTime(sdr["QuoteDate"].ToString()).ToShortDateString();
                 sbj.QuotedByName       = sdr["QuoteBy"].ToString();
                 sbj.CompanyID          = sdr["CompanyID"].ToString();
                 sbj.QuoteAllocateId    = sdr["QuoteAlloID"].ToString();
                 sbj.ContactID          = sdr["ContactID"].ToString();
                 sbj.QuoteTotal         = sdr["Total"].ToString();
                 sbj.CompanyName        = sdr["CompanyName"].ToString();
                 sbj.QuotedAssignedName = sdr["quoteAssigned"].ToString();
                 sbj.ContactName        = sdr["ContactName"].ToString();
                 sbj.DbType             = sdr["DbType"].ToString();
                 sbj.Status             = sdr["Status"].ToString();
                 sbj.CustomerType       = sdr["Type"].ToString();
                 sbj.QuoteAllocatedDate = Convert.ToDateTime(sdr["quoteAllocatedDate"].ToString()).ToShortDateString();
                 sbj.QuoteExpiryDate    = sdr["ExpiryDate"].ToString();
                 sbj.RemainingDays      = sdr["daysRemain"].ToString();
                 comList.Add(sbj);
             }
         }
     }
 }
Пример #2
0
 private static void ReadExecuteReader(List <QuoteAssign> comList, SqlCommand cmd, int repReference)
 {
     if (repReference >= 0)
     {
         using (SqlDataReader sdr = cmd.ExecuteReader())
         {
             if (sdr.HasRows)
             {
                 while (sdr.Read())
                 {
                     var sbj = new QuoteAssign();
                     sbj.QuoteId            = Convert.ToInt32(sdr["QuoteID"].ToString());
                     sbj.QuotedById         = Convert.ToInt32(sdr["QuoteByID"].ToString());
                     sbj.QuotedDate         = Convert.ToDateTime(sdr["QuoteDate"].ToString()).ToShortDateString();
                     sbj.QuotedByName       = sdr["QuoteBy"].ToString();
                     sbj.QuoteTotal         = sdr["Total"].ToString();
                     sbj.CompanyName        = sdr["CompanyName"].ToString();
                     sbj.QuotedAssignedName = sdr["quoteAssigned"].ToString();
                     sbj.ContactName        = sdr["ContactName"].ToString();
                     sbj.Status             = sdr["Status"].ToString();
                     sbj.CustomerType       = sdr["Type"].ToString();
                     comList.Add(sbj);
                 }
             }
         }
     }
     else
     {
         using (SqlDataReader sdr = cmd.ExecuteReader())
         {
             if (sdr.HasRows)
             {
                 while (sdr.Read())
                 {
                     var sbj = new QuoteAssign();
                     sbj.QuoteId      = Convert.ToInt32(sdr["QuoteID"].ToString());
                     sbj.QuotedById   = Convert.ToInt32(sdr["QuoteByID"].ToString());
                     sbj.QuotedDate   = Convert.ToDateTime(sdr["QuoteDate"].ToString()).ToShortDateString();
                     sbj.QuotedByName = sdr["QuoteBy"].ToString();
                     sbj.QuoteTotal   = sdr["Total"].ToString();
                     sbj.CompanyName  = sdr["CompanyName"].ToString();
                     sbj.ContactName  = sdr["ContactName"].ToString();
                     sbj.Status       = sdr["Status"].ToString();
                     sbj.CustomerType = sdr["Type"].ToString();
                     comList.Add(sbj);
                 }
             }
         }
     }
 }