Exemplo n.º 1
0
        public Pricelist SaveInfo()
        {
            int affiliateId = int.Parse(ddlAffiliate.SelectedValue);

            PriceListExportModeEnum exportMode          = (PriceListExportModeEnum)Enum.ToObject(typeof(PriceListExportModeEnum), int.Parse(this.ddlExportMode.SelectedItem.Value));
            PriceListExportTypeEnum exportType          = (PriceListExportTypeEnum)Enum.ToObject(typeof(PriceListExportTypeEnum), int.Parse(this.ddlExportType.SelectedItem.Value));
            PriceAdjustmentTypeEnum priceAdjustmentType = (PriceAdjustmentTypeEnum)Enum.ToObject(typeof(PriceAdjustmentTypeEnum), int.Parse(this.ddlPriceAdjustmentType.SelectedItem.Value));
            decimal priceAdjustment = txtPriceAdjustment.Value;

            Pricelist pricelist = ProductManager.GetPricelistById(this.PricelistId);

            if (pricelist != null)
            {
                pricelist = ProductManager.UpdatePricelist(pricelist.PricelistId,
                                                           exportMode, exportType, affiliateId, this.txtDisplayName.Text,
                                                           this.txtShortName.Text, this.txtPricelistGuid.Text, this.txtCacheTime.Value,
                                                           this.ddlFormatLocalization.SelectedValue, this.txtDescription.Text,
                                                           this.txtAdminNotes.Text, this.txtHeader.Text, this.txtBody.Text, this.txtFooter.Text,
                                                           priceAdjustmentType, this.txtPriceAdjustment.Value, this.chkOverrideIndivAdjustment.Checked,
                                                           pricelist.CreatedOn, DateTime.UtcNow);

                SavePricelistChanges(pricelist.PricelistId);
            }
            else
            {
                pricelist = ProductManager.InsertPricelist(
                    exportMode, exportType, affiliateId, this.txtDisplayName.Text,
                    this.txtShortName.Text, this.txtPricelistGuid.Text, this.txtCacheTime.Value, this.ddlFormatLocalization.SelectedValue,
                    this.txtDescription.Text, this.txtAdminNotes.Text, this.txtHeader.Text, this.txtBody.Text, this.txtFooter.Text,
                    priceAdjustmentType, priceAdjustment, chkOverrideIndivAdjustment.Checked,
                    DateTime.UtcNow, DateTime.UtcNow);

                SavePricelistChanges(pricelist.PricelistId);
            }

            return(pricelist);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the Pricelist
        /// </summary>
        /// <param name="PricelistID">Unique Identifier</param>
        /// <param name="ExportMode">Mode of list creation (Export all, assigned only, assigned only with special price)</param>
        /// <param name="ExportType">CSV or XML</param>
        /// <param name="AffiliateID">Affiliate connected to this pricelist (optional), links will be created with AffiliateID</param>
        /// <param name="DisplayName">Displayedname</param>
        /// <param name="ShortName">shortname to identify the pricelist</param>
        /// <param name="PricelistGuid">unique identifier to get pricelist "anonymous"</param>
        /// <param name="CacheTime">how long will the pricelist be in cached before new creation</param>
        /// <param name="FormatLocalization">what localization will be used (numeric formats, etc.) en-US, de-DE etc.</param>
        /// <param name="Description">Displayed description</param>
        /// <param name="AdminNotes">Admin can put some notes here, not displayed in public</param>
        /// <param name="Header">Headerline of the exported file (plain text)</param>
        /// <param name="Body">template for an exportet productvariant, uses delimiters and replacement strings</param>
        /// <param name="Footer">Footer line of the exportet file (plain text)</param>
        /// <param name="PriceAdjustmentType">type of price adjustment (if used) (relative or absolute)</param>
        /// <param name="PriceAdjustment">price will be adjusted by this amount (in accordance with PriceAdjustmentType)</param>
        /// <param name="OverrideIndivAdjustment">use individual adjustment, if available, or override</param>
        /// <param name="CreatedOn">when was this record originally created</param>
        /// <param name="UpdatedOn">last time this recordset was updated</param>
        /// <returns>Pricelist</returns>
        public static Pricelist UpdatePricelist(int PricelistID, PriceListExportModeEnum ExportMode, PriceListExportTypeEnum ExportType, int AffiliateID,
            string DisplayName, string ShortName, string PricelistGuid, int CacheTime, string FormatLocalization,
            string Description, string AdminNotes,
            string Header, string Body, string Footer,
            PriceAdjustmentTypeEnum PriceAdjustmentType, decimal PriceAdjustment, bool OverrideIndivAdjustment,
            DateTime CreatedOn, DateTime UpdatedOn)
        {
            CreatedOn = DateTimeHelper.ConvertToUtcTime(CreatedOn);
            UpdatedOn = DateTimeHelper.ConvertToUtcTime(UpdatedOn);

            DBPricelist dbItem = DBProviderManager<DBProductProvider>.Provider.UpdatePricelist(PricelistID, (int)ExportMode,
                (int)ExportType, AffiliateID, DisplayName, ShortName, PricelistGuid,
                CacheTime, FormatLocalization, Description, AdminNotes, Header, Body, Footer,
                (int)PriceAdjustmentType, PriceAdjustment, OverrideIndivAdjustment,
                CreatedOn, UpdatedOn);
            Pricelist newPricelist = DBMapping(dbItem);

            return newPricelist;
        }
        public Pricelist SaveInfo()
        {
            int affiliateId = int.Parse(ddlAffiliate.SelectedValue);

            PriceListExportModeEnum exportMode          = (PriceListExportModeEnum)Enum.ToObject(typeof(PriceListExportModeEnum), int.Parse(this.ddlExportMode.SelectedItem.Value));
            PriceListExportTypeEnum exportType          = (PriceListExportTypeEnum)Enum.ToObject(typeof(PriceListExportTypeEnum), int.Parse(this.ddlExportType.SelectedItem.Value));
            PriceAdjustmentTypeEnum priceAdjustmentType = (PriceAdjustmentTypeEnum)Enum.ToObject(typeof(PriceAdjustmentTypeEnum), int.Parse(this.ddlPriceAdjustmentType.SelectedItem.Value));
            decimal priceAdjustment = txtPriceAdjustment.Value;

            Pricelist pricelist = this.ProductService.GetPricelistById(this.PricelistId);

            if (pricelist != null)
            {
                pricelist.ExportModeId       = (int)exportMode;
                pricelist.ExportTypeId       = (int)exportType;
                pricelist.AffiliateId        = affiliateId;
                pricelist.DisplayName        = this.txtDisplayName.Text;
                pricelist.ShortName          = this.txtShortName.Text;
                pricelist.PricelistGuid      = this.txtPricelistGuid.Text;
                pricelist.CacheTime          = this.txtCacheTime.Value;
                pricelist.FormatLocalization = this.ddlFormatLocalization.SelectedValue;
                pricelist.Description        = this.txtDescription.Text;
                pricelist.AdminNotes         = this.txtAdminNotes.Text;
                pricelist.Header             = this.txtHeader.Text;
                pricelist.Body   = this.txtBody.Text;
                pricelist.Footer = this.txtFooter.Text;
                pricelist.PriceAdjustmentTypeId   = (int)priceAdjustmentType;
                pricelist.PriceAdjustment         = priceAdjustment;
                pricelist.OverrideIndivAdjustment = chkOverrideIndivAdjustment.Checked;
                pricelist.UpdatedOn = DateTime.UtcNow;

                this.ProductService.UpdatePricelist(pricelist);

                SavePricelistChanges(pricelist.PricelistId);
            }
            else
            {
                pricelist = new Pricelist();
                pricelist.ExportModeId       = (int)exportMode;
                pricelist.ExportTypeId       = (int)exportType;
                pricelist.AffiliateId        = affiliateId;
                pricelist.DisplayName        = this.txtDisplayName.Text;
                pricelist.ShortName          = this.txtShortName.Text;
                pricelist.PricelistGuid      = this.txtPricelistGuid.Text;
                pricelist.CacheTime          = this.txtCacheTime.Value;
                pricelist.FormatLocalization = this.ddlFormatLocalization.SelectedValue;
                pricelist.Description        = this.txtDescription.Text;
                pricelist.AdminNotes         = this.txtAdminNotes.Text;
                pricelist.Header             = this.txtHeader.Text;
                pricelist.Body   = this.txtBody.Text;
                pricelist.Footer = this.txtFooter.Text;
                pricelist.PriceAdjustmentTypeId   = (int)priceAdjustmentType;
                pricelist.PriceAdjustment         = priceAdjustment;
                pricelist.OverrideIndivAdjustment = chkOverrideIndivAdjustment.Checked;
                pricelist.CreatedOn = DateTime.UtcNow;
                pricelist.UpdatedOn = DateTime.UtcNow;

                this.ProductService.InsertPricelist(pricelist);

                SavePricelistChanges(pricelist.PricelistId);
            }

            return(pricelist);
        }