//!! Please Ran integration tests only one by one otherwise it leads to EventStoreCommunicationException "Unable to access persistence layer"
        public async Task ShouldUpdateReadModel()
        {
            subscriber.Subscribe <ProductItemCreated>(async @event => await HandleAsync(productItemCreatedHandlers, @event));
            subscriber.Subscribe <ProductItemChanged>(async @event => await HandleAsync(productItemChangedHandlers, @event));
            subscriber.Subscribe <ProductPriceChanged>(async @event => await HandleAsync(productItemPriceChangedHandlers, @event));

            var ProductItem = new Product(DefaultProductItemId);

            string priceId = Guid.NewGuid().ToString();

            ProductItem.ChangeProductItem(Code, ImageSource, ProductUrl, Description);
            ProductItem.ChangeProductItem(null, null, null, updatedDescription);
            ProductItem.ChangeProductPrice(priceId, priceValue);
            await sut1.SaveAsync(ProductItem);

            var productReadModel = await productItemRepository.GetByIdAsync(DefaultProductItemId.ToString());

            var productPriceReadModel = await productItemPriceRepository.FindAllAsync(price => price.ItemId == DefaultProductItemId.ToString());

            Assert.Equal(productReadModel.Id, DefaultProductItemId.ToString());
            Assert.Equal(priceValue, productReadModel.Price);
            Assert.Equal(updatedDescription, productReadModel.Description);
            Assert.Equal(ImageSource, productReadModel.ImageSource);
            Assert.Equal(ProductUrl, productReadModel.ProductUrl);

            Assert.Equal(priceValue, productPriceReadModel.ToList().First().CurrentPrice);
        }
Beispiel #2
0
        protected void dgProductsYad2_ItemCommand(object sender, DataGridCommandEventArgs e)
        {
            int   index = e.Item.ItemIndex;
            Int64 ProductId;

            switch (((LinkButton)e.CommandSource).CommandName)
            {
            case "approve":
                ProductId                  = Int64.Parse(dgProductsYad2.DataKeys[index].ToString());
                pnlRemark.Visible          = true;
                pnlStatusRemarks.Visible   = true;
                btnApprove.Visible         = true;
                hiddenFieldProductId.Value = ProductId.ToString();
                break;

            case "cancel":
                ProductId                  = Int64.Parse(dgProductsYad2.DataKeys[index].ToString());
                pnlRemark.Visible          = true;
                pnlStatusRemarks.Visible   = true;
                btnReject.Visible          = true;
                hiddenFieldProductId.Value = ProductId.ToString();
                break;

            default:
                // Do nothing.
                break;
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public string ToLog(uint aDepth = 0)
        {
            string res = "";

            const string KPrefix = "   ";
            string       prefix  = "";

            for (uint i = 0; i < aDepth; i++)
            {
                prefix += KPrefix;
            }

            string indent = prefix + KPrefix;

            res += prefix + "[HID Device]" + "\r\n";
            res += indent + "String: " + ToString() + "\r\n";
            res += indent + "Name: " + Name + "\r\n";
            res += indent + "Manufacturer: " + Manufacturer + "\r\n";
            res += indent + "Product: " + Product + "\r\n";
            res += indent + "VendorID: 0x" + VendorId.ToString("X4") + "\r\n";
            res += indent + "ProductID: 0x" + ProductId.ToString("X4") + "\r\n";
            res += indent + "Version: " + Version.ToString() + "\r\n";
            res += prefix + "[/HID Device]" + "\r\n";
            return(res);
        }
        private void UpdateEntry(bool isCreate = true)
        {
            entry.Title.Text = Title;
            entry.Content.Content = Description;
#if DEBUG
            entry.IsDraft = true;
#else
            entry.AlternateUri =
                new AtomUri(
                    hostName.ToDomainUrl(
                        string.Concat(GeneralConstants.URL_SINGLE_PRODUCT_SHOW, ProductId, "/", Title.ToSafeUrl()), true));
#endif
            // attributes
            entry.TargetCountry = CountryCode;
            // we need this or else duplicate attribute will exist (strange that target_country cannot be found or removed)
            if (isCreate)
            {
                entry.ProductId = ProductId.ToString();
                entry.Condition = "New";
                entry.ProductType = ProductType;
                entry.TargetCountry = CountryCode;
            }
            
            entry.ProductType = ItemType.ToDescriptionString();
            if (SellingPrice.HasValue)
            {
                entry.Price = new Price(CurrencyCode, SellingPrice.Value.ToString());
            }
        }
Beispiel #5
0
    private void GetOffer()
    {
        Offer offer = CurrentProduct.Offers[0];

        if (offer.Amount <= 0)
        {
            lAvailiableAmount.Text = string.Format("<span class=\"not-available\">{0}</span>", Resource.Client_Details_NotAvailable);
        }
        else
        {
            lAvailiableAmount.Text = string.Format("<span class=\"available\">{0}</span>", Resource.Client_Details_Available);
        }

        btnOrderByRequest.Visible = ((offer.Price > 0) && (offer.Amount <= 0) && CurrentProduct.OrderByRequest);

        btnAdd.Visible = CurrentProduct.Price > 0 && CurrentProduct.Amount > 0;
        btnAdd.Attributes["data-cart-add"] = ProductId.ToString();
        btnAdd.Rel = string.Format("productid:{0}", CurrentProduct.ID);

        BuyInOneClick.Visible = SettingsOrderConfirmation.BuyInOneClick && CurrentProduct.Price > 0 && CurrentProduct.Amount > 0;
        btnAddCredit.Visible  = false;

        if (btnAdd.Visible && CurrentProduct.Price > 3000)
        {
            var payment = PaymentService.GetPaymentMethodByType(PaymentType.Kupivkredit);

            if (payment != null && payment.Enabled)
            {
                btnAddCredit.Visible = true;
                btnAddCredit.Attributes["data-cart-add"]     = ProductId.ToString();
                btnAddCredit.Attributes["data-cart-paiment"] = payment.PaymentMethodID.ToString();
                btnAddCredit.Rel = string.Format("productid:{0}", CurrentProduct.ID);
            }
        }
    }
        private void button_Possess_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                using (WebClient client = new WebClient())
                {
                    NameValueCollection nvc = new NameValueCollection();
                    nvc["ProductId"] = ProductId.ToString();
                    nvc["StoreId"]   = StoreId.ToString();

                    if (Possess)
                    {
                        nvc["Possess"] = "False";
                        client.UploadValues(About.Server + "StoreProduct", nvc);

                        button_Possess.Content = "موجود نیست";
                        button_Possess.ToolTip = "برای اعلام موجود نبود کالا کلیک کنید";
                        Possess = false;
                    }
                    else if (!Possess)
                    {
                        nvc["Possess"] = "True";
                        client.UploadValues(About.Server + "StoreProduct", nvc);

                        button_Possess.Content = "موجود است";
                        button_Possess.ToolTip = "برای اعلام موجود بودن کالا کلیک کنید";
                        Possess = true;
                    }
                }
            }
            catch
            {
                MessageBox.Show("خطا در برقراری ارتباط با سرور");
            }
        }
Beispiel #7
0
        /// <summary>
        /// Formats the product Id into a Hex value that can be consumed
        /// for the license key generation system.
        /// </summary>
        /// <param name="length"></param>
        /// <returns></returns>
        public string GetFormattedProductId(int length)
        {
            string data = ProductId.ToString("X");

            data = data.PadLeft(length, char.Parse("0"));

            return(data);
        }
Beispiel #8
0
        public string GetUrlQuery()
        {
            string query = "CicleId=" + CicleId.ToString();

            if (ProducerId.HasValue)
            {
                query += "&ProducerId=" + ProducerId.ToString();
            }
            if (ProductId.HasValue)
            {
                query += "&ProductId=" + ProductId.ToString();
            }
            if (SaleCustomerId.HasValue)
            {
                query += "&SaleCustomerId=" + SaleCustomerId.ToString();
            }
            if (RancherId.HasValue)
            {
                query += "&RancherId=" + RancherId.ToString();
            }
            if (SupplierId.HasValue)
            {
                query += "&SupplierId=" + SupplierId.ToString();
            }
            if (WeightTicketType.HasValue)
            {
                query += "&WeightTicketType=" + ((int)WeightTicketType).ToString();
            }
            if (EntranceWeightTicketsOnly.HasValue)
            {
                query += "&EntranceWeightTicketsOnly=" + EntranceWeightTicketsOnly.ToString();
            }
            if (ExitWeightTicketsOnly.HasValue)
            {
                query += "&ExitWeightTicketsOnly=" + ExitWeightTicketsOnly.ToString();
            }
            if (!string.IsNullOrEmpty(Folio))
            {
                query += "&Folio=" + Folio;
            }
            if (!string.IsNullOrEmpty(Number))
            {
                query += "&Number=" + Number;
            }
            if (WareHouseId.HasValue)
            {
                query += "&WareHouseId=" + WareHouseId.ToString();
            }
            if (StartDateTime.HasValue)
            {
                query += "&StartDateTime=" + StartDateTime.Value.ToString("yyyy-MM-dd 00:00");
            }
            if (EndDateTime.HasValue)
            {
                query += "&EndDateTime=" + EndDateTime.Value.ToString("yyyy-MM-dd 23:59:59");
            }
            return(query);
        }
Beispiel #9
0
 public void Validate()
 {
     AddNotifications(
         new Contract()
         .Requires()
         .HasLen(ProductId.ToString(), 32, "Product", "Id do Produto Inválido")
         .IsGreaterThan(Quantity, 0, "Quantity", "Quantidade inválida")
         );
 }
Beispiel #10
0
 public override void DumpBody(XmlWriter writer)
 {
     writer.WriteElementString("product-id", ProductId.ToString());
     writer.WriteElementString("edition", Edition.ToString());
     writer.WriteElementString("major-version", MajorVersion.ToString());
     writer.WriteElementString("minor-version", MinorVersion.ToString());
     writer.WriteElementString("build-number", BuildNumber.ToString());
     writer.WriteElementString("build-date", BuildDate.ToString());
 }
Beispiel #11
0
        public async Task WhenGetBy()
        {
            var productId = new ProductId();

            var response = await this.client.GetAsync($"api/Order/Product/{productId}");

            var result = JsonConvert.DeserializeObject <ProductRst>(await response.Content.ReadAsStringAsync());

            response.EnsureSuccessStatusCode();
            result.Id.Should().Be(productId.ToString());
        }
        private async Task <List <wde.DeviceInformation> > GetDevicesByIdSlowAsync()
        {
            var allDevices = await GetAllDevices();

            Logger.Log($"Device Ids:{string.Join(", ", allDevices.Select(d => d.Id))} Names:{string.Join(", ", allDevices.Select(d => d.Name))}", null, nameof(UWPHidDevicePoller));

            var vendorIdString  = $"VID_{ VendorId.ToString("X").PadLeft(4, '0')}".ToLower();
            var productIdString = $"PID_{ ProductId.ToString("X").PadLeft(4, '0')}".ToLower();

            return(allDevices.Where(args => args.Id.ToLower().Contains(vendorIdString) && args.Id.ToLower().Contains(productIdString) && args.IsEnabled).ToList());
        }
 public override void Validate()
 {
     AddNotifications(new Contract()
                      .Requires()
                      .IsNotNullOrEmpty(UserId.ToString(), "User", "Usuário é obrigatório")
                      .IsNotNullOrEmpty(Size, "Size", "Tamanho é obrigatório")
                      .HasMaxLen(Size, 200, "Size", "Tamanho deve conter no máximo 20 caracteres")
                      .IsNotNullOrEmpty(Quantity.ToString(), "Quantity", "Quantidade é obrigatória")
                      .IsNotNullOrEmpty(ProductId.ToString(), "Product", "Produto é obrigatório")
                      .IsNotNullOrEmpty(Origin.ToString(), "Origin", "Origem é obrigatório")
                      );
 }
Beispiel #14
0
        /// <summary>
        /// Create a human readable string out of this object.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string res = "====== HidDevice ====\n";

            res += "== Name: " + Name + "\n";
            res += "== Manufacturer: " + Manufacturer + "\n";
            res += "== Product: " + Product + "\n";
            res += "== VendorID: 0x" + VendorId.ToString("X4") + "\n";
            res += "== ProductID: 0x" + ProductId.ToString("X4") + "\n";
            res += "== Version: " + Version + "\n";
            res += "=====================\n";
            return(res);
        }
Beispiel #15
0
 /// <summary>
 ///   Print information about this device to our debug output.
 /// </summary>
 public void DebugWrite()
 {
     Debug.WriteLine(
         "================ HID =========================================================================================");
     Debug.WriteLine("==== Name: " + Name);
     Debug.WriteLine("==== Manufacturer: " + Manufacturer);
     Debug.WriteLine("==== Product: " + Product);
     Debug.WriteLine("==== VendorID: 0x" + VendorId.ToString("X4"));
     Debug.WriteLine("==== ProductID: 0x" + ProductId.ToString("X4"));
     Debug.WriteLine("==== Version: " + Version);
     Debug.WriteLine(
         "==============================================================================================================");
 }
Beispiel #16
0
        private void GetOffer()
        {
            if (CurrentOffer != null)
            {
                bool isMultiOffers = CurrentProduct.Offers.Count > 1;
                bool isAvailable   = CurrentOffer.Amount > 0;
                bool isUnavalable  = CurrentOffer.Amount <= 0;
                bool showBlock     = SettingsCatalog.ShowBlockStockAvailability;

                if (showBlock)
                {
                    lAvailiableAmount.Text = string.Format(
                        "<div id='availability' class='{0}' {3}>{1}{2}</div>",
                        isAvailable ? "available" : "not-available",
                        isAvailable ? Resource.Client_Details_Available : Resource.Client_Details_NotAvailable,
                        isAvailable && SettingsCatalog.ShowStockAvailability
                      ? string.Format(" ({0}{1}<span {3}>{2}</span>)",
                                      CurrentOffer.Amount, CurrentProduct.Unit.IsNotEmpty() ? " " : string.Empty,
                                      CurrentProduct.Unit.IsNotEmpty() ? CurrentProduct.Unit : string.Empty,
                                      (CustomerContext.CurrentCustomer.IsAdmin || AdvantShop.Trial.TrialService.IsTrialEnabled) ? "data-inplace-update=\"amount\"" : "")
                      : string.Empty,
                        InplaceEditor.Offer.AttibuteAmount(CurrentOffer.OfferId, CurrentOffer.Amount));
                }
                else
                {
                    lAvailiableAmount.Text = string.Empty;
                }

                btnOrderByRequest.Attributes["data-offerid"]   = CurrentOffer.OfferId.ToString();
                btnOrderByRequest.Attributes["data-productid"] = CurrentProduct.ProductId.ToString();

                btnAdd.Attributes["data-cart-add-productid"] = ProductId.ToString();
                btnAdd.Attributes["data-cart-add-offerid"]   = CurrentOffer.OfferId.ToString();
                btnAdd.Attributes["data-offerid"]            = CurrentOffer.OfferId.ToString();

                ButtonSetVisible(btnOrderByRequest, (isUnavalable || CurrentOffer.Price == 0) && CurrentProduct.AllowPreOrder, isMultiOffers);
                ButtonSetVisible(btnAdd, CurrentOffer.Price > 0 && isAvailable, isMultiOffers);

                BuyInOneClick.Visible = SettingsOrderConfirmation.BuyInOneClick && CurrentOffer.Price > 0 && isAvailable;

                ShowCreditButtons(isMultiOffers);

                LoadBonusCard();
                LoadShippings();
            }
            else
            {
                lAvailiableAmount.Text = Resource.Client_Details_NotAvailable;
            }
        }
Beispiel #17
0
        internal string ToHidString()
        {
            string vendor  = VendorId.ToString("X4").ToUpper();
            string product = ProductId.ToString("X4").ToUpper();

            if (VersionNumber == 0)
            {
                return($"HID\\VID_{vendor}&PID_{product}");
            }
            else
            {
                string version = VersionNumber.ToString("X4").ToUpper();
                return($"HID\\VID_{vendor}&PID_{product}&REV_{version}");
            }
        }
Beispiel #18
0
 public override void UpdateSettings()
 {
     try
     {
         ModuleController objModules = new ModuleController();
         objModules.UpdateModuleSetting(ModuleId, "OpenCartOnAdd", chkOpenCartOnAdd.Checked.ToString());
         objModules.UpdateModuleSetting(ModuleId, "ContactModulePage", urlContactModulePage.Url);
         objModules.UpdateModuleSetting(ModuleId, "ListModulePage", urlListModulePage.Url);
         objModules.UpdateModuleSetting(ModuleId, "ProductId", ProductId.ToString());
         int isTaxIncluded = (string.IsNullOrEmpty(rblShowNetPrice.SelectedValue) ? 1 : Convert.ToInt32(rblShowNetPrice.SelectedValue));
         objModules.UpdateModuleSetting(ModuleId, "ShowNetPrice", isTaxIncluded.ToString());
         objModules.UpdateModuleSetting(ModuleId, "Template", tplTemplate.Value);
     }
     catch (Exception exc)
     {
         //Module failed to load
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FillcboPropertyName();
                txtSortIndex0.Text = PropertyService.GetNewPropertyValueSortOrder(ProductId).ToString(CultureInfo.InvariantCulture);
            }

            cboPropertyName.CssClass              = RadioButtonExistProperty.Checked ? string.Empty : "disabled";
            txtNewPropertyName.CssClass           = RadioButtonExistProperty.Checked ? "disabled" : string.Empty;
            RadioButtonNewPropertyValue.Checked   = RadioButtonAddNewProperty.Checked || RadioButtonNewPropertyValue.Checked;
            cboPropertyValue.Enabled              = !RadioButtonAddNewProperty.Checked;
            RadioButtonExistPropertyValue.Enabled = !RadioButtonAddNewProperty.Checked;
            RadioButtonExistPropertyValue.Checked = RadioButtonExistPropertyValue.Checked && !RadioButtonAddNewProperty.Checked;

            cboPropertyValue.CssClass    = RadioButtonExistPropertyValue.Checked ? string.Empty : "disabled";
            txtNewPropertyValue.CssClass = RadioButtonExistPropertyValue.Checked ? "disabled" : string.Empty;

            hfpropproductId.Value = ProductId.ToString();
        }
Beispiel #20
0
        public byte[] Serialize()
        {
            byte[] data = null;
            using (var stream = new MemoryStream())
            {
                using (XmlTextWriter writer = new XmlTextWriter(new StreamWriter(stream)))
                {
                    writer.Formatting = Formatting.Indented;

                    writer.WriteStartDocument(true);

                    writer.WriteStartElement("RootElementOfAnyName");
                    writer.WriteStartElement("MythLoginServiceConfig");

                    writer.WriteStartElement("Settings");
                    writer.WriteElementString("ProductId", ProductId.ToString());
                    writer.WriteElementString("MessageTimeoutSecs", MessageTimeoutSecs.ToString());
                    writer.WriteEndElement();//Settings

                    writer.WriteStartElement("RegionList");
                    foreach (var region in Regions)
                    {
                        region.Serialize(writer);
                    }
                    writer.WriteEndElement(); //RegionList

                    writer.WriteEndElement(); //MythLoginServiceConfig
                    writer.WriteEndElement(); //RootElementOfAnyName
                    writer.WriteEndDocument();

                    writer.Flush();
                    writer.WriteString("\r\n");
                }
                data = stream.ToArray();
            }
            return(data);
        }
Beispiel #21
0
        private void ShowCreditButtons(bool isMultiOffers)
        {
            var creditPayment = PaymentService.GetCreditPaymentMethods().FirstOrDefault();

            if (creditPayment != null && CurrentOffer != null)
            {
                btnAddCredit.Attributes["data-cart-add-productid"] = ProductId.ToString();
                btnAddCredit.Attributes["data-cart-add-offerid"]   = CurrentOffer.OfferId.ToString();
                btnAddCredit.Attributes["data-cart-payment"]       = creditPayment.PaymentMethodId.ToString();
                btnAddCredit.Attributes["data-cart-minprice"]      = creditPayment.MinimumPrice.ToString();

                var productPrice = CatalogService.CalculateProductPrice(CurrentOffer.Price,
                                                                        CurrentProduct.CalculableDiscount,
                                                                        CustomerContext.CurrentCustomer.CustomerGroup,
                                                                        CustomOptionsService.DeserializeFromXml(
                                                                            CustomOptionsService.SerializeToXml(productCustomOptions.CustomOptions, productCustomOptions.SelectedOptions)));

                var isVisible = productPrice > creditPayment.MinimumPrice && CurrentOffer.Amount > 0;

                ButtonSetVisible(btnAddCredit, isVisible, isMultiOffers);
                ButtonSetVisible(lblFirstPaymentNote, isVisible && creditPayment.MinimumPrice > 0, isMultiOffers);
                ButtonSetVisible(lblFirstPayment, isVisible && creditPayment.MinimumPrice > 0, isMultiOffers);

                hfFirstPaymentPercent.Value = creditPayment.FirstPayment.ToString();

                lblFirstPayment.Text = creditPayment.FirstPayment > 0
                    ? CatalogService.GetStringPrice(productPrice * creditPayment.FirstPayment / 100) + @"*"
                    : string.Format("<div class=\"price\">{0}*</div>", Resource.Client_Details_WithoutFirstPayment);
            }
            else
            {
                ButtonSetVisible(btnAddCredit, false, false);
                ButtonSetVisible(lblFirstPaymentNote, false, false);
                ButtonSetVisible(lblFirstPayment, false, false);
            }
        }
Beispiel #22
0
 public override string ToString()
 {
     return(ProductId.ToString() + "," + SupplierId.ToString());
 }
Beispiel #23
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // First lets save the product
                SimpleProductInfo SimpleProduct = null;
                bool isNew = false;

                if (ProductId >= 0)
                {
                    SimpleProduct = Controller.GetSimpleProductByProductId(PortalId, ProductId);
                }
                else
                {
                    isNew = true;
                }

                if (SimpleProduct != null)
                {
                    SimpleProduct.Image                = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                    SimpleProduct.ItemNo               = txtItemNo.Text.Trim();
                    SimpleProduct.UnitCost             = taxUnitCost.NetPrice;
                    SimpleProduct.OriginalUnitCost     = taxOriginalUnitCost.NetPrice;
                    SimpleProduct.TaxPercent           = Convert.ToDecimal(txtTaxPercent.Text.Trim());
                    SimpleProduct.LastModifiedByUserId = UserId;
                    SimpleProduct.LastModifiedOnDate   = DateTime.Now;
                    SimpleProduct.Disabled             = chkDisabled.Checked;
                    SimpleProduct.HideCost             = chkHideCost.Checked;
                    SimpleProduct.NoCart               = chkNoCart.Checked;
                    SimpleProduct.SupplierId           = String.IsNullOrEmpty(cboSupplier.SelectedValue) ? -1 : Convert.ToInt32(cboSupplier.SelectedValue);
                    SimpleProduct.UnitId               = String.IsNullOrEmpty(ddlUnit.SelectedValue) ? -1 : Convert.ToInt32(ddlUnit.SelectedValue);
                    SimpleProduct.Weight               = Convert.ToDecimal(txtWeight.Text.Trim());
                    Controller.UpdateSimpleProduct(SimpleProduct);
                }
                else
                {
                    SimpleProduct                      = new SimpleProductInfo();
                    SimpleProduct.PortalId             = PortalId;
                    SimpleProduct.Image                = BBStoreHelper.GetRelativeFilePath(ImageSelector.Url);
                    SimpleProduct.ItemNo               = txtItemNo.Text.Trim();
                    SimpleProduct.UnitCost             = taxUnitCost.NetPrice;
                    SimpleProduct.OriginalUnitCost     = taxOriginalUnitCost.NetPrice;
                    SimpleProduct.TaxPercent           = Convert.ToDecimal(txtTaxPercent.Text.Trim());
                    SimpleProduct.CreatedOnDate        = DateTime.Now;
                    SimpleProduct.LastModifiedOnDate   = DateTime.Now;
                    SimpleProduct.CreatedByUserId      = UserId;
                    SimpleProduct.LastModifiedByUserId = UserId;
                    SimpleProduct.Disabled             = chkDisabled.Checked;
                    SimpleProduct.HideCost             = chkHideCost.Checked;
                    SimpleProduct.NoCart               = chkNoCart.Checked;
                    SimpleProduct.SupplierId           = String.IsNullOrEmpty(cboSupplier.SelectedValue) ? -1 : Convert.ToInt32(cboSupplier.SelectedValue);
                    SimpleProduct.UnitId               = String.IsNullOrEmpty(ddlUnit.SelectedValue) ? -1 : Convert.ToInt32(ddlUnit.SelectedValue);
                    SimpleProduct.Weight               = Convert.ToDecimal(txtWeight.Text.Trim());
                    ProductId = Controller.NewSimpleProduct(SimpleProduct);
                }

                // Lets update the ShippingModel
                Controller.DeleteProductShippingModelByProduct(ProductId);
                int shippingModelId = -1;
                if (cboShippingModel.SelectedValue != null && Int32.TryParse(cboShippingModel.SelectedValue, out shippingModelId))
                {
                    Controller.InsertProductShippingModel(new ProductShippingModelInfo()
                    {
                        ShippingModelId = shippingModelId, SimpleProductId = ProductId
                    });
                }


                // Now lets update Language information
                lngSimpleProducts.UpdateLangs();
                Controller.DeleteSimpleProductLangs(ProductId);
                foreach (SimpleProductLangInfo si in lngSimpleProducts.Langs)
                {
                    si.SimpleProductId = ProductId;
                    Controller.NewSimpleProductLang(si);
                }

                // Lets handle the Product Groups
                int redirProductGroupId = 0;
                if (HasProductGroupModule)
                {
                    if (Request.QueryString["productgroup"] != null)
                    {
                        redirProductGroupId = Convert.ToInt32(Request.QueryString["productgroup"]);
                    }


                    Controller.DeleteProductInGroups(ProductId);
                    foreach (TreeNode node in treeProductGroup.CheckedNodes)
                    {
                        int ProductGroupId = Convert.ToInt32(node.Value.Substring(1));
                        Controller.NewProductInGroup(ProductId, ProductGroupId);
                        if (redirProductGroupId == 0)
                        {
                            redirProductGroupId = ProductGroupId;
                        }
                    }
                }

                // If we created a new product, we bound this as a fixed product to the module
                if (isNew && this.Parent.NamingContainer.ID != "ViewAdmin")
                {
                    ModuleController module = new ModuleController();
                    module.UpdateModuleSetting(ModuleId, "ProductId", ProductId.ToString());
                }
                FeatureGrid.SaveFeatures();

                List <string> addParams = new List <string>();

                if (Request["adminmode"] != null)
                {
                    addParams.Add("adminmode=productlist");
                }
                if (redirProductGroupId > 0)
                {
                    addParams.Add("productgroup=" + redirProductGroupId.ToString());
                }
                addParams.Add("productId=" + ProductId.ToString());

                Response.Redirect(Globals.NavigateURL(TabId, "", addParams.ToArray()), true);
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 public override string ToString()
 {
     return($"{{{nameof(CartId)}={CartId.ToString()}, {nameof(ProductId)}={ProductId.ToString()}, {nameof(Quantity)}={Quantity.ToString()}}}");
 }
Beispiel #25
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("ProductSimple(");
        bool __first = true;

        if (ProductId != null && __isset.productId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ProductId: ");
            ProductId.ToString(sb);
        }
        if (__isset.packageId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("PackageId: ");
            PackageId.ToString(sb);
        }
        if (__isset.version)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Version: ");
            Version.ToString(sb);
        }
        if (__isset.onSale)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("OnSale: ");
            OnSale.ToString(sb);
        }
        if (__isset.validUntil)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ValidUntil: ");
            ValidUntil.ToString(sb);
        }
        if (StickerIdRanges != null && __isset.stickerIdRanges)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("StickerIdRanges: ");
            StickerIdRanges.ToString(sb);
        }
        if (__isset.grantedByDefault)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("GrantedByDefault: ");
            GrantedByDefault.ToString(sb);
        }
        if (__isset.displayOrder)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("DisplayOrder: ");
            DisplayOrder.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
 public override string ToString()
 {
     return(String.Format("{0} {1} {2}", ProductId.ToString(), Name, ListPrice.ToString("C2")));
 }
Beispiel #27
0
 public override int GetHashCode()
 {
     return((OrderId.ToString() + "|" + ProductId.ToString()).GetHashCode());
 }
Beispiel #28
0
 public override string ToString()
 {
     return(string.Concat(ProductId.ToString(), " ", Description, " ", Quantity.ToString(), SupplierID.ToString()));
 }
Beispiel #29
0
        public bool AddNewOrderDetails(OrderDetails orderDetails)
        {
            int id = Convert.ToInt32(Functions.IDGeneration(MyShopConfigration.OrderDetails)) + 1;

            SysRegedit.SaveReg(MyShopConfigration.OrderDetails, id.ToString() + "." + orderDetails.Id, "Id", id.ToString());
            SysRegedit.SaveReg(MyShopConfigration.OrderDetails, id.ToString() + "." + orderDetails.Id, "OrderId", OrderId.ToString());
            SysRegedit.SaveReg(MyShopConfigration.OrderDetails, id.ToString() + "." + orderDetails.Id, "ProductId", ProductId.ToString());
            SysRegedit.SaveReg(MyShopConfigration.OrderDetails, id.ToString() + "." + orderDetails.Id, "Quntity", Quntity.ToString());
            SysRegedit.SaveReg(MyShopConfigration.OrderDetails, id.ToString() + "." + orderDetails.Id, "Amount", Amount.ToString());
            return(true);
        }
 public override string ToString()
 {
     return(ProductId.ToString() + " | " + ProdName);
 }