public IEnumerable<MediaViewEditResult> GetMediaNotReceivedReportRecords(string Export)
        {
            DBFactory db;
            SqlDataReader rdr;
            List<MediaViewEditResult> data = null;
            try
            {
                db = new DBFactory();
                rdr = db.ExecuteReader("MSI_spGetMediaNotReceivedReportData", new SqlParameter("@Export", Export));
                data = new List<MediaViewEditResult>();
                MediaViewEditResult record;
                while (rdr.Read())
                {
                    record = new MediaViewEditResult();
                    record.OrigAcct = rdr["OrigAcct"].ToString();
                    record.PIMSAcct = rdr["PIMSAcct"].ToString();
                    record.AcctName = rdr["AcctName"].ToString();
                    record.Portfolio = rdr["Portfolio"].ToString();
                    record.OriginalLender = rdr["OriginalLender"].ToString();
                    record.ID = Convert.ToInt32(rdr["ID"].ToString());
                    if (Export != null)
                    {
                        record.OpenDate = Convert.ToDateTime(rdr["OpenDate"]);
                        record.CODate = Convert.ToDateTime(rdr["CODate"]);
                        record.OrderDate = Convert.ToDateTime(rdr["OrderDate"]);
                        record.GUID = rdr["GUID"].ToString();
                        record.Portfolio = rdr["Portfolio"].ToString();
                        record.CompanyRequesting = rdr["CompanyRequesting"].ToString();
                        record.SSN = rdr["SSN"].ToString();
                        record.IsApplication = rdr["IsApplication"].ToString();
                        record.IsAffidavitIssuer = rdr["IsAffidavitIssuer"].ToString();
                        record.IsAffidavitSeller = rdr["IsAffidavitSeller"].ToString();
                        record.IsUnavailable = rdr["IsUnavailable"].ToString();
                        record.IsClosed = rdr["IsClosed"].ToString();
                        record.Explanation = rdr["Explanation"].ToString();
                        record.MediaTypeReceived = rdr["MediaTypeReceived"].ToString();
                        record.Notes = rdr["Notes"].ToString();
                        record.SellerInvoice = rdr["SellerInvoice"].ToString();
                        record.BuyerCheck = rdr["BuyerCheck"].ToString();
                        record.OurCheck = rdr["OurCheck"].ToString();
                        record.Seller = rdr["Seller"].ToString();
                        record.OrderNumber = rdr["OrderNumber"].ToString();
                        record.OurInvoice = rdr["OurInvoice"].ToString();
                        record.StmtsFrom = Convert.ToDateTime(rdr["StmtsFrom"]);
                        record.StmtsTo = Convert.ToDateTime(rdr["StmtsTo"]);
                        record.DateSubmitted = Convert.ToDateTime(rdr["DateSubmitted"]);
                        record.DateConfirmed = Convert.ToDateTime(rdr["DateConfirmed"]);
                        record.DateSellerPaid = Convert.ToDateTime(rdr["DateSellerPaid"]);
                        record.DateReceived = Convert.ToDateTime(rdr["DateReceived"]);
                        record.UnavailableDate = Convert.ToDateTime(rdr["UnavailableDate"]);
                        record.DatePayRec = Convert.ToDateTime(rdr["DatePayRec"]);
                        record.ID = Convert.ToInt32(rdr["ID"].ToString());
                        record.SellerFee = rdr["SellerFee"] == DBNull.Value ? Convert.ToDecimal(0.0) : Convert.ToDecimal(rdr["SellerFee"]);
                        record.OurFee = rdr["OurFee"] == DBNull.Value ? Convert.ToDecimal(0.0) : Convert.ToDecimal(rdr["OurFee"]);
                        if (record.SellerFee == Convert.ToDecimal(0.0))
                        {
                            record.SellerFee = null;
                        }
                        if (record.OurFee == Convert.ToDecimal(0.0))
                        {
                            record.OurFee = null;
                        }
                        if (record.OpenDate.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.OpenDate = null;
                        }
                        if (record.CODate.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.CODate = null;
                        }
                        if (record.OrderDate.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.OrderDate = null;
                        }

                        if (record.StmtsFrom.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.StmtsFrom = null;
                        }
                        if (record.StmtsTo.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.StmtsTo = null;
                        }
                        if (record.DateSubmitted.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.DateSubmitted = null;
                        }
                        if (record.DateConfirmed.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.DateConfirmed = null;
                        }
                        if (record.DateSellerPaid.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.DateSellerPaid = null;
                        }
                        if (record.DateReceived.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.DateReceived = null;
                        }
                        if (record.UnavailableDate.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.UnavailableDate = null;
                        }
                        if (record.DatePayRec.ToString() == "1/1/1900 12:00:00 AM")
                        {
                            record.DatePayRec = null;
                        }

                        if (record.IsApplication.ToUpper() == "TRUE")
                        {
                            record.IsApplication = "Yes";
                        }
                        else
                        {
                            record.IsApplication = "No";
                        }

                        if (record.IsAffidavitIssuer.ToUpper() == "TRUE")
                        {
                            record.IsAffidavitIssuer = "Yes";
                        }
                        else
                        {
                            record.IsAffidavitIssuer = "No";
                        }

                        if (record.IsAffidavitSeller.ToUpper() == "TRUE")
                        {
                            record.IsAffidavitSeller = "Yes";
                        }
                        else
                        {
                            record.IsAffidavitSeller = "No";
                        }

                        if (record.IsUnavailable.ToUpper() == "TRUE")
                        {
                            record.IsUnavailable = "Yes";
                        }
                        else
                        {
                            record.IsUnavailable = "No";
                        }

                        if (record.IsClosed.ToUpper() == "TRUE")
                        {
                            record.IsClosed = "Yes";
                        }
                        else
                        {
                            record.IsClosed = "No";
                        }
                    }
                    data.Add(record);
                }
                //Close the datareader
                rdr.Close();
            }
            catch (Exception ex)
            {
                throw new Exception("Exception in DataQueries.GetMediaNotReceivedReportRecords:" + ex.Message);
            }
            return data.AsEnumerable<MediaViewEditResult>();
        }
 public IEnumerable<MediaViewEditResult> GetMediaViewEditRecords(DateTime? StartDate, DateTime? EndDate, string PortfolioOwner, string Responsibility, string Account, string GUID)
 {
     DBFactory db;
     SqlDataReader rdr;
     List<MediaViewEditResult> data = null;
     try
     {
         db = new DBFactory();
         rdr = db.ExecuteReader("MSI_spGetMediaViewEditRecords", new SqlParameter("@StartDate", StartDate),
             new SqlParameter("@EndDate", EndDate), new SqlParameter("@PortfolioOwner", PortfolioOwner),
             new SqlParameter("@Responsibility", Responsibility), new SqlParameter("@Account", Account), new SqlParameter("@GUID", GUID));
         data = new List<MediaViewEditResult>();
         MediaViewEditResult record;
         while (rdr.Read())
         {
             record = new MediaViewEditResult();
             record.AcctName = rdr["AcctName"].ToString();
             record.PIMSAcct = rdr["PIMSAcct"].ToString();
             record.OrigAcct = rdr["OrigAcct"].ToString();
             record.OpenDate = Convert.ToDateTime(rdr["OpenDate"]);
             record.CODate = Convert.ToDateTime(rdr["CODate"]);
             record.OrderDate = Convert.ToDateTime(rdr["OrderDate"]);
             record.GUID = rdr["GUID"].ToString();
             record.Portfolio = rdr["Portfolio"].ToString();
             record.ID = Convert.ToInt32(rdr["ID"].ToString());
             record.SellerFee = rdr["SellerFee"] == DBNull.Value ? Convert.ToDecimal(0.0) : Convert.ToDecimal(rdr["SellerFee"]);
             if (record.SellerFee == Convert.ToDecimal(0.0))
             {
                 record.SellerFee = null;
             }
             record.OurFee = rdr["OurFee"] == DBNull.Value ? Convert.ToDecimal(0.0) : Convert.ToDecimal(rdr["OurFee"]);
             if (record.OurFee == Convert.ToDecimal(0.0))
             {
                 record.OurFee = null;
             }
             if (record.OpenDate.ToString() == "1/1/1900 12:00:00 AM")
             {
                 record.OpenDate = null;
             }
             if (record.CODate.ToString() == "1/1/1900 12:00:00 AM")
             {
                 record.CODate = null;
             }
             if (record.OrderDate.ToString() == "1/1/1900 12:00:00 AM")
             {
                 record.OrderDate = null;
             }
             data.Add(record);
         }
         //Close the datareader
         rdr.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Exception in DataQueries.GetMediaViewEditRecords:" + ex.Message);
     }
     return data.AsEnumerable<MediaViewEditResult>();
 }