Xml序列化与反序列化
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         HelpClick.Attributes.Add("onclick", PopupHelper.GeneratePopupScript(
                    "../../Help/Design/AppTypeHelp.htm", 260, 530, false, false, false, false));
         Util util = new Util();
         Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
         if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;
         XmlUtil x_util = new XmlUtil();
         AppType.Items.Clear();
         AppType.Items.Add(new RadComboBoxItem("Select ->", "->"));
         switch (State["SelectedAppType"].ToString())
         {
             case Constants.NATIVE_APP_TYPE:
                 AppType.Items.Add(new RadComboBoxItem("Web App Type (no accecss to native device resources)", Constants.WEB_APP_TYPE));
                 AppType.Items.Add(new RadComboBoxItem("Hybrid App Type", Constants.HYBRID_APP_TYPE));
                 break;
             case Constants.WEB_APP_TYPE:
                 AppType.Items.Add(new RadComboBoxItem("Native App Type", Constants.NATIVE_APP_TYPE));
                 AppType.Items.Add(new RadComboBoxItem("Hybrid App Type", Constants.HYBRID_APP_TYPE));
                  break;
             case Constants.HYBRID_APP_TYPE:
                  AppType.Items.Add(new RadComboBoxItem("Web App Type (no accecss to native device resources)", Constants.WEB_APP_TYPE));
                  AppType.Items.Add(new RadComboBoxItem("Native App Type", Constants.NATIVE_APP_TYPE));
                 break;
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (State == null || State.Count <= 2) { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "timeOut('../Default.aspx');", true); return; }

        string device_type = x_util.GetAppDeviceType(State);
        if (device_type == null)
        {
            UploadMessage.Text = "Before you can add a custom background you first need to save the app.";
            return;
        }

        switch (device_type)
        {
            case Constants.ANDROID_PHONE:
                Width.Text = Constants.ANDROID_PHONE_DISPLAY_WIDTH_S;
                Height.Text = (Constants.ANDROID_PHONE_DISPLAY_HEIGHT - 20).ToString();
                break;
            case Constants.ANDROID_TABLET:
                Width.Text = Constants.ANDROID_TABLET_DISPLAY_WIDTH_S;
                Height.Text = (Constants.ANDROID_TABLET_DISPLAY_HEIGHT - 25).ToString();
                break;
            case Constants.IPAD:
                Width.Text = Constants.IPAD_DISPLAY_WIDTH_S;
                Height.Text = (Constants.IPAD_DISPLAY_HEIGHT - 25).ToString();
                break;
            case Constants.IPHONE:
            default:
                Width.Text = Constants.IPHONE_DISPLAY_WIDTH_S;
                Height.Text = (Constants.IPHONE_DISPLAY_HEIGHT - 20).ToString();
                break;
        }
    }
    public XmlDocument GetCustomerInfo()
    {
        XmlUtil x_util = new XmlUtil();
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlNode status = null;
        XmlDocument Response = new XmlDocument();
        XmlNode root = Response.CreateElement("response");
        Response.AppendChild(root);
        try
        {
            DB db = new DB();
            String sql = "SELECT COUNT(*) FROM customers WHERE status!='inactive'";
            String count = db.ViziAppsExecuteScalar(State, sql);
            x_util.CreateNode(Response, root, "customer_count", count);
            db.CloseViziAppsDatabase(State);
            x_util.CreateNode(Response, root, "status", "success");
        }
        catch (System.Exception SE)
        {
            util.LogError(State, SE);

            if (status == null)
            {
                Response = new XmlDocument();
                XmlNode root2 = Response.CreateElement("response");
                Response.AppendChild(root2);
                status = x_util.CreateNode(Response, root2, "status");

            }
            status.InnerText = SE.Message;
            util.LogError(State, SE);
        }
        return Response;
    }
    public void InitAppPages()
    {
        AppPages.Items.Clear();
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());

        foreach (string page in pages)
        {
            AppPages.Items.Add(new RadComboBoxItem(page, page));
        }
        if (pages.Length == 0)
             State["SelectedAppPage"] = null;

        if ( State["SelectedAppPage"] == null)
        {
            AppPages.SelectedIndex = 0;
             State["SelectedAppPage"] = AppPages.SelectedValue;

        }
        else
            AppPages.SelectedValue =  State["SelectedAppPage"].ToString();

        if (State["SelectedAppPage"] != null)
            PageName.Text = State["SelectedAppPage"].ToString();
    }
    protected void DesignedForDevice_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();

            DesignedForDevice.Text = e.Text;
            string device_design = e.Value;
            DeviceType.Text = e.Text;
            XmlUtil x_util = new XmlUtil();
            string previous_device_design = x_util.GetAppDeviceType(State);

            //State["SelectedDeviceView"] = device_design;
            State["SelectedDeviceType"] = device_design;
            if (State["SelectedApp"] == null || State["SelectedApp"].ToString().Contains("->"))
            {
                util.SetDefaultBackgroundForView(State,device_design);
            }

            x_util.SetAppDeviceType(State, previous_device_design, device_design);

            Message.Text = "Main device for App has been set.";
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        Util util = new Util();
        if (util.CheckSessionTimeout(State,Response,"Default.aspx")) return;

        if (!IsPostBack)
        {

            XmlUtil x_util = new XmlUtil();
            if ( State["PageHtml"] == null) //get html if there is a selected app
                x_util.GetStagingAppXml(State);

            if ( State["PageHtml"] == null) //no selected app
                return;

            int left = 0;
            if (State["SelectedDeviceType"] != null &&
                (State["SelectedDeviceType"].ToString() == Constants.IPAD ||
                 State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET))
            {
                State["BackgroundImageUrl"] = null;
                State["BackgroundHtml"] = null;
                     if ( State["BackgroundColor"] == null)
                         State["BackgroundColor"] = "#cccccc";

                    string background_color_div_prefix = null;
                    if (State["SelectedDeviceType"].ToString() == Constants.IPAD)
                        background_color_div_prefix = "<div style=\"border:0px;width:" + Constants.IPAD_SPLASH_PORTRAIT_WIDTH_S + "px;height:" + Constants.IPAD_SPLASH_PORTRAIT_HEIGHT_S + "px;vertical-align:top;background-color:" + State["BackgroundColor"].ToString() + "\" >";
                    else if (State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET)
                        background_color_div_prefix = "<div style=\"border:0px;width:" + Constants.ANDROID_TABLET_SPLASH_PORTRAIT_WIDTH_S + "px;height:" + Constants.ANDROID_TABLET_SPLASH_PORTRAIT_HEIGHT_S + "px;vertical-align:top;background-color:" + State["BackgroundColor"].ToString() + "\" >";

                    string background_color_div_suffix = "</div>";
                   html_content.Text = background_color_div_prefix +  State["PageHtml"].ToString() + background_color_div_suffix;

                     if (( State["SelectedAppPage"] == null || x_util.IsFirstAppPage(State,  State["SelectedAppPage"].ToString())) )
                    {
                        left = (State["SelectedDeviceType"].ToString() == Constants.IPAD) ? 731 : 763;
                        string background = "<img src=\"images/editor_images/settings_button.png\" style=\"position:absolute;top:5px;left:" + left.ToString() + "px\"/>";
                        html_content.Text += background;
                    }
            }
            else{
                left = 283;
                 if ( State["BackgroundImageUrl"] == null)
                      State["BackgroundImageUrl"] = "https://s3.amazonaws.com/MobiFlexImages/apps/images/backgrounds/standard_w_header_iphone.jpg";

                  string background = "<img id=\"background_image\" src=\"" + State["BackgroundImageUrl"].ToString() + "\" style=\"position:absolute;top:0px;left:0px;height:100%;width:100%\"/>";
                 if ((State["SelectedAppPage"] == null || x_util.IsFirstAppPage(State, State["SelectedAppPage"].ToString())) && State["SelectedAppType"].ToString() == Constants.NATIVE_APP_TYPE)
                 {
                     background += "<img src=\"images/editor_images/settings_button.png\" style=\"position:absolute;top:5px;left:" + left.ToString() + "px\"/>";
                 }

                 html_content.Text = background +  State["PageHtml"].ToString();
                  State["BackgroundHtml"] = background;
            }
        }
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "../Default.aspx")) return;

        State["BackgroundColor"] = System.Drawing.ColorTranslator.ToHtml(BackgroundColor.SelectedColor);
        XmlUtil x_util = new XmlUtil();
        x_util.SetBackgroundColor((Hashtable)HttpRuntime.Cache[Session.SessionID],  State["BackgroundColor"].ToString());
        Message.Text = "App Background Color has been saved.";
    }
 protected void Clear_Click(object sender, EventArgs e)
 {
     XmlUtil x_util = new XmlUtil();
     Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
     x_util.SetAppOpenAction(State, null);
     actions.Items[0].Selected = true;
     actionsMultiPage.PageViews[0].Selected = true;
     docompute.Checked = false;
     compute.Value = "";
     Message.Text = "Cleared.";
     Clear.Style.Value = "display:none";
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Util util = new Util();
         Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
         if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;
         XmlUtil x_util = new XmlUtil();
         State["PageTransitionType"] = x_util.GetPageTransitionType(State);
         PageTransitions.Items.FindItemByValue(State["PageTransitionType"].ToString()).Selected = true;
     }
 }
    protected void Clear_Click(object sender, EventArgs e)
    {
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        Util util = new Util();
        if (util.CheckSessionTimeout(State, Response, "../Default.aspx")) return;

        x_util.ClearMobileCommerce(State);

        MobileCommerceUsername.Text = "";
        MobileCommercePassword.Text = "";
        Message.Text = "Mobile Commerce has been cleared.";
    }
    protected void InitActions()
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        actions.Items.Add(new RadComboBoxItem("Select action ->", ""));
        XmlUtil x_util = new XmlUtil();
        if (State["SelectedAppType"].ToString() == Constants.WEB_APP_TYPE)
        {
            actions.Items.Add(new RadComboBoxItem("Go to page", "next_page"));
            actions.Items.Add(new RadComboBoxItem("If/Then Go to page ", "if_then_next_page"));
            actions.Items.Add(new RadComboBoxItem("Go to previous page", "previous_page"));
            actions.Items.Add(new RadComboBoxItem("Get or send device data via a web data source", "post"));
        }
        else if (State["SelectedAppType"].ToString() == Constants.NATIVE_APP_TYPE)
        {
            actions.Items.Add(new RadComboBoxItem("Go to page", "next_page"));
            actions.Items.Add(new RadComboBoxItem("If/Then Go to page ", "if_then_next_page"));
            actions.Items.Add(new RadComboBoxItem("Go to previous page", "previous_page"));
            actions.Items.Add(new RadComboBoxItem("Get or send device data via a web data source", "post"));
            actions.Items.Add(new RadComboBoxItem("Call phone", "call"));
            actions.Items.Add(new RadComboBoxItem("Share a message through Facebook, Texting or Email using a popup menu", "share"));
            actions.Items.Add(new RadComboBoxItem("Email message", "email"));
            actions.Items.Add(new RadComboBoxItem("Text message", "sms"));
            actions.Items.Add(new RadComboBoxItem("Take a photo", "take_photo"));
            actions.Items.Add(new RadComboBoxItem("Capture a signature", "capture_signature"));
            actions.Items.Add(new RadComboBoxItem("Login to mobile commerce", "login_to_mcommerce"));
            actions.Items.Add(new RadComboBoxItem("Initialize card swiper for charge", "init_card_swiper"));
            actions.Items.Add(new RadComboBoxItem("Manually charge credit card", "manual_card_charge"));
            actions.Items.Add(new RadComboBoxItem("Void credit card charge", "void_charge"));

            if (State["AccountType"].ToString().Contains("kofax"))
            {
                //actions.Items.Add(new RadComboBoxItem("Capture documents from camera photos", "capture_doc"));
                actions.Items.Add(new RadComboBoxItem("Capture and Process documents from photos", "capture_process_document"));
                actions.Items.Add(new RadComboBoxItem("Manage document case", "manage_document_case"));
            }
            if (State["AccountType"].ToString().Contains("intuit"))
            {
                actions.Items.Add(new RadComboBoxItem("Pay with Intuit GoPayment App", "call_intuit_gopayment"));
            }

        }
        else if (State["SelectedAppType"].ToString() == Constants.HYBRID_APP_TYPE)
        {
            actions.Items.Add(new RadComboBoxItem("Go to page", "next_page"));
            actions.Items.Add(new RadComboBoxItem("If/Then Go to page ", "if_then_next_page"));
            actions.Items.Add(new RadComboBoxItem("Go to previous page", "previous_page"));
            actions.Items.Add(new RadComboBoxItem("Get or send device data via a web data source", "post"));
        }
    }
Esempio n. 12
0
    public Controls_GoToPage(string selected_page)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlUtil x_util = new XmlUtil();
        string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());

        gotopage.Items.Clear();
        foreach (string name in pages)
        {
            Telerik.Web.UI.RadComboBoxItem item = new Telerik.Web.UI.RadComboBoxItem(name, name);
            gotopage.Items.Add(item);
            if (name == selected_page)
                item.Selected = true;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (State == null || State.Count <= 2) { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "timeOut('../Default.aspx');", true); return; }

        if (!IsPostBack)
        {
            String[] Values = x_util.GetMobileCommerce(State, State["SelectedApp"].ToString());
            if (Values != null)
            {
                MobileCommerceUsername.Text = Values[0];
                MobileCommercePassword.Text = Values[1];
            }
        }
    }
Esempio n. 14
0
        public XDocument CallShowMainstreamProviderService(string providerId)
        {
            XDocument result = null;
            string service = "CSSProviders - ShowMainstreamProviders";
            LogUtil.CallingService(service, providerId);

            try
            {
                result = new XmlUtil().ParseXmlDocument(GetCSSProviderClient().CallShowMainstreamProviders(providerId));
                LogUtil.CallSuccess("showMainstreamProvider", result.ToString());
            }
            catch (Exception e)
            {
                LogUtil.CallFail(service, e);
                throw;
            }
            return result;
        }
Esempio n. 15
0
        /// <summary>
        /// Calls the Livematch service and returns result as XML Document
        /// </summary>
        /// <param name="method"></param>
        /// <param name="parameters"></param>
        /// <returns>XmlDocument</returns>
        public XmlDocument CallLiveMatchService(string method, Hashtable parameters)
        {
            var liveMatchClient = GetLiveMatchClient();

            string service = "LiveMatchClient";
            LogUtil.CallingService(service, LogUtil.getHashtableString(parameters));

            XmlDocument result = null;
            try
            {
                result = new XmlUtil().LoadXmlDocument(liveMatchClient.CallWebservice(method, parameters));
                LogUtil.CallSuccess(service, result.ToString());
            }
            catch (Exception e)
            {
                LogUtil.CallFail(service, e);
                throw;
            }
            return result;
        }
    protected void Save_Click(object sender, EventArgs e)
    {
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        Util util = new Util();
        if (util.CheckSessionTimeout(State, Response, "../Default.aspx")) return;

        if (MobileCommerceUsername.Text.Trim().Length == 0)
        {
            Message.Text = "Set the Username.";
            return;
        }
        if (MobileCommercePassword.Text.Trim().Length == 0)
        {
            Message.Text = "Set the Password.";
            return;
        }
        x_util.SetMobileCommerce(State, MobileCommerceUsername.Text.Trim(), MobileCommercePassword.Text.Trim());
        Message.Text = "Mobile Commerce has been set.";
    }
Esempio n. 17
0
    protected void AppType_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        Util util = new Util();
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();

            AppType.Text = e.Text;
            util.SetAppType(State, e.Value);
            string prev_app_type = State["SelectedAppType"].ToString();
            State["SelectedAppType"] = e.Value;
            switch (State["SelectedAppType"].ToString())
            {
                case Constants.NATIVE_APP_TYPE:
                    RedirectPage.Text = "TabDesignNative.aspx";
                    break;
                case Constants.WEB_APP_TYPE:
                    if (prev_app_type == Constants.NATIVE_APP_TYPE)
                        x_util.ConvertNativeAppToWebApp(State);
                     RedirectPage.Text = "TabDesignWeb.aspx";
                    break;
                case Constants.HYBRID_APP_TYPE:
                   if (prev_app_type == Constants.NATIVE_APP_TYPE)
                        x_util.ConvertNativeAppToWebApp(State);

                    RedirectPage.Text = "TabDesignHybrid.aspx";
                    break;
            }
             Message.Text = "The App Type has been changed...";
            //ajax return will close this dialog box and change page windows
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
    protected void PageTransitions_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();

            PageTransitions.Text = e.Text;
            State["PageTransitionType"] = e.Value;
            XmlUtil x_util = new XmlUtil();
            x_util.SetPageTransitionType(State, e.Value);
            Message.Text = "The Page Transition Type has been set.";
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
    protected void SaveWebServiceInfo_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "../../Default.aspx.aspx")) return;

        ClearMessages();

        if (WebServiceURL.Text.Length == 0)
        {
            SaveWebServiceInfoMessage.Text = "Enter Web Service URL";
            return;
        }
        //save in app xml
        XmlUtil x_util = new XmlUtil();
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode root = doc.SelectSingleNode("app_project");
        if (root == null)
            root = doc.SelectSingleNode("mobiflex_project");

        XmlNode database_config = doc.SelectSingleNode("//database_config");
        if (database_config == null)
        {
            database_config = x_util.CreateNode(doc, root, "database_config");
        }

        XmlNode database_webservice_url = doc.SelectSingleNode("database_webservice_url");
        if (database_webservice_url == null)
            x_util.CreateNode(doc, database_config, "database_webservice_url", WebServiceURL.Text);
        else
            database_webservice_url.InnerText = WebServiceURL.Text;

        util.UpdateStagingAppXml(State);

         ((Hashtable)HttpRuntime.Cache[Session.SessionID])["DBWebServiceURL"] = WebServiceURL.Text;

        SaveWebServiceInfoMessage.Text = "Your Web Service URL has been saved.";
    }
Esempio n. 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Util util = new Util();
         Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
         if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;
         XmlUtil x_util = new XmlUtil();
         State["SelectedDeviceType"] = x_util.GetAppDeviceType(State);
         DesignedForDevice.Items.Clear();
         DesignedForDevice.Items.Add(new RadComboBoxItem("Select ->", "->"));
         switch (State["SelectedDeviceType"].ToString())
         {
             case Constants.IPHONE:
                 DesignedForDevice.Items.Add(new RadComboBoxItem("iPad", Constants.IPAD));
                 DesignedForDevice.Items.Add(new RadComboBoxItem("Android Phone", Constants.ANDROID_PHONE));
                 DesignedForDevice.Items.Add(new RadComboBoxItem("Android Tablet", Constants.ANDROID_TABLET));
                 break;
             case Constants.IPAD:
                 DesignedForDevice.Items.Add(new RadComboBoxItem("iPhone", Constants.IPHONE));
                 DesignedForDevice.Items.Add(new RadComboBoxItem("Android Phone", Constants.ANDROID_PHONE));
                 DesignedForDevice.Items.Add(new RadComboBoxItem("Android Tablet", Constants.ANDROID_TABLET));
                break;
             case Constants.ANDROID_PHONE:
                 DesignedForDevice.Items.Add(new RadComboBoxItem("iPhone", Constants.IPHONE));
                  DesignedForDevice.Items.Add(new RadComboBoxItem("iPad", Constants.IPAD));
                 DesignedForDevice.Items.Add(new RadComboBoxItem("Android Tablet", Constants.ANDROID_TABLET));
                break;
              case Constants.ANDROID_TABLET:
                 DesignedForDevice.Items.Add(new RadComboBoxItem("iPhone", Constants.IPHONE));
                  DesignedForDevice.Items.Add(new RadComboBoxItem("iPad", Constants.IPAD));
                 DesignedForDevice.Items.Add(new RadComboBoxItem("Android Phone", Constants.ANDROID_PHONE));
                break;
        }
     }
 }
 protected void Save_Click(object sender, EventArgs e)
 {
     Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
     if (PageName.Value.Length == 0)
     {
         Message.Text = "Enter an Page Name";
         return;
     }
     else if (!Check.ValidateObjectNameNoSpace(Message, PageName.Value))
     {
         return;
     }
     XmlUtil x_util = new XmlUtil();
     string[] pages = x_util.GetAppPageNames(State, State["SelectedApp"].ToString());
     foreach (string page in pages)
     {
         if (PageName.Value == page)
         {
             Message.Text = "The New Page Name has already been used. Try another name";
             return;
         }
     }
     Message.Text = "Saved.";
 }
        public override bool GenerarVariablesDocumentoInstancia()
        {
            bool resultado = true;

            var    parametrosConfiguracion = this.ObtenerParametrosConfiguracion();
            string emisora          = null;
            string strFechaEvento   = null;
            string moneda           = null;
            string namespaceEmisora = null;

            if (!parametrosConfiguracion.TryGetValue("fecha", out strFechaEvento))
            {
                if (!parametrosConfiguracion.TryGetValue("fechaEvento", out strFechaEvento))
                {
                    return(false);
                }
            }

            if (!parametrosConfiguracion.TryGetValue("emisora", out emisora) ||
                !parametrosConfiguracion.TryGetValue("moneda", out moneda))
            {
                return(false);
            }

            DateTime fechaEvento = new DateTime();

            if (!XmlUtil.ParsearUnionDateTime(strFechaEvento, out fechaEvento, DateTimeStyles.AdjustToUniversal))
            {
                return(false);
            }

            if (!this.variablesPlantilla.ContainsKey("nombreEntidad"))
            {
                this.variablesPlantilla.Add("nombreEntidad", emisora);
            }

            if (!this.variablesPlantilla.ContainsKey("esquemaEntidad"))
            {
                if (parametrosConfiguracion.TryGetValue("namespaceEmisora", out namespaceEmisora))
                {
                    if (namespaceEmisora != null)
                    {
                        this.variablesPlantilla.Add("esquemaEntidad", namespaceEmisora);
                    }
                }
                else
                {
                    this.variablesPlantilla.Add("esquemaEntidad", "http://www.bmv.com.mx/id");
                }
            }

            if (!this.variablesPlantilla.ContainsKey("medida_MXN"))
            {
                this.variablesPlantilla.Add("medida_MXN", moneda.Replace("http://www.xbrl.org/2003/iso4217:", ""));
            }


            if (!this.variablesPlantilla.ContainsKey("medida_http___www_xbrl_org_2003_iso4217"))
            {
                this.variablesPlantilla.Add("medida_http___www_xbrl_org_2003_iso4217", "http://www.xbrl.org/2003/iso4217");
            }

            if (!this.variablesPlantilla.ContainsKey("valorDefaultNumerico"))
            {
                this.variablesPlantilla.Add("valorDefaultNumerico", "0");
            }

            if (!this.variablesPlantilla.ContainsKey("valorDefaultNoNumerico"))
            {
                this.variablesPlantilla.Add("valorDefaultNoNumerico", " ");
            }

            if (!this.variablesPlantilla.ContainsKey("fecha_2016_09_30"))
            {
                this.variablesPlantilla.Add("fecha_2016_09_30", DateUtil.ToFormatString(fechaEvento, DateUtil.YMDateFormat));                 //fecha fin del año anterior
            }
            if (!variablesPlantilla.ContainsKey("medida_http___www_xbrl_org_2003_instance"))
            {
                this.variablesPlantilla.Add("medida_http___www_xbrl_org_2003_instance", "http://www.xbrl.org/2003/instance");
            }

            if (!variablesPlantilla.ContainsKey("medida_pure"))
            {
                this.variablesPlantilla.Add("medida_pure", "pure");
            }

            return(resultado);
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            //
            bool   b;
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "datepicker.css");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b));
            }
            string[] jsFiles = new string[8];
            jsFiles[0] = "backstripes.gif";
            jsFiles[1] = "bg_header.jpg";
            jsFiles[2] = "bullet1.gif";
            jsFiles[3] = "bullet2.gif";
            jsFiles[4] = "cal.gif";
            jsFiles[5] = "cal-grey.gif";
            jsFiles[6] = "datepicker.js";
            jsFiles[7] = "gradient-e5e5e5-ffffff.gif";
            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), jsFiles[i]);
                if (File.Exists(btimg))
                {
                    _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Javascript, out b));
                }
            }
            //
            bool    inDataRepeater = false;
            Control p = this.Parent;

            while (p != null)
            {
                if (p is HtmlDataRepeater)
                {
                    inDataRepeater = true;
                    break;
                }
                p = p.Parent;
            }
            if (inDataRepeater)
            {
                string fs          = string.Format(CultureInfo.InvariantCulture, "{0}px", _ftSize);
                string includeTime = IncludeTime ? "true" : "false";
                string cannotMove  = Movable ? "false" : "true";
                string pid         = (this.Parent is Form) ? "*" : (this.Parent.Site != null ? this.Parent.Site.Name : this.Parent.Name);
                XmlUtil.SetAttribute(node, "useDP", true);
                XmlUtil.SetAttribute(node, "useDPTime", includeTime);
                XmlUtil.SetAttribute(node, "useDPSize", fs);
                XmlUtil.SetAttribute(node, "useDPfix", cannotMove);
                XmlUtil.SetAttribute(node, "useDPid", pid);
                XmlUtil.SetAttribute(node, "useDPx", this.Left);
                XmlUtil.SetAttribute(node, "useDPy", this.Top);
                if (!_visible)
                {
                    XmlUtil.SetAttribute(node, "useDPv", true);
                }
            }
            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateElementPosition(this, style, EnumWebElementPositionType.Auto);
            XmlUtil.SetAttribute(node, "style", style.ToString());

            //
            _visible = true;
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                _visible = false;
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Esempio n. 24
0
        private static void ReadEntry(XmlNode xmlNode, PwGroup pgParent,
                                      PwDatabase pwStorage)
        {
            PwEntry pe = new PwEntry(true, true);

            pgParent.AddEntry(pe, true);

            DateTime?ndt;

            foreach (XmlNode xmlChild in xmlNode)
            {
                if (xmlChild.Name == ElemEntryName)
                {
                    pe.Strings.Set(PwDefs.TitleField, new ProtectedString(
                                       pwStorage.MemoryProtection.ProtectTitle,
                                       XmlUtil.SafeInnerText(xmlChild)));
                }
                else if (xmlChild.Name == ElemEntryUser)
                {
                    pe.Strings.Set(PwDefs.UserNameField, new ProtectedString(
                                       pwStorage.MemoryProtection.ProtectUserName,
                                       XmlUtil.SafeInnerText(xmlChild)));
                }
                else if (xmlChild.Name == ElemEntryPassword)
                {
                    pe.Strings.Set(PwDefs.PasswordField, new ProtectedString(
                                       pwStorage.MemoryProtection.ProtectPassword,
                                       XmlUtil.SafeInnerText(xmlChild)));
                }
                else if (xmlChild.Name == ElemEntryURL)
                {
                    pe.Strings.Set(PwDefs.UrlField, new ProtectedString(
                                       pwStorage.MemoryProtection.ProtectUrl,
                                       XmlUtil.SafeInnerText(xmlChild)));
                }
                else if (xmlChild.Name == ElemEntryNotes)
                {
                    pe.Strings.Set(PwDefs.NotesField, new ProtectedString(
                                       pwStorage.MemoryProtection.ProtectNotes,
                                       XmlUtil.SafeInnerText(xmlChild)));
                }
                else if (xmlChild.Name == ElemEntryLastModTime)
                {
                    ndt = ReadTime(xmlChild);
                    if (ndt.HasValue)
                    {
                        pe.LastModificationTime = ndt.Value;
                    }
                }
                else if (xmlChild.Name == ElemEntryExpireTime)
                {
                    ndt = ReadTime(xmlChild);
                    if (ndt.HasValue)
                    {
                        pe.ExpiryTime = ndt.Value;
                        pe.Expires    = true;
                    }
                }
                else if (xmlChild.Name == ElemEntryCreatedTime)
                {
                    ndt = ReadTime(xmlChild);
                    if (ndt.HasValue)
                    {
                        pe.CreationTime = ndt.Value;
                    }
                }
                else if (xmlChild.Name == ElemEntryLastAccTime)
                {
                    ndt = ReadTime(xmlChild);
                    if (ndt.HasValue)
                    {
                        pe.LastAccessTime = ndt.Value;
                    }
                }
                else if (xmlChild.Name == ElemEntryUsageCount)
                {
                    ulong uUsageCount;
                    if (ulong.TryParse(XmlUtil.SafeInnerText(xmlChild), out uUsageCount))
                    {
                        pe.UsageCount = uUsageCount;
                    }
                }
                else if (xmlChild.Name == ElemEntryAutoType)
                {
                    pe.AutoType.DefaultSequence = MapAutoType(
                        XmlUtil.SafeInnerText(xmlChild));
                }
                else if (xmlChild.Name == ElemEntryCustom)
                {
                    ReadCustomContainer(xmlChild, pe);
                }
                else if (xmlChild.Name == ElemImageIndex)
                {
                    pe.IconId = MapIcon(XmlUtil.SafeInnerText(xmlChild), true);
                }
                else if (Array.IndexOf <string>(ElemEntryUnsupportedItems,
                                                xmlChild.Name) >= 0)
                {
                }
                else
                {
                    Debug.Assert(false, xmlChild.Name);
                }
            }

            string strInfoText = pe.Strings.ReadSafe(FieldInfoText);

            if ((pe.Strings.ReadSafe(PwDefs.NotesField).Length == 0) &&
                (strInfoText.Length > 0))
            {
                pe.Strings.Remove(FieldInfoText);
                pe.Strings.Set(PwDefs.NotesField, new ProtectedString(
                                   pwStorage.MemoryProtection.ProtectNotes, strInfoText));
            }
        }
Esempio n. 25
0
 /// <summary>
 /// 反序列化指定的类
 /// </summary>
 /// <param name="configfilepath">config 文件的路径</param>
 /// <param name="configtype">相应的类型</param>
 /// <returns></returns>
 public static IConfigInfo DeserializeInfo(string configfilepath, Type configtype)
 {
     return((IConfigInfo)XmlUtil.Load(configtype, configfilepath));
 }
Esempio n. 26
0
        protected override void BuildXml()
        {
            if (Request.Form["CKFinderCommand"] != "true")
            {
                ConnectorException.Throw(Errors.InvalidRequest);
            }

            if (!this.CurrentFolder.CheckAcl(AccessControlRules.FolderCreate))
            {
                ConnectorException.Throw(Errors.Unauthorized);
            }

            string sNewFolderName = HttpContext.Current.Request.QueryString["newFolderName"];

            if (!Connector.CheckFolderName(sNewFolderName) || Config.Current.CheckIsHiddenFolder(sNewFolderName))
            {
                ConnectorException.Throw(Errors.InvalidName);
            }
            else
            {
                // Map the virtual path to the local server path of the current folder.
                string sServerDir = System.IO.Path.Combine(this.CurrentFolder.ServerPath, sNewFolderName);

                bool bCreated = false;

                if (System.IO.Directory.Exists(sServerDir))
                {
                    ConnectorException.Throw(Errors.AlreadyExist);
                }

                try
                {
                    Util.CreateDirectory(sServerDir);
                    bCreated = true;
                }
                catch (ArgumentException)
                {
                    ConnectorException.Throw(Errors.InvalidName);
                }
                catch (System.IO.PathTooLongException)
                {
                    ConnectorException.Throw(Errors.InvalidName);
                }
                catch (System.Security.SecurityException)
                {
                    ConnectorException.Throw(Errors.AccessDenied);
                }
                catch (ConnectorException connectorException)
                {
                    throw connectorException;
                }
                catch (Exception)
                {
#if DEBUG
                    throw;
#else
                    ConnectorException.Throw(Errors.Unknown);
#endif
                }

                if (bCreated)
                {
                    XmlNode oNewFolderNode = XmlUtil.AppendElement(this.ConnectorNode, "NewFolder");
                    XmlUtil.SetAttribute(oNewFolderNode, "name", sNewFolderName);
                }
            }
        }
 public ShortCut(XmlNode node)
 {
     _node     = node;
     _filename = XmlUtil.GetAttribute(node, "file");
     _key      = _filename.ToLowerInvariant();
 }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlElement tNode = node.OwnerDocument.CreateElement("legend");

            node.AppendChild(tNode);
            tNode.InnerText = this.Text;
            tNode.IsEmpty   = false;
            //
            StringBuilder sb = new StringBuilder();

            //
            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
    public void InitCurrentApp(string app)
    {
        try
        {
            Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
            CurrentApp.SelectedValue = app;
            Util util = new Util();
            if (app.Contains("->"))
            {
                ResetAppStateVariables();
                DesignMessage.Text = "Select an App or Click the New App Icon";
                State["SelectedDeviceType"] = Constants.IPHONE;
                //State["SelectedDeviceView"] = Constants.IPHONE;
                SetViewForDevice();
                HideAppControls();
                AppName.Text = "";
                return;
            }
            State["SelectedApp"] = app;
            AppName.Text = app;
            State["SelectedAppType"] = util.GetAppType(State);
            switch (State["SelectedAppType"].ToString())
            {
                case Constants.NATIVE_APP_TYPE:
                    Response.Redirect("TabDesignNative.aspx", false);
                    break;
                case Constants.WEB_APP_TYPE:
                     break;
                case Constants.HYBRID_APP_TYPE:
                    Response.Redirect("TabDesignHybrid.aspx", false);
                    break;
            }
            XmlUtil x_util = new XmlUtil();
            util.GetStagingAppXml(State, app);
           // State["SelectedDeviceView"] =
            State["SelectedDeviceType"] = x_util.GetAppDeviceType(State);
            if (State["SelectedDeviceType"] == null)
            {
               // State["SelectedDeviceView"] =
                State["SelectedDeviceType"] = Constants.IPHONE;
            }
            if (State["SelectedDeviceType"].ToString() == Constants.IPAD ||
                State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET)
            {
                State["BackgroundColor"] = x_util.GetBackgroundColor(State);
            }
            DeviceType.Text = State["SelectedDeviceType"].ToString();
            SetViewForDevice();

            InitAppPages();
             DesignMessage.Text = "";

            string html = x_util.GetFirstAppPage(State);
            State["PageHtml"] = html;

            DefaultButtonImage.Text = util.GetDefaultButton(State);

            AppPages.SelectedValue = State["SelectedAppPage"].ToString();

            ShowAppControls();
        }
        catch (Exception ex)
        {
            Util util = new Util();
            Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
    protected void MovePageUp_Click(object sender, ImageClickEventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        if (SavedCanvasHtml.Text.Length > 0)
        {
            if (!SavePage())
                return;
        }
        if (State["SelectedApp"] == null)
            return;

        XmlUtil x_util = new XmlUtil();
        x_util.MovePageUp(State);
        InitAppPages();
    }
Esempio n. 31
0
    /// <summary>
    ///  结算
    /// </summary>
    /// <param name="source"></param>
    /// <param name="e"></param>
    protected void btnAudit_Click(object source, EventArgs e)
    {
        int    compID    = 0;
        int    disID     = 0;
        long   price     = 0;            //金额
        int    ordID     = 0;            //订单Id
        string ReceiptNo = string.Empty; //订单号
        string guid      = string.Empty; //流水号
        string remark    = string.Empty; //订单备注

        //-----银行信息
        string orgcode              = string.Empty; //机构代码
        int    accountType          = 0;            //帐号类型
        string paymentaccountname   = string.Empty; //账户名称
        string paymentaccountnumber = string.Empty; //账户号码
        string bankaccount          = string.Empty; //收款方在银行开立的账户
        string bankId        = string.Empty;        //银行ID
        string accountname   = string.Empty;        //账户名称
        string accountnumber = string.Empty;        //账户号码
        string branchname    = string.Empty;        //开会行地址
        string province      = string.Empty;        //开会所在省
        string city          = string.Empty;        //开会所在市

        //结算接口日志表
        Hi.Model.PAY_PayLog paylogmodel = new Hi.Model.PAY_PayLog();
        Hi.BLL.PAY_PayLog   paylogbll   = new Hi.BLL.PAY_PayLog();
        int paylogID = 0;//接口日志返回ID

        string str = CB_SelAll();

        if (string.IsNullOrEmpty(str))
        {
            JScript.AlertMsgOne(this, "请选择要结算的记录!", JScript.IconOption.错误, 2500);
            return;
        }
        string[] strArry = str.Split(',');

        foreach (string s in strArry)
        {
            ordID = Convert.ToInt32(s);//订单编号

            DataTable dt_order = new Hi.BLL.PAY_PrePayment().GetdataTable(1, " and dis_order.ID =" + ordID, 1);
            if (dt_order.Rows.Count <= 0)
            {
                JScript.AlertMsgOne(this, "支付数据中没有相关的记录,无法进行收款结算,请检查数据!", JScript.IconOption.错误, 2500);
                return;
            }
            foreach (DataRow dr in dt_order.Rows)
            {
                compID    = Convert.ToInt32(dr["CompID"]);
                disID     = Convert.ToInt32(dr["DisID"]);
                price     = Convert.ToInt64(Convert.ToDecimal(dr["PayPrice"]) * 100);
                ReceiptNo = Convert.ToString(dr["ReceiptNo"]);
                guid      = Convert.ToString(dr["GUID"]);
                remark    = Convert.ToString(dr["Remark"]);

                //查找企业银行信息(绑定>默认)
                DataTable dt_bank_bydis = new Hi.BLL.PAY_PrePayment().GetdataTable(2, " and PAY_PaymentAccountdtl.DisID=" + disID, 0); //结算接口,银行信息--已代理商为核心
                DataTable dt_bank_comp  = new Hi.BLL.PAY_PrePayment().GetdataTable(3, " and PAY_PaymentBank.CompID=" + compID, 0);     //结算接口,银行信息--已企业为主,


                if (dt_bank_bydis.Rows.Count > 0)
                {
                    foreach (DataRow drdis in dt_bank_bydis.Rows)
                    {
                        orgcode              = Convert.ToString(drdis["OrgCode"]); //机构代码
                        accountType          = Convert.ToInt32(drdis["type"]);     //帐号类型
                        paymentaccountname   = Convert.ToString(drdis["payName"]); //账户名称
                        paymentaccountnumber = Convert.ToString(drdis["PayCode"]); //账户号码
                        //收款方在银行开立的账户
                        bankId        = "700";                                     // Convert.ToString(drdis["BankID"]); ;//银行ID
                        accountname   = Convert.ToString(drdis["AccountName"]);    //账户名称
                        accountnumber = Convert.ToString(drdis["bankcode"]);       //账户号码
                        branchname    = Convert.ToString(drdis["bankAddress"]);    //开会行地址
                        province      = Convert.ToString(drdis["bankprivate"]);    //开会所在省
                        city          = Convert.ToString(drdis["bankcity"]);       //开会所在市
                    }
                }
                else if (dt_bank_comp.Rows.Count > 0)
                {
                    foreach (DataRow drcomp in dt_bank_comp.Rows)
                    {
                        orgcode              = Convert.ToString(drcomp["OrgCode"]); //机构代码
                        accountType          = Convert.ToInt32(drcomp["type"]);     //帐号类型
                        paymentaccountname   = Convert.ToString(drcomp["payName"]); //账户名称
                        paymentaccountnumber = Convert.ToString(drcomp["PayCode"]); //账户号码
                        //收款方在银行开立的账户
                        bankId        = Convert.ToString(drcomp["BankID"]);;        //银行ID
                        accountname   = Convert.ToString(drcomp["AccountName"]);    //账户名称
                        accountnumber = Convert.ToString(drcomp["bankcode"]);       //账户号码
                        branchname    = Convert.ToString(drcomp["bankAddress"]);    //开会行地址
                        province      = Convert.ToString(drcomp["bankprivate"]);    //开会所在省
                        city          = Convert.ToString(drcomp["bankcity"]);       //开会所在市
                    }
                }
                //判断参数收款银行是否维护
                if (accountType == 0)
                {
                    JScript.AlertMsgOne(this, "无法进行收款结算,请在【结算账户管理】中维护收款帐号信息!", JScript.IconOption.错误, 2500);
                    return;
                }
                if ((accountType == 11 || accountType == 12) && bankId != "" && accountname != "" && accountnumber != "")
                {
                    //先插入日志表,
                    paylogmodel.OrderId     = ordID;
                    paylogmodel.Ordercode   = ReceiptNo;
                    paylogmodel.number      = guid;
                    paylogmodel.CompID      = compID;
                    paylogmodel.OrgCode     = orgcode;
                    paylogmodel.MarkName    = paymentaccountname;
                    paylogmodel.MarkNumber  = paymentaccountnumber;
                    paylogmodel.AccountName = accountname;
                    paylogmodel.bankcode    = accountnumber;
                    paylogmodel.bankAddress = branchname;
                    paylogmodel.bankPrivate = province;
                    paylogmodel.bankCity    = city;
                    paylogmodel.Price       = price;
                    paylogmodel.Remark      = remark;
                    paylogmodel.CreateDate  = DateTime.Now;
                    paylogmodel.CreateUser  = this.UserID;
                    paylogID = paylogbll.Add(paylogmodel);


                    if (paylogID > 0)//日志插入成功
                    {
                        //调用中金接口,做结算处理-------------------------------
                        try
                        {
                            string configPath = WebConfigurationManager.AppSettings["payment.config.path"];
                            PaymentEnvironment.Initialize(configPath);

                            // 2.创建交易请求对象
                            Tx1341Request tx1341Request = new Tx1341Request();
                            tx1341Request.setInstitutionID(orgcode);
                            tx1341Request.setSerialNumber(guid);
                            tx1341Request.setOrderNo(ReceiptNo);
                            tx1341Request.setAmount(price);
                            tx1341Request.setRemark(remark);
                            tx1341Request.setAccountType(accountType);
                            tx1341Request.setPaymentAccountName(paymentaccountname);
                            tx1341Request.setPaymentAccountNumber(paymentaccountnumber);

                            BankAccount bankAccount = new BankAccount();
                            bankAccount.setBankID(bankId);
                            bankAccount.setAccountName(accountname);
                            bankAccount.setAccountNumber(accountnumber);
                            bankAccount.setBranchName(branchname);
                            bankAccount.setProvince(province);
                            bankAccount.setCity(city);
                            tx1341Request.setBankAccount(bankAccount);

                            // 3.执行报文处理
                            tx1341Request.process();

                            //2个信息参数
                            HttpContext.Current.Items["txCode"] = "1341";
                            HttpContext.Current.Items["txName"] = "市场订单结算(结算)";

                            // 与支付平台进行通讯
                            TxMessenger txMessenger = new TxMessenger();
                            String[]    respMsg     = txMessenger.send(tx1341Request.getRequestMessage(), tx1341Request.getRequestSignature());// 0:message; 1:signature
                            String      plaintext   = XmlUtil.formatXmlString(Encoding.UTF8.GetString(Convert.FromBase64String(respMsg[0])));
                            Console.WriteLine("[message] = [" + respMsg[0] + "]");
                            Console.WriteLine("[signature] = [" + respMsg[1] + "]");
                            Console.WriteLine("[plaintext] = [" + plaintext + "]");

                            Tx134xResponse tx134xResponse = new Tx134xResponse(respMsg[0], respMsg[1]);
                            HttpContext.Current.Items["plainText"] = tx134xResponse.getResponsePlainText();
                            string strs = tx134xResponse.getCode() + "," + tx134xResponse.getMessage();
                            //消息提示
                            //JScript.ShowAlert(this, strs);

                            if ("2000".Equals(tx134xResponse.getCode()))
                            {
                                //处理业务

                                //日志记录 接口返回的信息
                                paylogmodel.Start         = tx134xResponse.getCode();
                                paylogmodel.ResultMessage = tx134xResponse.getMessage();
                                paylogmodel.ID            = paylogID;
                                bool payLog_update = paylogbll.Update(paylogmodel);

                                //修改订单状态
                                Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(ordID);
                                orderModel.PayState = 6;
                                orderModel.ID       = ordID;
                                bool fal = new Hi.BLL.DIS_Order().Update(orderModel);
                                if (fal)
                                {
                                    Utils.AddSysBusinessLog(CompID, "Order", ordID.ToString(), "订单结算", "");
                                    JScript.AlertMsgOne(this, "操作成功!", JScript.IconOption.笑脸);
                                    Bind();
                                }
                            }
                            else
                            {
                                JScript.AlertMsgOne(this, strs + "!", JScript.IconOption.错误);
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }
                    else
                    {
                        Utils.AddSysBusinessLog(CompID, "Order", ordID.ToString(), "系统繁忙,接口日志文件插入失败!", "");
                        JScript.AlertMsgOne(this, "系统繁忙,接口日志文件插入失败!", JScript.IconOption.错误, 2500);
                    }
                }

                //支付账户类型判断**************************************************************************************
                else if (accountType == 20 && paymentaccountname != "" && paymentaccountnumber != "")
                {
                    //先插入日志表,
                    paylogmodel.OrderId     = ordID;
                    paylogmodel.Ordercode   = ReceiptNo;
                    paylogmodel.number      = guid;
                    paylogmodel.CompID      = compID;
                    paylogmodel.OrgCode     = orgcode;
                    paylogmodel.MarkName    = paymentaccountname;
                    paylogmodel.MarkNumber  = paymentaccountnumber;
                    paylogmodel.AccountName = accountname;
                    paylogmodel.bankcode    = accountnumber;
                    paylogmodel.bankAddress = branchname;
                    paylogmodel.bankPrivate = province;
                    paylogmodel.bankCity    = city;
                    paylogmodel.Price       = price;
                    paylogmodel.Remark      = remark;
                    paylogmodel.CreateDate  = DateTime.Now;
                    paylogmodel.CreateUser  = this.UserID;
                    paylogID = paylogbll.Add(paylogmodel);


                    if (paylogID > 0)//日志插入成功
                    {
                        //调用中金接口,做结算处理-------------------------------
                        try
                        {
                            string configPath = WebConfigurationManager.AppSettings["payment.config.path"];
                            PaymentEnvironment.Initialize(configPath);

                            // 2.创建交易请求对象
                            Tx1341Request tx1341Request = new Tx1341Request();
                            tx1341Request.setInstitutionID(orgcode);
                            tx1341Request.setSerialNumber(guid);
                            tx1341Request.setOrderNo(ReceiptNo);
                            tx1341Request.setAmount(price);
                            tx1341Request.setRemark(remark);
                            tx1341Request.setAccountType(accountType);
                            tx1341Request.setPaymentAccountName(paymentaccountname);
                            tx1341Request.setPaymentAccountNumber(paymentaccountnumber);

                            BankAccount bankAccount = new BankAccount();
                            bankAccount.setBankID(bankId);
                            bankAccount.setAccountName(accountname);
                            bankAccount.setAccountNumber(accountnumber);
                            bankAccount.setBranchName(branchname);
                            bankAccount.setProvince(province);
                            bankAccount.setCity(city);
                            tx1341Request.setBankAccount(bankAccount);

                            // 3.执行报文处理
                            tx1341Request.process();

                            //2个信息参数
                            HttpContext.Current.Items["txCode"] = "1341";
                            HttpContext.Current.Items["txName"] = "市场订单结算(结算)";

                            // 与支付平台进行通讯
                            TxMessenger txMessenger = new TxMessenger();
                            String[]    respMsg     = txMessenger.send(tx1341Request.getRequestMessage(), tx1341Request.getRequestSignature());// 0:message; 1:signature
                            String      plaintext   = XmlUtil.formatXmlString(Encoding.UTF8.GetString(Convert.FromBase64String(respMsg[0])));
                            Console.WriteLine("[message] = [" + respMsg[0] + "]");
                            Console.WriteLine("[signature] = [" + respMsg[1] + "]");
                            Console.WriteLine("[plaintext] = [" + plaintext + "]");

                            Tx134xResponse tx134xResponse = new Tx134xResponse(respMsg[0], respMsg[1]);
                            HttpContext.Current.Items["plainText"] = tx134xResponse.getResponsePlainText();
                            string strs = tx134xResponse.getCode() + "," + tx134xResponse.getMessage();
                            //消息提示
                            //JScript.ShowAlert(this, strs);

                            if ("2000".Equals(tx134xResponse.getCode()))
                            {
                                //处理业务

                                //日志记录 接口返回的信息
                                paylogmodel.Start         = tx134xResponse.getCode();
                                paylogmodel.ResultMessage = tx134xResponse.getMessage();
                                paylogmodel.ID            = paylogID;
                                bool payLog_update = paylogbll.Update(paylogmodel);

                                //修改订单状态
                                Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(ordID);
                                orderModel.PayState = 6;
                                orderModel.ID       = ordID;
                                bool fal = new Hi.BLL.DIS_Order().Update(orderModel);
                                if (fal)
                                {
                                    Utils.AddSysBusinessLog(CompID, "Order", ordID.ToString(), "订单结算", "");
                                    JScript.AlertMsgOne(this, "操作成功!", JScript.IconOption.笑脸);
                                    Bind();
                                }
                            }
                            else
                            {
                                JScript.AlertMsgOne(this, strs + "!", JScript.IconOption.错误);
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }
                    else
                    {
                        Utils.AddSysBusinessLog(CompID, "Order", ordID.ToString(), "系统繁忙,接口日志文件插入失败!", "");

                        JScript.AlertMsgOne(this, "系统繁忙,接口日志文件插入失败!", JScript.IconOption.错误, 2500);
                    }
                }
                else
                {
                    if (accountType == 11 || accountType == 12)
                    {
                        JScript.AlertMsgOne(this, "银行名称、持卡人名称、银行卡号不能为空!", JScript.IconOption.错误, 2500);
                    }
                    else
                    {
                        JScript.AlertMsgOne(this, "中金账户名称、中金账户号码不能为空!", JScript.IconOption.错误, 2500);
                    }
                }
            }
        }
    }
    protected bool CheckPageName(string app, string page_name)
    {
        try
        {
            ClearMessages();
            if (page_name.Length == 0)
            {
                Message.Text = "Enter Page Name";
                return false;
            }

            //check for valid name
            if (!Check.ValidateObjectName(Message, page_name))
            {
                return false;
            }

            //check for previous name
            XmlUtil x_util = new XmlUtil();
            Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
            string[] page_names = x_util.GetAppPageNames(State, app);
            foreach (string name in page_names)
            {
                if (name == page_name)
                {
                    Message.Text = "The page name " + page_name + " already exists.";
                    return false;
                }
            }

            return true;
        }
        catch (Exception ex)
        {
            Util util = new Util();
            Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
            return false;
        }
    }
 public static void Init()
 {
     if (!_knowTypesAdded)
     {
         XmlUtil.AddKnownType("WebPage", typeof(WebPage));
         VPLUtil.DelegateLogIdeProfiling = DesignUtil.LogIdeProfile;
         _knowTypesAdded = true;
         //
         VirtualWebDir.OnValidationError = new EventHandler(MathNode.OnSetLastValidationError);
         //
         XmlUtil.CreateDesignTimeType = new fnCreateDesignTimeType(CreateClassType);
         //
         VPLUtil.GetClassTypeFromDynamicType = new fnGetClassTypeFromDynamicType(ClassPointerX.GetClassTypeFromDynamicType);
         VPLUtil.CollectLanguageIcons        = ProjectResources.CollectLanguageIcons;
         VPLUtil.GetLanguageImageByName      = TreeViewObjectExplorer.GetLangaugeBitmapByName;
         VPLUtil.SetServiceByName(VPLUtil.SERVICE_ComponentSelector, typeof(ComponentPointerSelector <EasyDataSet>));
         VPLUtil.PropertyValueLinkEditor  = ParameterValue.GetValueSelector();
         VPLUtil.PropertyValueLinkType    = typeof(PropertyValue);
         VPLUtil.delegateGetComponentID   = GetComponentID;
         VPLUtil.delegateGetComponentList = GetProjectComponents;
         VPLUtil.RemoveDialogCaches       = FrmObjectExplorer.RemoveDialogueCaches;
         VPLUtil.VariableMapTargetType    = typeof(ParameterValue);
         //
         VariableMap.ValueTypeSelectorType = typeof(SelectorEnumValueType);
         //
         XmlSerializerUtility.OnCreateWriterFromReader = new fnCreateWriterFromReader(CreateWriterFromReader);
         //
         MathNode.Init();
         MathNode.AddPlugin(typeof(MathNodeActionInput));
         //
         XmlUtil.AddKnownType("ParameterValue", typeof(ParameterValue));
         XmlUtil.AddKnownType("ActionClass", typeof(ActionClass));
         XmlUtil.AddKnownType("SetterPointer", typeof(SetterPointer));
         XmlUtil.AddKnownType("PropertyPointer", typeof(PropertyPointer));
         XmlUtil.AddKnownType("ClassPointer", typeof(ClassPointer));
         //
         XmlUtil.AddKnownType("MethodClass", typeof(MethodClass));
         XmlUtil.AddKnownType("CustomMethodPointer", typeof(CustomMethodPointer));
         XmlUtil.AddKnownType("ConstructorClass", typeof(ConstructorClass));
         XmlUtil.AddKnownType("GetterClass", typeof(GetterClass));
         XmlUtil.AddKnownType("PropertyClass", typeof(PropertyClass));
         //
         XmlUtil.AddKnownType("SetterClass", typeof(SetterClass));
         XmlUtil.AddKnownType("CustomPropertyPointer", typeof(CustomPropertyPointer));
         XmlUtil.AddKnownType("UserControl", typeof(UserControl));
         XmlUtil.AddKnownType("ConstObjectPointer", typeof(ConstObjectPointer));
         XmlUtil.AddKnownType("DataTypePointer", typeof(DataTypePointer));
         //
         XmlUtil.AddKnownType("Form", typeof(Form));
         XmlUtil.AddKnownType("LimnorWinApp", typeof(LimnorWinApp));
         XmlUtil.AddKnownType("ComponentPointer", typeof(ComponentPointer));
         XmlUtil.AddKnownType("TypePointerCollection", typeof(TypePointerCollection));
         XmlUtil.AddKnownType("MessageBox", typeof(MessageBox));
         //
         XmlUtil.AddKnownType("WebService", typeof(WebService));
         XmlUtil.AddKnownType("WebServiceAttribute", typeof(WebServiceAttribute));
         XmlUtil.AddKnownType("WebMethodAttribute", typeof(WebMethodAttribute));
         XmlUtil.AddKnownType("WebServiceBindingAttribute", typeof(WebServiceBindingAttribute));
         //
         XmlUtil.AddKnownType("LimnorKioskApp", typeof(LimnorKioskApp));
         XmlUtil.AddKnownType("LimnorConsole", typeof(LimnorConsole));
         XmlUtil.AddKnownType("Console", typeof(Console));
         XmlUtil.AddKnownType("Object", typeof(Object));
         XmlUtil.AddKnownType("MethodInfoPointer", typeof(MethodInfoPointer));
         //
         XmlUtil.AddKnownType("Control", typeof(Control));
         XmlUtil.AddKnownType("EventAction", typeof(EventAction));
         XmlUtil.AddKnownType("EventPointer", typeof(EventPointer));
         XmlUtil.AddKnownType("TaskID", typeof(TaskID));
         XmlUtil.AddKnownType("Button", typeof(Button));
         //
         XmlUtil.AddKnownType("ActionMethodReturn", typeof(ActionMethodReturn));
         XmlUtil.AddKnownType("MathNodeRoot", typeof(MathNodeRoot));
         XmlUtil.AddKnownType("EnumIconType", typeof(EnumIconType));
         XmlUtil.AddKnownType("Size", typeof(Size));
         XmlUtil.AddKnownType("Font", typeof(Font));
         //
         XmlUtil.AddKnownType("Color", typeof(Color));
         XmlUtil.AddKnownType("Point", typeof(Point));
         XmlUtil.AddKnownType("MathNodeVariable", typeof(MathNodeVariable));
         XmlUtil.AddKnownType("RaisDataType", typeof(RaisDataType));
         XmlUtil.AddKnownType("MathNodePropertyField", typeof(MathNodePropertyField));
         //
         XmlUtil.AddKnownType("ActionAssignment", typeof(ActionAssignment));
         XmlUtil.AddKnownType("MathNodePropertySetValue", typeof(MathNodePropertySetValue));
         XmlUtil.AddKnownType("TypePointer", typeof(TypePointer));
         XmlUtil.AddKnownType("AB_SingleAction", typeof(AB_SingleAction));
         XmlUtil.AddKnownType("ActionPortOut", typeof(ActionPortOut));
         //
         XmlUtil.AddKnownType("enumPositionType", typeof(enumPositionType));
         XmlUtil.AddKnownType("DrawingVariable", typeof(DrawingVariable));
         XmlUtil.AddKnownType("ActionPortIn", typeof(ActionPortIn));
         XmlUtil.AddKnownType("PropertyReturnAction", typeof(PropertyReturnAction));
         XmlUtil.AddKnownType("ParameterClass", typeof(ParameterClass));
         //
         XmlUtil.AddKnownType("MemberComponentId", typeof(MemberComponentId));
         XmlUtil.AddKnownType("MathNodeIntegral", typeof(MathNodeIntegral));
         XmlUtil.AddKnownType("MathExpItem", typeof(MathExpItem));
         XmlUtil.AddKnownType("MathExpGroup", typeof(MathExpGroup));
         XmlUtil.AddKnownType("EnumIncludeReturnPorts", typeof(EnumIncludeReturnPorts));
         //
         XmlUtil.AddKnownType("MathNodeArgument", typeof(MathNodeArgument));
         XmlUtil.AddKnownType("MathNodeAssign", typeof(MathNodeAssign));
         XmlUtil.AddKnownType("MathNodeCondition", typeof(MathNodeCondition));
         XmlUtil.AddKnownType("MathNodeConditions", typeof(MathNodeConditions));
         XmlUtil.AddKnownType("MathNodeDefaultValue", typeof(MathNodeDefaultValue));
         //
         XmlUtil.AddKnownType("MathNodeFunction", typeof(MathNodeFunction));
         XmlUtil.AddKnownType("MathNodeInc", typeof(MathNodeInc));
         XmlUtil.AddKnownType("IntegerVariable", typeof(IntegerVariable));
         XmlUtil.AddKnownType("Modulus", typeof(Modulus));
         XmlUtil.AddKnownType("MathNodeBitAnd", typeof(MathNodeBitAnd));
         //
         XmlUtil.AddKnownType("MathNodeBitOr", typeof(MathNodeBitOr));
         XmlUtil.AddKnownType("LogicVariable", typeof(LogicVariable));
         XmlUtil.AddKnownType("LogicFalse", typeof(LogicFalse));
         XmlUtil.AddKnownType("LogicTrue", typeof(LogicTrue));
         XmlUtil.AddKnownType("LogicNot", typeof(LogicNot));
         //
         XmlUtil.AddKnownType("LogicAnd", typeof(LogicAnd));
         XmlUtil.AddKnownType("LogicOr", typeof(LogicOr));
         XmlUtil.AddKnownType("LogicGreaterThan", typeof(LogicGreaterThan));
         XmlUtil.AddKnownType("LogicGreaterThanOrEqual", typeof(LogicGreaterThanOrEqual));
         XmlUtil.AddKnownType("LogicValueEquality", typeof(LogicValueEquality));
         //
         XmlUtil.AddKnownType("LogicValueInEquality", typeof(LogicValueInEquality));
         XmlUtil.AddKnownType("LogicLessThan", typeof(LogicLessThan));
         XmlUtil.AddKnownType("LogicLessThanOrEqual", typeof(LogicLessThanOrEqual));
         XmlUtil.AddKnownType("MathNodeMethodInvoke", typeof(MathNodeMethodInvoke));
         XmlUtil.AddKnownType("MathNodeParameter", typeof(MathNodeParameter));
         //
         XmlUtil.AddKnownType("MathNodeStringContains", typeof(MathNodeStringContains));
         XmlUtil.AddKnownType("MathNodeStringBegins", typeof(MathNodeStringBegins));
         XmlUtil.AddKnownType("MathNodeStringEnds", typeof(MathNodeStringEnds));
         XmlUtil.AddKnownType("MathNodeStringGT", typeof(MathNodeStringGT));
         XmlUtil.AddKnownType("MathNodeStringGET", typeof(MathNodeStringGET));
         //
         XmlUtil.AddKnownType("MathNodeStringLT", typeof(MathNodeStringLT));
         XmlUtil.AddKnownType("MathNodeStringLET", typeof(MathNodeStringLET));
         XmlUtil.AddKnownType("MathNodeStringEQ", typeof(MathNodeStringEQ));
         XmlUtil.AddKnownType("MathNodeStringValue", typeof(MathNodeStringValue));
         XmlUtil.AddKnownType("StringVariable", typeof(StringVariable));
         //
         XmlUtil.AddKnownType("MathNodeStringAdd", typeof(MathNodeStringAdd));
         XmlUtil.AddKnownType("MathNodeSum", typeof(MathNodeSum));
         XmlUtil.AddKnownType("MathNodeValue", typeof(MathNodeValue));
         XmlUtil.AddKnownType("MathNodeNumber", typeof(MathNodeNumber));
         XmlUtil.AddKnownType("MathNodeVariable", typeof(MathNodeVariable));
         //
         XmlUtil.AddKnownType("MathNodeVariableDummy", typeof(MathNodeVariableDummy));
         XmlUtil.AddKnownType("MathNodeSqrt", typeof(MathNodeSqrt));
         XmlUtil.AddKnownType("MathNodeAbs", typeof(MathNodeAbs));
         XmlUtil.AddKnownType("MathNodeAcos", typeof(MathNodeAcos));
         XmlUtil.AddKnownType("MathNodeAsin", typeof(MathNodeAsin));
         //
         XmlUtil.AddKnownType("MathNodeAtan", typeof(MathNodeAtan));
         XmlUtil.AddKnownType("MathNodeAtan2", typeof(MathNodeAtan2));
         XmlUtil.AddKnownType("MathNodeCeiling", typeof(MathNodeCeiling));
         XmlUtil.AddKnownType("MathNodeCos", typeof(MathNodeCos));
         XmlUtil.AddKnownType("MathNodeCos2", typeof(MathNodeCos2));
         //
         XmlUtil.AddKnownType("MathNodeCosh", typeof(MathNodeCosh));
         XmlUtil.AddKnownType("MathNodeFloor", typeof(MathNodeFloor));
         XmlUtil.AddKnownType("MathNodeIEEERemainder", typeof(MathNodeIEEERemainder));
         XmlUtil.AddKnownType("MathNodeConstE", typeof(MathNodeConstE));
         XmlUtil.AddKnownType("MathNodeConstPI", typeof(MathNodeConstPI));
         //
         XmlUtil.AddKnownType("MathNodeExp", typeof(MathNodeExp));
         XmlUtil.AddKnownType("MathNodeLog", typeof(MathNodeLog));
         XmlUtil.AddKnownType("MathNodeLog10", typeof(MathNodeLog10));
         XmlUtil.AddKnownType("MathNodeLogX", typeof(MathNodeLogX));
         XmlUtil.AddKnownType("MathNodeMax", typeof(MathNodeMax));
         //
         XmlUtil.AddKnownType("MathNodeMin", typeof(MathNodeMin));
         XmlUtil.AddKnownType("MathNodeRound", typeof(MathNodeRound));
         XmlUtil.AddKnownType("MathNodeRound2", typeof(MathNodeRound2));
         XmlUtil.AddKnownType("MathNodeSign", typeof(MathNodeSign));
         XmlUtil.AddKnownType("MathNodeSin", typeof(MathNodeSin));
         //
         XmlUtil.AddKnownType("MathNodeSinh", typeof(MathNodeSinh));
         XmlUtil.AddKnownType("MathNodeTan", typeof(MathNodeTan));
         XmlUtil.AddKnownType("MathNodeTanh", typeof(MathNodeTanh));
         XmlUtil.AddKnownType("MathNodeTruncate", typeof(MathNodeTruncate));
         XmlUtil.AddKnownType("MathNodePower", typeof(MathNodePower));
         //
         XmlUtil.AddKnownType("LinkLineNodeInPort", typeof(LinkLineNodeInPort));
         XmlUtil.AddKnownType("EventHandlerMethod", typeof(EventHandlerMethod));
         XmlUtil.AddKnownType("ComponentIconPublic", typeof(ComponentIconPublic));
         XmlUtil.AddKnownType("ComponentIconLocal", typeof(ComponentIconLocal));
         XmlUtil.AddKnownType("ComponentIconMethodReturnPointer", typeof(ComponentIconMethodReturnPointer));
         XmlUtil.AddKnownType("HandlerMathodID", typeof(HandlerMethodID));
         //
         XmlUtil.AddKnownType("AB_ActionString", typeof(AB_ActionString));
         XmlUtil.AddKnownType("LinkLineNode", typeof(LinkLineNode));
         XmlUtil.AddKnownType("PlusNode", typeof(PlusNode));
         XmlUtil.AddKnownType("DivNode", typeof(DivNode));
         XmlUtil.AddKnownType("MinusNode", typeof(MinusNode));
         //
         XmlUtil.AddKnownType("MultiplyNode", typeof(MultiplyNode));
         XmlUtil.AddKnownType("MultiplyNodeBig", typeof(MultiplyNodeBig));
         XmlUtil.AddKnownType("ArrayVariable", typeof(ArrayVariable));
         XmlUtil.AddKnownType("ComponentIconArrayPointer", typeof(ComponentIconArrayPointer));
         XmlUtil.AddKnownType("ArrayPointer", typeof(ArrayPointer));
         //
         XmlUtil.AddKnownType("ConstructorPointer", typeof(ConstructorPointer));
         XmlUtil.AddKnownType("LocalVariable", typeof(LocalVariable));
         XmlUtil.AddKnownType("CustomMethodReturnPointer", typeof(CustomMethodReturnPointer));
         XmlUtil.AddKnownType("AB_SubMethodAction", typeof(AB_SubMethodAction));
         XmlUtil.AddKnownType("ActionSubMethod", typeof(ActionSubMethod));
         XmlUtil.AddKnownType("SubMethodInfoPointer", typeof(SubMethodInfoPointer));
         //
         XmlUtil.AddKnownType("ComponentIconParameter", typeof(ComponentIconParameter));
         XmlUtil.AddKnownType("ParameterClassArrayIndex", typeof(ParameterClassArrayIndex));
         XmlUtil.AddKnownType("ParameterClassArrayItem", typeof(ParameterClassArrayItem));
         XmlUtil.AddKnownType("AB_ConditionBranch", typeof(AB_ConditionBranch));
         XmlUtil.AddKnownType("Label", typeof(System.Windows.Forms.Label));
         //
         XmlUtil.AddKnownType("PropertyValueClass", typeof(PropertyValueClass));
         XmlUtil.AddKnownType("MethodReturnMethod", typeof(MethodReturnMethod));
         XmlUtil.AddKnownType("AB_MethodReturn", typeof(AB_MethodReturn));
         XmlUtil.AddKnownType("MathNodeActionInput", typeof(MathNodeActionInput));
         XmlUtil.AddKnownType("InterfaceClass", typeof(InterfaceClass));
         //
         XmlUtil.AddKnownType("InterfaceElementMethod", typeof(InterfaceElementMethod));
         XmlUtil.AddKnownType("InterfacePointer", typeof(InterfacePointer));
         XmlUtil.AddKnownType("InterfaceElementEvent", typeof(InterfaceElementEvent));
         XmlUtil.AddKnownType("InterfaceElementProperty", typeof(InterfaceElementProperty));
         XmlUtil.AddKnownType("NamedDataType", typeof(NamedDataType));
         //
         XmlUtil.AddKnownType("InterfaceElementMethodParameter", typeof(InterfaceElementMethodParameter));
         XmlUtil.AddKnownType("PropertyOverride", typeof(PropertyOverride));
         XmlUtil.AddKnownType("CustomPropertyOverridePointer", typeof(CustomPropertyOverridePointer));
         XmlUtil.AddKnownType("ParameterClassBaseProperty", typeof(ParameterClassBaseProperty));
         XmlUtil.AddKnownType("BaseMethod", typeof(BaseMethod));
         //
         XmlUtil.AddKnownType("MethodOverride", typeof(MethodOverride));
         XmlUtil.AddKnownType("EventClass", typeof(EventClass));
         XmlUtil.AddKnownType("ActionInput", typeof(ActionInput));
         XmlUtil.AddKnownType("CustomEventPointer", typeof(CustomEventPointer));
         XmlUtil.AddKnownType("CustomMethodParameterPointer", typeof(CustomMethodParameterPointer));
         //
         XmlUtil.AddKnownType("InterfaceMethodPointer", typeof(InterfaceMethodPointer));
         XmlUtil.AddKnownType("InterfacePropertyPointer", typeof(InterfacePropertyPointer));
         XmlUtil.AddKnownType("InterfaceMethodPointer", typeof(InterfaceMethodPointer));
         XmlUtil.AddKnownType("InterfaceEventPointer", typeof(InterfaceEventPointer));
         XmlUtil.AddKnownType("InterfaceCustomProperty", typeof(InterfaceCustomProperty));
         //
         XmlUtil.AddKnownType("AB_DecisionTableActions", typeof(AB_DecisionTableActions));
         XmlUtil.AddKnownType("DecisionTable", typeof(DecisionTable));
         XmlUtil.AddKnownType("MathNodeRandom", typeof(MathNodeRandom));
         XmlUtil.AddKnownType("AB_ActionList", typeof(AB_ActionList));
         XmlUtil.AddKnownType("ActionItem", typeof(ActionItem));
         //
         XmlUtil.AddKnownType("ClassInstancePointer", typeof(ClassInstancePointer));
         XmlUtil.AddKnownType("AB_LoopActions", typeof(AB_LoopActions));
         XmlUtil.AddKnownType("ActionAssignInstance", typeof(ActionAssignInstance));
         XmlUtil.AddKnownType("AB_ForLoop", typeof(AB_ForLoop));
         XmlUtil.AddKnownType("ActionBranchParameter", typeof(ActionBranchParameter));
         //
         XmlUtil.AddKnownType("ComponentIconActionBranchParameter", typeof(ComponentIconActionBranchParameter));
         XmlUtil.AddKnownType("ActionBranchParameterPointer", typeof(ActionBranchParameterPointer));
         XmlUtil.AddKnownType("EnumImageFormat", typeof(EnumImageFormat));
         XmlUtil.AddKnownType("AB_Constructor", typeof(AB_Constructor));
         XmlUtil.AddKnownType("ExpressionValue", typeof(ExpressionValue));
         //
         XmlUtil.AddKnownType("CustomEventHandlerType", typeof(CustomEventHandlerType));
         XmlUtil.AddKnownType("MemberComponentIdCustom", typeof(MemberComponentIdCustom));
         XmlUtil.AddKnownType("Environment", typeof(Environment));
         XmlUtil.AddKnownType("String[]", typeof(String[]));
         XmlUtil.AddKnownType("StringCollectionVariable", typeof(StringCollectionVariable));
         //
         XmlUtil.AddKnownType("StringCollectionPointer", typeof(StringCollectionPointer));
         XmlUtil.AddKnownType("FireEventMethod", typeof(FireEventMethod));
         XmlUtil.AddKnownType("FieldPointer", typeof(FieldPointer));
         XmlUtil.AddKnownType("NullObjectPointer", typeof(NullObjectPointer));
         XmlUtil.AddKnownType("BreakActionMethod", typeof(BreakActionMethod));
         //
         XmlUtil.AddKnownType("AB_Break", typeof(AB_Break));
         XmlUtil.AddKnownType("AttributeConstructor", typeof(AttributeConstructor));
         XmlUtil.AddKnownType("IXDesignerViewer", typeof(IXDesignerViewer));
         XmlUtil.AddKnownType("EnumMaxButtonLocation", typeof(EnumMaxButtonLocation));
         XmlUtil.AddKnownType("ICustomEventMethodDescriptor", typeof(ICustomEventMethodDescriptor));
         //
         XmlUtil.AddKnownType("MultiPanes", typeof(MultiPanes));
         XmlUtil.AddKnownType("IAction", typeof(IAction));
         XmlUtil.AddKnownType("INonHostedObject", typeof(INonHostedObject));
         XmlUtil.AddKnownType("LimnorService", typeof(LimnorService));
         XmlUtil.AddKnownType("TextBox", typeof(TextBox));
         //
         XmlUtil.AddKnownType("GroupBox", typeof(GroupBox));
         XmlUtil.AddKnownType("EventPortOutExecuteMethod", typeof(EventPortOutExecuteMethod));
         XmlUtil.AddKnownType("EventPortOutExecuter", typeof(EventPortOutExecuter));
         XmlUtil.AddKnownType("ComponentIconMethod", typeof(ComponentIconMethod));
         XmlUtil.AddKnownType("EventPathData", typeof(EventPathData));
         //
         XmlUtil.AddKnownType("ComponentIconEvent", typeof(ComponentIconEvent));
         XmlUtil.AddKnownType("ComponentIconEventhandle", typeof(ComponentIconEventhandle));
         XmlUtil.AddKnownType("ActionAssignComponent", typeof(ActionAssignComponent));
         XmlUtil.AddKnownType("ComponentIconCollectionPointer", typeof(ComponentIconCollectionPointer));
         XmlUtil.AddKnownType("CollectionTypePointer", typeof(CollectionTypePointer));
         //
         XmlUtil.AddKnownType("CollectionVariable", typeof(CollectionVariable));
         XmlUtil.AddKnownType("ParameterClassCollectionItem", typeof(ParameterClassCollectionItem));
         XmlUtil.AddKnownType("CustomConstructorPointer", typeof(CustomConstructorPointer));
         XmlUtil.AddKnownType("ComponentIconProperty", typeof(ComponentIconProperty));
         XmlUtil.AddKnownType("EventPortOutSetProperty", typeof(EventPortOutSetProperty));
         //
         XmlUtil.AddKnownType("ComponentIconFireEvent", typeof(ComponentIconFireEvent));
         XmlUtil.AddKnownType("EventPortOutFirer", typeof(EventPortOutFirer));
         XmlUtil.AddKnownType("EventPortInFireEvent", typeof(EventPortInFireEvent));
         XmlUtil.AddKnownType("EventPortIn", typeof(EventPortIn));
         XmlUtil.AddKnownType("EventHandler", typeof(EventHandler));
         //
         XmlUtil.AddKnownType("EventArgs", typeof(EventArgs));
         XmlUtil.AddKnownType("MemberComponentIdInstance", typeof(MemberComponentIdInstance));
         XmlUtil.AddKnownType("MemberComponentIdCustomInstance", typeof(MemberComponentIdCustomInstance));
         XmlUtil.AddKnownType("LimnorScreenSaverApp", typeof(LimnorScreenSaverApp));
         XmlUtil.AddKnownType("CollectionPointer", typeof(CollectionPointer));
         //
         XmlUtil.AddKnownType("AB_CastAs", typeof(AB_CastAs));
         XmlUtil.AddKnownType("Component", typeof(Component));
         XmlUtil.AddKnownType("ComponentIconClass", typeof(ComponentIconClass));
         XmlUtil.AddKnownType("ComponentIconClassType", typeof(ComponentIconClassType));
         XmlUtil.AddKnownType("EventPortOutTypeAction", typeof(EventPortOutTypeAction));
         //
         XmlUtil.AddKnownType("EventPortOutClassTypeAction", typeof(EventPortOutClassTypeAction));
         XmlUtil.AddKnownType("MemberComponentIdDefaultInstance", typeof(MemberComponentIdDefaultInstance));
         XmlUtil.AddKnownType("ExceptionHandler", typeof(ExceptionHandler));
         XmlUtil.AddKnownType("ExceptionHandlerList", typeof(ExceptionHandlerList));
         XmlUtil.AddKnownType("SelectExceptionToHandle", typeof(SelectExceptionToHandle));
         //
         XmlUtil.AddKnownType("ComponentIconLocalSubScope", typeof(ComponentIconException));
         XmlUtil.AddKnownType("SubscopeActions", typeof(SubscopeActions));
         XmlUtil.AddKnownType("ComponentIconSubscopeVariable", typeof(ComponentIconSubscopeVariable));
         XmlUtil.AddKnownType("ComponentID", typeof(ComponentID));
         XmlUtil.AddKnownType("ListVariable", typeof(ListVariable));
         //
         XmlUtil.AddKnownType("ComponentIconListPointer", typeof(ComponentIconListPointer));
         XmlUtil.AddKnownType("ListTypePointer", typeof(ListTypePointer));
         XmlUtil.AddKnownType("RuntimeInstance", typeof(RuntimeInstance));
         XmlUtil.AddKnownType("ActionSubMethodGlobal", typeof(ActionSubMethodGlobal));
         XmlUtil.AddKnownType("SubMethodInfoPointerGlobal", typeof(SubMethodInfoPointerGlobal));
         //
         XmlUtil.AddKnownType("MethodActionForeachAtServer", typeof(MethodActionForeachAtServer));
         XmlUtil.AddKnownType("MethodActionForeachAtClient", typeof(MethodActionForeachAtClient));
         XmlUtil.AddKnownType("MethodDataTransfer", typeof(MethodDataTransfer));
         XmlUtil.AddKnownType("StringMapList", typeof(StringMapList));
         XmlUtil.AddKnownType("StringMap", typeof(StringMap));
         //
         XmlUtil.AddKnownType("ParameterValueArrayItem", typeof(ParameterValueArrayItem));
         XmlUtil.AddKnownType("NameTypePair", typeof(NameTypePair));
         XmlUtil.AddKnownType("InlineAction", typeof(InlineAction));
         XmlUtil.AddKnownType("AB_Group", typeof(AB_Group));
         XmlUtil.AddKnownType("FileDownloadEventArgs", typeof(FileDownloadEventArgs));
         //
         XmlUtil.AddKnownType("BrowserNavigationEventArgs", typeof(BrowserNavigationEventArgs));
         XmlUtil.AddKnownType("ConstValueSelector", typeof(ConstValueSelector));
         XmlUtil.AddKnownType("EnumBorderStyle", typeof(EnumBorderStyle));
         XmlUtil.AddKnownType("EnumBorderWidthStyle", typeof(EnumBorderWidthStyle));
         //
         XmlUtil.AddKnownType("WebClientEventHandlerMethodDownloadActions", typeof(WebClientEventHandlerMethodDownloadActions));
         XmlUtil.AddKnownType("WebMouseEventArgs", typeof(WebMouseEventArgs));
         XmlUtil.AddKnownType("WebKeyEventArgs", typeof(WebKeyEventArgs));
         XmlUtil.AddKnownType("FileDownloadEventHandler", typeof(FileDownloadEventHandler));
         //
         XmlUtil.AddKnownType("HtmlElementPointer", typeof(HtmlElementPointer));
         XmlUtil.AddKnownType("ComponentIconHtmlElement", typeof(ComponentIconHtmlElement));
         XmlUtil.AddKnownType("ComponentIconHtmlElementCurrent", typeof(ComponentIconHtmlElementCurrent));
         XmlUtil.AddKnownType("WebClientEventHandlerMethodClientActions", typeof(WebClientEventHandlerMethodClientActions));
         XmlUtil.AddKnownType("WebClientEventHandlerMethodServerActions", typeof(WebClientEventHandlerMethodServerActions));
         //
         XmlUtil.AddKnownType("IWebClientControl", typeof(IWebClientControl));
         XmlUtil.AddKnownType("WebMouseButton", typeof(WebMouseButton));
         XmlUtil.AddKnownType("IWebClientComponent", typeof(IWebClientComponent));
         XmlUtil.AddKnownType("CollectionComponents", typeof(CollectionComponentNames));
         //
         XmlUtil.AddKnownType("LogonUser", typeof(LogonUser));
         XmlUtil.AddKnownType("CustomInterfaceMethodPointer", typeof(CustomInterfaceMethodPointer));
         //
         Type[] ts = typeof(HtmlElement_body).Assembly.GetExportedTypes();
         for (int i = 0; i < ts.Length; i++)
         {
             if (typeof(HtmlElement_Base).IsAssignableFrom(ts[i]))
             {
                 XmlUtil.AddKnownType(ts[i].Name, ts[i]);
             }
         }
         XmlUtil.AddKnownType("WebClientValueCollection", typeof(WebClientValueCollection));
         //
         XmlUtil.AddKnownType("OLECMDF", typeof(OLECMDF));
         XmlUtil.AddKnownType("OLECMDID", typeof(OLECMDID));
         XmlUtil.AddKnownType("OLECMDEXECOPT", typeof(OLECMDEXECOPT));
         XmlUtil.AddKnownType("EnumPopupLevel", typeof(EnumPopupLevel));
         XmlUtil.AddKnownType("IWebBrowser2", typeof(IWebBrowser2));
         //
         XmlUtil.AddKnownType("ConnectionItem", typeof(ConnectionItem));
         XmlUtil.AddKnownType("PluginManager`1", typeof(PluginManager <>));
         XmlUtil.AddKnownType("MethodAssignActions", typeof(MethodAssignActions));
         XmlUtil.AddKnownType("AB_AssignActions", typeof(AB_AssignActions));
         XmlUtil.AddKnownType("ActionAttachEvent", typeof(ActionAttachEvent));
         XmlUtil.AddKnownType("ActionDetachEvent", typeof(ActionDetachEvent));
         //
         XmlUtil.AddKnownType("EventHandlerDataChanged", typeof(EventHandlerDataChanged));
         XmlUtil.AddKnownType("EventArgsDataName", typeof(EventArgsDataName));
         XmlUtil.AddKnownType("IPluginManager", typeof(IPluginManager));
         XmlUtil.AddKnownType("IPlugin", typeof(IPlugin));
         //
         XmlUtil.AddKnownType("ILicenseRequestHandler", typeof(ILicenseRequestHandler));
         XmlUtil.AddKnownType("EventArgsRegister", typeof(EventArgsRegister));
         XmlUtil.AddKnownType("CopyProtector", typeof(CopyProtector));
         XmlUtil.AddKnownType("EnumHideDialogButtons", typeof(EnumHideDialogButtons));
         XmlUtil.AddKnownType("VplMethodPointer", typeof(VplMethodPointer));
     }
 }
Esempio n. 34
0
 public void SetAttribute(string name, string value)
 {
     XmlUtil.SetAttribute(name, "", value, XMLDocument.FirstChild);
 }
Esempio n. 35
0
 public FakeField(string xmlString)
 {
     XMLDocument = XmlUtil.LoadXml(xmlString);
 }
Esempio n. 36
0
 public void Save()
 {
     XmlUtil.Seialize(SavePath + "AllData.xml", AllUserData);
 }
Esempio n. 37
0
        public void AddBreakOnThisPattern(XmlNode node)
        {
            var breakMatch = XmlUtil.GetAttribute("text", node);

            _breakOnTheseStrings.Add(breakMatch);
        }
Esempio n. 38
0
    public Controls_PageView(string PageName)
    {
        XmlUtil x_util = new XmlUtil();
        Util util = new Util();
        //get page image
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        PageImage.ImageUrl = util.GetAppPageImage(State, State["PageViewAppID"].ToString(), PageName);
        PageImage.ID = PageName + "_PageImage";
        PageImage.Attributes.Add("onclick", "goToPage('" + PageName + "');");
        PageImage.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
        PageImage.Attributes.Add("onmouseout", "this.style.cursor='arrow';");
        if (State["UseFullPageImage"] != null)
        {
            PageImage.Width = 320;
            PageImage.Height = 460;
        }
        //get page fields
        XmlDocument doc = x_util.GetStagingAppXml(State);
        RadTreeNode PageRoot = new RadTreeNode(PageName);
        PageRoot.CssClass = "RadTreeView";
        PageRoot.ImageUrl = "../images/ascx.gif";
        PageRoot.Category = "page";
        PageRoot.Font.Size = FontUnit.Point(12);
        OnePageView.Nodes.Add(PageRoot);

        //do all fields
        XmlNode page = doc.SelectSingleNode("//pages/page/name[.  ='" + PageName + "']").ParentNode;
        XmlNode fields = page.SelectSingleNode("fields");

        if (fields != null)
        {
            //sort fields first
            SortedList list = new SortedList();
            SortableList<StoryBoardField> nameList = new SortableList<StoryBoardField>();

            foreach (XmlNode child in fields.ChildNodes)
            {
                Hashtable dict = new Hashtable();
                dict["field_type"] = child.Name;
                XmlNode id_node = child.SelectSingleNode("id");
                dict["id"] = id_node;
                string input_field = id_node.InnerText.Trim();
                if (child.SelectSingleNode("left") != null)
                    dict["left"] = child.SelectSingleNode("left").InnerText;
                else
                    dict["left"] = "0";

                if (child.SelectSingleNode("top") != null)
                    dict["top"] = child.SelectSingleNode("top").InnerText;
                else
                    dict["top"] = "0";

                dict["width"] = child.SelectSingleNode("width").InnerText;
                dict["height"] = child.SelectSingleNode("height").InnerText;
                string field_type = dict["field_type"].ToString();
                if (field_type == "button" ||
                    field_type == "image_button" ||
                    field_type == "table" ||
                    field_type == "switch")
                {
                    if(child.SelectSingleNode("submit") != null)
                        dict["submit"] = child.SelectSingleNode("submit").InnerText;
                }
                if (field_type == "table" )
                {
                    XmlNodeList sub_fields = child.SelectNodes("table_fields/table_field/name");
                    ArrayList table_list = new ArrayList();
                    foreach (XmlNode sub_field in sub_fields)
                    {
                        table_list.Add(sub_field.InnerText);
                    }
                    dict["sub_fields"] = table_list;
                }
                else if (field_type == "picker")
                {
                    XmlNodeList sub_fields = child.SelectNodes("picker_fields/picker_field/name");
                    ArrayList picker_list = new ArrayList();
                    foreach (XmlNode sub_field in sub_fields)
                    {
                        picker_list.Add(sub_field.InnerText);
                    }
                    dict["sub_fields"] = picker_list;
                }
                list[input_field] = dict;
                nameList.Add(new StoryBoardField(id_node.InnerText.Trim(), Convert.ToInt32(dict["top"].ToString()), Convert.ToInt32(dict["left"].ToString())));
            }

            nameList.Sort("Top", true);

            foreach (StoryBoardField input_field in nameList)
            {
                Hashtable dict = (Hashtable)list[input_field.FieldName];
                string field_type = dict["field_type"].ToString();
                RadTreeNode field_node = util.CreateFieldNode(PageRoot, input_field.FieldName, field_type);
                field_node.Value = "left:" +  dict["left"].ToString() + ";top:" + dict["top"].ToString() + ";width:" + dict["width"].ToString() + ";height:" + dict["height"].ToString() ;
                if (dict["submit"] != null && dict["submit"].ToString().Length > 0 && dict["submit"].ToString() != ";")
                {
                    field_node.BackColor = Color.PeachPuff;
                    string[] submit = dict["submit"].ToString().Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    string target_page_name = null;
                    //this code is compatible with both old and new syntax
                    if (submit[0].StartsWith("post") && (submit[0].Contains("response_page:") || submit[0].Contains("response_page~")))
                    {
                        target_page_name = submit[0].Substring(19);
                        field_node.Value += ";next_page:" + target_page_name;
                    }
                    else if (submit[0].StartsWith("next_page"))
                    {
                        if (submit[0].Contains("next_page:page~"))
                            target_page_name = submit[0].Substring(15);
                        else
                            target_page_name = submit[0].Substring(10);

                        field_node.Value += ";next_page:" + target_page_name;
                    }

                 }
                if (field_type == "table" ||
                    field_type == "picker")
                {
                    ArrayList sub_field_list = (ArrayList)dict["sub_fields"];
                    foreach (string sub_field_name in sub_field_list)
                    {
                        RadTreeNode sub_field_node = util.CreateFieldNode(field_node, sub_field_name, field_type);
                    }
                }
            }
        }
        OnePageView.ExpandAllNodes();
        OnePageView.OnClientMouseOver = "onPageViewMouseOver";
        OnePageView.OnClientMouseOut = "onPageViewMouseOut";
    }
 public override void ExportXml(StreamWriter writer, int level)
 {
     writer.WriteLine(XmlUtil.Indentation(level) + XmlUtil.EmptyNamedValuePair("WzByteFloat", this.Name, this.Value.ToString()));
 }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            for (int i = 0; i < Items.Count; i++)
            {
                string v;
                string s = VPLUtil.ObjectToString(Items[i]);
                if (!string.IsNullOrEmpty(s))
                {
                    int n = s.IndexOf('|');
                    if (n >= 0)
                    {
                        v = s.Substring(n + 1).Trim();
                        s = s.Substring(0, n).Trim();
                    }
                    else
                    {
                        v = s;
                    }
                }
                else
                {
                    v = string.Empty;
                }
                XmlElement oNode = node.OwnerDocument.CreateElement("option");
                node.AppendChild(oNode);
                XmlUtil.SetAttribute(oNode, "value", v);
                oNode.InnerText = s;
                oNode.IsEmpty   = false;
            }
            //
            if (Items.Count < 2)
            {
                XmlUtil.SetAttribute(node, "size", 2);
            }
            else
            {
                XmlUtil.SetAttribute(node, "size", Items.Count);
            }

            if (this.MultiSelection)
            {
                XmlUtil.SetAttribute(node, "multiple", "multiple");
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            StringBuilder dbs = new StringBuilder();

            if (this.DataBindings != null && this.DataBindings.Count > 0)
            {
                string tbl2    = null;
                string sIdx    = string.Empty;
                string slItem  = string.Empty;
                string slValue = string.Empty;
                for (int i = 0; i < DataBindings.Count; i++)
                {
                    if (DataBindings[i].DataSource != null)
                    {
                        if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(DataBindings[i].PropertyName, "selectedIndex", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex",
                                                 DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember);
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2   = DataBindings[i].BindingMemberInfo.BindingPath;
                            slItem = DataBindings[i].BindingMemberInfo.BindingField;                            // "SelectedItem";
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2    = DataBindings[i].BindingMemberInfo.BindingPath;
                            slValue = DataBindings[i].BindingMemberInfo.BindingField;                             // "SelectedValue";
                        }
                    }
                }
                if (!string.IsNullOrEmpty(sIdx))
                {
                    dbs.Append(sIdx);
                }
                if (!string.IsNullOrEmpty(tbl2))
                {
                    if (dbs.Length > 0)
                    {
                        dbs.Append(";");
                    }
                    dbs.Append(tbl2);
                    dbs.Append(":");
                    dbs.Append(slItem);
                    dbs.Append(":");
                    dbs.Append(slValue);
                }
                if (dbs.Length > 0)
                {
                    XmlUtil.SetAttribute(node, "jsdb", dbs.ToString());
                }
                if (this.AddBlankOnDataBinding)
                {
                    XmlUtil.SetAttribute(node, "useblank", "true");
                }
            }
            if (this.Items.Count == 0)
            {
                node.InnerText = "";
            }
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
Esempio n. 41
0
 /// <summary>
 /// 保存(序列化)指定路径下的配置文件
 /// </summary>
 /// <param name="configFilePath">指定的配置文件所在的路径(包括文件名)</param>
 /// <param name="configinfo">被保存(序列化)的对象</param>
 /// <returns></returns>
 public bool SaveConfig(string configFilePath, IConfigInfo configinfo)
 {
     return(XmlUtil.Serializer(configinfo, configFilePath));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected AbstractRoadContributionImpl(XmlElement e)
     : base(e)
 {
     name        = XmlUtil.SelectSingleNode(e, "name").InnerText;
     description = XmlUtil.SelectSingleNode(e, "description").InnerText;
 }
Esempio n. 43
0
 public void OnReadFromXmlNode(IXmlCodeReader reader, XmlNode node)
 {
     _memberId = XmlUtil.GetAttributeUInt(node, XmlTags.XMLATT_ComponentID);
     _classId  = XmlUtil.GetAttributeUInt(node, XmlTags.XMLATT_ClassID);
     OnRead(reader, node);
 }
Esempio n. 44
0
 public virtual void ExportXml(StreamWriter writer, int level)
 {
     writer.WriteLine(XmlUtil.Indentation(level) + XmlUtil.OpenNamedTag(this.PropertyType.ToString(), this.Name, true));
     writer.WriteLine(XmlUtil.Indentation(level) + XmlUtil.CloseTag(this.PropertyType.ToString()));
 }
Esempio n. 45
0
        protected override void BuildXml()
        {
            if (Request.Form["CKFinderCommand"] != "true")
            {
                ConnectorException.Throw(Errors.InvalidRequest);
            }

            if (!this.CurrentFolder.CheckAcl(AccessControlRules.FileRename | AccessControlRules.FileUpload | AccessControlRules.FileDelete))
            {
                ConnectorException.Throw(Errors.Unauthorized);
            }

            if (Request.Form["files[0][type]"] == null)
            {
                ConnectorException.Throw(Errors.InvalidRequest);
            }

            int moved    = 0;
            int movedAll = 0;

            if (Request.Form["moved"] != null)
            {
                movedAll = Int32.Parse(Request.Form["moved"]);
            }
            Settings.ResourceType resourceType;
            Hashtable             resourceTypeConfig = new Hashtable();
            Hashtable             checkedPaths       = new Hashtable();

            int iFileNum = 0;

            while (Request.Form["files[" + iFileNum.ToString() + "][type]"] != null && Request.Form["files[" + iFileNum.ToString() + "][type]"].Length > 0)
            {
                string name    = Request.Form["files[" + iFileNum.ToString() + "][name]"];
                string type    = Request.Form["files[" + iFileNum.ToString() + "][type]"];
                string path    = Request.Form["files[" + iFileNum.ToString() + "][folder]"];
                string options = "";

                if (name == null || name.Length < 1 || type == null || type.Length < 1 || path == null || path.Length < 1)
                {
                    ConnectorException.Throw(Errors.InvalidRequest);
                    return;
                }

                if (Request.Form["files[" + iFileNum.ToString() + "][options]"] != null)
                {
                    options = Request.Form["files[" + iFileNum.ToString() + "][options]"];
                }
                iFileNum++;

                // check #1 (path)
                if (!Connector.CheckFileName(name) || Regex.IsMatch(path, @"(/\.)|(\.\.)|(//)|([\\:\*\?""\<\>\|])"))
                {
                    ConnectorException.Throw(Errors.InvalidRequest);
                    return;
                }

                // get resource type config for current file
                if (!resourceTypeConfig.ContainsKey(type))
                {
                    resourceTypeConfig[type] = Config.Current.GetResourceTypeConfig(type);
                }

                // check #2 (resource type)
                if (resourceTypeConfig[type] == null)
                {
                    ConnectorException.Throw(Errors.InvalidRequest);
                    return;
                }

                resourceType = (Settings.ResourceType)resourceTypeConfig[type];
                FolderHandler folder         = new FolderHandler(type, path);
                string        sourceFilePath = System.IO.Path.Combine(folder.ServerPath, name);

                // check #3 (extension)
                if (!resourceType.CheckExtension(System.IO.Path.GetExtension(name)))
                {
                    this.appendErrorNode(Errors.InvalidExtension, name, type, path);
                    continue;
                }

                // check #4 (extension) - when moving to another resource type, double check extension
                if (this.CurrentFolder.ResourceTypeName != type)
                {
                    if (!this.CurrentFolder.ResourceTypeInfo.CheckExtension(System.IO.Path.GetExtension(name)))
                    {
                        this.appendErrorNode(Errors.InvalidExtension, name, type, path);
                        continue;
                    }
                }

                // check #5 (hidden folders)
                if (!checkedPaths.ContainsKey(path))
                {
                    checkedPaths[path] = true;
                    if (Config.Current.CheckIsHidenPath(path))
                    {
                        ConnectorException.Throw(Errors.InvalidRequest);
                        return;
                    }
                }

                // check #6 (hidden file name)
                if (Config.Current.CheckIsHiddenFile(name))
                {
                    ConnectorException.Throw(Errors.InvalidRequest);
                    return;
                }

                // check #7 (Access Control, need file view permission to source files)
                if (!folder.CheckAcl(AccessControlRules.FileView))
                {
                    ConnectorException.Throw(Errors.Unauthorized);
                    return;
                }

                // check #8 (invalid file name)
                if (!System.IO.File.Exists(sourceFilePath) || System.IO.Directory.Exists(sourceFilePath))
                {
                    this.appendErrorNode(Errors.FileNotFound, name, type, path);
                    continue;
                }

                // check #9 (max size)
                if (this.CurrentFolder.ResourceTypeName != type)
                {
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(sourceFilePath);
                    if (this.CurrentFolder.ResourceTypeInfo.MaxSize > 0 && fileInfo.Length > this.CurrentFolder.ResourceTypeInfo.MaxSize)
                    {
                        this.appendErrorNode(Errors.UploadedTooBig, name, type, path);
                        continue;
                    }
                }

                string destinationFilePath = System.IO.Path.Combine(this.CurrentFolder.ServerPath, name);
                string thumbPath           = System.IO.Path.Combine(folder.ThumbsServerPath, name);

                // finally, no errors so far, we may attempt to copy a file
                // protection against copying files to itself
                if (sourceFilePath == destinationFilePath)
                {
                    this.appendErrorNode(Errors.SourceAndTargetPathEqual, name, type, path);
                    continue;
                }
                // check if file exists if we don't force overwriting
                else if (System.IO.File.Exists(destinationFilePath))
                {
                    if (options.Contains("overwrite"))
                    {
                        try
                        {
                            System.IO.File.Delete(destinationFilePath);
                        }
                        catch (Exception)
                        {
                            this.appendErrorNode(Errors.AccessDenied, name, type, path);
                            continue;
                        }
                        try
                        {
                            System.IO.File.Move(sourceFilePath, destinationFilePath);
                            moved++;

                            try
                            {
                                System.IO.File.Delete(thumbPath);
                            }
                            catch { /* No errors if we are not able to delete the thumb. */ }
                        }
                        catch (Exception)
                        {
                            this.appendErrorNode(Errors.AccessDenied, name, type, path);
                            continue;
                        }
                    }
                    else if (options.Contains("autorename"))
                    {
                        int    iCounter = 1;
                        string fileName;
                        string sFileNameNoExt = System.IO.Path.GetFileNameWithoutExtension(name);
                        while (true)
                        {
                            fileName            = sFileNameNoExt + "(" + iCounter.ToString() + ")" + System.IO.Path.GetExtension(name);
                            destinationFilePath = System.IO.Path.Combine(this.CurrentFolder.ServerPath, fileName);
                            if (!System.IO.File.Exists(destinationFilePath))
                            {
                                break;
                            }
                            else
                            {
                                iCounter++;
                            }
                        }
                        try
                        {
                            System.IO.File.Move(sourceFilePath, destinationFilePath);
                            moved++;

                            try
                            {
                                System.IO.File.Delete(thumbPath);
                            }
                            catch { /* No errors if we are not able to delete the thumb. */ }
                        }
                        catch (ArgumentException)
                        {
                            this.appendErrorNode(Errors.InvalidName, name, type, path);
                            continue;
                        }
                        catch (System.IO.PathTooLongException)
                        {
                            this.appendErrorNode(Errors.InvalidName, name, type, path);
                            continue;
                        }
                        catch (Exception)
                        {
#if DEBUG
                            throw;
#else
                            this.appendErrorNode(Errors.AccessDenied, name, type, path);
                            continue;
#endif
                        }
                    }
                    else
                    {
                        this.appendErrorNode(Errors.AlreadyExist, name, type, path);
                        continue;
                    }
                }
                else
                {
                    try
                    {
                        System.IO.File.Move(sourceFilePath, destinationFilePath);
                        moved++;

                        try
                        {
                            System.IO.File.Delete(thumbPath);
                        }
                        catch { /* No errors if we are not able to delete the thumb. */ }
                    }
                    catch (ArgumentException)
                    {
                        this.appendErrorNode(Errors.InvalidName, name, type, path);
                        continue;
                    }
                    catch (System.IO.PathTooLongException)
                    {
                        this.appendErrorNode(Errors.InvalidName, name, type, path);
                        continue;
                    }
                    catch (Exception)
                    {
#if DEBUG
                        throw;
#else
                        this.appendErrorNode(Errors.AccessDenied, name, type, path);
                        continue;
#endif
                    }
                }
            }

            XmlNode moveFilesNode = XmlUtil.AppendElement(this.ConnectorNode, "MoveFiles");
            XmlUtil.SetAttribute(moveFilesNode, "moved", moved.ToString());
            XmlUtil.SetAttribute(moveFilesNode, "movedTotal", (movedAll + moved).ToString());

            if (this.ErrorsNode != null)
            {
                ConnectorException.Throw(Errors.MoveFailed);
                return;
            }
        }
Esempio n. 46
0
        /// <summary>
        /// Reads all configured Sitecore Caches
        /// </summary>
        /// <returns>List of Sitecore Cache Configurations</returns>
        public IList <CacheConfig> Read()
        {
            var root = this.baseFactory.GetConfigNode(ConfigurationReader.Path);

            if (root == null)
            {
                this.baseLog.Debug($"Unable to find cache configuration at {ConfigurationReader.Path}", this);
                return(new CacheConfig[0]);
            }

            var nodes = root.SelectNodes(ConfigurationReader.NodePath);

            if (nodes == null || nodes.Count == 0)
            {
                this.baseLog.Debug($"No caches have been configured at {ConfigurationReader.NodePath}", this);
                return(new CacheConfig[0]);
            }

            return((from XmlNode node in nodes
                    let name = XmlUtil.GetAttribute("name", node)
                               let maxSize = StringUtil.ParseSizeString(XmlUtil.GetAttribute("maxSize", node))
                                             let lifespan = Int32.Parse(XmlUtil.GetAttribute("lifespan", node))
                                                            let expirationType = this.ParseExpirationType(XmlUtil.GetAttribute("expirationType", node))
                                                                                 select new CacheConfig(name, maxSize, lifespan, expirationType))
                   .ToList());
        }
Esempio n. 47
0
 public virtual void GetObjectData(XmlWriter wr)
 {
     wr.WriteStartElement(Id);
     XmlUtil.WriteProperties(this, wr);
     wr.WriteEndElement();
 }
Esempio n. 48
0
        internal static string GetNodeKey(XmlNode xn, string strXPath)
        {
            if (xn == null)
            {
                Debug.Assert(false); return(null);
            }
            if (string.IsNullOrEmpty(strXPath))
            {
                Debug.Assert(false); return(null);
            }

            Debug.Assert(xn is XmlElement);
            Debug.Assert((strXPath == xn.Name) || strXPath.EndsWith("/" + xn.Name));
            Debug.Assert(strXPath.IndexOf('[') < 0);

            string strA = null, strB = null;

            switch (strXPath)
            {
            // Sync. with documentation

            case "/Configuration/Application/PluginCompatibility/Item":
            case "/Configuration/Application/WorkingDirectories/Item":
            case "/Configuration/Integration/AutoTypeAbortOnWindows/Window":
                strA = XmlUtil.SafeInnerXml(xn);
                break;

            case "/Configuration/Application/MostRecentlyUsed/Items/ConnectionInfo":
                strA = XmlUtil.SafeInnerXml(xn, "Path");
                strB = XmlUtil.SafeInnerXml(xn, "UserName");                         // Cf. MRU display name
                break;

            case "/Configuration/Application/TriggerSystem/Triggers/Trigger":
                strA = XmlUtil.SafeInnerXml(xn, "Guid");
                break;

            case "/Configuration/Custom/Item":
                strA = XmlUtil.SafeInnerXml(xn, "Key");
                break;

            case "/Configuration/Defaults/KeySources/Association":
                strA = XmlUtil.SafeInnerXml(xn, "DatabasePath");
                break;

            case "/Configuration/Integration/UrlSchemeOverrides/CustomOverrides/Override":
                strA = XmlUtil.SafeInnerXml(xn, "Scheme");
                strB = XmlUtil.SafeInnerXml(xn, "UrlOverride");
                break;

            case "/Configuration/MainWindow/EntryListColumnCollection/Column":
                strA = XmlUtil.SafeInnerXml(xn, "Type");
                strB = XmlUtil.SafeInnerXml(xn, "CustomName");
                break;

            case "/Configuration/PasswordGenerator/UserProfiles/Profile":
            case "/Configuration/Search/UserProfiles/Profile":
                strA = XmlUtil.SafeInnerXml(xn, "Name");
                break;

            default: break;
            }

            Debug.Assert((strA == null) || (strA.IndexOf('<') < 0));
            Debug.Assert((strB == null) || (strB.IndexOf('<') < 0));
            Debug.Assert((strB == null) || (strA != null));             // B => A
            Debug.Assert((strA == null) || (strA.Length != 0));

            if (strB != null)
            {
                return((strA ?? string.Empty) + " <> " + strB);
            }
            return(strA);
        }
 public override void ExportXml(StreamWriter writer, int level)
 {
     writer.WriteLine(XmlUtil.Indentation(level) + XmlUtil.OpenNamedTag("WzSub", this.Name, true));
     WzImageProperty.DumpPropertyList(writer, level, WzProperties);
     writer.WriteLine(XmlUtil.Indentation(level) + XmlUtil.CloseTag("WzSub"));
 }
        protected override void BuildXml()
        {
            if (!this.CurrentFolder.CheckAcl(AccessControlRules.FileView))
            {
                ConnectorException.Throw(Errors.Unauthorized);
            }

            // Map the virtual path to the local server path.
            string sServerDir  = this.CurrentFolder.ServerPath;
            bool   bShowThumbs = Request.QueryString["showThumbs"] != null && Request.QueryString["showThumbs"].ToString().Equals("1");

            // Create the "Files" node.
            XmlNode oFilesNode = XmlUtil.AppendElement(this.ConnectorNode, "Files");

            System.IO.DirectoryInfo oDir   = new System.IO.DirectoryInfo(sServerDir);
            System.IO.FileInfo[]    aFiles = oDir.GetFiles();

            for (int i = 0; i < aFiles.Length; i++)
            {
                System.IO.FileInfo oFile      = aFiles[i];
                string             sExtension = System.IO.Path.GetExtension(oFile.Name);

                if (Config.Current.CheckIsHiddenFile(oFile.Name))
                {
                    continue;
                }

                if (!this.CurrentFolder.ResourceTypeInfo.CheckExtension(sExtension))
                {
                    continue;
                }

                Decimal iFileSize = Math.Round((Decimal)oFile.Length / 1024);
                if (iFileSize < 1 && oFile.Length != 0)
                {
                    iFileSize = 1;
                }

                // Create the "File" node.
                XmlNode oFileNode = XmlUtil.AppendElement(oFilesNode, "File");
                XmlUtil.SetAttribute(oFileNode, "name", oFile.Name);
                XmlUtil.SetAttribute(oFileNode, "date", oFile.LastWriteTime.ToString("yyyyMMddHHmm"));
                if (Config.Current.Thumbnails.Enabled &&
                    (Config.Current.Thumbnails.DirectAccess || bShowThumbs) &&
                    ImageTools.IsImageExtension(sExtension.TrimStart('.')))
                {
                    bool bFileExists = false;
                    try
                    {
                        bFileExists = System.IO.File.Exists(System.IO.Path.Combine(this.CurrentFolder.ThumbsServerPath, oFile.Name));
                    }
                    catch {}

                    if (bFileExists)
                    {
                        XmlUtil.SetAttribute(oFileNode, "thumb", oFile.Name);
                    }
                    else if (bShowThumbs)
                    {
                        XmlUtil.SetAttribute(oFileNode, "thumb", "?" + oFile.Name);
                    }
                }
                XmlUtil.SetAttribute(oFileNode, "size", iFileSize.ToString(CultureInfo.InvariantCulture));
            }
        }
    protected void DeletePage_Click(object sender, ImageClickEventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();
            XmlUtil x_util = new XmlUtil();
            int n_pages = x_util.GetAppPageCount(State);
            if (n_pages == 1)
            {
                Message.Text = "A saved application must have at least 1 page. You can rename this page.";
                return;
            }
            if (x_util.IsCurrentPageNameUsed(State))
            {
                Message.Text = "The page was deleted but note that it was referred to, by an action on another page.";
            }
            x_util.DeleteAppPage(State, State["SelectedAppPage"].ToString());
            AppPages.SelectedIndex = 0;
            InitAppPages();

            State["SelectedAppPage"] = AppPages.SelectedValue;
            PageName.Text = State["SelectedAppPage"].ToString();

            string html = x_util.GetAppPage(State, State["SelectedAppPage"].ToString());
            if (html.StartsWith("Error:"))
            {
                Message.Text += html;
                return;
            }
            State["PageHtml"] = html;
            PageName.Text = "";
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
Esempio n. 52
0
 private bool ShowNode(XmlNode node, bool includeSystemNodes)
 {
     return(includeSystemNodes ||
            !XmlUtil.GetAttribute("type", node, true)
            .StartsWith("Sitecore", StringComparison.InvariantCultureIgnoreCase));
 }
    protected void DuplicatePage_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();
            if (SavedCanvasHtml.Text.Length > 0)
            {
                if (!SavePage())
                    return;
            }
            string new_page_name = PageName.Text.Trim().Replace(" ", "_");
            PageName.Text = "";

            if (!CheckPageName(CurrentApp.SelectedValue, new_page_name))
            {
                return;
            }

            XmlUtil x_util = new XmlUtil();
            x_util.CopyAppPage(State, State["SelectedAppPage"].ToString(), new_page_name);

            Message.Text = new_page_name + " page has been created. ";
            State["SelectedAppPage"] = new_page_name;
            PageName.Text = State["SelectedAppPage"].ToString();

            InitAppPages();
            ShowPage(new_page_name);
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
Esempio n. 54
0
        public MathExpEditor()
        {
            InitializeComponent();
            //
            mathExpCtrl1.SetMathEditor(this);
            //
            List <Type> NodeTypes;
            List <Type> NodeTypesLogic;
            List <Type> NodeTypesInteger;
            List <Type> NodeTypesString;
            List <Type> NodeTypesOther;

            propertyGrid1.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid1_PropertyValueChanged);
            propertyGrid2.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid2_PropertyValueChanged);
            tabGreek.Text    = new string((char)0x03b1, 1) + " - " + new string((char)0x03c9, 1);
            NodeTypes        = new List <Type>();     //decimal nodes
            NodeTypesLogic   = new List <Type>();     //logic nodes
            NodeTypesInteger = new List <Type>();     //integer nodes
            NodeTypesString  = new List <Type>();     //string nodes
            NodeTypesOther   = new List <Type>();     //other nodes
            //load types in this DLL
            Type[]      tps0  = this.GetType().Assembly.GetExportedTypes();
            List <Type> types = MathNode.MathNodePlugIns;

            Type[] tps = new Type[tps0.Length + types.Count];
            tps0.CopyTo(tps, 0);
            types.CopyTo(tps, tps0.Length);
            for (int i = 0; i < tps.Length; i++)
            {
                enumOperatorCategory opCat = MathNodeCategoryAttribute.GetTypeCategory(tps[i]);
                if (opCat != enumOperatorCategory.Internal)
                {
                    if (!tps[i].IsAbstract && tps[i].IsSubclassOf(typeof(MathNode)))
                    {
                        if (!tps[i].Equals(typeof(MathNodeRoot)))
                        {
                            if ((opCat & enumOperatorCategory.Logic) != 0)
                            {
                                NodeTypesLogic.Add(tps[i]);
                            }
                            if ((opCat & enumOperatorCategory.Integer) != 0)
                            {
                                NodeTypesInteger.Add(tps[i]);
                            }
                            if ((opCat & enumOperatorCategory.String) != 0)
                            {
                                NodeTypesString.Add(tps[i]);
                            }
                            if ((opCat & enumOperatorCategory.System) != 0)
                            {
                                if (ExcludeProjectItem)
                                {
                                    object[] vs = tps[i].GetCustomAttributes(typeof(ProjectItemAttribute), true);
                                    if (vs != null && vs.Length > 0)
                                    {
                                        continue;
                                    }
                                }
                                NodeTypesOther.Add(tps[i]);
                            }
                            if ((opCat & enumOperatorCategory.Decimal) != 0)
                            {
                                NodeTypes.Add(tps[i]);
                            }
                        }
                    }
                }
            }
            //load types from configuration XML
            string file = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.GetType().Assembly.Location), "MathTypes.xml");

            if (System.IO.File.Exists(file))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(file);
                if (doc.DocumentElement != null)
                {
                    for (int i = 0; i < doc.DocumentElement.ChildNodes.Count; i++)
                    {
                        try
                        {
                            Type t = XmlUtil.GetLibTypeAttribute(doc.DocumentElement.ChildNodes[i]);
                            enumOperatorCategory opCat = MathNodeCategoryAttribute.GetTypeCategory(t);
                            if (opCat != enumOperatorCategory.Internal)
                            {
                                if ((opCat & enumOperatorCategory.Logic) != 0)
                                {
                                    if (!NodeTypesLogic.Contains(t))
                                    {
                                        NodeTypesLogic.Add(t);
                                    }
                                }
                            }
                            if ((opCat & enumOperatorCategory.Integer) != 0)
                            {
                                if (!NodeTypesInteger.Contains(t))
                                {
                                    NodeTypesInteger.Add(t);
                                }
                            }
                            if ((opCat & enumOperatorCategory.String) != 0)
                            {
                                if (!NodeTypesString.Contains(t))
                                {
                                    NodeTypesString.Add(t);
                                }
                            }
                            if ((opCat & enumOperatorCategory.System) != 0)
                            {
                                if (!NodeTypesOther.Contains(t))
                                {
                                    NodeTypesOther.Add(t);
                                }
                            }
                            if ((opCat & enumOperatorCategory.Decimal) != 0)
                            {
                                if (!NodeTypes.Contains(t))
                                {
                                    NodeTypes.Add(t);
                                }
                            }
                        }
                        catch (Exception err)
                        {
                            MessageBox.Show(err.Message);
                        }
                    }
                }
            }
            typeIcons1.Category        = enumOperatorCategory.Decimal;
            typeIcons1.lblTooltips     = lblTooltips;
            typeIcons1.OnTypeSelected += new EventHandler(typeIcons1_OnTypeSelected);
            typeIcons1.LoadData(NodeTypes);

            typeIconsLogic.lblTooltips     = lblTooltips;
            typeIconsLogic.Category        = enumOperatorCategory.Logic;
            typeIconsLogic.OnTypeSelected += new EventHandler(typeIcons1_OnTypeSelected);
            typeIconsLogic.LoadData(NodeTypesLogic);

            typeIconsInteger.lblTooltips     = lblTooltips;
            typeIconsInteger.Category        = enumOperatorCategory.Integer;
            typeIconsInteger.OnTypeSelected += new EventHandler(typeIcons1_OnTypeSelected);
            typeIconsInteger.LoadData(NodeTypesInteger);

            typeIconsString.lblTooltips     = lblTooltips;
            typeIconsString.Category        = enumOperatorCategory.String;
            typeIconsString.OnTypeSelected += new EventHandler(typeIcons1_OnTypeSelected);
            typeIconsString.LoadData(NodeTypesString);

            typeIconsOther.lblTooltips     = lblTooltips;
            typeIconsOther.Category        = enumOperatorCategory.System;
            typeIconsOther.OnTypeSelected += new EventHandler(typeIcons1_OnTypeSelected);
            typeIconsOther.LoadData(NodeTypesOther);

            //
            greekLetters1.OnLetterSelected += new EventHandler(greekLetters1_OnLetterSelected);
            //
            mathExpCtrl1.OnFinish         += new EventHandler(btOK_Click);
            mathExpCtrl1.OnCancel         += new EventHandler(btCancel_Click);
            mathExpCtrl1.OnCreateCompound += new EventHandler(mathExpCtrl1_OnCreateCompound);
            //
            //
            MethodType mt = (MethodType)MathNode.GetService(typeof(MethodType));

            typeIconsOther.SetIconVisible(typeof(MathNodeArgument), (mt != null && mt.ParameterCount > 0));
            //
            propertyGrid2.SetOnValueChange(onValueChanged);
            //
            if (Clipboard.ContainsData("MathNode"))
            {
                btPaste.Enabled    = true;
                btPaste.ImageIndex = IMG_Paste_Enable;
            }
            tabControl1.SelectedTab = tabPageOther;
            typeIconsOther.LoadIcons();
        }
    protected void NewPage_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();
            if (SavedCanvasHtml.Text.Length > 0)
            {
                if (!SavePage())
                    return;
            }
            string next_page = PageName.Text.Trim().Replace(" ", "_");
            PageName.Text = "";

            if (!CheckPageName(CurrentApp.SelectedValue, next_page))
            {
                return;
            }

            AppPages.SelectedValue = next_page;
            State["SelectedAppPage"] = next_page;
            PageName.Text = State["SelectedAppPage"].ToString();

            XmlUtil x_util = new XmlUtil();

            AppPages.Items.Add(new RadComboBoxItem(next_page, next_page));
            AppPages.SelectedIndex = AppPages.Items.Count - 1;
            x_util.SaveAppPage(State, next_page, "");
            x_util.EncodeAppPageToAppXml(State, next_page, "");
            InitPage();
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
Esempio n. 56
0
 public void AttemptToDeserialiseProjectFromXmlWithInvalidRootElement()
 {
     Assert.That(delegate { reader.Read(XmlUtil.CreateDocument("<loader/>"), null); },
                 Throws.TypeOf <ConfigurationException>());
 }
    protected void SaveAppAs_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        try
        {
            ClearMessages();
            if (SavedCanvasHtml.Text.Length > 0)
                SavePage();
            string app = AppName.Text.Trim();
            if (!CheckAppName(app))
                return;

            string page_name = PageName.Text.Trim().Replace(" ", "_");
            string designed_for = DeviceType.Text.Trim();
            string app_type = AppType.Text.Trim();

            if (IsNewApp.Text.Length > 0)
            {
                IsNewApp.Text = "";
                CurrentApp.SelectedIndex = 0;
                AppPages.Items.Clear();
                ResetAppStateVariables();
                SavedCanvasHtml.Text = "";
            }
            else
            {
                if ( State["AppXmlDoc"] != null && !CheckPageName(app, page_name))
                    return;
            }

            State["SelectedApp"] = app;
            State["SelectedAppPage"] = page_name;
            State["SelectedDeviceType"] = designed_for;
           // State["SelectedDeviceView"] = designed_for;
            State["SelectedAppType"] = app_type;

            XmlUtil x_util = new XmlUtil();

             AppPages.SelectedValue = page_name;

             util.SetDefaultBackgroundForView(State,designed_for);

             if (!SaveAppInDatabase(app, page_name))
             {
                 return;
             }
             switch (State["SelectedAppType"].ToString())
             {
                 case Constants.NATIVE_APP_TYPE:
                     Response.Redirect("TabDesignNative.aspx", false);
                     break;
                 case Constants.WEB_APP_TYPE:
                     break;
                 case Constants.HYBRID_APP_TYPE:
                       Response.Redirect("TabDesignHybrid.aspx", false);
                     break;
             }

             DesignedFor.Text = "";
            DeviceType.Text = State["SelectedDeviceType"].ToString();
            ShowAppControls();
            InitAppPages();

            Message.Text = app + " has been saved. ";
            AppName.Text = app;
            DesignMessage.Text = "";

            if ( State["EncodeComputeWarnings"] != null)
            {
                Message.Text += " " +  State["EncodeComputeWarnings"].ToString();
                 State["EncodeComputeWarnings"] = null;
            }

            if ( State["CreatePageMessage"] != null)
            {
                StringBuilder sb = (StringBuilder) State["CreatePageMessage"];
                Message.Text += sb.ToString();
                 State["SelectedAppPage"] = page_name;
                 PageName.Text = State["SelectedAppPage"].ToString();

            }

            UpdateAppLists();
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Internal Error: " + ex.Message + ": " + ex.StackTrace;
        }
    }
        public override bool Edit(UInt32 actionBranchId, Rectangle rcStart, ILimnorDesignerLoader loader, Form caller)
        {
            if (this.Owner == null)
            {
                this.Owner = loader.GetRootId();
            }
            DlgMethod dlg = this.CreateMethodEditor(rcStart);

            try
            {
                _origiContext = VPLUtil.CurrentRunContext;
                if (loader.Project.IsWebApplication)
                {
                    if (this.RunAt == EnumWebRunAt.Client)
                    {
                        VPLUtil.CurrentRunContext = EnumRunContext.Client;
                    }
                    else
                    {
                        VPLUtil.CurrentRunContext = EnumRunContext.Server;
                    }
                }
                else
                {
                    VPLUtil.CurrentRunContext = EnumRunContext.Server;
                }
                dlg.LoadMethod(this, EnumParameterEditType.Edit);
                if (dlg.ShowDialog(caller) == DialogResult.OK)
                {
                    _display = null;
                    XmlNode nodeMethodCollection = loader.Node.SelectSingleNode(XmlTags.XML_CONSTRUCTORS);
                    if (nodeMethodCollection == null)
                    {
                        nodeMethodCollection = loader.Node.OwnerDocument.CreateElement(XmlTags.XML_CONSTRUCTORS);
                        loader.Node.AppendChild(nodeMethodCollection);
                    }
                    XmlNode nodeMethod = nodeMethodCollection.SelectSingleNode(
                        string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                      "{0}[@{1}='{2}']",
                                      XmlTags.XML_Item, XmlTags.XMLATT_MethodID, MemberId));
                    if (nodeMethod == null)
                    {
                        nodeMethod = nodeMethodCollection.OwnerDocument.CreateElement(XmlTags.XML_Item);
                        nodeMethodCollection.AppendChild(nodeMethod);
                    }
                    XmlUtil.SetAttribute(nodeMethod, XmlTags.XMLATT_MethodID, MemberId);
                    XmlUtil.SetAttribute(nodeMethod, XmlTags.XMLATT_NAME, Name);
                    XmlObjectWriter wr = loader.Writer;
                    wr.WriteObjectToNode(nodeMethod, this);
                    if (wr.HasErrors)
                    {
                        MathNode.Log(wr.ErrorCollection);
                    }
                    ILimnorDesignPane pane = loader.Project.GetTypedData <ILimnorDesignPane>(loader.ObjectMap.ClassId);

                    pane.OnNotifyChanges();
                    return(true);
                }
            }
            catch (Exception err)
            {
                MathNode.Log(caller, err);
            }
            finally
            {
                ExitEditor();
                VPLUtil.CurrentRunContext = _origiContext;
            }
            return(false);
        }
Esempio n. 59
0
        /// <summary>
        /// Call the GMI Study webservice
        /// </summary>
        /// <param name="method"></param>
        /// <param name="parameters"></param>
        /// <returns>XDocument webservice response</returns>
        private XDocument CallGMIStudyService(string method, Hashtable parameters)
        {
            XDocument result = null;
            var gMIStudyClient = GetGMIStudyClient();

            string service = "GMI StudyService - " + method;
            LogUtil.CallingService(service, LogUtil.getHashtableString(parameters));

            try
            {
                result = new XmlUtil().ParseXmlDocument(gMIStudyClient.CallWebservice(method, parameters));
                LogUtil.CallSuccess(service, result.ToString());
            }
            catch(Exception e)
            {
                LogUtil.CallFail(service, e);
                throw;
            }

            return result;
        }
Esempio n. 60
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();

            foreach (Control ct in this.Controls)
            {
                createControlWebContents(ct, node, groupId);
            }
            //
            StringBuilder sb = new StringBuilder();

            if (this.Parent != null)
            {
                if (this.BackColor != this.Parent.BackColor)
                {
                    sb.Append("background-color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
                    sb.Append("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            if (this.BorderStyle != BorderStyle.None)
            {
                sb.Append("border:1px solid black;");
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positiontype);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                         "{0}[@name='Visible']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (!b)
                            {
                                sb.Append("display:none; ");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }