Example #1
0
 public List<CustomerInfo> File_GetByAll()
 {
     List<CustomerInfo> list = new List<CustomerInfo>();
     using (SqlConnection Conn = new SqlConnection(Common.GetConnectString()))
     {
         try
         {
             Conn.Open();
             using (SqlCommand cmd = new SqlCommand("DDV_GetCustomerInfo", Conn))
             {
                 CustomerInfo obj = new CustomerInfo();
                 cmd.CommandType = CommandType.StoredProcedure;
                 SqlDataReader dr = cmd.ExecuteReader();
                 if (dr.HasRows)
                 {
                     while (dr.Read())
                     {
                         list.Add(obj.CustomerIDataReader(dr));
                     }
                 }
                 dr.Close();
             }
         }
         catch (Exception ex)
         {
             throw ex;
         }
         finally
         {
             Conn.Close();
         }
     }
     return list;
 }
Example #2
0
 public CustomerInfo CustomerIDataReader(IDataReader dr)
 {
     CustomerInfo obj = new CustomerInfo();
     obj.File_Sharing_ID = (dr["File_Sharing_ID"] is DBNull) ? string.Empty : dr["File_Sharing_ID"].ToString();
     obj.CustomerName = (dr["Customer_name"] is DBNull) ? string.Empty : dr["Customer_name"].ToString();
     obj.CustomerEmail = (dr["Customer_Email"] is DBNull) ? string.Empty : dr["Customer_Email"].ToString();
     return obj;
 }