当前位置: 首页>>代码示例>>C#>>正文


C# Util.GetStagingAppXml方法代码示例

本文整理汇总了C#中Util.GetStagingAppXml方法的典型用法代码示例。如果您正苦于以下问题:C# Util.GetStagingAppXml方法的具体用法?C# Util.GetStagingAppXml怎么用?C# Util.GetStagingAppXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util的用法示例。


在下文中一共展示了Util.GetStagingAppXml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        Util util = new Util();
        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; }

        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode database_config = doc.SelectSingleNode("//application/data_sources/data_source"); //new config
        if (database_config == null)
        {
            database_config = doc.SelectSingleNode("//database_config"); //old config
            if (database_config == null)
            {
                return;
            }
        }

        XmlNodeList table_list = database_config.SelectNodes("//tables/table");
        table.Items.Clear();
        ArrayList tables = new ArrayList();
        foreach (XmlNode table_node in table_list)
        {
            XmlNode table_name = table_node.SelectSingleNode("table_name");
            tables.Add(table_name.InnerText);
        }
        tables.Sort();

        foreach(string name in tables)
        {
            table.Items.Add(new Telerik.Web.UI.RadComboBoxItem(name, name));
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:32,代码来源:DatabaseCommand.ascx.cs

示例2: LoadData

    private void LoadData()
    {
        DataTable myDataTable = new DataTable();
        DataColumn event_column = new DataColumn("Event");
        myDataTable.Columns.Add(event_column);

        DataColumn inputs_mapped = new DataColumn("Inputs Mapped");
        myDataTable.Columns.Add(inputs_mapped);

        DataColumn outputs_mapped = new DataColumn("Outputs Mapped");
        myDataTable.Columns.Add(outputs_mapped);

        Util util = new Util();
        XmlDocument doc = util.GetStagingAppXml((Hashtable)HttpRuntime.Cache[Session.SessionID]);

        RadComboBox WebServiceEvents  = (RadComboBox)  ((Hashtable)HttpRuntime.Cache[Session.SessionID])["WebServiceEvents"]  ;
        String Yes = "<img src='../../images/check.gif'/>";
        String No = "<img src='../../images/delete.gif'/>";

        foreach (RadComboBoxItem item in WebServiceEvents.Items)
        {
            if (item.Index == 0) //skip the select label item
                continue;

            DataRow row = myDataTable.NewRow();
            row.SetField<String>(event_column,item.Text);

            XmlNode mapped_node = doc.SelectSingleNode("//phone_data_request/event_field[.='" + item.Text + "']");
            if (mapped_node != null)
            {
                row.SetField<String>(inputs_mapped, Yes);
                mapped_node = mapped_node.ParentNode.SelectSingleNode("output_mapping");
                 if (mapped_node != null)
                 {
                     row.SetField<String>(outputs_mapped, Yes);
                 }
                 else
                 {
                     row.SetField<String>(outputs_mapped, No);
                 }
            }
            else
            {
                row.SetField<String>(inputs_mapped, No);
                row.SetField<String>(outputs_mapped, No);
            }

            myDataTable.Rows.Add(row);
        }

        MappingStatus.DataSource = myDataTable;
        MappingStatus.DataBind();
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:53,代码来源:EventMappingStatus.aspx.cs

示例3: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        Util util = new Util();
        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; }

        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode database_config = doc.SelectSingleNode("//application/data_sources/data_source"); //new config
        if (database_config == null)
        {
            database_config = doc.SelectSingleNode("//database_config"); //old config
            if (database_config == null)
            {
                return;
            }
        }

        string table =  State["SelectedDatabaseTable"].ToString();
        XmlNode table_name_node = database_config.SelectSingleNode("//tables/table/table_name[.='" + table + "'] | //tables/table/table_name[.='" + table.ToLower() + "']");
        if (table_name_node == null)
        {
            State["SpreadsheetError"] = "Query Error: A saved worksheet or table: " + table + " does not exist. All queries for this event have been deleted to avoid runtime errors.";
            State["SelectedDatabaseTable"] = null;
            return;
        }
        XmlNodeList field_list = table_name_node.ParentNode.SelectNodes("fields/field/name");

        // init database fields
        sort_field.Items.Clear();
        ArrayList fields = new ArrayList();
        foreach (XmlNode field_node in field_list)
        {
            fields.Add(field_node.InnerText);
        }
        fields.Sort();

        foreach (string name in fields)
        {
            sort_field.Items.Add(new Telerik.Web.UI.RadComboBoxItem(name, name));
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:41,代码来源:DatabaseOrderBy.ascx.cs

示例4: SaveWebServiceInfo_Click

    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.";
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:38,代码来源:DBWebService.aspx.cs

示例5: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        Util util = new Util();
        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; }

        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode database_config = doc.SelectSingleNode("//application/data_sources/data_source"); //new config
        if (database_config == null)
        {
            database_config = doc.SelectSingleNode("//database_config"); //old config
            if (database_config == null)
            {
                return;
            }
        }

        ArrayList fields = new ArrayList();
        //init phone_fields
        fields.Clear();
        RadComboBox DatabaseEvents = null;
        if ( State["ManageDataType"].ToString() == "database")
        {
            DatabaseEvents = (RadComboBox) State["DatabaseEvents"];
        }
        else
        {
            DatabaseEvents = (RadComboBox) State["SpreadSheetEvents"];
        }
        command_condition_device_field1.Items.Clear();
        command_condition_device_field2.Items.Clear();
        ArrayList phone_fields = new ArrayList();

        string[] page_names = DatabaseEvents.SelectedItem.Value.Split(":".ToCharArray());
        string from_page = page_names[0];
        string to_page = page_names[1];

        XmlNodeList pages = doc.SelectNodes("//pages/page");
        foreach (XmlNode page in pages)
        {
            XmlNode page_name_node = page.SelectSingleNode("name");
            string page_name = page_name_node.InnerText;

           // if (page_name != from_page && page_name != to_page)
          //      continue;

            //do inputs from phone
            XmlNodeList input_nodes = page.SelectNodes(
                 "fields/text_area | fields/label | fields/text_field | fields/hidden_field | fields/alert | fields/web_view | fields/image | fields/photo | fields/audio");
            foreach (XmlNode input_node in input_nodes)
            {
                // phone input field
                XmlNode id_node = input_node.SelectSingleNode("id");
                    fields.Add(id_node.InnerText.Trim());
            }

                XmlNodeList gps_fields = page.SelectNodes("fields/gps");
                foreach (XmlNode gps_field in gps_fields)
                {
                    XmlNode id_node = gps_field.SelectSingleNode("id");
                    string input_field = id_node.InnerText.Trim();

                    XmlNode part_node = gps_field.SelectSingleNode("latitude");
                    fields.Add(part_node.InnerText);
                    part_node = gps_field.SelectSingleNode("longitude");
                    fields.Add(part_node.InnerText);
                }

                XmlNodeList speech_recos = page.SelectNodes("fields/speech_reco");
                foreach (XmlNode speech_reco in speech_recos)
                {
                    XmlNode id_node = speech_reco.SelectSingleNode("id");
                    fields.Add(id_node.InnerText.Trim());
                }

            XmlNodeList pickers = page.SelectNodes("fields/picker");
            foreach (XmlNode picker in pickers)
            {
                XmlNode id_node = picker.SelectSingleNode("id");
                XmlNode picker_fields = picker.SelectSingleNode("picker_fields");
                if (picker_fields != null)
                {
                    //picker fields are both inputs and outputs
                        XmlNodeList picker_field_list = picker_fields.SelectNodes("picker_field");
                        foreach (XmlNode field_item in picker_field_list)
                        {
                            XmlNode field_name = field_item.SelectSingleNode("name");

                            //table fields can be inputs too
                            fields.Add(field_name.InnerText.Trim());
                        }
                }
                else//for date and time picker types
                {
                    //picker fields are both inputs and outputs
                        fields.Add(id_node.InnerText.Trim());
                }
            }

            //do responses to phone
//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:IfDeviceFieldThenDoCommand.ascx.cs

示例6: DisplayMode_Click

    protected void DisplayMode_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        if (State["SelectedApp"] == null || State["SelectedApp"].ToString().Contains("->"))
            return;

        int index = DisplayModeButton.SelectedToggleStateIndex;

        if (index == 0)//design mode
        {
             State["WebAppMode"] = null;//design mode is the default
            canvas.Attributes["src"] = "canvas.aspx";
            DesignMessage.Text = "";
            QRCode.Src = "";
            QRCode.Style.Value = "display:none";
            QRCodeLabel.Style.Value = "display:none";
            CurrentAppContainer.Style.Value = CurrentAppContainerStyle;
            TestAppURL.Text = "";
            ShowAppControls();
        }
        else //preview mode
        {
            //save Page first
            if (SavedCanvasHtml.Text.Length > 0)
                SavePage();

            HideAppControls();
            DisplayModeButton.Style.Value = "";//don't hide the toggle button
            CurrentAppContainer.Style.Value = "display:none";

            State["WebAppMode"] = "preview";
            WebAppsUtil web_util = new WebAppsUtil();
            AmazonS3 s3 = new AmazonS3();
            State["IsProduction"] = false;
            string file_name =  State["SelectedApp"].ToString().Replace(" ", "_") + Constants.WEB_APP_TEST_SUFFIX +"/index.html";

            string save_file_path =  HttpRuntime.Cache["TempFilesPath"].ToString() + State["Username"].ToString() + "." + file_name.Replace(Constants.WEB_APP_TEST_SUFFIX + "/index.html", ".html");

            string ret = web_util.GetWebApp(State, util.GetStagingAppXml(State), 1.0D,1.0D);
            if (ret.StartsWith("Error:"))
            {
                Message.Text = ret;
                DisplayMode_Click(null, null);
                return;
            }
            File.WriteAllText(save_file_path, ret);

            if ( State["UrlAccountIdentifier"] == null)
            {
                Message.Text = "The Account Identifier has not been set.";
                return;
            }
            string key =  State["UrlAccountIdentifier"].ToString() + "/" + file_name;
            s3.UploadFileWithKey(State, file_name, save_file_path,key);
            string url = "http://viziapps.s3-website-us-east-1.amazonaws.com/" +  State["UrlAccountIdentifier"].ToString() + "/" +  State["SelectedApp"].ToString().Replace(" ", "_") + Constants.WEB_APP_TEST_SUFFIX;
            canvas.Attributes["src"] = url;

            if (File.Exists(save_file_path))
                File.Delete(save_file_path);

            BitlyData.LoginName = ConfigurationManager.AppSettings["BitlyLoginName"];
            BitlyData.APIKEY = ConfigurationManager.AppSettings["BitlyAPIKey"];
            String bitly_url = Bitly.ShortURL(url, Bitly.Format.TXT);
            QRCode.Src = Bitly.GetQRCodeURL(bitly_url);

            TestAppURL.Text = "Test App URL: " + bitly_url;
            QRCode.Style.Value = "";
            QRCodeLabel.Style.Value = "";
            QRCodeLabel.Text = "QR Code for Test Web App: " +  State["SelectedApp"].ToString() + ". Capture the URL from this image with any app that reads QR codes and you will see your app on your device in seconds." ;
            DisplayModeValue.Text = "";
            SavedCanvasHtml.Text = "";
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:76,代码来源:TabDesignWeb.aspx.cs

示例7: GetFirstDatabaseTable

    protected string GetFirstDatabaseTable()
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlDocument doc = util.GetStagingAppXml(State);

        //get this page
        XmlNode page_node = doc.SelectSingleNode("//pages/page/name[.='" + State["SelectedAppPage"].ToString() + "']").ParentNode;

        //get get data sources on this page
        XmlNodeList data_sources = page_node.SelectNodes("data_sources/data_source");
        if (data_sources == null)
        {
            return null;
        }
        int dataSourceIndex = (int)State["PageDataSourceIndex"];

        //get the correct data source by index
        XmlNode data_source = data_sources.Item(dataSourceIndex);
        string data_source_id = data_source.SelectSingleNode("data_source_id").InnerText;

        //get the data source detail from the app data sources
        XmlNode app_data_source = doc.SelectSingleNode("//application/data_sources/data_source/data_source_id[.='" + data_source_id + "']").ParentNode;

        //get all the tables
        XmlNodeList table_list = app_data_source.SelectNodes("data_source_configuration/tables/table");
        ArrayList tables = new ArrayList();
        foreach (XmlNode table_node in table_list)
        {
            XmlNode table_name = table_node.SelectSingleNode("table_name");
            tables.Add(table_name.InnerText);
        }
        tables.Sort();
        if (tables.Count == 0)
            return null;

        //get the first table
        return tables[0].ToString();
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:39,代码来源:GoogleSpreadsheetOperations.aspx.cs

示例8: SaveDatabaseConfig_Click

    protected void SaveDatabaseConfig_Click(object sender, EventArgs e)
    {
        XmlUtil x_util = new XmlUtil();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (State == null || State.Count <= 2) { SessionTimeOut.Text = "../../Default.aspx"; return; }

        Util util = new Util();
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode page_name = doc.SelectSingleNode("//pages/page/name[.='" + State["SelectedAppPage"].ToString() + "']");
        XmlNode data_sources = page_name.ParentNode.SelectSingleNode("data_sources");
        if (data_sources == null)
        {
            Message.Text = "There was an internal error with your design. Please notify ViziApps: " +  HttpRuntime.Cache["TechSupportEmail"].ToString();
            return;
        }
        XmlNodeList list = data_sources.SelectNodes("data_source");
        XmlNode data_source = list[(int)State["PageDataSourceIndex"] ];
        XmlNode event_node = null;
        if (State["DataSourceEventField"] == null) //page type
        {
            XmlNode temp_data_source_event_type = data_source.SelectSingleNode("event/data_source_event_type[.='page']");
            if (temp_data_source_event_type == null)
            {
                event_node = x_util.CreateNode(doc, data_source, "event");
                x_util.CreateNode(doc, event_node, "data_source_event_type", "page");
            }
            else
                event_node = temp_data_source_event_type.ParentNode;
        }
        else //field type
        {
            XmlNode temp_data_source_event_field = data_source.SelectSingleNode("event/data_source_event_field[.='" + State["DataSourceEventField"].ToString() + "']");
            if (temp_data_source_event_field == null)
            {
                event_node = x_util.CreateNode(doc, data_source, "event");
                x_util.CreateNode(doc, event_node, "data_source_event_type", "field");
                x_util.CreateNode(doc, event_node, "data_source_event_field", State["DataSourceEventField"].ToString());
            }
            else
            {
                event_node = temp_data_source_event_field.ParentNode;
            }
        }

        XmlNode data_source_operations = event_node.SelectSingleNode("data_source_operations");
        if (data_source_operations != null)
            event_node.RemoveChild(data_source_operations);

        data_source_operations = x_util.CreateNode(doc, event_node, "data_source_operations");

        XmlNode sql_commands = x_util.CreateNode(doc, data_source_operations, "sql_commands");

        ArrayList DBCommands = (ArrayList)State["DBCommands"];
        if (DBCommands == null)
        {
            Message.Text = "There are no query Commands to save.";
            Message.ForeColor = Color.Maroon;
            return;
        }

        foreach (Hashtable CommandEntry in DBCommands)
        {
            XmlNode sql_command = x_util.CreateNode(doc, sql_commands, "sql_command");
            string command = CommandEntry["command"].ToString().ToLower();
            x_util.CreateNode(doc, sql_command, "command", command);
            if (command == "if")
            {
                x_util.CreateNode(doc, sql_command, "command_condition_phone_field1", CommandEntry["command_condition_device_field1"].ToString());
                x_util.CreateNode(doc, sql_command, "command_condition_operation", CommandEntry["command_condition_operation"].ToString());
                x_util.CreateNode(doc, sql_command, "command_condition_phone_field2", CommandEntry["command_condition_device_field2"].ToString());
            }
            else
            {
                if (command.EndsWith("go to page"))
                {
                    x_util.CreateNode(doc, sql_command, "page", CommandEntry["page"].ToString());
                }
                else
                {
                    x_util.CreateNode(doc, sql_command, "table", CommandEntry["table"].ToString());

                    ArrayList DBFields = (ArrayList)CommandEntry["database_fields"];
                    if (DBFields != null)
                    {
                        foreach (Hashtable FieldEntry in DBFields)
                        {
                            XmlNode field_item = x_util.CreateNode(doc, sql_command, "field_item");
                            if (FieldEntry["database_field"] != null && FieldEntry["database_field"].ToString().Length > 0)
                            {
                                x_util.CreateNode(doc, field_item, "database_field", FieldEntry["database_field"].ToString());
                            }
                            else
                                x_util.CreateNode(doc, field_item, "database_field", GetFirstDatabaseField(CommandEntry["table"].ToString()));

                            if (FieldEntry["device_field"] != null && FieldEntry["device_field"].ToString().Length > 0)
                            {
                                x_util.CreateNode(doc, field_item, "phone_field", FieldEntry["device_field"].ToString());
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:GoogleSpreadsheetOperations.aspx.cs

示例9: ShowPublishedWebApp

    protected void ShowPublishedWebApp()
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        if (State["SelectedApp"] == null || State["SelectedApp"].ToString().Contains("->"))
            return;

        WebAppsUtil web_util = new WebAppsUtil();
        AmazonS3 s3 = new AmazonS3();
        State["IsProduction"] = true;

        string file_name = State["SelectedApp"].ToString().Replace(" ", "_") + Constants.WEB_APP_TEST_SUFFIX + "/index.html";
        string save_file_path =  HttpRuntime.Cache["TempFilesPath"].ToString() + State["Username"].ToString() + "." + file_name.Replace(Constants.WEB_APP_TEST_SUFFIX + "/index.html", ".html");

        string ret = web_util.GetWebApp(State, util.GetStagingAppXml(State),1.0D, 1.0D);
        if (ret.StartsWith("Error:"))
        {
            PublishMessage.Text = ret;
             return;
        }
        File.WriteAllText(save_file_path, ret);

        if (State["UrlAccountIdentifier"] == null)
        {
            PublishMessage.Text = "The Account Identifier has not been set.";
            return;
        }
        string key = State["UrlAccountIdentifier"].ToString() + "/" + file_name;
        s3.UploadFileWithKey(State, file_name, save_file_path, key);
        string url = "http://viziapps.s3-website-us-east-1.amazonaws.com/" + State["UrlAccountIdentifier"].ToString() + "/" + State["SelectedApp"].ToString().Replace(" ", "_") ;

        if (File.Exists(save_file_path))
            File.Delete(save_file_path);

        BitlyData.LoginName = ConfigurationManager.AppSettings["BitlyLoginName"];
        BitlyData.APIKEY = ConfigurationManager.AppSettings["BitlyAPIKey"];
        String bitly_url = Bitly.ShortURL(url, Bitly.Format.TXT);
        QRCode.Src = Bitly.GetQRCodeURL(bitly_url);

        PublishedAppURL.Text = "Published App URL: " + bitly_url;
        QRCode.Style.Value = "";
        QRCodeLabel.Style.Value = "";
        QRCodeLabel.Text = "QR Code for Published Web App: " + State["SelectedApp"].ToString() + ". Capture the URL from this image with any app that reads QR codes and you will see your app on your device in seconds.";
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:46,代码来源:PublishingFormWebApps.aspx.cs

示例10: ResetDataResponseMap_Click

    public void ResetDataResponseMap_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        ClearMessages();
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode web_service_data_responses = doc.SelectSingleNode("//web_service_data_responses");
        if (web_service_data_responses != null)
        {
            web_service_data_responses.RemoveAll();
        }

        XmlNode phone_data_requests = doc.SelectSingleNode("//phone_data_requests");
        if (phone_data_requests == null)
            return;
        XmlNodeList event_fields = phone_data_requests.SelectNodes("phone_data_request/event_field");
        foreach (XmlNode event_field in event_fields)
        {
            XmlNode phone_data_request = event_field.ParentNode;
            XmlNodeList output_mappings = phone_data_request.SelectNodes("output_mapping");
            foreach (XmlNode output_mapping in output_mappings)
            {
                phone_data_request.RemoveChild(output_mapping);
            }
        }

        util.UpdateStagingAppXml(State);

        BuildWebServiceDataTrees(WebServiceEvents.SelectedItem.Text);
        ResponseMessage.Text = "Response Map Reset.";
        ResponseTreeEdits.Text = "";
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:34,代码来源:ManageData.aspx.cs

示例11: InitDataTrees

    protected void InitDataTrees(string app)
    {
        try
        {
            WebServiceEvents.Items.Clear();
            WebServiceEvents.Items.Add(new RadComboBoxItem("Select ->", ""));

            DatabaseEvents.Items.Clear();
            DatabaseEvents.Items.Add(new RadComboBoxItem("Select ->", ""));

            SpreadSheetEvents.Items.Clear();
            SpreadSheetEvents.Items.Add(new RadComboBoxItem("Select ->", ""));

            PhoneRequestTreeView.Nodes.Clear();
            WebServiceInputTreeView.Nodes.Clear();
            PhoneResponseTreeView.Nodes.Clear();
            WebServiceResponseTreeView.Nodes.Clear();
            DatabaseCommandsView.Nodes.Clear();
            SpreadsheetCommandsView.Nodes.Clear();

            Util util = new Util();
            Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
            XmlDocument doc = util.GetStagingAppXml(State, app);
            if (doc == null)
                return;

            //do events from phone
            XmlNodeList buttons = doc.SelectNodes("//fields/button | //fields/image_button | //fields/table | //fields/switch | //fields/checkbox");
            foreach (XmlNode button in buttons)
            {
                XmlNode page_node = button.ParentNode.ParentNode.SelectSingleNode("name");
                XmlNode id_node = button.SelectSingleNode("id");
                string event_field = id_node.InnerText.Trim();

                string button_id = button.SelectSingleNode("id").InnerText;
                XmlNode submit = button.SelectSingleNode("submit");
                if (submit != null)
                {
                    string page_name = null;
                    XmlNode post_node = submit.SelectSingleNode("post");
                    if (post_node != null) //new syntax
                    {
                        XmlNode response_page_node = post_node.SelectSingleNode("response_page");
                        if (response_page_node != null)
                            page_name = response_page_node.InnerText;
                        else
                            page_name = page_node.InnerText;
                    }
                    else //old syntax
                    {
                        string action = submit.InnerText;
                        //this code is compatible with old syntax
                        if (action.StartsWith("post") )
                        {
                            if (action.Contains("response_page:") || action.Contains("response_page~"))
                            {
                                string[] split = action.Split(";".ToCharArray());
                                if (split[0].Length > 19)
                                    page_name = split[0].Substring(19);
                                else
                                    page_name = split[1].Substring(14);
                            }
                            else
                                page_name = page_node.InnerText;
                        }

                    }
                    if (page_name != null)
                    {
                        WebServiceEvents.Items.Add(new RadComboBoxItem(event_field, page_node.InnerText + ":" + page_name + ":" + event_field));
                        DatabaseEvents.Items.Add(new RadComboBoxItem(event_field, page_node.InnerText + ":" + page_name + ":" + event_field));
                        SpreadSheetEvents.Items.Add(new RadComboBoxItem(event_field, page_node.InnerText + ":" + page_name + ":" + event_field));
                    }
                }
            }

            //set default first
            ManageDataType.SelectedIndex = 0;
            ManageTypeMultiPage.SelectedIndex = Constants.BLANK_PAGE;

            if ( State["ManageDataType"] != null)
            {
                switch ( State["ManageDataType"].ToString())
                {
                    case "google_spreadsheet":
                        ManageDataType.SelectedIndex = Constants.GOOGLE_DOCS_INDEX;
                        ManageTypeMultiPage.SelectedIndex = Constants.GOOGLE_DOCS_PAGE;
                        break;
                    case "database":
                        ManageDataType.SelectedIndex = Constants.DATABASE_INDEX;
                        ManageTypeMultiPage.SelectedIndex = Constants.DATABASE_PAGE;
                        break;
                    case "web_service":
                        ManageDataType.SelectedIndex = Constants.WEB_SERVICE_INDEX;
                        ManageTypeMultiPage.SelectedIndex = Constants.WEB_SERVICE_PAGE;
                        break;
                }
            }
            else
            {
//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:ManageData.aspx.cs

示例12: InitDatabaseCommandsView

    protected void InitDatabaseCommandsView(RadTreeNode DatabaseCommandRoot, string event_field)
    {
        XmlUtil x_util = new XmlUtil();
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode database_config = doc.SelectSingleNode("//database_config");

        XmlNode events = database_config.SelectSingleNode("events");
        if (events == null)
            return;

        XmlNode event_name_node = events.SelectSingleNode("event/event_name[.='" + event_field + "']");
        if (event_name_node == null)
            return;

        XmlNode event_node = event_name_node.ParentNode;

        XmlNode sql_commands = event_node.SelectSingleNode("sql_commands");
        if (sql_commands == null)
            return;

        ArrayList DBCommands = new ArrayList();

        XmlNodeList sql_command_list = sql_commands.SelectNodes("sql_command");

        foreach (XmlNode sql_command in sql_command_list)
        {
            if (sql_command.InnerXml.Length == 0)
                continue;
            Hashtable CommandEntry = new Hashtable();
            string command = sql_command.SelectSingleNode("command").InnerText.ToLower();
            CommandEntry["command"] = command;
            if (command == "if")
            {
                CommandEntry["command_condition_device_field1"] = sql_command.SelectSingleNode("command_condition_phone_field1").InnerText;
                CommandEntry["command_condition_operation"] = sql_command.SelectSingleNode("command_condition_operation").InnerText;
                CommandEntry["command_condition_device_field2"] = sql_command.SelectSingleNode("command_condition_phone_field2").InnerText;
            }
            else
            {

                CommandEntry["table"] = sql_command.SelectSingleNode("table").InnerText;

                XmlNodeList database_fields = sql_command.SelectNodes("field_item");
                if (database_fields != null)
                {
                    ArrayList DBFields = new ArrayList();
                    foreach (XmlNode field in database_fields)
                    {
                        if (field.InnerXml.Length == 0)
                            continue;
                        Hashtable FieldEntry = new Hashtable();
                        FieldEntry["database_field"] = field.SelectSingleNode("database_field").InnerText;
                        XmlNode phone_field_node = field.SelectSingleNode("phone_field");
                        if (phone_field_node != null)
                            FieldEntry["device_field"] = phone_field_node.InnerText;
                        else
                            FieldEntry["device_field"] = "";

                        DBFields.Add(FieldEntry);
                    }
                    CommandEntry["database_fields"] = DBFields;

                }
                XmlNodeList conditions = sql_command.SelectNodes("condition");
                if (conditions != null)
                {
                    ArrayList DBConditions = new ArrayList();
                    foreach (XmlNode condition in conditions)
                    {
                        if (condition.InnerXml.Length == 0)
                            continue;
                        Hashtable ConditionEntry = new Hashtable();
                        ConditionEntry["condition_operation"] = condition.SelectSingleNode("condition_operation").InnerText;
                        ConditionEntry["condition_1st_field"] = condition.SelectSingleNode("condition_1st_field").InnerText;
                        ConditionEntry["field_operation"] = condition.SelectSingleNode("field_operation").InnerText;
                        XmlNode node = condition.SelectSingleNode("condition_2nd_field");
                        if (node != null)
                            ConditionEntry["condition_2nd_field"] = node.InnerText;
                        else
                            ConditionEntry["condition_2nd_field"] = "";
                        DBConditions.Add(ConditionEntry);
                    }
                    CommandEntry["conditions"] = DBConditions;

                }
                XmlNode order_by = sql_command.SelectSingleNode("order_by");
                if (order_by != null)
                {
                    Hashtable OrderBy = new Hashtable();
                    if (order_by.InnerXml.Length > 0)
                    {
                        OrderBy["sort_field"] = order_by.SelectSingleNode("sort_field").InnerText;
                        OrderBy["sort_direction"] = order_by.SelectSingleNode("sort_direction").InnerText;
                        CommandEntry["order_by"] = OrderBy;
                    }
                }
            }
            DBCommands.Add(CommandEntry);
//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:ManageData.aspx.cs

示例13: GetFirstDatabaseTable

    protected string GetFirstDatabaseTable()
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlDocument doc = util.GetStagingAppXml(State);
        XmlNode database_config = doc.SelectSingleNode("//database_config");
        if (database_config == null)
        {
            return null;
        }

        XmlNodeList table_list = database_config.SelectNodes("//tables/table");
        ArrayList tables = new ArrayList();
        foreach (XmlNode table_node in table_list)
        {
            XmlNode table_name = table_node.SelectSingleNode("table_name");
            tables.Add(table_name.InnerText);
        }
        tables.Sort();
        if (tables.Count == 0)
            return null;
        return tables[0].ToString();
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:23,代码来源:ManageData.aspx.cs

示例14: DeleteWebServiceInputTreeViewMethod

    protected void DeleteWebServiceInputTreeViewMethod(RadTreeNode view_method_node)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        XmlDocument doc = util.GetStagingAppXml(State);
         State["AppXmlDoc"] = doc;
        XmlNode phone_data_requests = doc.SelectSingleNode("//phone_data_requests");
        if (phone_data_requests == null)
            return;
        string method = view_method_node.Text;

        XmlNode xml_method_node = phone_data_requests.SelectSingleNode("phone_data_request/method[.='" + method + "']");
        if (xml_method_node != null)
        {
            XmlNode phone_data_request = xml_method_node.ParentNode;
            phone_data_request.ParentNode.RemoveChild(phone_data_request);

            XmlNode web_service_data_responses = doc.SelectSingleNode("//web_service_data_responses");
            xml_method_node = web_service_data_responses.SelectSingleNode("web_service_data_response/method[.='" + method + "']");
            if (xml_method_node != null)
            {
                XmlNode phone_data_response = xml_method_node.ParentNode;
                web_service_data_responses.RemoveChild(phone_data_response);
            }

            util.UpdateStagingAppXml(State);
        }

        BuildWebServiceDataTrees(WebServiceEvents.SelectedItem.Text);
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:30,代码来源:ManageData.aspx.cs

示例15: GetDesign

    protected XmlDocument GetDesign(string application_id, string user_id, string customer_id,
        int device_display_width, int device_display_height, string app_status, string time_stamp)
    {
        XmlUtil x_util = new XmlUtil();
        Util util = new Util();
        DB db = new DB();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        string sql = "SELECT application_name,application_type FROM applications WHERE application_id='" + application_id + "'";
        DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
        DataRow row = rows[0];
        string application_name = row["application_name"].ToString();
        string application_type = row["application_type"].ToString();
        State["SelectedApp"] = application_name;

        XmlDocument Design = null;
        if (app_status == "staging")
        {
            Design = util.GetStagingAppXml(State, application_name);
        }
        else
        {
            Design = util.GetProductionAppXml(State, application_name);
        }

        if (Design == null)
            return null;

        if (application_type == Constants.HYBRID_APP_TYPE)
        {
            WebAppsUtil w_util = new WebAppsUtil();
            State["SelectedAppType"] = Constants.HYBRID_APP_TYPE;
             HttpRuntime.Cache["NewWebAppHtml"] = File.ReadAllText(Server.MapPath(".") + @"\App_Data\NewViziAppsWebApp.txt");
             HttpRuntime.Cache["NewHybridAppXml"] = File.ReadAllText(Server.MapPath(".") + @"\App_Data\NewViziAppsHybridApp.xml");
             HttpRuntime.Cache["ShareThisScripts"] = File.ReadAllText(Server.MapPath(".") + @"\App_Data\ShareThisScripts.txt");
             HttpRuntime.Cache["TempFilesPath"] = Server.MapPath(".") + @"\temp_files\";

            State["Username"] = util.GetUsernameFromCustomerID(State, customer_id);
            //get original design display width and height
            string device_design_width = Design.SelectSingleNode("//configuration/device_design_width").InnerText;
            string device_design_height = Design.SelectSingleNode("//configuration/device_design_height").InnerText;
            double x_size_factor = 1.0D;
            double y_size_factor = 1.0D;
            if (device_display_width > 600)
            {
                x_size_factor = Convert.ToDouble(device_display_width) / Convert.ToDouble(device_design_width);
                y_size_factor = Convert.ToDouble(device_display_height) / Convert.ToDouble(device_design_height);
            }
            if (app_status == "production")
                State["IsProduction"] = true;
            else
                State["IsProduction"] = false;
            string html = w_util.GetWebApp(State, Design, x_size_factor, y_size_factor);
            Design = x_util.GenerateHybridAppXml(State, Design, device_display_width.ToString(), device_display_height.ToString(), html);
        }
        XmlNode configuration = Design.SelectSingleNode("//configuration");

        if (user_id != null && user_id.Length > 0)
            x_util.CreateNode(Design, configuration, "user_id", user_id);
        x_util.CreateNode(Design, configuration, "customer_id", customer_id);
        XmlNode app_node = Design.SelectSingleNode("//application");
        if (time_stamp == null)
        {
            if (app_status == "staging")
            {
                time_stamp = util.GetStagingAppTimeStamp(State, application_id);
            }
            else
            {
                time_stamp = util.GetProductionAppTimeStamp(State, application_id);
            }
        }

        x_util.CreateNode(Design, app_node, "time_stamp", time_stamp);
        XmlNode id_node = app_node.SelectSingleNode("id");
        if (id_node == null)
            x_util.CreateNode(Design, app_node, "id", application_id);
        else
            id_node.InnerText = application_id;

        XmlNode root = Design.SelectSingleNode("app_project");
        if (root == null)
            root = Design.SelectSingleNode("mobiflex_project");

        XmlNode status_node = x_util.CreateNode(Design, root, "status", "OK");

        return Design;
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:87,代码来源:PhoneWebService.cs


注:本文中的Util.GetStagingAppXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。