Ejemplo n.º 1
0
 private void GetOfferProduct(Guid guid)
 {
     using (IDataReader reader = DBOfferProduct.Get(guid))
     {
         if (reader.Read())
         {
             this.guid              = new Guid(reader["Guid"].ToString());
             this.offerGuid         = new Guid(reader["OfferGuid"].ToString());
             this.productGuid       = new Guid(reader["ProductGuid"].ToString());
             this.fullfillType      = Convert.ToByte(reader["FullfillType"]);
             this.fullFillTermsGuid = new Guid(reader["FullFillTermsGuid"].ToString());
             this.quantity          = Convert.ToInt32(reader["Quantity"]);
             this.sortOrder         = Convert.ToInt32(reader["SortOrder"]);
             this.isDeleted         = Convert.ToBoolean(reader["IsDeleted"]);
             this.created           = Convert.ToDateTime(reader["Created"]);
             this.createdBy         = new Guid(reader["CreatedBy"].ToString());
             this.createdFromIP     = reader["CreatedFromIP"].ToString();
             if (reader["DeletedBy"] != DBNull.Value)
             {
                 this.deletedBy = new Guid(reader["DeletedBy"].ToString());
             }
             this.deletedFromIP = reader["DeletedFromIP"].ToString();
             if (reader["DeletedTime"] != DBNull.Value)
             {
                 this.deletedTime = Convert.ToDateTime(reader["DeletedTime"]);
             }
             this.lastModified       = Convert.ToDateTime(reader["LastModified"]);
             this.lastModifiedBy     = new Guid(reader["LastModifiedBy"].ToString());
             this.lastModifiedFromIP = reader["LastModifiedFromIP"].ToString();
         }
     }
 }
Ejemplo n.º 2
0
        public static DataTable GetByOffer(Guid offerGuid)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Guid", typeof(Guid));
            dataTable.Columns.Add("OfferGuid", typeof(Guid));
            dataTable.Columns.Add("ProductGuid", typeof(Guid));
            dataTable.Columns.Add("FullfillType", typeof(byte));
            dataTable.Columns.Add("FullFillTermsGuid", typeof(Guid));
            dataTable.Columns.Add("Quantity", typeof(int));
            dataTable.Columns.Add("SortOrder", typeof(int));
            dataTable.Columns.Add("Name", typeof(string));


            using (IDataReader reader = DBOfferProduct.GetByOffer(offerGuid))
            {
                while (reader.Read())
                {
                    DataRow row = dataTable.NewRow();
                    row["Guid"]              = reader["Guid"];
                    row["OfferGuid"]         = reader["OfferGuid"];
                    row["ProductGuid"]       = reader["ProductGuid"];
                    row["FullfillType"]      = reader["FullfillType"];
                    row["FullFillTermsGuid"] = reader["FullFillTermsGuid"];
                    row["Quantity"]          = reader["Quantity"];
                    row["SortOrder"]         = reader["SortOrder"];
                    row["Name"]              = reader["Name"];
                    dataTable.Rows.Add(row);
                }
            }

            return(dataTable);
        }
Ejemplo n.º 3
0
 public static bool DeleteByProduct(
     Guid productGuid,
     Guid deletedBy,
     string deletedFromIP)
 {
     return(DBOfferProduct.DeleteByProduct(
                productGuid,
                deletedBy,
                deletedFromIP,
                DateTime.UtcNow));
 }
Ejemplo n.º 4
0
 private bool Update()
 {
     return(DBOfferProduct.Update(
                this.guid,
                this.fullfillType,
                this.fullFillTermsGuid,
                this.quantity,
                this.sortOrder,
                this.lastModified,
                this.lastModifiedBy,
                this.lastModifiedFromIP));
 }
Ejemplo n.º 5
0
        private bool Create()
        {
            Guid newID = Guid.NewGuid();

            this.guid = newID;

            int rowsAffected = DBOfferProduct.Add(
                this.guid,
                this.offerGuid,
                this.productGuid,
                this.fullfillType,
                this.fullFillTermsGuid,
                this.quantity,
                this.sortOrder,
                this.created,
                this.createdBy,
                this.createdFromIP,
                this.lastModified,
                this.lastModifiedBy,
                this.lastModifiedFromIP);

            return(rowsAffected > 0);
        }
Ejemplo n.º 6
0
        public static Collection <OfferProduct> GetbyOffer(Guid offerGuid)
        {
            Collection <OfferProduct> offerProducts = new Collection <OfferProduct>();

            using (IDataReader reader = DBOfferProduct.GetByOffer(offerGuid))
            {
                while (reader.Read())
                {
                    OfferProduct offerProduct = new OfferProduct();
                    offerProduct.fullFillTermsGuid = new Guid(reader["FullfillTermsGuid"].ToString());
                    offerProduct.fullfillType      = Convert.ToByte(reader["FullfillType"]);
                    offerProduct.guid        = new Guid(reader["Guid"].ToString());
                    offerProduct.offerGuid   = offerGuid;
                    offerProduct.productGuid = new Guid(reader["ProductGuid"].ToString());
                    offerProduct.quantity    = Convert.ToInt32(reader["Quantity"]);
                    offerProduct.sortOrder   = Convert.ToInt32(reader["SortOrder"]);

                    offerProducts.Add(offerProduct);
                }
            }


            return(offerProducts);
        }
Ejemplo n.º 7
0
 public static int GetCountByOffer(Guid offerGuid)
 {
     return(DBOfferProduct.GetCountByOffer(offerGuid));
 }
Ejemplo n.º 8
0
 public static IDataReader GetReaderByOffer(Guid offerGuid)
 {
     return(DBOfferProduct.GetByOffer(offerGuid));
 }