Beispiel #1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    ShippingRateComputationMethod shippingRateComputationMethod = ShippingRateComputationMethodManager.GetShippingRateComputationMethodByID(this.ShippingRateComputationMethodID);

                    if (shippingRateComputationMethod != null)
                    {
                        shippingRateComputationMethod = ShippingRateComputationMethodManager.UpdateShippingRateComputationMethod(shippingRateComputationMethod.ShippingRateComputationMethodID, txtName.Text,
                                                                                                                                 txtDescription.Text, txtConfigureTemplatePath.Text, txtClassName.Text,
                                                                                                                                 txtDisplayOrder.Value);

                        IConfigureShippingRateComputationMethodModule configureModule = GetConfigureModule();
                        if (configureModule != null)
                        {
                            configureModule.Save();
                        }

                        Response.Redirect("ShippingRateComputationMethodDetails.aspx?ShippingRateComputationMethodID=" + shippingRateComputationMethod.ShippingRateComputationMethodID.ToString());
                    }
                    else
                    {
                        Response.Redirect("ShippingRateComputationMethods.aspx");
                    }
                }
                catch (Exception exc)
                {
                    ProcessException(exc);
                }
            }
        }
Beispiel #2
0
        private void BindGrid()
        {
            var shippingRateComputationMethods = ShippingRateComputationMethodManager.GetAllShippingRateComputationMethods();

            gvShippingRateComputationMethods.DataSource = shippingRateComputationMethods;
            gvShippingRateComputationMethods.DataBind();
        }
Beispiel #3
0
 protected void DeleteButton_Click(object sender, EventArgs e)
 {
     try
     {
         ShippingRateComputationMethodManager.DeleteShippingRateComputationMethod(this.ShippingRateComputationMethodID);
         Response.Redirect("ShippingRateComputationMethods.aspx");
     }
     catch (Exception exc)
     {
         ProcessException(exc);
     }
 }
 protected void rdbIsDefault_CheckedChanged(object sender, EventArgs e)
 {
     foreach (GridViewRow row in gvShippingRateComputationMethods.Rows)
     {
         RadioButton rdbIsDefault = (RadioButton)row.FindControl("rdbIsDefault");
         HiddenField hfShippingRateComputationMethodID = (HiddenField)row.FindControl("hfShippingRateComputationMethodID");
         int         shippingRateComputationMethodID   = int.Parse(hfShippingRateComputationMethodID.Value);
         if (rdbIsDefault == sender)
         {
             ShippingManager.ActiveShippingRateComputationMethod = ShippingRateComputationMethodManager.GetShippingRateComputationMethodByID(shippingRateComputationMethodID);
         }
     }
     BindGrid();
 }
        protected void AddButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    ShippingRateComputationMethod shippingRateComputationMethod = ShippingRateComputationMethodManager.InsertShippingRateComputationMethod(txtName.Text,
                                                                                                                                                           txtDescription.Text, txtConfigureTemplatePath.Text, txtClassName.Text, txtDisplayOrder.Value);

                    Response.Redirect("ShippingRateComputationMethodDetails.aspx?ShippingRateComputationMethodID=" + shippingRateComputationMethod.ShippingRateComputationMethodID.ToString());
                }
                catch (Exception exc)
                {
                    ProcessException(exc);
                }
            }
        }
Beispiel #6
0
        private void CreateChildControlsTree()
        {
            ShippingRateComputationMethod shippingRateComputationMethod = ShippingRateComputationMethodManager.GetShippingRateComputationMethodByID(this.ShippingRateComputationMethodID);

            if (shippingRateComputationMethod != null)
            {
                Control child = null;
                try
                {
                    child = base.LoadControl(shippingRateComputationMethod.ConfigureTemplatePath);
                    this.ConfigurePlaceHolder.Controls.Add(child);
                }
                catch (Exception exc)
                {
                }
            }
        }
Beispiel #7
0
        private void BindData()
        {
            ShippingRateComputationMethod shippingRateComputationMethod = ShippingRateComputationMethodManager.GetShippingRateComputationMethodByID(this.ShippingRateComputationMethodID);

            if (shippingRateComputationMethod != null)
            {
                this.txtName.Text                  = shippingRateComputationMethod.Name;
                this.txtDescription.Text           = shippingRateComputationMethod.Description;
                this.txtConfigureTemplatePath.Text = shippingRateComputationMethod.ConfigureTemplatePath;
                this.txtClassName.Text             = shippingRateComputationMethod.ClassName;
                this.txtDisplayOrder.Value         = shippingRateComputationMethod.DisplayOrder;
            }
            else
            {
                Response.Redirect("ShippingRateComputationMethods.aspx");
            }
        }
Beispiel #8
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    var shippingRateComputationMethod = ShippingRateComputationMethodManager.GetShippingRateComputationMethodById(this.ShippingRateComputationMethodId);

                    if (shippingRateComputationMethod != null)
                    {
                        shippingRateComputationMethod = ShippingRateComputationMethodManager.UpdateShippingRateComputationMethod(shippingRateComputationMethod.ShippingRateComputationMethodId,
                                                                                                                                 txtName.Text, txtDescription.Text, txtConfigureTemplatePath.Text,
                                                                                                                                 txtClassName.Text, cbActive.Checked, txtDisplayOrder.Value);

                        var configureModule = GetConfigureModule();
                        if (configureModule != null)
                        {
                            configureModule.Save();
                        }

                        CustomerActivityManager.InsertActivity(
                            "EditShippingProvider",
                            GetLocaleResourceString("ActivityLog.EditShippingProvider"),
                            shippingRateComputationMethod.Name);

                        Response.Redirect(string.Format("ShippingRateComputationMethodDetails.aspx?ShippingRateComputationMethodID={0}&TabID={1}", shippingRateComputationMethod.ShippingRateComputationMethodId, this.GetActiveTabId(this.ShippingTabs)));
                    }
                    else
                    {
                        Response.Redirect("ShippingRateComputationMethods.aspx");
                    }
                }
                catch (Exception exc)
                {
                    ProcessException(exc);
                }
            }
        }
Beispiel #9
0
        private void BindGrid()
        {
            ShippingRateComputationMethodCollection shippingRateComputationMethodCollection = ShippingRateComputationMethodManager.GetAllShippingRateComputationMethods();

            gvShippingRateComputationMethods.DataSource = shippingRateComputationMethodCollection;
            gvShippingRateComputationMethods.DataBind();
        }
        protected override void OnPreRender(EventArgs e)
        {
            StringBuilder warningResult = new StringBuilder();

            //currencies
            if (CurrencyManager.PrimaryExchangeRateCurrency == null)
            {
                warningResult.Append("Primary exchange rate currency is not set. <a href=\"Currencies.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }
            if (CurrencyManager.PrimaryStoreCurrency == null)
            {
                warningResult.Append("Primary store currency is not set. <a href=\"Currencies.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            //measures
            if (MeasureManager.BaseWeightIn == null)
            {
                warningResult.Append("The weight that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }
            if (MeasureManager.BaseDimensionIn == null)
            {
                warningResult.Append("The dimension that will can used as a default is not set. <a href=\"GlobalSettings.aspx\">Set now</a>");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            //languages
            LanguageCollection publishedLanguages = LanguageManager.GetAllLanguages(false);

            foreach (MessageTemplate messageTemplate in MessageManager.GetAllMessageTemplates())
            {
                foreach (Language language in publishedLanguages)
                {
                    LocalizedMessageTemplate localizedMessageTemplate = MessageManager.GetLocalizedMessageTemplate(messageTemplate.Name, language.LanguageId);
                    if (localizedMessageTemplate == null)
                    {
                        warningResult.AppendFormat("You don't have localized version of message template [{0}] for {1}. <a href=\"MessageTemplates.aspx\">Create it now</a>", messageTemplate.Name, language.Name);
                        warningResult.Append("<br />");
                        warningResult.Append("<br />");
                    }
                }
            }
            foreach (Topic topic in TopicManager.GetAllTopics())
            {
                foreach (Language language in publishedLanguages)
                {
                    LocalizedTopic localizedTopic = TopicManager.GetLocalizedTopic(topic.Name, language.LanguageId);
                    if (localizedTopic == null)
                    {
                        warningResult.AppendFormat("You don't have localized version of topic [{0}] for {1}. <a href=\"Topics.aspx\">Create it now</a>", topic.Name, language.Name);
                        warningResult.Append("<br />");
                        warningResult.Append("<br />");
                    }
                }
            }

            //shipping methods
            var srcmList         = ShippingRateComputationMethodManager.GetAllShippingRateComputationMethods(false);
            int offlineSrcmCount = 0;

            foreach (var srcm in srcmList)
            {
                if (srcm.ShippingRateComputationMethodType == ShippingRateComputationMethodTypeEnum.Offline)
                {
                    offlineSrcmCount++;
                }
            }
            if (offlineSrcmCount > 1)
            {
                warningResult.Append("Only one offline shipping rate computation method is recommended to use");
                warningResult.Append("<br />");
                warningResult.Append("<br />");
            }

            string warnings = warningResult.ToString();

            if (!String.IsNullOrEmpty(warnings))
            {
                lblWarnings.Text = warnings;
            }
            else
            {
                this.Visible = false;
            }

            base.OnPreRender(e);
        }