Exemple #1
0
        protected void buttonSend_OnClick(object sender, EventArgs e)
        {
            try
            {
                if (dropDownSettings.SelectedIndex == 0)
                {
                    return;
                }


                string key = dropDownSettings.SelectedValue;


                ApplicationSettings find = Array.Find(settings, delegate(ApplicationSettings s)
                {
                    return(s.SettingId.ToString() == key);
                });

                if (find.DataType == "text")
                {
                    find.SettingValue = textBoxText.Text;
                }
                else if (find.DataType == "integer")
                {
                    int f;

                    bool parse = Int32.TryParse(textBoxInteger.Text, out f);


                    if (parse == false)
                    {
                        this.Master.ShowErrorMessage("Please enter a valid numeric value");

                        return;
                    }

                    find.SettingValue = textBoxInteger.Text;
                }
                else if (find.DataType == "double")
                {
                    double d;

                    bool parse = Double.TryParse(textBoxInteger.Text, out d);


                    if (parse == false)
                    {
                        this.Master.ShowErrorMessage("Please enter a valid numeric value");

                        return;
                    }

                    find.SettingValue = textBoxInteger.Text;
                }
                else if (find.DataType == "bool")
                {
                    if (radioButtonTrue.Checked)
                    {
                        find.SettingValue = "true";
                    }
                    else
                    {
                        find.SettingValue = "false";
                    }
                }

                manager.Update(find);


                ApplicationContext.UpdateOption(find);

                Response.Redirect(Request.RawUrl, true);
            }
            catch (Exception ex)
            {
                Log.WriteTraceOutput(ex);
            }
        }