public void AddParameter(ParametersInfo parameter)
 {
    using (IDataContext ctx = DataContext.Instance())
    {
       var rep = ctx.GetRepository<ParametersInfo>();
       rep.Insert(parameter);
    }
 }
Пример #2
0
 public void ChangeParameter(ParametersInfo parameter)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository <ParametersInfo>();
         rep.Update(parameter);
     }
 }
Пример #3
0
 public void AddParameter(ParametersInfo parameter)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository <ParametersInfo>();
         rep.Insert(parameter);
     }
 }
 public void ChangeParameter(ParametersInfo parameter)
 {
    using (IDataContext ctx = DataContext.Instance())
    {
       var rep = ctx.GetRepository<ParametersInfo>();
       rep.Update(parameter);
    }
 }
      public void ImportModule(int moduleID, string content, string version, int userID)
      {
         XmlNode iFrame = Globals.GetContent(content, "IFrameParameters");

         if (iFrame != null)
         {
            XmlNode moduleSettings = iFrame.SelectSingleNode("ModuleSettings");
            if (moduleSettings != null)
            {
               XmlNode x;
               // Source
               if ((x = moduleSettings.SelectSingleNode("Source")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "Source", x.InnerText);
               // UrlType
               if ((x = moduleSettings.SelectSingleNode("UrlType")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "UrlType", x.InnerText);
               // Width
               if ((x = moduleSettings.SelectSingleNode("Width")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "Width", x.InnerText);
               // Height
               if ((x = moduleSettings.SelectSingleNode("Height")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "Height", x.InnerText);
               // AutoHeight
               if ((x = moduleSettings.SelectSingleNode("AutoHeight")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "AutoHeight", x.InnerText);
               // Scrolling
               if ((x = moduleSettings.SelectSingleNode("Scrolling")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "Scrolling", x.InnerText);
               // Border
               if ((x = moduleSettings.SelectSingleNode("Border")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "Border", x.InnerText);
               // AllowTransparency
               if ((x = moduleSettings.SelectSingleNode("AllowTransparency")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "AllowTransparency", x.InnerText);
               // Name
               if ((x = moduleSettings.SelectSingleNode("Name")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "Name", x.InnerText);
               // ToolTip
               if ((x = moduleSettings.SelectSingleNode("ToolTip")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "ToolTip", x.InnerText);
               // CssStyle
               if ((x = moduleSettings.SelectSingleNode("CssStyle")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "CssStyle", x.InnerText);
               // OnLoadJavaScript
               if ((x = moduleSettings.SelectSingleNode("OnLoadJavaScript")) != null)
                  ModuleController.UpdateModuleSetting(moduleID, "OnLoadJavaScript", x.InnerText);
            }

            XmlNode parameters = iFrame.SelectSingleNode("Parameters");
            if (parameters != null)
            {
               foreach (XmlNode parameter in parameters.SelectNodes("Parameter"))
               {
                  try
                  {
                     string type = parameter.SelectSingleNode("Type").InnerText;
                     string name = parameter.SelectSingleNode("Name").InnerText;
                     string argument = parameter.SelectSingleNode("Argument").InnerText;
                     bool useAsHash = Convert.ToBoolean(parameter.SelectSingleNode("UseAsHash").InnerText);
                     bool update = true;

                     ParametersInfo pi = GetParameter(moduleID, name);
                     if (pi == null)
                     {
                        pi = new ParametersInfo();
                        update = false;
                     }

                     pi.ModuleID = moduleID;
                     ParameterType pt;
                     if (Enum.TryParse(type, out pt))
                        pi.Type = pt;
                     pi.Name = name;
                     pi.Argument = argument;
                     pi.UseAsHash = useAsHash;

                     if (update)
                        ChangeParameter(pi);
                     else
                        AddParameter(pi);
                  }
                  catch(Exception ex)
                  {
                     Exceptions.LogException(ex);
                  }
               }
            }
         }
      }
Пример #6
0
      protected void UpdateParameterButton_Click(object sender, EventArgs e)
      {
         try
         {
            LinkButton updateParameterButton = (LinkButton)sender;
            ParametersInfo parameter;

            if (updateParameterButton.CommandArgument == "-1")
               parameter = new ParametersInfo();
            else
               parameter = ParametersController.GetParameter(Convert.ToInt32(updateParameterButton.CommandArgument));
            parameter.ModuleID = ModuleId;
            parameter.Type = (ParameterType)Convert.ToInt32(ParameterTypeDropDownList.SelectedValue);
            parameter.Name = ParameterNameTextBox.Text;
            parameter.Argument = (ParameterValuePanel.Visible ? ParameterValueTextBox.Text : null);
            parameter.UseAsHash = UseAsHashCheckBox.Checked;
            if (updateParameterButton.CommandArgument == "-1")
               ParametersController.AddParameter(parameter);
            else
               ParametersController.ChangeParameter(parameter);

            ResetParametersForm(true);
         }
         catch (Exception ex)
         {
            Exceptions.ProcessModuleLoadException(this, ex);
         }
      }
Пример #7
0
        public void ImportModule(int moduleID, string content, string version, int userID)
        {
            XmlNode iFrame = Globals.GetContent(content, "IFrameParameters");

            if (iFrame != null)
            {
                XmlNode moduleSettings = iFrame.SelectSingleNode("ModuleSettings");
                if (moduleSettings != null)
                {
                    XmlNode x;
                    // Source
                    if ((x = moduleSettings.SelectSingleNode("Source")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "Source", x.InnerText);
                    }
                    // UrlType
                    if ((x = moduleSettings.SelectSingleNode("UrlType")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "UrlType", x.InnerText);
                    }
                    // Width
                    if ((x = moduleSettings.SelectSingleNode("Width")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "Width", x.InnerText);
                    }
                    // Height
                    if ((x = moduleSettings.SelectSingleNode("Height")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "Height", x.InnerText);
                    }
                    // AutoHeight
                    if ((x = moduleSettings.SelectSingleNode("AutoHeight")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "AutoHeight", x.InnerText);
                    }
                    // Scrolling
                    if ((x = moduleSettings.SelectSingleNode("Scrolling")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "Scrolling", x.InnerText);
                    }
                    // Border
                    if ((x = moduleSettings.SelectSingleNode("Border")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "Border", x.InnerText);
                    }
                    // AllowTransparency
                    if ((x = moduleSettings.SelectSingleNode("AllowTransparency")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "AllowTransparency", x.InnerText);
                    }
                    // Name
                    if ((x = moduleSettings.SelectSingleNode("Name")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "Name", x.InnerText);
                    }
                    // ToolTip
                    if ((x = moduleSettings.SelectSingleNode("ToolTip")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "ToolTip", x.InnerText);
                    }
                    // CssStyle
                    if ((x = moduleSettings.SelectSingleNode("CssStyle")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "CssStyle", x.InnerText);
                    }
                    // OnLoadJavaScript
                    if ((x = moduleSettings.SelectSingleNode("OnLoadJavaScript")) != null)
                    {
                        ModuleController.UpdateModuleSetting(moduleID, "OnLoadJavaScript", x.InnerText);
                    }
                }

                XmlNode parameters = iFrame.SelectSingleNode("Parameters");
                if (parameters != null)
                {
                    foreach (XmlNode parameter in parameters.SelectNodes("Parameter"))
                    {
                        try
                        {
                            string type      = parameter.SelectSingleNode("Type").InnerText;
                            string name      = parameter.SelectSingleNode("Name").InnerText;
                            string argument  = parameter.SelectSingleNode("Argument").InnerText;
                            bool   useAsHash = Convert.ToBoolean(parameter.SelectSingleNode("UseAsHash").InnerText);
                            bool   update    = true;

                            ParametersInfo pi = GetParameter(moduleID, name);
                            if (pi == null)
                            {
                                pi     = new ParametersInfo();
                                update = false;
                            }

                            pi.ModuleID = moduleID;
                            ParameterType pt;
                            if (Enum.TryParse(type, out pt))
                            {
                                pi.Type = pt;
                            }
                            pi.Name      = name;
                            pi.Argument  = argument;
                            pi.UseAsHash = useAsHash;

                            if (update)
                            {
                                ChangeParameter(pi);
                            }
                            else
                            {
                                AddParameter(pi);
                            }
                        }
                        catch (Exception ex)
                        {
                            Exceptions.LogException(ex);
                        }
                    }
                }
            }
        }