public static DataTable GetPage(
            Guid storeGuid,
            int pageNumber,
            int pageSize)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Guid", typeof(Guid));
            dataTable.Columns.Add("StoreGuid", typeof(Guid));

            dataTable.Columns.Add("Name", typeof(string));
            dataTable.Columns.Add("Description", typeof(string));

            dataTable.Columns.Add("DownloadsAllowed", typeof(int));
            dataTable.Columns.Add("ExpireAfterDays", typeof(int));
            dataTable.Columns.Add("CountAfterDownload", typeof(bool));
            dataTable.Columns.Add("Created", typeof(DateTime));
            dataTable.Columns.Add("CreatedBy", typeof(Guid));
            dataTable.Columns.Add("CreatedFromIP", typeof(string));
            dataTable.Columns.Add("LastModified", typeof(DateTime));
            dataTable.Columns.Add("LastModifedBy", typeof(Guid));
            dataTable.Columns.Add("LastModifedFromIPAddress", typeof(string));
            dataTable.Columns.Add("TotalPages", typeof(int));

            using (IDataReader reader = DBDownloadTerms.GetFullfillDownloadTermsPage(
                       storeGuid,
                       pageNumber,
                       pageSize))
            {
                while (reader.Read())
                {
                    DataRow row = dataTable.NewRow();
                    row["Guid"]      = reader["Guid"];
                    row["StoreGuid"] = reader["StoreGuid"];

                    row["Name"]        = reader["Name"];
                    row["Description"] = reader["Description"];

                    row["DownloadsAllowed"]         = reader["DownloadsAllowed"];
                    row["ExpireAfterDays"]          = reader["ExpireAfterDays"];
                    row["CountAfterDownload"]       = reader["CountAfterDownload"];
                    row["Created"]                  = reader["Created"];
                    row["CreatedBy"]                = reader["CreatedBy"];
                    row["CreatedFromIP"]            = reader["CreatedFromIP"];
                    row["LastModified"]             = reader["LastModified"];
                    row["LastModifedBy"]            = reader["LastModifedBy"];
                    row["LastModifedFromIPAddress"] = reader["LastModifedFromIPAddress"];
                    row["TotalPages"]               = Convert.ToInt32(reader["TotalPages"]);
                    dataTable.Rows.Add(row);
                }
            }

            return(dataTable);
        }
 private bool Update()
 {
     return(DBDownloadTerms.Update(
                this.guid,
                this.downloadsAllowed,
                this.expireAfterDays,
                this.countAfterDownload,
                this.lastModified,
                this.lastModifedBy,
                this.lastModifedFromIPAddress,
                this.name,
                this.description));
 }
        private bool Create()
        {
            Guid newID = Guid.NewGuid();

            this.guid = newID;

            int rowsAffected = DBDownloadTerms.Add(
                this.guid,
                this.storeGuid,
                this.downloadsAllowed,
                this.expireAfterDays,
                this.countAfterDownload,
                this.created,
                this.createdBy,
                this.createdFromIP,
                this.lastModified,
                this.lastModifedBy,
                this.lastModifedFromIPAddress,
                this.name,
                this.description);

            return(rowsAffected > 0);
        }
        private void GetFullfillDownloadTerms(Guid guid)
        {
            using (IDataReader reader = DBDownloadTerms.Get(guid))
            {
                if (reader.Read())
                {
                    this.guid                     = new Guid(reader["Guid"].ToString());
                    this.storeGuid                = new Guid(reader["StoreGuid"].ToString());
                    this.downloadsAllowed         = Convert.ToInt32(reader["DownloadsAllowed"]);
                    this.expireAfterDays          = Convert.ToInt32(reader["ExpireAfterDays"]);
                    this.countAfterDownload       = Convert.ToBoolean(reader["CountAfterDownload"]);
                    this.created                  = Convert.ToDateTime(reader["Created"]);
                    this.createdBy                = new Guid(reader["CreatedBy"].ToString());
                    this.createdFromIP            = reader["CreatedFromIP"].ToString();
                    this.lastModified             = Convert.ToDateTime(reader["LastModified"]);
                    this.lastModifedBy            = new Guid(reader["LastModifedBy"].ToString());
                    this.lastModifedFromIPAddress = reader["LastModifedFromIPAddress"].ToString();

                    this.name        = reader["Name"].ToString();
                    this.description = reader["Description"].ToString();
                }
            }
        }
 public static IDataReader GetAll(Guid storeGuid)
 {
     return(DBDownloadTerms.GetAll(storeGuid));
 }
        public static List <FullfillDownloadTerms> GetList(Guid storeGuid)
        {
            IDataReader reader = DBDownloadTerms.GetAll(storeGuid);

            return(LoadListFromReader(reader));
        }
 public static bool Delete(Guid guid)
 {
     return(DBDownloadTerms.Delete(guid));
 }