public ProductDetailsViewModel(ProductDetails productDetails, IEnumerable<ProductRelationship> related)
        {
            Argument.ExpectNotNull(() => productDetails);
            Argument.ExpectNotNull(() => related);

            ProductDetails = productDetails;
            RelatedProducts = related.ToList();
        }
Exemple #2
0
 // Fill the control with data
 private void PopulateControls(ProductDetails pd)
 {
     // Display product details
     titleLabel.Text = pd.Name;
     descriptionLabel.Text = pd.Description;
     priceLabel.Text = String.Format("{0:c}", pd.Price);
     productImage.ImageUrl = "ProductImages/" + pd.Image;
     // Set the title of the page
     this.Title = BalloonShopConfiguration.SiteName + pd.Name;
 }
        /// <summary>
        /// Registers the product identifiers the application is interested in with the store manager class.
        /// </summary>
        /// <param name="productIdentifiers">The product identifiers to register.</param>
        public void RegisterProducts(params string[] productIdentifiers)
        {
            foreach (var id in productIdentifiers)
            {
                if (!this.products.ContainsKey(id))
                {
                    var product = new ProductDetails(id);
                    this.products [id] = product;
                }
            }

            this.RequestProductDetails();
        }
Exemple #4
0
    // Fill the control with data
    private void PopulateControls(ProductDetails pd)
    {
        // Display product recommendations
        string productId = pd.ProductID.ToString();
        recommendations.LoadProductRecommendations(productId);
        // Display product details
        titleLabel.Text = pd.Name;
        descriptionLabel.Text = pd.Description;
        priceLabel.Text = String.Format("{0:c}", pd.Price);
        productImage.ImageUrl = Link.ToProductImage(pd.Image);
        // Set the title of the page
        this.Title = "Хотелски услуги" + ": " + pd.Name;

        // obtain the attributes of the product
        DataTable attrTable =
          CatalogAccess.GetProductAttributes(pd.ProductID.ToString());

        // temp variables
        string prevAttributeName = "";
        string attributeName, attributeValue, attributeValueId;

        // current DropDown for attribute values
        Label attributeNameLabel;
        DropDownList attributeValuesDropDown = new DropDownList();

        // read the list of attributes
        foreach (DataRow r in attrTable.Rows)
        {
          // get attribute data
          attributeName = r["AttributeName"].ToString();
          attributeValue = r["AttributeValue"].ToString();
          attributeValueId = r["AttributeValueID"].ToString();

          // if starting a new attribute (e.g. Color, Size)
          if (attributeName != prevAttributeName)
          {
        prevAttributeName = attributeName;
        attributeNameLabel = new Label();
        attributeNameLabel.Text = attributeName + ": ";
        attributeValuesDropDown = new DropDownList();
        attrPlaceHolder.Controls.Add(attributeNameLabel);
        attrPlaceHolder.Controls.Add(attributeValuesDropDown);
          }

          // add a new attribute value to the DropDownList
          attributeValuesDropDown.Items.Add(new ListItem(attributeValue, attributeValueId));
        }
    }
    private void PopulateControls(ProductDetails pd)
    {
        titleLabel.Text = pd.Name;
        descriptionLabel.Text = pd.Description;
        priceLabel.Text = String.Format("{0:c}", pd.Price);
        productImage.ImageUrl = "./Images/ProductImages/" + pd.Image;
        this.Title = BalloonShopConfiguration.SiteName + pd.Name;

        DataTable attrTable = CatalogAccess.GetProductAttributes(pd.ProductID.ToString());
        // temp variables
        string prevAttributeName = "";
        string attributeName, attributeValue, attributeValueId;
        // current DropDown for attribute values
        Label attributeNameLabel;
        DropDownList attributeValuesDropDown = new DropDownList();
        // read the list of attributes
        foreach (DataRow r in attrTable.Rows)
        {
            // get attribute data
            attributeName = r["AttributeName"].ToString();
            attributeValue = r["AttributeValue"].ToString();
            attributeValueId = r["AttributeValueID"].ToString();
            // if starting a new attribute (e.g. Color, Size)
            if (attributeName != prevAttributeName)
            {
                prevAttributeName = attributeName;
                attributeNameLabel = new Label();
                attributeNameLabel.Text = attributeName + ": ";
                attributeValuesDropDown = new DropDownList();
                attrPlaceHolder.Controls.Add(attributeNameLabel);
                attrPlaceHolder.Controls.Add(attributeValuesDropDown);
            }
            // add a new attribute value to the DropDownList
            attributeValuesDropDown.Items.Add(new ListItem(attributeValue, attributeValueId));
        }
    }
Exemple #6
0
 public bool Delete(ProductDetails entity)
 {
     _dbContext.Remove(entity);
     return(Save());
 }
Exemple #7
0
        private void SaveRecord()
        {
            SOItemDetails clsDetails = new SOItemDetails();

            Products       clsProducts       = new Products();
            ProductDetails clsProductDetails = clsProducts.Details1(Constants.BRANCH_ID_MAIN, Convert.ToInt64(cboProductCode.SelectedItem.Value));

            Terminal        clsTerminal        = new Terminal(clsProducts.Connection, clsProducts.Transaction);
            TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());

            clsProducts.CommitAndDispose();

            clsDetails.SOID            = Convert.ToInt64(lblSOID.Text);
            clsDetails.ProductID       = Convert.ToInt64(cboProductCode.SelectedItem.Value);
            clsDetails.ProductCode     = clsProductDetails.ProductCode;
            clsDetails.BarCode         = clsProductDetails.BarCode;
            clsDetails.Description     = clsProductDetails.ProductDesc;
            clsDetails.ProductUnitID   = Convert.ToInt32(cboProductUnit.SelectedItem.Value);
            clsDetails.ProductUnitCode = cboProductUnit.SelectedItem.Text;
            clsDetails.Quantity        = Convert.ToDecimal(txtQuantity.Text);
            clsDetails.UnitCost        = Convert.ToDecimal(txtPrice.Text);
            clsDetails.Discount        = getItemTotalDiscount();
            clsDetails.DiscountApplied = Convert.ToDecimal(txtDiscount.Text);
            if (clsDetails.DiscountApplied == 0)
            {
                if (chkInPercent.Checked == true)
                {
                    clsDetails.DiscountType = DiscountTypes.Percentage;
                }
                else
                {
                    clsDetails.DiscountType = DiscountTypes.FixedValue;
                }
            }
            else
            {
                clsDetails.DiscountType = DiscountTypes.NotApplicable;
            }

            clsDetails.IsVatable = chkIsTaxable.Checked;
            clsDetails.Amount    = ComputeItemAmount();

            if (clsDetails.IsVatable)
            {
                clsDetails.VatableAmount  = clsDetails.Amount;
                clsDetails.EVatableAmount = clsDetails.Amount;
                clsDetails.LocalTax       = clsDetails.Amount;

                if (clsTerminalDetails.IsVATInclusive == false)
                {
                    if (clsDetails.VatableAmount < clsDetails.Discount)
                    {
                        clsDetails.VatableAmount = 0;
                    }
                    if (clsDetails.EVatableAmount < clsDetails.Discount)
                    {
                        clsDetails.EVatableAmount = 0;
                    }
                    if (clsDetails.LocalTax < clsDetails.Discount)
                    {
                        clsDetails.LocalTax = 0;
                    }
                }
                else
                {
                    if (clsDetails.VatableAmount >= clsDetails.Discount)
                    {
                        clsDetails.VatableAmount = (clsDetails.VatableAmount) / (1 + (clsTerminalDetails.VAT / 100));
                    }
                    else
                    {
                        clsDetails.VatableAmount = 0;
                    }
                    if (clsDetails.EVatableAmount >= clsDetails.Discount)
                    {
                        clsDetails.EVatableAmount = (clsDetails.EVatableAmount) / (1 + (clsTerminalDetails.VAT / 100));
                    }
                    else
                    {
                        clsDetails.EVatableAmount = 0;
                    }
                    if (clsDetails.LocalTax >= clsDetails.Discount)
                    {
                        clsDetails.LocalTax = (clsDetails.LocalTax) / (1 + (clsTerminalDetails.LocalTax / 100));
                    }
                    else
                    {
                        clsDetails.LocalTax = 0;
                    }
                }

                clsDetails.VAT      = clsDetails.VatableAmount * (clsTerminalDetails.VAT / 100);
                clsDetails.EVAT     = clsDetails.EVatableAmount * (clsTerminalDetails.EVAT / 100);
                clsDetails.LocalTax = clsDetails.LocalTax * (clsTerminalDetails.LocalTax / 100);

                //if (!clsTerminalDetails.IsVATInclusive) clsDetails.Amount += (clsDetails.VAT + clsDetails.LocalTax);
                //if (!clsTerminalDetails.EnableEVAT) clsDetails.Amount += clsDetails.EVAT;
            }
            else
            {
                clsDetails.VAT            = 0;
                clsDetails.VatableAmount  = 0;
                clsDetails.EVAT           = 0;
                clsDetails.EVatableAmount = 0;
                clsDetails.LocalTax       = 0;
            }

            clsDetails.isVATInclusive    = clsTerminalDetails.IsVATInclusive;
            clsDetails.VariationMatrixID = Convert.ToInt64(cboVariation.SelectedItem.Value);
            if (clsDetails.VariationMatrixID != 0)
            {
                clsDetails.MatrixDescription = cboVariation.SelectedItem.Text;
            }
            clsDetails.ProductGroup    = clsProductDetails.ProductGroupCode;
            clsDetails.ProductSubGroup = clsProductDetails.ProductSubGroupCode;
            clsDetails.Remarks         = txtRemarks.Text;

            // Added Jul 1, 2010 4:20PM : for suggested selling information
            clsDetails.SellingPrice    = decimal.Parse(txtSellingPrice.Text);
            clsDetails.SellingVAT      = decimal.Parse(txtVAT.Text);
            clsDetails.SellingEVAT     = decimal.Parse(txtEVAT.Text);
            clsDetails.SellingLocalTax = decimal.Parse(txtLocalTax.Text);

            SOItem clsSOItem = new SOItem();

            if (lblSOItemID.Text != "0")
            {
                clsDetails.SOItemID = Convert.ToInt64(lblSOItemID.Text);
                clsSOItem.Update(clsDetails);
            }
            else
            {
                clsSOItem.Insert(clsDetails);
            }

            SODetails clsSODetails = new SODetails();

            clsSODetails.SOID            = clsDetails.SOID;
            clsSODetails.DiscountApplied = Convert.ToDecimal(txtSODiscountApplied.Text);
            clsSODetails.DiscountType    = (DiscountTypes)Enum.Parse(typeof(DiscountTypes), cboSODiscountType.SelectedItem.Value);

            SO clsSO = new SO(clsSOItem.Connection, clsSOItem.Transaction);

            clsSO.UpdateDiscount(clsDetails.SOID, clsSODetails.DiscountApplied, clsSODetails.DiscountType);

            clsSODetails = clsSO.Details(clsDetails.SOID);
            clsSOItem.CommitAndDispose();

            UpdateFooter(clsSODetails);
        }
 public Task <bool> Update(ProductDetails entity, string UpdatedUser = "******")
 {
     throw new NotImplementedException();
 }
Exemple #9
0
 public bool Create(ProductDetails entity)
 {
     _dbContext.Add(entity);
     return(Save());
 }
 private void BtnSearch_OnClick(object sender, RoutedEventArgs e)
 {
     ProductDetails.ViewBook(SearchBox.Text);
     MainFrame.Source = new Uri("View/ProductDetails.xaml", UriKind.RelativeOrAbsolute);
 }
Exemple #11
0
    // Get product details
    public static ProductDetails GetProductDetails(string productId)
    {
        // get a configured DbCommand object
        DbCommand comm = GenericDataAccess.CreateCommand();
        // set the stored procedure name
        comm.CommandText = "CatalogGetProductDetails";
        // create a new parameter
        DbParameter param = comm.CreateParameter();
        param.ParameterName = "@ProductID";
        param.Value = productId;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        // execute the stored procedure
        DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
        // wrap retrieved data into a ProductDetails object
        ProductDetails details = new ProductDetails();
        if (table.Rows.Count > 0)
        {
            // get the first table row
            DataRow dr = table.Rows[0];
            // get product details
            details.ProductID = int.Parse(productId);
            details.Name = dr["Name"].ToString();
            details.Description = dr["Description"].ToString();
            details.Price = Decimal.Parse(dr["Price"].ToString());
            details.Thumbnail = dr["Thumbnail"].ToString();
            details.Image = dr["Image"].ToString();
            details.PromoFront = bool.Parse(dr["PromoFront"].ToString());
            details.PromoDept =
        bool.Parse(dr["PromoDept"].ToString());
        }
        // return department details
        return details;
    }
 public bool IsAlphaName(ProductDetails item)
 {
     return(_service.IsAlphaName(item));
 }
    private DataTable getItemDetail(ProductDetails p)
    {
        DataTable dt = new DataTable();

        dt.Columns.Add(new DataColumn("Price"));
        dt.Columns.Add(new DataColumn("Retail"));
        dt.Columns.Add(new DataColumn("Title"));
        dt.Columns.Add(new DataColumn("Description"));
        dt.Columns.Add(new DataColumn("AboutBrand"));
        dt.Columns.Add(new DataColumn("ItemDetail"));
        dt.Columns.Add(new DataColumn("ImageUrlThumb"));
        dt.Columns.Add(new DataColumn("ImageUrlZoom"));

        dt.Columns.Add(new DataColumn("ImageUrlMain"));
        dt.Columns.Add(new DataColumn("ImageUrlMainWidth"));
        dt.Columns.Add(new DataColumn("ImageUrlMainHeight"));

        dt.Columns.Add(new DataColumn("ImageUrlFull"));
        dt.Columns.Add(new DataColumn("ImageUrlFullWidth"));
        dt.Columns.Add(new DataColumn("ImageUrlFullHeight"));

        DataRow dr;

        dr = dt.NewRow();

         //   dr["Retail"] = p.GetRetailPrice();
        dr["Price"] = SpecialItemCost;
        //    dr["Title"] = p.GetTitle();

        //Get the brand
        string brand = "";// p.GetStringFieldOrAttribute("Brand");

        //Converted from choice value guid to its label
        object result = null;// BusinessFlow.WebServices.LookupTables[LookupTables.AttributeValues].TranslateToLabel(brand, "");

        if (result != null)
            brand = result.ToString();

        if (brand.Length != 0)
        {
            //dr["AboutBrand"] ="Rolex is considered to be one of the most prolific Swiss wristwatch manufacturing companies in the world. With their sheer elegance and uncompromising attention to detail, Rolex is the largest luxury watch brand worldwide, producing around 200 watches per day. Since its inception in 1905, Rolex has exuded an aura of unsurpassed urbanity. Unveiled in 1945, the Rolex Oyster Perpetual Datejust was the first wristwatch to display the date and boast a Cyclops magnifying lens. Similarly, the Rolex Oyster Perpetual Cosmograph Daytona, introduced 1988, is designed for measuring elapsed time and calculating average speed with artistic precision. Rolex, an eclectic company, had the maritime adventurer in mind when it created the Oyster Perpetual Submariner with water resistance at depths of 300 meters. All Rolex watches, whether the Rolex Air-King, Rolex Pearlmaster, Rolex Explorer, Rolex Day-Date, Rolex Oyster Perpetual Milgauss, Rolex GMT-Master II, Rolex Yacht-Master, Rolex Oyster Perpetual or Rolex Sea-Dweller, are exceptional investments. The Rolex watch is a pathway to a timeless tradition.";
            PrgFunctions f = new PrgFunctions();// ((MainStreet.BusinessFlow.SDK.Web.BusinessFlowWebContext)BusinessFlow.Context);
            //dr["AboutBrand"] = f.GetGlobalChoiceValueDescription("BrandDescriptions", brand);
        }

        //dr["ItemDetail"] = "Rolex is considered to be one of the most prolific Swiss wristwatch manufacturing companies in the world. With their sheer elegance and uncompromising attention to detail, Rolex is the largest luxury watch brand worldwide, producing around 200 watches per day. Since its inception in 1905, Rolex has exuded an aura of unsurpassed urbanity. Unveiled in 1945, the Rolex Oyster Perpetual Datejust was the first wristwatch to display the date and boast a Cyclops magnifying lens. Similarly, the Rolex Oyster Perpetual Cosmograph Daytona, introduced 1988, is designed for measuring elapsed time and calculating average speed with artistic precision. Rolex, an eclectic company, had the maritime adventurer in mind when it created the Oyster Perpetual Submariner with water resistance at depths of 300 meters. All Rolex watches, whether the Rolex Air-King, Rolex Pearlmaster, Rolex Explorer, Rolex Day-Date, Rolex Oyster Perpetual Milgauss, Rolex GMT-Master II, Rolex Yacht-Master, Rolex Oyster Perpetual or Rolex Sea-Dweller, are exceptional investments. The Rolex watch is a pathway to a timeless tradition.";
        //dr["ItemDetail"] = p.GetDescription(this.Page);

        //Get the main(medium) image
        DataTable dtItemimages = new DataTable();// p.GetItemimagesTable();
        DataRow[] drRows = dtItemimages.Select("item_image_type_id=1");

        if (drRows.Length > 0)
        {
            //Get the Main display images
          //  dr["ImageUrlMain"] = BusinessFlow.Settings.Pages.images.get_UrlByImage(new Guid(drRows[0]["image_guid"].ToString()), MainStreet.BusinessFlow.SDK.Ws.imagesize.Medium).ToString();
            dr["ImageUrlMainWidth"] = drRows[0]["image_med_width"].ToString();
            dr["ImageUrlMainHeight"] = drRows[0]["image_med_height"].ToString();

            //Get the full image
           // dr["ImageUrlFull"] = BusinessFlow.Settings.Pages.images.get_UrlByImage(new Guid(drRows[0]["image_guid"].ToString()), MainStreet.BusinessFlow.SDK.Ws.imagesize.Full).ToString();
            dr["ImageUrlFullWidth"] = drRows[0]["image_full_width"].ToString();
            dr["ImageUrlFullHeight"] = drRows[0]["image_full_height"].ToString();
        }
        else
        {
            dr["ImageUrlMain"] = "";
            dr["ImageUrlMainWidth"] = "";
            dr["ImageUrlMainHeight"] = "";

            dr["ImageUrlFull"] = "";
            dr["ImageUrlFullWidth"] = "";
            dr["ImageUrlFullHeight"] = "";
        }

        dt.Rows.Add(dr);

        return dt;
    }
 [HttpPost] //Post method
 public Task Create([FromBody] ProductDetails item)
 {
     return(_service.Create(item));
 }
 [HttpPut("{id}")] //Update method
 public Task Update(int id, [FromBody] ProductDetails item)
 {
     return(_service.Update(id, item));
 }
Exemple #16
0
        public ProductDetails GetProductDetail(decimal ProductId, decimal LoginStateCode)
        {
            ProductDetails objproduct = objProductAPI.GetProductDetail(ProductId, LoginStateCode);

            return(objproduct);
        }
Exemple #17
0
        public ActionResult Edit([Bind(Include = "Id,ProductId,Ram,CPU,OS,Size")] ProductDetails productDetails)
        {
            if (ModelState.IsValid)
            {
                var get = db.ProductDetails.Find(productDetails.Id);

                var changes = new Changes
                {
                    LocalIpAddress = LocalIPAddress.Get(),
                    Date           = DateTime.Now.Date,
                    ProductId      = get.Products.Id,
                    Ip             = "???"
                };

                if (get.OS != productDetails.OS)
                {
                    db.ChangeDetails.Add(new ChangeDetails
                    {
                        Changes     = changes,
                        Description = "OS değişiklik yapıldı. ---- " + get.OS + " --> " + productDetails.OS
                    });
                    get.OS = productDetails.OS;
                }

                if (get.Ram != productDetails.Ram)
                {
                    db.ChangeDetails.Add(new ChangeDetails
                    {
                        Changes     = changes,
                        Description = "Ram değişiklik yapıldı. ---- " + get.Ram + " --> " + productDetails.Ram
                    });
                    get.Ram = productDetails.Ram;
                }
                if (get.Ram != productDetails.Ram)
                {
                    db.ChangeDetails.Add(new ChangeDetails
                    {
                        Changes     = changes,
                        Description = "Ram değişiklik yapıldı. ---- " + get.Ram + " --> " + productDetails.Ram
                    });
                    get.Ram = productDetails.Ram;
                }
                if (get.Size != productDetails.Size)
                {
                    db.ChangeDetails.Add(new ChangeDetails
                    {
                        Changes     = changes,
                        Description = "Boyut değişiklik yapıldı. ---- " + get.Size + " --> " + productDetails.Size
                    });
                    get.Size = productDetails.Size;
                }

                if (get.CPU != productDetails.CPU)
                {
                    db.ChangeDetails.Add(new ChangeDetails
                    {
                        Changes     = changes,
                        Description = "CPU değişiklik yapıldı. ---- " + get.CPU + " --> " + productDetails.CPU
                    });
                    get.CPU = productDetails.CPU;
                }
                db.SaveChanges();


                return(RedirectToAction("Index"));
            }
            ViewBag.ProductId = new SelectList(db.Products, "Id", "TypeId", productDetails.ProductId);
            return(View(productDetails));
        }
Exemple #18
0
        public void PerformInstall(ProductDetails product)
        {
            var productRepository = _appConfig.ProductsRepository;
            var productDir        = new DirectoryInfo($"{_appConfig.ProductsDownloadFolder}\\{product.Name}\\{product.VersionTag}");
            var downloadOnly      = false; //TODO: Read from config or manifest

            try
            {
                var remoteProductUrl = $"{productRepository}{product.Name}\\{product.VersionTag}\\";
                _logger.Info($"{product.Name} does not exist or a different version - will upgrade.");
                productDir.Create();

                _logger.Info($"{product.Name} download folder is {productDir.FullName}.");


                _logger.Info($"Start downloading {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");
                _logger.Info($"Package file is {product.CatalogVersion.PackageFile}.");

                var newProductFile = new FileInfo($"{productDir.FullName}\\{product.CatalogVersion.PackageFile}");

                var downloadClient = new HttpClientDownloadWithProgress(remoteProductUrl + product.CatalogVersion.PackageFile, newProductFile.FullName);

                downloadClient.ProgressChanged += DownloadClientOnProgressChanged;
                var downloadTask = downloadClient.StartDownload();

                downloadTask.Wait();

                if (downloadTask.Exception != null)
                {
                    _logger.Error($"Download failure: {downloadTask.Exception.Message}", downloadTask.Exception);
                    return;
                }

                _logger.Info($"Successfully downloaded {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");

                //save version file from product
                using (var fs = File.Open(productDir.FullName + "\\version.json", FileMode.CreateNew))
                {
                    var sw     = new StreamWriter(fs);
                    var writer = new JsonTextWriter(sw)
                    {
                        Formatting = Formatting.Indented
                    };
                    var serializer = new JsonSerializer();
                    serializer.Serialize(writer, product.CatalogVersion);
                    writer.Close();
                    sw.Close();
                    sw.Dispose();
                }

                if (downloadOnly)
                {
                    //remove inprogress flag file
                    File.Delete(newProductFile.FullName + ".inprogress");
                    return;
                }

                var destDirectory = new DirectoryInfo(productDir.FullName + "\\extract");

                if (newProductFile.Extension.ToLowerInvariant() == ".zip" |
                    (newProductFile.Extension.ToLowerInvariant() == ".7z"))
                {
                    UnzipArchive(newProductFile.FullName, destDirectory.FullName);
                }
                else
                {
                    destDirectory = new DirectoryInfo(newProductFile.Directory?.FullName ?? throw new InvalidOperationException());
                }

                _logger.Info($"Extraction of {product.CatalogVersion.Name} version {product.CatalogVersion.Version} finished successfully.");

                _logger.Info($"Start installing {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");

                //check if unattended-install.ps1 exists
                if (File.Exists(destDirectory.FullName + "\\Support\\Unattended-Install.ps1"))
                {
                    var args = new Dictionary <string, string>
                    {
                        { "rootPath", destDirectory.ToString() }
                    };

                    if (RunScript(destDirectory.FullName + "\\Support\\Unattended-Install.ps1", args))
                    {
                        _logger.Info($"Successfully installed {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");
                    }
                    else
                    {
                        _logger.Warn($"Failed to installed {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");
                    }
                }
                else
                {
                    if (product.CatalogVersion.AllowUnscriptedInstall)
                    {
                        //no specific unattended file - let's see if we just have a loose MSI or EXE...
                        var extractFolder = new DirectoryInfo(destDirectory.FullName);
                        foreach (var enumerateFile in extractFolder.EnumerateFiles())
                        {
                            //if there is a specific target set, only install that
                            if (!string.IsNullOrWhiteSpace(product.CatalogVersion.InstallationTarget) &&
                                enumerateFile.Name != product.CatalogVersion.InstallationTarget)
                            {
                                continue;
                            }

                            switch (enumerateFile.Extension.ToLowerInvariant())
                            {
                            case ".msi":

                                //run MSI install for all MSI files found with default args
                                if (InstallMsi(enumerateFile.FullName))
                                {
                                    _logger.Info($"Successfully installed {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");
                                }
                                else
                                {
                                    _logger.Warn($"Failed to installed {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");
                                }
                                break;

                            case ".exe":
                                //run EXE install for all EXE files found with args found in version manifest
                                if (InstallExe(enumerateFile.FullName, product.CatalogVersion.InstallationArguments))
                                {
                                    _logger.Info($"Successfully installed {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");
                                }
                                else
                                {
                                    _logger.Warn($"Failed to installed {product.CatalogVersion.Name} version {product.CatalogVersion.Version}.");
                                }
                                break;
                            }
                        }
                    }
                }

                //remove inprogress flag file
                File.Delete(newProductFile.FullName + ".inprogress");
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message, ex);
            }
        }
        /// <summary>
        /// Updates an existing product
        /// </summary>
        public static bool UpdateProduct(int id, int departmentID, string title, 
            string description, string sku, decimal unitPrice, int discountPercentage,
            int unitsInStock, string smallImageUrl, string fullImageUrl)
        {
            title = BizObject.ConvertNullToEmptyString(title);
             description = BizObject.ConvertNullToEmptyString(description);
             sku = BizObject.ConvertNullToEmptyString(sku);
             smallImageUrl = BizObject.ConvertNullToEmptyString(smallImageUrl);
             fullImageUrl = BizObject.ConvertNullToEmptyString(fullImageUrl);

             ProductDetails record = new ProductDetails(id, DateTime.Now, "", departmentID,
            "", title, description, sku, unitPrice, discountPercentage, unitsInStock,
            smallImageUrl, fullImageUrl, 0, 0);
             bool ret = SiteProvider.Store.UpdateProduct(record);

             BizObject.PurgeCacheItems("store_product_" + id.ToString());
             BizObject.PurgeCacheItems("store_products");
             return ret;
        }
 public bool IsNumericRate(ProductDetails item)
 {
     return(_service.IsNumericRate(item));
 }
Exemple #21
0
        /// <summary>
        /// LoadDetailsFromConfigFile:
        /// Loads details from the config file. It populates the global variable cfProducts with
        /// product names. If the productName parameter is not empty and contains a valid product
        /// name, then the productDetails parameter is populated with the build information for
        /// the specified product.
        /// </summary>
        /// <param name="configFileName">[required, in] The path and filename of the config file</param>
        /// <param name="productName">[optional, in] The name of the product to be loaded</param>
        /// <param name="productDetails">[optional, out] Required only if productName is specified</param>
        /// <returns>A boolean value indicating if product names were successfully added to the
        /// cfProducts variable</returns>
        private bool LoadDetailsFromConfigFile(string configFileName, string productName, out ProductDetails productDetails)
        {
            productDetails = null;

            //Local variables
            bool hasMoreProducts = true;

            //Erase any previously loaded information
            cfProducts = null;

            XmlTextReader xmlReader = null;
            XmlValidatingReader validator = null;
            System.Xml.XPath.XPathDocument doc;
            System.Xml.XPath.XPathNavigator nav;

            try
            {
                xmlReader = new XmlTextReader(configFileName);
                validator = new XmlValidatingReader(xmlReader);
                validator.ValidationType = ValidationType.DTD;
                //Any errors will cause an XmlException to be thrown
                while (validator.Read())
                {
                }

                doc = new System.Xml.XPath.XPathDocument(configFileName);
                nav = doc.CreateNavigator();
            }

            catch (Exception)
            {
                if (xmlReader != null)
                    xmlReader.Close();
                if (validator != null)
                    validator.Close();
                return false;
            }

            #region Load PRODUCT names (and product details if specified) from the XML configuration file
            //Move to the SIBuilder Tag
            nav.MoveToFirstChild();
            if (!nav.HasChildren)
            {
                //MessageBox.Show ("The configuration file does not contain any products that can be built", errorDialogCaption);
                xmlReader.Close();
                validator.Close();
                return false;
            }

            this.cfProducts = new ArrayList();
            //Move to the first PRODUCT in the configuration file
            nav.MoveToFirstChild ();
            hasMoreProducts = true;

            while (hasMoreProducts)
            {
                this.cfProducts.Add (nav.GetAttribute ("Name", ""));

                //Check if the Name attribute was returned; if not declare config file corrupt
                if (this.cfProducts[this.cfProducts.Count - 1].ToString() == String.Empty)
                {
                    this.cfProducts = null;
                    xmlReader.Close();
                    validator.Close();
                    return false;
                }

                #region Load details of this product if requested by the user
                //Check if the user wants details about the current PRODUCT
                if ((productName != "") && (cfProducts[cfProducts.Count -1].ToString() == productName))
                {
                    productDetails = new ProductDetails();
                    //Add the product name
                    productDetails.Name = productName;
                    //Get the Versioning information
                    productDetails.MajorVersion = nav.GetAttribute ("MajorVersion", "");
                    productDetails.MinorVersion = nav.GetAttribute ("MinorVersion", "");
                    productDetails.BuildNumber = nav.GetAttribute ("BuildNumber", "");
                    //Get the other product details
                    if (nav.HasChildren)
                    {
                        nav.MoveToFirstChild();
                        bool moreProductDetails = true;
                        bool moreChildren = true;

                        while (moreProductDetails)
                        {
                            switch (nav.Name.ToUpper())
                            {
                                case "SOURCECONTROL":
                                    //Move into the children of the SOURCECONTROL node
                                    moreChildren= nav.MoveToFirstChild();
                                    if (!moreChildren)
                                        break;
                                    while (moreChildren)
                                    {
                                        if (productDetails.SourceControlInfo== null)
                                            productDetails.SourceControlInfo = new ArrayList();

                                        SourceControlInfo scInfo = new SourceControlInfo();
                                        scInfo.Executable = nav.Value;
                                        scInfo.Arguments = nav.GetAttribute ("Args", "");
                                        productDetails.SourceControlInfo.Add (scInfo);
                                        moreChildren = nav.MoveToNext();
                                    }
                                    //Move back to the SOURCECONTROL node
                                    nav.MoveToParent();
                                    break;
                                case "PATHS":
                                    //Move into the children of the PATHS node
                                    moreChildren = nav.MoveToFirstChild();
                                    if (!moreChildren)
                                        break;
                                    while (moreChildren)
                                    {
                                        switch (nav.Name.ToUpper())
                                        {
                                            case "BUILDS_LOCATION":
                                                productDetails.BuildsLocation = nav.Value;
                                                break;
                                            case "LOGS_LOCATION":
                                                productDetails.LogsLocation = nav.Value;
                                                break;
                                            case "DEVENV_FILE":
                                                productDetails.DevenvFile = nav.Value;
                                                break;
                                            case "INSTALLSHIELD_SCRIPT":
                                                productDetails.InstallShieldScript = nav.Value;
                                                break;
                                            case "INSTALLSHIELD_OUTPUT":
                                                productDetails.InstallShieldOutput = nav.Value;
                                                break;
                                            default:
                                                break;
                                        }
                                        moreChildren = nav.MoveToNext();
                                    }
                                    //Move back to the PATHS node
                                    nav.MoveToParent();
                                    break;

                                case "BUILDMAIL":
                                    //Move to the children of the BUILDMAIL node
                                    moreChildren = nav.MoveToFirstChild();
                                    if (!moreChildren)
                                        break;
                                    while (moreChildren)
                                    {
                                        switch (nav.Name.ToUpper())
                                        {
                                            case "RECIPIENTS":
                                                productDetails.MailRecipients = nav.Value;
                                                break;
                                            case "MAILSENDER":
                                                productDetails.MailSenderAddress = nav.GetAttribute ("Address", "");
                                                productDetails.MailServerAddress = nav.GetAttribute ("SmtpServer", "");
                                                break;
                                            default:
                                                break;
                                        }
                                        moreChildren = nav.MoveToNext();
                                    }
                                    //Move back to the BUILDMAIL node
                                    nav.MoveToParent();
                                    break;

                                case "BUILD_SOLUTIONS":
                                    //Move to the children of the BUILD_SOLUTIONS node
                                    moreChildren = nav.MoveToFirstChild();
                                    if (!moreChildren)
                                        break;
                                    while (moreChildren)
                                    {
                                        switch (nav.Name.ToUpper())
                                        {
                                            case "SOLUTION":
                                                if (productDetails.SolutionInfo == null)
                                                    productDetails.SolutionInfo = new ArrayList();

                                                SolutionInfo solInfo = new SolutionInfo();
                                                solInfo.SolutionPath = nav.Value;
                                                solInfo.ProjectName = nav.GetAttribute ("Project", "");
                                                solInfo.BuildConfig = nav.GetAttribute ("BuildConfig", "");
                                                productDetails.SolutionInfo.Add (solInfo);

                                                break;
                                            default:
                                                break;
                                        }
                                        moreChildren = nav.MoveToNext();
                                    }
                                    //Move back to the BUILD_SOLUTIONS node
                                    nav.MoveToParent();
                                    break;
                                default:
                                    break;
                            }
                            moreProductDetails = nav.MoveToNext();
                        }

                    }
                }
                #endregion

                hasMoreProducts = nav.MoveToNext();
            }
            #endregion

            xmlReader.Close();
            validator.Close();
            return true;
        }
 public bool IsNumericGroupID(ProductDetails item)
 {
     return(_service.IsNumericGroupID(item));
 }
    protected void btnBuyNow_Click(object sender, EventArgs e)
    {
        int quantity = 1;

        try
        {

            if (quantity < 1)
                return;

            //STI 07/15/09: Custom code
            if (quantity > 10)
            {
                quantity = 10;
                return;
            }
        }
        catch
        {
            return;
        }

        //customization
        /*
        string promotionGuid = PrgFunctions.TryCastString(BusinessFlow.DefaultCart.Data.OrderRow["promotion_guid"]);
        string promotionCode = BusinessFlow.DefaultCart.Data.OrderRow["order_promotion_cd"].ToString();
        string promotionDescription = BusinessFlow.DefaultCart.Data.OrderRow["order_promotion_description"].ToString();

        BusinessFlow.DefaultCart.Clear();

        //Load up the customer information because, default cart clears everything
        if (BusinessFlow.Identity.IsAuthenticated)
            BusinessFlow.DefaultCart.LoadCustomerInfo(BusinessFlow.Identity.CustomerGuid);
        */

           // BusinessFlow.DefaultCart.PersistTimeout = new TimeSpan(0, 30, 0);

        p = getDetails();
        //if (p.IsLoaded())
        //{
            //customization: Adjust the quantity based on the control, do not add items to the cart
            PrgFunctions f = new PrgFunctions();
          //////////////  f.RemoveItemFromCart(new Guid(p.GetItemGuid()));

          /////////////////  BusinessFlow.DefaultCart.AddItem(new Guid(p.GetItemGuid()), quantity, null, SpecialItemCost);

            /*
            if (promotionGuid.Length != 0)
            {
                BusinessFlow.DefaultCart.Data.OrderRow["promotion_guid"] = PrgFunctions.TryCastGuid(promotionGuid);
                BusinessFlow.DefaultCart.Data.OrderRow["order_promotion_cd"] = promotionCode;
                BusinessFlow.DefaultCart.Data.OrderRow["order_promotion_description"] = promotionDescription;
            }
            */

            DisplayVariationGuid = "";

            Session["prefex"] = "block";

            Response.Redirect("checkout/checkout_step1.aspx");

        //}
    }
        private void DownloadBookImages(List <ProductImage> productImages, ProductDetails productDetail)
        {
            ProductImage bookImage;

            byte[] imageContent;
            //Download book images
            bookImage             = new ProductImage();
            bookImage.UPC         = productDetail.UPC;
            bookImage.ProductType = productDetail.ProductType;
            string url = String.Format(BooksImagesDynamicURL, bookImage.UPC);

            try
            {
                if (TryGetImage(url, out imageContent))
                {
                    bookImage.ImageFound   = true;
                    bookImage.ImageContent = imageContent;
                    bookImage.SHA256Hash   = GenerateSHA256String(imageContent, url);
                }
                else
                {
                    url = GetBooksUrlFromDB(bookImage.UPC);
                    if (TryGetImage(url, out imageContent))
                    {
                        bookImage.ImageFound   = true;
                        bookImage.ImageContent = imageContent;
                        bookImage.SHA256Hash   = GenerateSHA256String(imageContent, url);
                        if (!Directory.Exists(BooksImagesOutputFolder))
                        {
                            Directory.CreateDirectory(BooksImagesOutputFolder);
                        }
                        File.WriteAllBytes(BooksImagesOutputFolder + "\\" + bookImage.UPC + ".jpg", bookImage.ImageContent);
                    }
                    else
                    {
                        bookImage.ImageFound   = false;
                        bookImage.ImageContent = null;
                    }
                }
                productImages.Add(bookImage);
            }
            catch (WebException wex)
            {
                if (((HttpWebResponse)wex.Response).StatusCode == HttpStatusCode.NotFound)
                {
                    Log.Information($"The image at {url} was not found. 404 Encountered...");
                    //Case for image not found. 404
                    bookImage.ImageFound   = false;
                    bookImage.ImageContent = null;
                    productImages.Add(bookImage);
                }
            }
            catch (Exception ex)
            {
                bookImage.ImageFound   = false;
                bookImage.ImageContent = null;
                productImages.Add(bookImage);
                string errorMessage = $"An exception was encountered while downloading image from url : {url}.";
                Log.Error(errorMessage, ex);
            }
        }
        public void Graph_iterator_does_not_go_visit_Apple()
        {
            using (var context = new EarlyLearningCenter())
            {
                var details = new ProductDetails { Id = 1, Product = new Product { Id = 1 } };
                details.Product.Details = details;

                context.ChangeTracker.TrackGraph(details, e => { });

                Assert.Equal(0, context.ChangeTracker.Entries().Count());
            }
        }
        private void DownloadGiftImages(List <ProductImage> productImages, ProductDetails productDetail)
        {
            string       upc        = string.Empty;
            int          imageIndex = 0;
            ProductImage giftImage;

            //Process the first image of the gift merchandise
            byte[] imageContent;
            upc                   = productDetail.UPC;
            giftImage             = new ProductImage();
            giftImage.UPC         = productDetail.UPC;
            giftImage.ProductType = productDetail.ProductType;
            giftImage.ImageIndex  = imageIndex;
            string url = string.Empty;

            url = String.Format(GiftsImagesDynamicURL, upc);
            try
            {
                if (TryGetImage(url, out imageContent))
                {
                    //Process first image.
                    giftImage.ImageContent = imageContent;
                    giftImage.ImageFound   = true;
                    giftImage.SHA256Hash   = GenerateSHA256String(imageContent, url);
                    productImages.Add(giftImage);
                    //Process other images of the gift merchandise.
                    upc = upc + "_" + (++imageIndex).ToString();
                    url = String.Format(GiftsImagesDynamicURL, upc);
                    while (TryGetImage(url, out imageContent))
                    {
                        giftImage              = new ProductImage();
                        giftImage.UPC          = productDetail.UPC;
                        giftImage.ProductType  = productDetail.ProductType;
                        giftImage.ImageIndex   = imageIndex;
                        giftImage.ImageContent = imageContent;
                        giftImage.SHA256Hash   = GenerateSHA256String(imageContent, url);
                        giftImage.ImageFound   = true;
                        upc = giftImage.UPC + "_" + (++imageIndex).ToString();
                        productImages.Add(giftImage);
                        url = String.Format(GiftsImagesDynamicURL, upc);
                    }
                }
                else
                {
                    giftImage.ImageContent = null;
                    giftImage.ImageFound   = false;
                }
            }
            catch (WebException wex)
            {
                if (((HttpWebResponse)wex.Response).StatusCode == HttpStatusCode.NotFound)
                {
                    //Case for image not found. 404
                    if (imageIndex == 0)
                    {
                        Log.Information($"The image at {url} was not found. 404 Encountered...");
                        //Only if first image was not found, add the item to result set and mark image found = false. Ignore exceptions for upc_1, upc_2 etc.
                        giftImage.ImageFound   = false;
                        giftImage.ImageContent = null;
                        productImages.Add(giftImage);
                    }
                }
            }
            catch (Exception ex)
            {
                giftImage.ImageFound   = false;
                giftImage.ImageContent = null;
                productImages.Add(giftImage);
                string errorMessage = $"An exception was encountered while downloading image from url : {url}.";
                Log.Error(errorMessage, ex);
            }
            //return imageIndex;
        }
 public static ProductDetails GetProductDetails(string productId)
 {
     DbCommand comm = GenericDataAccess.CreateCommand();
     comm.CommandText = "CatalogGetProductDetails";
     DbParameter param = comm.CreateParameter();
     param.ParameterName = "@ProductID";
     param.Value = productId;
     param.DbType = DbType.Int32;
     comm.Parameters.Add(param);
     DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
     ProductDetails details = new ProductDetails();
     if (table.Rows.Count > 0)
     {
         DataRow dr = table.Rows[0];
         // get product details
         details.ProductID = int.Parse(productId);
         details.Name = dr["Name"].ToString();
         details.Description = dr["Description"].ToString();
         details.Price = Decimal.Parse(dr["Price"].ToString());
         details.Thumbnail = dr["Thumbnail"].ToString();
         details.Image = dr["Image"].ToString();
         details.PromoFront = bool.Parse(dr["PromoFront"].ToString());
         details.PromoDept =
         bool.Parse(dr["PromoDept"].ToString());
     }
     return details;
 }
Exemple #28
0
        public static async Task <Tuple <StorageFile, ToastNotification> > DownloadPackage(PackageInstance package, ProductDetails product, bool hideProgressToastWhenDone = true)
        {
            // Download the file to the app's temp directory
            //var client = new System.Net.WebClient();
            string filepath = Path.Combine(ApplicationData.Current.TemporaryFolder.Path, package.PackageMoniker);

            Debug.WriteLine(filepath);
            //client.DownloadFile(package.Uri, filepath);

            StorageFile destinationFile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync(
                package.PackageMoniker, CreationCollisionOption.ReplaceExisting);

            BackgroundDownloader downloader = new BackgroundDownloader();

            downloader.FailureToastNotification = GenerateDownloadFailureToast(package, product);
            var progressToast = GenerateProgressToast(package, product);

            Debug.WriteLine(package.PackageUri.AbsoluteUri);
            DownloadOperation download = downloader.CreateDownload(package.PackageUri, destinationFile);

            download.RangesDownloaded += (op, args) =>
            {
                ToastNotificationManager.GetDefault().CreateToastNotifier().Update(
                    new NotificationData(new Dictionary <string, string>()
                {
                    { "progressValue", ((double)op.Progress.BytesReceived / op.Progress.TotalBytesToReceive).ToString() },
                    { "progressStatus", "Downloading..." }
                }),
                    progressToast.Tag
                    );
            };
            ToastNotificationManager.GetDefault().CreateToastNotifier().Show(progressToast);
            await download.StartAsync();

            if (hideProgressToastWhenDone)
            {
                ToastNotificationManager.GetDefault().CreateToastNotifier().Hide(progressToast);
            }

            string extension           = "";
            string contentTypeFilepath = filepath + "_[Content_Types].xml";

            using (var archive = ZipFile.OpenRead(filepath))
            {
                var entry = archive.GetEntry("[Content_Types].xml");
                entry.ExtractToFile(contentTypeFilepath, true);
                var ctypesXml = XDocument.Load(contentTypeFilepath);
                var defaults  = ctypesXml.Root.Elements().Where(e => e.Name.LocalName == "Default");
                if (defaults.Any(d => d.Attribute("Extension").Value == "msix"))
                {
                    // Package contains one or more MSIX packages
                    extension += ".msix";
                }
                else if (defaults.Any(d => d.Attribute("Extension").Value == "appx"))
                {
                    // Package contains one or more MSIX packages
                    extension += ".appx";
                }
                if (defaults.Any(defaults => defaults.Attribute("ContentType").Value == "application/vnd.ms-appx.bundlemanifest+xml"))
                {
                    // Package is a bundle
                    extension += "bundle";
                }
            }
            if (File.Exists(contentTypeFilepath))
            {
                File.Delete(contentTypeFilepath);
            }

            if (extension != "")
            {
                await destinationFile.RenameAsync(destinationFile.Name + extension, NameCollisionOption.ReplaceExisting);
            }

            return((destinationFile, progressToast).ToTuple());
        }
Exemple #29
0
        public ActionResult Edit(int id)
        {
            ProductDetails product = getProduct.GetProduct(id);

            return(View(product));
        }
 public abstract int InsertProduct(ProductDetails product);
Exemple #31
0
 public bool Update(ProductDetails entity)
 {
     _dbContext.Update(entity);
     return(Save());
 }
        protected virtual ProductDetails GetProductFromReader(IDataReader reader, bool readDescription)
        {
            ProductDetails product = new ProductDetails(
            (int)reader["ProductID"],
            (DateTime)reader["AddedDate"],
            reader["AddedBy"].ToString(),
            (int)reader["DepartmentID"],
            reader["DepartmentTitle"].ToString(),
            reader["Title"].ToString(),
            null,
            reader["SKU"].ToString(),
            (decimal)reader["UnitPrice"],
            (int)reader["DiscountPercentage"],
            (int)reader["UnitsInStock"],
            reader["SmallImageUrl"].ToString(),
            reader["FullImageUrl"].ToString(),
            (int)reader["Votes"],
            (int)reader["TotalRating"]);

             if (readDescription)
            product.Description = reader["Description"].ToString();

             return product;
        }
 public void UpdateProductDetails(ProductDetails productDetails)
 {
     productDetails.Amount = this.Amount;
 }
Exemple #34
0
        protected void cboProductCode_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (cboProductCode.Items.Count == 0)
            {
                return;
            }

            DataClass clsDataClass = new DataClass();
            long      ProductID    = Convert.ToInt64(cboProductCode.SelectedItem.Value);

            ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();

            cboVariation.DataTextField  = "MatrixDescription";
            cboVariation.DataValueField = "MatrixID";
            cboVariation.DataSource     = clsProductVariationsMatrix.BaseListSimpleAsDataTable(ProductID, SortField: "VariationDesc").DefaultView;
            cboVariation.DataBind();

            if (cboVariation.Items.Count == 0)
            {
                cboVariation.Items.Add(new ListItem("No Variation", "0"));
            }
            cboVariation.SelectedIndex = cboVariation.Items.Count - 1;

            ProductUnitsMatrix clsUnitMatrix = new ProductUnitsMatrix(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);

            cboProductUnit.DataTextField  = "BottomUnitCode";
            cboProductUnit.DataValueField = "BottomUnitID";
            cboProductUnit.DataSource     = clsUnitMatrix.ListAsDataTable(ProductID, "a.MatrixID", SortOption.Ascending).DefaultView;
            cboProductUnit.DataBind();

            Products       clsProduct = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction);
            ProductDetails clsDetails = clsProduct.Details(ProductID);

            clsProductVariationsMatrix.CommitAndDispose();
            cboProductUnit.Items.Insert(0, new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));
            cboProductUnit.SelectedIndex = cboProductUnit.Items.IndexOf(new ListItem(clsDetails.BaseUnitCode, clsDetails.BaseUnitID.ToString()));

            txtPrice.Text        = clsDetails.WSPrice.ToString("#####0.#0");
            txtSellingPrice.Text = clsDetails.Price.ToString("#####0.#0");
            decimal decMargin = clsDetails.Price - clsDetails.WSPrice;

            try { decMargin = decMargin / clsDetails.WSPrice; }
            catch { decMargin = 1; }
            decMargin        = decMargin * 100;
            txtMargin.Text   = decMargin.ToString("#,##0.##0");
            txtVAT.Text      = clsDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text     = clsDetails.EVAT.ToString("#,##0.#0");
            txtLocalTax.Text = clsDetails.LocalTax.ToString("#,##0.#0");

            if (clsDetails.VAT > 0)
            {
                chkIsTaxable.Checked = true;
            }
            else
            {
                chkIsTaxable.Checked = false;
            }

            ComputeItemAmount();
            cboVariation_SelectedIndexChanged(null, null);

            //if (ProductID != 0)
            //{
            //    lnkVariationAdd.Visible = true;
            //    string stParam = "?task=" + Common.Encrypt("add", Session.SessionID) +
            //                "&prodid=" + Common.Encrypt(ProductID.ToString(), Session.SessionID);
            //    lnkVariationAdd.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Product/_VariationsMatrix/Default.aspx" + stParam;
            //}
            //else { lnkVariationAdd.Visible = false; }
        }
 /// <summary>
 /// Adds a product to a user's inventory
 /// </summary>
 /// <param name="pD">Details about a product</param>
 /// <param name="uSi">User session information</param>
 /// <returns>True if the transaction is successful</returns>
 public bool AddProductToInventory(ProductDetails pD, UserSessionInfo uSi)
 {
     try
     {
         DBConnection.Open();
         SQLcmdSP = new SqlCommand("sp_AddProductToInventory", DBConnection);
         SQLcmdSP.CommandType = CommandType.StoredProcedure;
         SQLcmdSP.Parameters.Add(new SqlParameter("@inventoryID", SqlDbType.Int, 0));
         SQLcmdSP.Parameters.Add(new SqlParameter("@productID", SqlDbType.Int, 0));
         SQLcmdSP.Parameters.Add(new SqlParameter("@prodQuantity", SqlDbType.Int, 0));
         SQLcmdSP.Parameters.Add(new SqlParameter("@prodPrice", SqlDbType.Int, 0));
         SQLcmdSP.Parameters.Add(new SqlParameter("@providerID", SqlDbType.Int, 0));
         SQLcmdSP.Parameters[0].Value = uSi.InventoryID;
         SQLcmdSP.Parameters[1].Value = pD.ProductX.GTIN;
         SQLcmdSP.Parameters[2].Value = pD.Quantity;
         SQLcmdSP.Parameters[3].Value = pD.ProductPrice;
         SQLcmdSP.Parameters[4].Value = pD.ProviderID;
         int i = SQLcmdSP.ExecuteNonQuery();
         evtWriter.writeInfo("Product " + pD.ProductX.GTIN +  " successfully updated in DB");
         return true;
     }
     catch (Exception exc)
     {
         evtWriter.writeError("Error adding product " + pD.ProductX.GTIN + " to DB" + Environment.NewLine + exc.Message);
         return false;
     }
     finally
     {
         SQLcmdSP.Dispose();
         DBConnection.Close();
     }
 }
Exemple #36
0
        public static async Task <Tuple <StorageFile, ToastNotification> > DownloadPackage(PackageInstance package, ProductDetails product, bool hideProgressToastWhenDone = true, string filepath = null)
        {
            // Download the file to the app's temp directory
            if (filepath == null)
            {
                filepath = Path.Combine(ApplicationData.Current.TemporaryFolder.Path, package.PackageMoniker);
            }
            Debug.WriteLine(filepath);

            StorageFile destinationFile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync(
                package.PackageMoniker, CreationCollisionOption.ReplaceExisting);

            BackgroundDownloader downloader = new BackgroundDownloader();

            downloader.FailureToastNotification = GenerateDownloadFailureToast(package, product);
            var progressToast = GenerateProgressToast(package, product);

            Debug.WriteLine(package.PackageUri.AbsoluteUri);
            DownloadOperation download = downloader.CreateDownload(package.PackageUri, destinationFile);

            download.RangesDownloaded += (op, args) =>
            {
                ToastNotificationManager.GetDefault().CreateToastNotifier().Update(
                    new NotificationData(new Dictionary <string, string>()
                {
                    { "progressValue", ((double)op.Progress.BytesReceived / op.Progress.TotalBytesToReceive).ToString() },
                    { "progressStatus", "Downloading..." }
                }),
                    progressToast.Tag
                    );
            };
            ToastNotificationManager.GetDefault().CreateToastNotifier().Show(progressToast);
            await download.StartAsync();

            if (hideProgressToastWhenDone)
            {
                ToastNotificationManager.GetDefault().CreateToastNotifier().Hide(progressToast);
            }

            string extension           = "";
            string contentTypeFilepath = filepath + "_[Content_Types].xml";

            using (var stream = await destinationFile.OpenStreamForReadAsync())
            {
                var bytes = new byte[4];
                stream.Read(bytes, 0, 4);
                uint magicNumber = (uint)((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]);

                switch (magicNumber)
                {
                // ZIP
                /// Typical [not empty or spanned] ZIP archive
                case 0x504B0304:
                    using (var archive = ZipFile.OpenRead(filepath))
                    {
                        var entry = archive.GetEntry("[Content_Types].xml");
                        entry.ExtractToFile(contentTypeFilepath, true);
                        var ctypesXml = XDocument.Load(contentTypeFilepath);
                        var defaults  = ctypesXml.Root.Elements().Where(e => e.Name.LocalName == "Default");
                        if (defaults.Any(d => d.Attribute("Extension").Value == "msix"))
                        {
                            // Package contains one or more MSIX packages
                            extension += ".msix";
                        }
                        else if (defaults.Any(d => d.Attribute("Extension").Value == "appx"))
                        {
                            // Package contains one or more MSIX packages
                            extension += ".appx";
                        }
                        if (defaults.Any(defaults => defaults.Attribute("ContentType").Value == "application/vnd.ms-appx.bundlemanifest+xml"))
                        {
                            // Package is a bundle
                            extension += "bundle";
                        }

                        if (extension == string.Empty)
                        {
                            // We're not sure exactly what kind of package it is, but it's definitely
                            // a package archive. Even if it's not actually an appxbundle, it will
                            // likely still work.
                            extension = ".appxbundle";
                        }
                    }
                    break;

                // EMSIX, EAAPX, EMSIXBUNDLE, EAPPXBUNDLE
                /// An encrypted installer [bundle]?
                case 0x45584248:
                    // This means the downloaded file wasn't a zip archive.
                    // Some inspection of a hex dump of the file leads me to believe that this means
                    // the installer is encrypted. There's probably nothing that can be done about this,
                    // but since it's a known case, let's leave this here.
                    extension = ".eappxbundle";
                    break;
                }
            }

            if (File.Exists(contentTypeFilepath))
            {
                File.Delete(contentTypeFilepath);
            }

            if (extension != string.Empty)
            {
                await destinationFile.RenameAsync(destinationFile.Name + extension, NameCollisionOption.ReplaceExisting);
            }

            return((destinationFile, progressToast).ToTuple());
        }
 public abstract bool UpdateProduct(ProductDetails product);
Exemple #38
0
        public static async Task <Tuple <StorageFile, ToastNotification> > DownloadPackage(ProductDetails product,
                                                                                           bool hideProgressToastWhenDone = true, string filepath = null,
                                                                                           Action <ProductDetails> gettingPackagesCallback = null, Action <ProductDetails> noPackagesCallback = null,
                                                                                           Action <ProductDetails> packagesLoadedCallback  = null, Action <ProductDetails, PackageInstance, StorageFile, ToastNotification> packageDownloadedCallback = null)
        {
            var culture = CultureInfo.CurrentUICulture;

            gettingPackagesCallback?.Invoke(product);

            var dcathandler = new StoreLib.Services.DisplayCatalogHandler(DCatEndpoint.Production, new StoreLib.Services.Locale(culture, true));
            await dcathandler.QueryDCATAsync(product.ProductId);

            var packs = await dcathandler.GetMainPackagesForProductAsync();

            string packageFamilyName = dcathandler.ProductListing.Product.Properties.PackageFamilyName;

            packagesLoadedCallback?.Invoke(product);

            if (packs != null)
            {
                var package = GetLatestDesktopPackage(packs.ToList(), packageFamilyName, product);
                if (package == null)
                {
                    noPackagesCallback?.Invoke(product);
                    return(null);
                }
                else
                {
                    var result = await DownloadPackage(package, product, hideProgressToastWhenDone, filepath);

                    if (result != null && result.Item1 != null)
                    {
                        packageDownloadedCallback?.Invoke(product, package, result.Item1, result.Item2);
                        return(result);
                    }
                }
            }

            return(null);
        }
 /// <summary>
 /// Updates an product
 /// </summary>
 public override bool UpdateProduct(ProductDetails product)
 {
     using (SqlConnection cn = new SqlConnection(this.ConnectionString))
      {
     SqlCommand cmd = new SqlCommand("tbh_Store_UpdateProduct", cn);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value = product.ID;
     cmd.Parameters.Add("@DepartmentID", SqlDbType.Int).Value = product.DepartmentID;
     cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = product.Title;
     cmd.Parameters.Add("@Description", SqlDbType.NText).Value = product.Description;
     cmd.Parameters.Add("@SKU", SqlDbType.NVarChar).Value = product.SKU;
     cmd.Parameters.Add("@UnitPrice", SqlDbType.Money).Value = product.UnitPrice;
     cmd.Parameters.Add("@DiscountPercentage", SqlDbType.Int).Value = product.DiscountPercentage;
     cmd.Parameters.Add("@UnitsInStock", SqlDbType.Int).Value = product.UnitsInStock;
     cmd.Parameters.Add("@SmallImageUrl", SqlDbType.NVarChar).Value = product.SmallImageUrl;
     cmd.Parameters.Add("@FullImageUrl", SqlDbType.NVarChar).Value = product.FullImageUrl;
     cn.Open();
     int ret = ExecuteNonQuery(cmd);
     return (ret == 1);
      }
 }
Exemple #40
0
        public static async Task <bool> InstallPackage(PackageInstance package, ProductDetails product, bool?useAppInstaller = null)
        {
            ToastNotification finalNotif = GenerateInstallSuccessToast(package, product);
            bool isSuccess = true;

            try
            {
                (await DownloadPackage(package, product, false)).Deconstruct(out var installer, out var progressToast);

                PackageManager pkgManager = new PackageManager();
                Progress <DeploymentProgress> progressCallback = new Progress <DeploymentProgress>(prog =>
                {
                    ToastNotificationManager.GetDefault().CreateToastNotifier().Update(
                        new NotificationData(new Dictionary <string, string>()
                    {
                        { "progressValue", (prog.percentage / 100).ToString() },
                        { "progressStatus", "Installing..." }
                    }),
                        progressToast.Tag
                        );
                });

                if (Settings.Default.UseAppInstaller || (useAppInstaller.HasValue && useAppInstaller.Value))
                {
                    // Pass the file to App Installer to install it
                    Uri launchUri = new Uri("ms-appinstaller:?source=" + installer.Path);
                    switch (await Launcher.QueryUriSupportAsync(launchUri, LaunchQuerySupportType.Uri))
                    {
                    case LaunchQuerySupportStatus.Available:
                        isSuccess = await Launcher.LaunchUriAsync(launchUri);

                        if (!isSuccess)
                        {
                            finalNotif = GenerateInstallFailureToast(package, product, new Exception("Failed to launch App Installer."));
                        }
                        break;

                    case LaunchQuerySupportStatus.AppNotInstalled:
                        finalNotif = GenerateInstallFailureToast(package, product, new Exception("App Installer is not available on this device."));
                        isSuccess  = false;
                        break;

                    case LaunchQuerySupportStatus.AppUnavailable:
                        finalNotif = GenerateInstallFailureToast(package, product, new Exception("App Installer is not available right now, try again later."));
                        isSuccess  = false;
                        break;

                    case LaunchQuerySupportStatus.Unknown:
                    default:
                        finalNotif = GenerateInstallFailureToast(package, product, new Exception("An unknown error occured."));
                        isSuccess  = false;
                        break;
                    }
                }
                else
                {
                    // Attempt to install the downloaded package
                    var result = await pkgManager.AddPackageByUriAsync(
                        new Uri(installer.Path),
                        new AddPackageOptions()
                    {
                        ForceAppShutdown = true
                    }
                        ).AsTask(progressCallback);

                    if (result.IsRegistered)
                    {
                        finalNotif = GenerateInstallSuccessToast(package, product);
                    }
                    else
                    {
                        finalNotif = GenerateInstallFailureToast(package, product, result.ExtendedErrorCode);
                    }
                    isSuccess = result.IsRegistered;
                    await installer.DeleteAsync();
                }

                // Hide progress notification
                ToastNotificationManager.GetDefault().CreateToastNotifier().Hide(progressToast);
                // Show the final notification
                ToastNotificationManager.GetDefault().CreateToastNotifier().Show(finalNotif);

                return(true);
            }
            catch (Exception ex)
            {
                ToastNotificationManager.GetDefault().CreateToastNotifier().Show(GenerateInstallFailureToast(package, product, ex));
                return(false);
            }
        }
 /// <summary>
 /// Returns a Product object filled with the data taken from the input ProductDetails
 /// </summary>
 private static Product GetProductFromProductDetails(ProductDetails record)
 {
     if (record == null)
     return null;
      else
      {
     return new Product(record.ID, record.AddedDate, record.AddedBy,
        record.DepartmentID, record.DepartmentTitle, record.Title, record.Description,
        record.SKU, record.UnitPrice, record.DiscountPercentage, record.UnitsInStock,
        record.SmallImageUrl, record.FullImageUrl, record.Votes, record.TotalRating);
      }
 }
Exemple #42
0
        public static PackageInstance GetLatestDesktopPackage(List <PackageInstance> packages, string family, ProductDetails product)
        {
            List <PackageInstance> installables = packages.FindAll(p => p.Version.Revision != 70);

            if (installables.Count <= 0)
            {
                return(null);
            }
            // TODO: Add addtional checks that might take longer that the user can enable
            // if they are having issues
            return(installables.OrderByDescending(p => p.Version).First());
        }
Exemple #43
0
        private void DisplayProductInformation(ProductDetails productDetails)
        {
            this.grpMainGroup.Enabled = true;
            this.cbProducts.Text = productDetails.Name;
            this.txtProductName.Text = productDetails.Name;
            this.txtBuildOut.Text = productDetails.BuildsLocation;
            this.txtInstallShieldOutputFile.Text = productDetails.InstallShieldOutput;
            this.txtLogOut.Text = productDetails.LogsLocation;
            this.txtPackageScript.Text = productDetails.InstallShieldScript;
            this.txtDevEnvFile.Text = productDetails.DevenvFile;

            this.txtMailFrom.Text = productDetails.MailSenderAddress;
            this.txtMailRecipients.Text = productDetails.MailRecipients;
            this.txtMailSMTPServer.Text = productDetails.MailServerAddress;

            this.txtMajor.Text = productDetails.MajorVersion;
            this.txtMinor.Text = productDetails.MinorVersion;
            this.txtBuild.Text = productDetails.BuildNumber;

            this.lvProjects.Items.Clear();
            if (productDetails.SolutionInfo != null)
            {
                for (int i=0; i< productDetails.SolutionInfo.Count; i++)
                {
                    SolutionInfo solutionInfo = productDetails.SolutionInfo[i] as SolutionInfo;
                    ListViewItem lviProjectItem = new ListViewItem (solutionInfo.SolutionPath);
                    lviProjectItem.SubItems.Add (solutionInfo.ProjectName);
                    lviProjectItem.SubItems.Add (solutionInfo.BuildConfig);
                    this.lvProjects.Items.Add (lviProjectItem);
                }
            }

            this.lvSCOptions.Items.Clear();
            if (productDetails.SourceControlInfo != null)
            {
                for (int i=0; i< productDetails.SourceControlInfo.Count; i++)
                {
                    SourceControlInfo scInfo = productDetails.SourceControlInfo[i] as SourceControlInfo;
                    ListViewItem lviSCItem = new ListViewItem (scInfo.Executable);
                    lviSCItem.SubItems.Add (scInfo.Arguments);
                    this.lvSCOptions.Items.Add (lviSCItem);
                }
            }

            HasProductDataChanged= false;
        }
Exemple #44
0
        public static ToastNotification GenerateProgressToast(PackageInstance package, ProductDetails product)
        {
            var content = new ToastContent()
            {
                Visual = new ToastVisual()
                {
                    BindingGeneric = new ToastBindingGeneric()
                    {
                        Children =
                        {
                            new AdaptiveText()
                            {
                                Text = new BindableString("progressTitle")
                            },
                            new AdaptiveProgressBar()
                            {
                                Value  = new BindableProgressBarValue("progressValue"),
                                Title  = new BindableString("progressVersion"),
                                Status = new BindableString("progressStatus")
                            }
                        },
                        AppLogoOverride = new ToastGenericAppLogo()
                        {
                            Source = product.Images.FindLast(i => i.ImageType == MicrosoftStore.Enums.ImageType.Logo).Url
                        }
                    }
                },
                // TODO: Add cancel and pause functionality
                //Actions = new ToastActionsCustom()
                //{
                //    Buttons =
                //    {
                //        new ToastButton("Pause", $"action=pauseDownload&packageName={package.PackageMoniker}")
                //        {
                //            ActivationType = ToastActivationType.Background
                //        },
                //        new ToastButton("Cancel", $"action=cancelDownload&packageName={package.PackageMoniker}")
                //        {
                //            ActivationType = ToastActivationType.Background
                //        }
                //    }
                //},
                Launch = $"action=viewDownload&packageName={package.PackageMoniker}",
            };

            var notif = new ToastNotification(content.GetXml());

            notif.Data = new NotificationData(new Dictionary <string, string>()
            {
                { "progressTitle", product.Title },
                { "progressVersion", package.Version.ToString() },
                { "progressStatus", "Downloading..." }
            });
            notif.Tag = package.PackageFamily;
            //notif.Group = "App Downloads";
            return(notif);
        }
    private void loadChildInformation()
    {
        ////  compareOther();

        if (DisplayVariationGuid.Length == 0)
            return;

        //Load up the product info
           p = new ProductDetails(new Guid(DisplayVariationGuid));

        //Read the images from the harddisk instead of the image manager
        PrgFunctions f = new PrgFunctions();
        string productimagesPath = "";// PrgFunctions.TryCastString(f.GetAppSettings("productimagesPath"));

        if (!productimagesPath.EndsWith("\\"))
            productimagesPath += "\\";

        string manufacturerId = "";// p.GetStringFieldOrAttribute("ManufactuerItem").ToLower();

        //Set the main image
        DataTable dtItemimages= new DataTable();// = p.GetItemimagesTable();
        DataRow[] drRows = dtItemimages.Select("item_image_type_id=1");

        if (drRows.Length > 0)
        {
            MediumImageWidth = Unit.Parse(drRows[0]["image_med_width"].ToString()).ToString();
            MediumImageHeight = Unit.Parse(drRows[0]["image_med_height"].ToString()).ToString();
        }

           // ImageDesc = p.GetTitle();
        ProductTitle = ImageDesc;

        //customization: override the image urls to use higher qualities ones
         LinkToFullImage = ResolveUrl("Productimages/Full/" + manufacturerId + "_1.jpg");
        MediumImageUrl = ResolveUrl("Productimages/Medium/" + manufacturerId + "_1.jpg");

        //Load up thumbnails
        string itemTag = "";// p.GetStringFieldOrAttribute("item_tag").ToLower();

        DataTable dtimagesThumb = new DataTable();//=   p.GetimagesTableWithUrls();//p.GetimagesTableWithUrlsFromHarddisk(this.Page)
        //HtmlContainerControl body_partone_11 = (HtmlContainerControl)this.FindControl("body_partone_1");
        //HtmlControl pOtherViews = (HtmlControl)body_partone_11.FindControl("pOtherViews");
        //pOtherViews.Visible = true;
        //if (dtimagesThumb.Rows.Count==0)
        //{

        //    pOtherViews.Visible = false;
        //}

        for (int i = 0; i < dtimagesThumb.Rows.Count && i <3; i++)
            dtimagesThumb.Rows[i]["ImageDesc"] = itemTag + " " + (i + 1).ToString();

        DataTable dtimagesThumb3 = new DataTable();

        dtimagesThumb3 = dtimagesThumb.Clone();

        DataSet dst = new DataSet();
        dst.Tables.Add("dtimagesThumb3");

        DataView dv = new DataView();

        dv = dst.Tables[0].DefaultView;

        int cntrows = 0;
        foreach (DataRow rows_ in dtimagesThumb.Rows)
        {

            if (cntrows <= 2)
            {
                dtimagesThumb3.ImportRow(rows_);
                cntrows += 1;
            }

        }

        // checks to see if count more that 3 (images) then displays right/left buttons
        //if (dtimagesThumb.Rows.Count <= 3)
        //{
        //    ImgBtnOvleft.Visible = false;
        //    ImgBtnOvright.Visible = false;
        //}
        //else
        //{
        //    ImgBtnOvleft.Visible = true;
        //    ImgBtnOvright.Visible = true;
        //}

        //iqimagesThumb.DataSource = dtimagesThumb3;
        //iqimagesThumb.DataBind();

        Session["dtimagesThumb"] = dtimagesThumb;

        int q = 0;// p.GetActualQuantityOnHand();

        if (q > 0)
        {

        }
        else
        {

        }
    }
Exemple #46
0
        public static ToastNotification GenerateDownloadSuccessToast(PackageInstance package, ProductDetails product, StorageFile file)
        {
            var content = new ToastContentBuilder().SetToastScenario(ToastScenario.Reminder)
                          .AddToastActivationInfo($"action=viewEvent&eventId={package.PackageMoniker}&installerPath={file.Path}", ToastActivationType.Foreground)
                          .AddText(product.Title)
                          .AddText(product.Title + " is ready to install")
                          .AddAppLogoOverride(product.Images.FindLast(i => i.ImageType == MicrosoftStore.Enums.ImageType.Logo).Uri, addImageQuery: false)
                          .Content;

            return(new ToastNotification(content.GetXml()));
        }
    // checks if landing page wasspecified in back end then goes first time to that page else goes to watches
    //private string GetLandingFromXml()
    //{
    //    string Landing;
    //    XmlDocument xDoc = new XmlDocument();
    //    string XmlFilePath = Request.MapPath("~\\XML\\changeText.xml");
    //    xDoc.Load(XmlFilePath);
    //    XmlNode xn = xDoc.SelectSingleNode("JomaExl/changeText/landing");
    //    Landing = xn.InnerText;
    //    DateTime landingdate;
    //    TimeSpan tsd = TimeSpan.FromDays(2);
    //    xn = xDoc.SelectSingleNode("JomaExl/changeText/landingdate");
    //    landingdate = Convert.ToDateTime(xn.InnerText);
    //    if (landingdate < DateTime.Today.Add(-tsd))
    //    {
    //        xn = xDoc.SelectSingleNode("JomaExl/changeText/landingdefault");
    //        Landing = xn.InnerText;
    //    }
    //       xn = null;
    //    xDoc = null;
    //    return Landing;
    //}
    //protected DataTable getAttributes(ProductDetails p)
    //{
    //    DataTable dt = new DataTable();
    //    dt.Columns.Add(new DataColumn("attribute_description"));
    //    dt.Columns.Add(new DataColumn("attribute_label"));
    //    dt.Columns.Add(new DataColumn("attribute_value"));
    //    DataView dv = p.GetAttributesView();
    //    if ((dv != null) && (dv.Count > 0))
    //    {
    //        DataRow dr = null;
    //        string val = "";
    //        foreach (DataRowView drv in dv)
    //        {
    //            val = "";
    //            dr = dt.NewRow();
    //            val = PrgFunctions.TryCastString(drv["attribute_value"]);
    //            if (val.Length > 0)
    //            {
    //                dr["attribute_label"] = PrgFunctions.TryCastString(drv["attribute_label"]) + ":";
    //                dr["attribute_value"] = val;
    //                dr["attribute_description"] = PrgFunctions.TryCastString(drv["attribute_description"]);
    //                dt.Rows.Add(dr);
    //            }
    //        }
    //    }
    //    return dt;
    //}
    protected DataTable getCompareSave(ProductDetails p)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("ImageLogoURL"));
        dt.Columns.Add(new DataColumn("Price"));
        dt.Columns.Add(new DataColumn("PriceFormated"));
        dt.Columns.Add(new DataColumn("CompanyName"));
        dt.Columns.Add(new DataColumn("ProductUrl"));

        //DataRow drItem = p.GetItemRow();

        //for (int i = 1; i <= 5; i++)
        //{
        //    DataRow drNew = dt.NewRow();

        //    if (!PrgFunctions.IsNullOrEmpty(drItem["CompareAndSaveLink" + i.ToString()]))
        //    {
        //        drNew["ProductUrl"] = drItem["CompareAndSaveLink" + i.ToString()];
        //    }
        //    else
        //    {
        //        drNew["ProductUrl"] = "";
        //    }

        //    if (!PrgFunctions.IsNullOrEmpty(drItem["CompareAndSaveIcon" + i.ToString()]))
        //    {
        //        drNew["ImageLogoURL"] = drItem["CompareAndSaveIcon" + i.ToString()].ToString().TrimStart('/');
        //    }
        //    else
        //    {
        //        drNew["ImageLogoURL"] = "";
        //    }

        //    if (!PrgFunctions.IsNullOrEmpty(drItem["CompareAndSavePrice" + i.ToString()]))
        //    {
        //        drNew["Price"] = drItem["CompareAndSavePrice" + i.ToString()];
        //    }
        //    else
        //    {
        //        drNew["Price"] = "";
        //    }

        //    if (!PrgFunctions.IsNullOrEmpty(drItem["CompareAndSaveName" + i.ToString()]))
        //    {
        //        drNew["CompanyName"] = drItem["CompareAndSaveName" + i.ToString()];
        //    }
        //    else
        //    {
        //        drNew["CompanyName"] = "";
        //    }

        //    if (!string.IsNullOrEmpty(drNew["Price"].ToString()))
        //    {
        //        if (drNew["CompanyName"].ToString().Length > 30)
        //        {
        //            drNew["CompanyName"] =
        //                drNew["CompanyName"].ToString().Substring(0, drNew["CompanyName"].ToString().Length / 4).ToString();
        //        }
        //        dt.Rows.Add(drNew);
        //    }
        //}

        return dt;
    }
Exemple #48
0
        public static ToastNotification GenerateInstallFailureToast(PackageInstance package, ProductDetails product, Exception ex)
        {
            var content = new ToastContentBuilder().SetToastScenario(ToastScenario.Reminder)
                          .AddToastActivationInfo($"action=viewEvent&eventId={package.PackageMoniker}", ToastActivationType.Foreground)
                          .AddText(product.Title)
                          .AddText(product.Title + " failed to install.")
                          .AddText(ex.Message)
                          .AddAppLogoOverride(product.Images.FindLast(i => i.ImageType == MicrosoftStore.Enums.ImageType.Logo).Uri, addImageQuery: false)
                          .Content;

            return(new ToastNotification(content.GetXml()));
        }
        public void Can_attach_entity_with_one_to_one_parent_and_child()
        {
            using (var context = new EarlyLearningCenter())
            {
                var details = new ProductDetails { Id = 1, Product = new Product { Id = 1 }, Tag = new ProductDetailsTag { Id = 1 } };

                context.ChangeTracker.TrackGraph(details, e => e.State = EntityState.Unchanged);

                Assert.Equal(3, context.ChangeTracker.Entries().Count());

                Assert.Equal(EntityState.Unchanged, context.Entry(details).State);
                Assert.Equal(EntityState.Unchanged, context.Entry(details.Product).State);
                Assert.Equal(EntityState.Unchanged, context.Entry(details.Tag).State);

                Assert.Same(details, details.Tag.Details);
                Assert.Same(details, details.Product.Details);
            }
        }
        public override void OnLoad()
        {
            satsuma     = GameObject.Find("SATSUMA(557kg, 248)");
            raccarb     = GameObject.Find("racing carburators(Clone)");
            carb2       = GameObject.Find("twin carburators(Clone)");
            powerMP     = FsmVariables.GlobalVariables.FindFsmFloat("EnginePowerMultiplier");
            pullmesh    = GameObject.Find("crankshaft_pulley_mesh");
            inVencle    = FsmVariables.GlobalVariables.FindFsmString("PlayerCurrentVehicle");
            engine_head = GameObject.Find("cylinder head(Clone)");
            Mixture     = satsuma.transform.GetChild(14).GetChild(1).GetChild(3).gameObject.GetComponents <PlayMakerFSM>()[1].FsmVariables.FloatVariables[16];
            math1       = satsuma.transform.GetChild(14).GetChild(1).GetChild(7).gameObject.GetComponent <PlayMakerFSM>().FsmVariables.FloatVariables[1];
            n2o         = satsuma.transform.GetChild(14).GetChild(1).GetChild(7).gameObject.GetComponent <PlayMakerFSM>().FsmStates[4];
            n2oPSI      = satsuma.transform.GetChild(14).GetChild(1).GetChild(7).gameObject.GetComponent <PlayMakerFSM>().FsmVariables.FloatVariables[4];
            drivetrain  = satsuma.GetComponent <Drivetrain>();
            sparkRetard = satsuma.transform.GetChild(14).GetChild(1).GetChild(7).gameObject.GetComponent <PlayMakerFSM>().FsmVariables.FloatVariables[7];
            noN2O       = satsuma.transform.GetChild(14).GetChild(1).GetChild(7).gameObject.GetComponent <PlayMakerFSM>().FsmStates[5];
            heat        = FsmVariables.GlobalVariables.FindFsmFloat("EngineTemp");

            AssetBundle ab = LoadAssets.LoadBundle(this, "turbo.unity3d");

            turbine       = ab.LoadAsset("Turbine.prefab") as GameObject;
            turbine.name  = "Turbine";
            turbine.tag   = "PART";
            turbine.layer = LayerMask.NameToLayer("Parts");

            pulley       = ab.LoadAsset("Pulley.prefab") as GameObject;
            pulley.name  = "Pulley";
            pulley.tag   = "PART";
            pulley.layer = LayerMask.NameToLayer("Parts");

            pipe       = ab.LoadAsset("Pipe.prefab") as GameObject;
            pipe.name  = "Pipe";
            pipe.tag   = "PART";
            pipe.layer = LayerMask.NameToLayer("Parts");

            pipe_rac_carb       = ab.LoadAsset("Pipe rac_carb.prefab") as GameObject;
            pipe_rac_carb.name  = "racing carburators pipe";
            pipe_rac_carb.tag   = "PART";
            pipe_rac_carb.layer = LayerMask.NameToLayer("Parts");

            belt       = ab.LoadAsset("Belt.prefab") as GameObject;
            belt.name  = "Turbine belt";
            belt.tag   = "PART";
            belt.layer = LayerMask.NameToLayer("Parts");

            turbinegauge       = ab.LoadAsset("Датчик.prefab") as GameObject;
            turbinegauge.name  = "Turbine gauge";
            turbinegauge.tag   = "PART";
            turbinegauge.layer = LayerMask.NameToLayer("Parts");

            pipe_2_carb       = ab.LoadAsset("Pipe 2_carb.prefab") as GameObject;
            pipe_2_carb.name  = "Twin carburators pipe";
            pipe_2_carb.tag   = "PART";
            pipe_2_carb.layer = LayerMask.NameToLayer("Parts");

            switch_button       = ab.LoadAsset("Switch.prefab") as GameObject;
            switch_button.name  = "Switch button";
            switch_button.tag   = "PART";
            switch_button.layer = LayerMask.NameToLayer("Parts");

            headgasket       = ab.LoadAsset("Head_gasket.prefab") as GameObject;
            headgasket.name  = "Additional Head Gasket";
            headgasket.tag   = "PART";
            headgasket.layer = LayerMask.NameToLayer("Parts");

            filter       = ab.LoadAsset("filter.prefab") as GameObject;
            filter.name  = "filter";
            filter.tag   = "PART";
            filter.layer = LayerMask.NameToLayer("Parts");

            PartSaveInfo pulleySaveInfo = null, turbineSaveInfo = null, pipeSaveInfo = null, pipe_rac_carbSaveInfo = null, beltSaveInfo = null, turbinegaugeSaveInfo = null, pipe_2_carbSaveInfo = null, switch_buttonSaveInfo = null, filterSaveInfo = null, headgasketSaveInfo = null;

            pulleySaveInfo        = LoadSaveData("pulleySaveInfo");
            turbineSaveInfo       = LoadSaveData("turbineSaveInfo");
            pipeSaveInfo          = LoadSaveData("pipeSaveInfo");
            pipe_rac_carbSaveInfo = LoadSaveData("pipe_rac_carbSaveInfo");
            beltSaveInfo          = LoadSaveData("beltSaveInfo");
            turbinegaugeSaveInfo  = LoadSaveData("turbinegaugeSaveInfo");
            pipe_2_carbSaveInfo   = LoadSaveData("pipe_2_carbSaveInfo");
            switch_buttonSaveInfo = LoadSaveData("switch_buttonSaveInfo");
            filterSaveInfo        = LoadSaveData("filterSaveInfo");
            headgasketSaveInfo    = LoadSaveData("headgasketSaveInfo");
            try
            {
                buysafeinfo = SaveLoad.DeserializeSaveFile <Safeinfo>(this, "Safeinfo");
            }
            catch
            {
            }
            if (buysafeinfo == null)
            {
                buysafeinfo = new Safeinfo()
                {
                    Buybelt          = false,
                    Buypipe          = false,
                    Buypipe_2_carb   = false,
                    Buypipe_rac_carb = false,
                    Buypulley        = false,
                    Buyturbine       = false,
                    Buyturbinegauge  = false,
                    Buyswitch_button = false,
                    Buyfilter        = false,
                    Buyheadgasket    = false,
                    Beltwear         = 100,
                    Filterwear       = 100,
                    Turbinewear      = 100,
                    BoostOn          = true
                };
            }
            if (!buysafeinfo.Buyturbine)
            {
                turbineSaveInfo = null;
            }
            if (!buysafeinfo.Buybelt)
            {
                beltSaveInfo = null;
            }
            if (!buysafeinfo.Buypulley)
            {
                pulleySaveInfo = null;
            }
            if (!buysafeinfo.Buypipe)
            {
                pipeSaveInfo = null;
            }
            if (!buysafeinfo.Buypipe_rac_carb)
            {
                pipe_rac_carbSaveInfo = null;
            }
            if (!buysafeinfo.Buypipe_2_carb)
            {
                pipe_2_carbSaveInfo = null;
            }
            if (!buysafeinfo.Buyturbinegauge)
            {
                turbinegaugeSaveInfo = null;
            }
            if (!buysafeinfo.Buyswitch_button)
            {
                switch_buttonSaveInfo = null;
            }
            if (!buysafeinfo.Buyfilter)
            {
                filterSaveInfo = null;
            }
            if (!buysafeinfo.Buyheadgasket)
            {
                headgasketSaveInfo = null;
            }

            GameObject pulleyparent  = GameObject.Find("crankshaft_pulley_mesh");
            Trigger    pulleytrigger = new Trigger("pulleyTrigger", pulleyparent, new Vector3(0.027f, 0.0f, 0.0f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);

            pulleyPart = new Pulley(pulleySaveInfo, pulleytrigger, new Vector3(0.027f, 0.0f, 0.0f), new Quaternion(0, 0, 0, 0), pulley, pulleyparent);

            GameObject turbineparent  = GameObject.Find("block(Clone)");
            Trigger    turbinetrigger = new Trigger("turbineTrigger", turbineparent, new Vector3(0.234f, 0.14f, 0.0817f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);

            turbinePart = new Turbine(turbineSaveInfo, turbinetrigger, new Vector3(0.234f, 0.14f, 0.0817f), Quaternion.Euler(90, 0, 0), turbine, turbineparent);

            GameObject pipeparent  = turbinePart.rigidPart;
            Trigger    pipetrigger = new Trigger("pipeTrigger", pipeparent, new Vector3(-0.12f, 0.085f, -0.04f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);

            pipePart = new Pipe(pipeSaveInfo, pipetrigger, new Vector3(-0.12f, 0.085f, -0.04f), new Quaternion(0, 0, 0, 0), pipe, pipeparent);

            GameObject pipe_rac_carbparent = GameObject.Find("cylinder head(Clone)");

            pipe_rac_carbtrigger = new Trigger("pipe_rac_carbTrigger", pipe_rac_carbparent, new Vector3(0.013f, -0.139f, 0.12f), Quaternion.Euler(90, 0, 0), new Vector3(0.3f, 0.3f, 0.3f), false);
            pipe_rac_carbPart    = new Pipe_rac_carb(pipe_rac_carbSaveInfo, pipe_rac_carbtrigger, new Vector3(0.013f, -0.139f, 0.12f), Quaternion.Euler(90, 0, 0), pipe_rac_carb, pipe_rac_carbparent);

            GameObject beltparent = turbinePart.rigidPart;

            belttrigger = new Trigger("beltTrigger", beltparent, new Vector3(0.035f, -0.091f, 0.08f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);
            beltPart    = new Belt(beltSaveInfo, belttrigger, new Vector3(0.035f, -0.091f, 0.08f), new Quaternion(0, 0, 0, 0), belt, beltparent);

            GameObject turbinegaugeParent  = GameObject.Find("dashboard(Clone)");
            Trigger    turbinegaugeTrigger = new Trigger("turbinegaugeTriger", turbinegaugeParent, new Vector3(0.48f, -0.04f, 0.135f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);

            turbinegaugePart = new Turbinegauge(turbinegaugeSaveInfo, turbinegaugeTrigger, new Vector3(0.48f, -0.04f, 0.135f), Quaternion.Euler(0, 0, 345), turbinegauge, turbinegaugeParent);

            GameObject pipe_2_carbparent = GameObject.Find("cylinder head(Clone)");

            pipe_2_carbtrigger = new Trigger("pipe_2_carbTrigger", pipe_rac_carbparent, new Vector3(0.06f, -0.147f, 0.04f), Quaternion.Euler(0, 0, 0), new Vector3(0.3f, 0.3f, 0.3f), false);
            pipe_2_carbPart    = new Pipe_2_carb(pipe_2_carbSaveInfo, pipe_2_carbtrigger, new Vector3(0.06f, -0.147f, 0.04f), Quaternion.Euler(90, 0, 0), pipe_2_carb, pipe_2_carbparent);

            GameObject switchbuttonparent  = GameObject.Find("dashboard(Clone)");
            Trigger    switchbuttontrigger = new Trigger("switchbuttonTrigger", switchbuttonparent, new Vector3(0.54f, -0.062f, -0.065f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);

            switch_buttonPart = new Switchbutton(switch_buttonSaveInfo, switchbuttontrigger, new Vector3(0.54f, -0.062f, -0.065f), Quaternion.Euler(12, 0, 0), switch_button, switchbuttonparent);

            GameObject filterparent  = pipePart.rigidPart;
            Trigger    filtertrigger = new Trigger("filterTrigger", filterparent, new Vector3(-0.14f, 0.075f, -0.035f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);

            filterPart = new Filter(filterSaveInfo, filtertrigger, new Vector3(-0.14f, 0.075f, -0.035f), Quaternion.Euler(0, 0, 0), filter, filterparent);

            GameObject headgasketparent = GameObject.Find("head gasket(Clone)");

            headgaskettrigger = new Trigger("headgasketTrigger", headgasketparent, new Vector3(0f, 0f, 0.003f), Quaternion.Euler(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f), false);
            headgasketPart    = new HeadGasket(headgasketSaveInfo, headgaskettrigger, new Vector3(0f, 0f, 0.003f), Quaternion.Euler(0, 0, 0), headgasket, headgasketparent);

            shop         = GameObject.Find("Shop for mods").GetComponent <ShopItem>();
            shop_turbine = new ProductDetails()
            {
                productName       = "Centrifugal supercharger",
                multiplePurchases = false,
                productCategory   = "Details",
                productIcon       = ab.LoadAsset <Sprite>("Turbine_ico.png"),
                productPrice      = 3499
            };
            if (!buysafeinfo.Buyturbine)
            {
                shop.Add(this, shop_turbine, ShopType.Fleetari, Buy_turbine, turbinePart.activePart);
                turbinePart.activePart.SetActive(false);
            }


            shopbelt = new ProductDetails()
            {
                productName       = "Belt",
                multiplePurchases = false,
                productCategory   = "Details",
                productIcon       = ab.LoadAsset <Sprite>("Belt.png"),
                productPrice      = 299
            };
            if (!buysafeinfo.Buybelt)
            {
                shop.Add(this, shopbelt, ShopType.Fleetari, Buy_belt, beltPart.activePart);
                beltPart.activePart.SetActive(false);
            }


            if (!buysafeinfo.Buypulley)
            {
                ProductDetails shop_pulley = new ProductDetails()
                {
                    productName       = "Pulley",
                    multiplePurchases = false,
                    productCategory   = "Details",
                    productIcon       = ab.LoadAsset <Sprite>("pulley.png"),
                    productPrice      = 399
                };
                shop.Add(this, shop_pulley, ShopType.Fleetari, Buy_pulley, pulleyPart.activePart);
                pulleyPart.activePart.SetActive(false);
            }


            if (!buysafeinfo.Buypipe)
            {
                ProductDetails shop_pipe = new ProductDetails()
                {
                    productName       = "Pipe",
                    multiplePurchases = false,
                    productCategory   = "Details",
                    productIcon       = ab.LoadAsset <Sprite>("pipe.png"),
                    productPrice      = 749
                };
                shop.Add(this, shop_pipe, ShopType.Fleetari, Buy_pipe, pipePart.activePart);
                pipePart.activePart.SetActive(false);
            }


            if (!buysafeinfo.Buypipe_rac_carb)
            {
                ProductDetails shop_pipe_rac_carb = new ProductDetails()
                {
                    productName       = "Racing carburators pipe",
                    multiplePurchases = false,
                    productCategory   = "Details",
                    productIcon       = ab.LoadAsset <Sprite>("pipe2.png"),
                    productPrice      = 749
                };
                shop.Add(this, shop_pipe_rac_carb, ShopType.Fleetari, Buy_pipe_rac_carb, pipe_rac_carbPart.activePart);
                pipe_rac_carbPart.activePart.SetActive(false);
            }


            if (!buysafeinfo.Buypipe_2_carb)
            {
                ProductDetails shop_pipe_2_carb = new ProductDetails()
                {
                    productName       = "Twin carburators pipe",
                    multiplePurchases = false,
                    productCategory   = "Details",
                    productIcon       = ab.LoadAsset <Sprite>("pipe3.png"),
                    productPrice      = 749
                };
                shop.Add(this, shop_pipe_2_carb, ShopType.Fleetari, Buy_pipe_2_carb, pipe_2_carbPart.activePart);
                pipe_2_carbPart.activePart.SetActive(false);
            }


            if (!buysafeinfo.Buyturbinegauge)
            {
                ProductDetails shop_turbinegauge = new ProductDetails()
                {
                    productName       = "Turbine gauge",
                    multiplePurchases = false,
                    productCategory   = "Details",
                    productIcon       = ab.LoadAsset <Sprite>("Гаджет.png"),
                    productPrice      = 499
                };
                shop.Add(this, shop_turbinegauge, ShopType.Fleetari, Buy_turbinegauge, turbinegaugePart.activePart);
                turbinegaugePart.activePart.SetActive(false);
            }


            if (!buysafeinfo.Buyswitch_button)
            {
                ProductDetails shop_switch_button = new ProductDetails()
                {
                    productName       = "Switch button",
                    multiplePurchases = false,
                    productCategory   = "Details",
                    productIcon       = ab.LoadAsset <Sprite>("switch 1.png"),
                    productPrice      = 249
                };
                shop.Add(this, shop_switch_button, ShopType.Fleetari, Buy_switch_button, switch_buttonPart.activePart);
                switch_buttonPart.activePart.SetActive(false);
            }

            shop_filter = new ProductDetails()
            {
                productName       = "Filter",
                multiplePurchases = false,
                productCategory   = "Details",
                productIcon       = ab.LoadAsset <Sprite>("filter.png"),
                productPrice      = 99
            };
            if (!buysafeinfo.Buyfilter)
            {
                shop.Add(this, shop_filter, ShopType.Fleetari, Buy_filter, filterPart.activePart);
                filterPart.activePart.SetActive(false);
            }

            if (!buysafeinfo.Buyheadgasket)
            {
                ProductDetails shop_headgasket = new ProductDetails()
                {
                    productName       = "Additional Head Gasket",
                    multiplePurchases = false,
                    productCategory   = "Details",
                    productIcon       = ab.LoadAsset <Sprite>("headgasket.png"),
                    productPrice      = 329
                };
                shop.Add(this, shop_headgasket, ShopType.Fleetari, Buy_headgasket, headgasketPart.activePart);
                headgasketPart.activePart.SetActive(false);
            }


            ab.Unload(false);

            UnityEngine.Object.Destroy(turbine);
            UnityEngine.Object.Destroy(pulley);
            UnityEngine.Object.Destroy(pipe);
            UnityEngine.Object.Destroy(pipe_rac_carb);
            UnityEngine.Object.Destroy(belt);
            UnityEngine.Object.Destroy(turbinegauge);
            UnityEngine.Object.Destroy(ab);
            UnityEngine.Object.Destroy(pipe_2_carb);
            UnityEngine.Object.Destroy(switch_button);
            turbinePart.rigidPart.GetComponent <AudioSource>().volume = 0;

            racingcarb_inst = false;
            carb2_inst      = false;

            fullreset = false;

            if (buysafeinfo.BoostOn)
            {
                switch_buttonPart.rigidPart.transform.GetChild(0).transform.localRotation = Quaternion.Euler(50, 0, 0);
            }
            else
            {
                switch_buttonPart.rigidPart.transform.GetChild(0).transform.localRotation = Quaternion.Euler(-50, 0, 0);
            }

            ModConsole.Print("Supercharger for Satsuma was loaded.");
        }
        [Fact] // Issue #1207
        public void Can_add_identifying_dependents_and_principal_with_reverse_post_nav_fixup_with_key_generation()
        {
            using (var context = new EarlyLearningCenter())
            {
                var product1 = new Product();
                var details1 = new ProductDetails();
                var tag1 = new ProductDetailsTag();
                var tagDetails1 = new ProductDetailsTagDetails();

                var product2 = new Product();
                var details2 = new ProductDetails();
                var tag2 = new ProductDetailsTag();
                var tagDetails2 = new ProductDetailsTagDetails();

                context.Add(product1);
                context.Add(tagDetails2);
                context.Add(details1);
                context.Add(tag2);
                context.Add(details2);
                context.Add(tag1);
                context.Add(tagDetails1);
                context.Add(product2);

                tagDetails1.Tag = tag1;
                tag1.Details = details1;
                details1.Product = product1;

                tagDetails2.Tag = tag2;
                tag2.Details = details2;
                details2.Product = product2;

                context.ChangeTracker.DetectChanges();

                AssertProductAndDetailsFixedUp(context, product1.Details.Tag.TagDetails, product2.Details.Tag.TagDetails);
            }
        }
Exemple #52
0
        public static ToastNotification GenerateDonwloadProgressToast(Package package, ProductDetails product)
        {
            var content = new ToastContent()
            {
                Visual = new ToastVisual()
                {
                    BindingGeneric = new ToastBindingGeneric()
                    {
                        Children =
                        {
                            new AdaptiveProgressBar()
                            {
                                Value  = new BindableProgressBarValue("progressValue"),
                                Title  = new BindableString("progressTitle"),
                                Status = new BindableString("progressStatus")
                            }
                        },
                        AppLogoOverride = new ToastGenericAppLogo()
                        {
                            Source = product.Images.FindLast(i => i.ImageType == "logo").Url
                        }
                    }
                },
                Actions = new ToastActionsCustom()
                {
                    Buttons =
                    {
                        new ToastButton("Pause", $"action=pauseDownload&packageName={package.Name}")
                        {
                            ActivationType = ToastActivationType.Background
                        },
                        new ToastButton("Cancel", $"action=cancelDownload&packageName={package.Name}")
                        {
                            ActivationType = ToastActivationType.Background
                        }
                    }
                },
                Launch = $"action=viewDownload&packageName={package.Name}"
            };

            var notif = new ToastNotification(content.GetXml());

            notif.Data = new NotificationData(new Dictionary <string, string>()
            {
                { "progressTitle", product.Title },
                { "progressStatus", "Downloading..." }
            });
            notif.Tag = package.PackageFamily;
            //notif.Group = "App Downloads";
            return(notif);
        }
    // Get product details
    public static ProductDetails GetProductDetails(string productId)
    {
        // get a configured OracleCommand object
        OracleCommand comm = GenericDataAccess.CreateCommand();
        // set the stored procedure name
        comm.CommandText = "CatalogGetProductDetails";
        // create a new parameter
        OracleParameter param = comm.Parameters.Add("Prod_ID", OracleDbType.Int32);
        param.Direction = ParameterDirection.Input;
        param.Value = Int32.Parse(productId);
        OracleParameter p2 =
           comm.Parameters.Add("prod_out", OracleDbType.RefCursor);
        p2.Direction = ParameterDirection.Output;
        // execute the stored procedure
        comm.CommandType = CommandType.StoredProcedure;
        DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
        // wrap retrieved data into a ProductDetails object
        ProductDetails details = new ProductDetails();
        if (table.Rows.Count > 0)
        {
            // get the first table row
            DataRow dr = table.Rows[0];
            // get product details
            details.Name = dr["Name"].ToString();
            details.Description = dr["Description"].ToString();
            details.Price = Decimal.Parse(dr["Price"].ToString());
            details.Image1FileName = dr["Thumbnail"].ToString();
            details.Image2FileName = dr["Image"].ToString();
            details.OnDepartmentPromotion = Convert.ToBoolean(dr["PromoDept"]);
            details.OnCatalogPromotion = Convert.ToBoolean(dr["PromoFront"]);

        }
        // return department details
        return details;
    }
Exemple #54
0
        public static ToastNotification GenerateDonwloadFailureToast(Package package, ProductDetails product)
        {
            var content = new ToastContentBuilder().SetToastScenario(ToastScenario.Reminder)
                          .AddToastActivationInfo($"action=viewEvent&eventId={package.Name}", ToastActivationType.Foreground)
                          .AddText(product.Title)
                          .AddText("Failed to download, please try again later")
                          .AddAppLogoOverride(product.Images.FindLast(i => i.ImageType == "logo").Uri, addImageQuery: false)
                          .Content;

            return(new ToastNotification(content.GetXml()));
        }