Ejemplo n.º 1
0
 public static void PopulateSueetieProductList(IDataReader dr, SueetieProduct _sueetieProduct)
 {
     _sueetieProduct.ProductID              = (int)dr["productid"];
     _sueetieProduct.UserID                 = (int)dr["userid"];
     _sueetieProduct.CategoryID             = (int)dr["categoryid"];
     _sueetieProduct.Title                  = dr["title"] as string;
     _sueetieProduct.SubTitle               = dr["subtitle"] as string;
     _sueetieProduct.ProductDescription     = dr["productdescription"] as string;
     _sueetieProduct.DownloadURL            = dr["downloadurl"] as string;
     _sueetieProduct.Price                  = (decimal)dr["price"];
     _sueetieProduct.ExpirationDate         = DataHelper.DateOrNull(dr["expirationdate"].ToString());
     _sueetieProduct.DateCreated            = DataHelper.DateOrNull(dr["datecreated"].ToString());
     _sueetieProduct.DateApproved           = DataHelper.DateOrNull(dr["dateapproved"].ToString());
     _sueetieProduct.NumViews               = (int)dr["numviews"];
     _sueetieProduct.NumDownloads           = (int)dr["numdownloads"];
     _sueetieProduct.PurchaseTypeID         = (int)dr["purchasetypeid"];
     _sueetieProduct.PreviewImageID         = (int)dr["previewimageid"];
     _sueetieProduct.DocumentationURL       = dr["documentationurl"] as string;
     _sueetieProduct.ImageGalleryURL        = dr["imagegalleryurl"] as string;
     _sueetieProduct.StatusTypeID           = (int)dr["statustypeid"];
     _sueetieProduct.UserName               = dr["username"] as string;
     _sueetieProduct.Email                  = dr["email"] as string;
     _sueetieProduct.DisplayName            = dr["displayname"] as string;
     _sueetieProduct.ContentID              = (int)dr["contentid"];
     _sueetieProduct.ContentTypeID          = (int)dr["contenttypeid"];
     _sueetieProduct.ApplicationID          = (int)dr["applicationid"];
     _sueetieProduct.StatusTypeCode         = dr["statustypecode"] as string;
     _sueetieProduct.CategoryName           = dr["categoryname"] as string;
     _sueetieProduct.CategoryPath           = dr["categorypath"] as string;
     _sueetieProduct.PurchaseTypeCode       = dr["purchasetypecode"] as string;
     _sueetieProduct.ProductTypeID          = (int)dr["producttypeid"];
     _sueetieProduct.ProductTypeCode        = dr["producttypecode"] as string;
     _sueetieProduct.ProductTypeDescription = dr["producttypedescription"] as string;
 }
 public override void UpdateSueetieProduct(SueetieProduct sueetieProduct)
 {
     using (var connection = this.GetSqlConnection(true))
     {
         connection.Execute(GetSqlScript("Product.Update"), sueetieProduct);
     }
 }
Ejemplo n.º 3
0
        public static int ActionType(this SueetieProduct product)
        {
            int num = -1;

            if ((product.ProductTypeID == 5) || (product.ProductTypeID == 2))
            {
                return(2);
            }
            if (product.ProductTypeID == 4)
            {
                return(4);
            }
            if ((product.ProductTypeID == 6) || (product.ProductTypeID == 1))
            {
                return(3);
            }
            if (product.ProductTypeID == 3)
            {
                return(5);
            }
            if (product.ProductTypeID == 7)
            {
                num = 6;
            }
            return(num);
        }
        public override List <SueetieProduct> GetSueetieProductsByCategoryTree(int categoryID)
        {
            List <SueetieProduct> list = new List <SueetieProduct>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                using (SqlCommand command = new SqlCommand("SuCommerce_ProductsByCategory_Get", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@categoryID", SqlDbType.Int, 4).Value    = categoryID;
                    command.Parameters.Add("@contentTypeID", SqlDbType.Int, 4).Value = 0x12;
                    connection.Open();
                    using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        SueetieProduct product = null;
                        while (reader.Read())
                        {
                            product = new SueetieProduct();
                            CommerceDataProvider.PopulateSueetieProductList(reader, product);
                            list.Add(product);
                        }
                        reader.Close();
                        connection.Close();
                    }
                    return(list);
                }
            }
        }
Ejemplo n.º 5
0
        public static int CreateSueetieProduct(SueetieProduct sueetieProduct)
        {
            int num = CommerceDataProvider.LoadProvider().CreateSueetieProduct(sueetieProduct);

            CommerceCommon.ClearMarketplaceCache();
            return(num);
        }
        public override int CreateSueetieProduct(SueetieProduct sueetieProduct)
        {
            using (SqlConnection connection = this.GetSqlConnection(true))
            {
                var id = (int)connection.Query(GetSqlScript("Product.Insert"), sueetieProduct).First().Id;

                sueetieProduct.ProductID = id;

                connection.Execute("INSERT INTO SuCommerce_CartLinks select @ProductID, -1 as [PackageTypeID], -1 as [LicenseTypeID], @Price as [Price], 1.0 as [Version], 1 as [IsActive]", new { ProductId = id, Price = sueetieProduct.Price });

                return(id);
            }
        }
Ejemplo n.º 7
0
        public static void DownloadProductFile(int _productID, string _purchaseKey, int _cartLinkID)
        {
            int             num2;
            HttpContext     current         = HttpContext.Current;
            Stream          stream          = null;
            SueetieProduct  sueetieProduct  = Products.GetSueetieProduct(_productID);
            ProductPurchase productPurchase = new ProductPurchase {
                ProductID   = _productID,
                UserID      = SueetieContext.Current.User.UserID,
                PurchaseKey = _purchaseKey,
                CartLinkID  = _cartLinkID,
                ActionID    = 1
            };

            Purchases.RecordPurchase(productPurchase);
            string marketplaceFolderName = SueetieConfiguration.Get().Core.MarketplaceFolderName;
            string str            = sueetieProduct.DateCreated.Year.ToString();
            string str2           = Guid.NewGuid() + ".zip";
            string sourceFileName = siteRootPath + @"util\marketplace\downloads\" + str + @"\" + sueetieProduct.DownloadURL;
            string destFileName   = siteRootPath + @"util\marketplace\downloads\tmp\" + str2;

            File.Copy(sourceFileName, destFileName);
            int num = 0x8000;

            byte[] buffer = new byte[num];
            stream = File.OpenRead(destFileName);
            current.Response.AddHeader("Content-Disposition", "attachment; filename=" + sueetieProduct.DownloadURL);
            current.Response.Clear();
            current.Response.ContentType = "application/zip";
            current.Response.Buffer      = false;
            stream.Position = 0L;
            while ((num2 = stream.Read(buffer, 0, buffer.Length)) > 0)
            {
                if (current.Response.IsClientConnected)
                {
                    current.Response.OutputStream.Write(buffer, 0, num2);
                    current.Response.Flush();
                }
                else
                {
                    return;
                }
            }
            if (stream != null)
            {
                stream.Close();
            }
            current.Response.End();
        }
Ejemplo n.º 8
0
        public static bool SendAdResponse(int productID, string senderName, string senderAddress, string comments)
        {
            bool           flag           = false;
            SueetieProduct sueetieProduct = Products.GetSueetieProduct(productID);

            if (sueetieProduct == null)
            {
                return(flag);
            }
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("A user has sent a response to your Ad '{0}' at {1}", sueetieProduct.Title, SiteSettings.Instance.SiteName);
            builder.AppendLine();
            builder.AppendLine();
            builder.AppendLine("The contact information of the user is below:");
            builder.AppendLine();
            builder.AppendLine("Name: " + senderName);
            builder.AppendLine("Email: " + senderAddress);
            builder.AppendLine();
            builder.AppendLine("User comments/questions:");
            builder.AppendLine(comments);
            builder.AppendLine();
            builder.AppendLine("You can respond to the user by using the Reply feature of your email client.");
            builder.AppendLine();
            builder.AppendLine(SiteSettings.Instance.SiteName);
            builder.AppendLine(string.Format("http://{0}", HttpContext.Current.Request.Url.Host));
            string from = string.Format("{0} <{1}>", senderName, senderAddress);

            try
            {
                EmailHelper.AsyncSendEmail(new MailMessage(from, sueetieProduct.Email)
                {
                    Subject = "Response for Ad: " + sueetieProduct.Title, Body = builder.ToString()
                });
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 9
0
 public abstract void UpdateSueetieProduct(SueetieProduct sueetieProduct);
Ejemplo n.º 10
0
 public abstract int CreateSueetieProduct(SueetieProduct sueetieProduct);
Ejemplo n.º 11
0
 public static void UpdateSueetieProduct(SueetieProduct sueetieProduct)
 {
     CommerceDataProvider.LoadProvider().UpdateSueetieProduct(sueetieProduct);
     CommerceCommon.ClearMarketplaceCache();
 }