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


C# Util.GetStagingAppTimeStamp方法代码示例

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


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

示例1: Report


//.........这里部分代码省略.........
                    if (staging_status == null || (!staging_status.Contains("staging") && customer_id != null))
                    {
                        sql = "SELECT application_id FROM applications WHERE customer_id='" + customer_id + "' AND status LIKE '%staging%'";
                        string new_application_id = db.ViziAppsExecuteScalar(State, sql);
                        if (new_application_id != null)
                        {
                            XmlDocument Design = GetDesign(new_application_id, user_id, customer_id, Convert.ToInt32(display_width), Convert.ToInt32(display_height), app_status, null);
                            if (Design != null)
                            {
                                Design.SelectSingleNode("//status").InnerText = "update_app";
                                SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, latitude, longitude, "app updated");
                            }
                            else
                            {
                                Design = new XmlDocument();
                                XmlNode root2 = Design.CreateElement("report_response");
                                Design.AppendChild(root2);
                                x_util.CreateNode(Design, root2, "status", "kill");
                                x_util.CreateNode(Design, root2, "status_message", "Application no longer exists.");
                                SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, latitude, longitude, "app does not exist");
                            }
                            return Design;
                        }
                    }
                    db.CloseViziAppsDatabase(State);
                }
            }

            string app_time_stamp = request.QueryString.Get("app_time_stamp");
            if (app_time_stamp != null && app_time_stamp.Length > 0)
            {
                string date_time_modified = null;
                if (app_status == "staging")
                    date_time_modified = util.GetStagingAppTimeStamp(State, application_id);
                else
                {
                    date_time_modified = State["DateTimeModified"].ToString();
                }
                DateTime AppDateTime;
                bool isGoodAppDateTime= DateTime.TryParse(app_time_stamp, out AppDateTime);
                DateTime DateTimeModified;
                bool isGoodDateTimeModified = DateTime.TryParse(date_time_modified, out DateTimeModified);
                if (isGoodAppDateTime && isGoodDateTimeModified && AppDateTime != DateTimeModified)
                { // assuming that there is a newer version
                    XmlDocument Design = null;
                    if (app_status == "staging")
                    {
                        Design = GetDesign(application_id, user_id, customer_id, Convert.ToInt32(display_width), Convert.ToInt32(display_height), app_status, date_time_modified);
                    }
                    else
                    {
                        Design = new XmlDocument();
                        Design.LoadXml(util.GetWebPage(State["AppDesignURL"].ToString()));
                    }
                    if (Design != null)
                    {
                        Design.SelectSingleNode("//status").InnerText = "update_app";
                        SaveReport(State, application_id, app_status, customer_id, user_id, device_id, device_model, device_version, viziapps_version, latitude, longitude, "app updated");
                    }
                    else
                    {
                        Design = new XmlDocument();
                        XmlNode root2 = Design.CreateElement("report_response");
                        Design.AppendChild(root2);
                        x_util.CreateNode(Design, root2, "status", "kill");
                        x_util.CreateNode(Design, root2, "status_message", "Application no longer exists.");
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:67,代码来源:PhoneWebService.cs

示例2: 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

示例3: GetWebApp

    public string GetWebApp(Hashtable State,XmlDocument xmlDoc, double x_size_factor,double y_size_factor )
    {
        try
        {
            XmlUtil x_util = new XmlUtil();
            Util util = new Util();
            DataSources DS = new DataSources();
            HtmlDocument htmlDoc = new HtmlDocument();

            //Load App Foundation
            StringBuilder NewWebAppHtml = new StringBuilder( HttpRuntime.Cache["NewWebAppHtml"].ToString());
            if (State["IsProduction"] == null)
                State["IsProduction"] = false;
            if ((bool)State["IsProduction"]== true)
            {
                string production_app_name = util.GetProductionAppName(State);
                NewWebAppHtml.Replace("CUSTOM_TITLE", production_app_name);
            }
            else
            {
                NewWebAppHtml.Replace("CUSTOM_TITLE", State["SelectedApp"].ToString());
            }

            /*if(false)
            {
                 NewWebAppHtml.Replace("ADDON_VIZIAPPS_SCRIPTS",  HttpRuntime.Cache["ShareThisScripts"].ToString());
            }
            else*/
                NewWebAppHtml.Replace("ADDON_VIZIAPPS_SCRIPTS", "");

                        //add custom header html
            NewWebAppHtml.Replace("CUSTOM_ACCOUNT_HEADER",util.GetCustomHeaderHTML(State));

            htmlDoc.LoadHtml(NewWebAppHtml.ToString());
            HtmlNode root = htmlDoc.DocumentNode;

            //Load Custom App Init
            StringBuilder customInitScript = new StringBuilder();
            string application_id = util.GetAppID(State);
            customInitScript.Append("var app_id = '" + application_id + "';\n");

            string app_time_stamp = null;
            if ((bool)State["IsProduction"] == false)
                app_time_stamp = util.GetStagingAppTimeStamp(State, application_id);
            else
                app_time_stamp = util.GetProductionAppTimeStamp(State, application_id);

            if (State["SelectedDeviceType"] == null)
                State["SelectedDeviceType"] = Constants.IPHONE;

            customInitScript.Append("\tvar app_time_stamp = '" + app_time_stamp + "';\n");
            customInitScript.Append("\tvar customer_id = '" + State["CustomerID"].ToString() + "';\n");
            customInitScript.Append("\tvar customer = '" + State["Username"].ToString() + "';\n");
            customInitScript.Append("\tvar app_name = '" + State["SelectedApp"].ToString() + "';\n");
            customInitScript.Append("\tvar design_device_type = '" + State["SelectedDeviceType"].ToString().ToLower() + "';\n");
            string viziapps_transition_type = null;
            if(State["PageTransitionType"] != null)
                viziapps_transition_type = State["PageTransitionType"].ToString();
            else
                 viziapps_transition_type ="slide";
            customInitScript.Append("\tvar viziapps_transition_type = '" + viziapps_transition_type + "';\n");

            switch (State["SelectedDeviceType"].ToString())
            {
                case Constants.IPHONE:
                case Constants.ANDROID_PHONE:
                default:
                    customInitScript.Append("\tvar ios_landscape_width_factor = " + Constants.IPHONE_LANDSCAPE_WIDTH_FACTOR + ";\n");
                    customInitScript.Append("\tvar ios_landscape_height_factor = " + Constants.IPHONE_LANDSCAPE_HEIGHT_FACTOR + ";\n");
                    customInitScript.Append("\tvar android_landscape_width_factor = " + Constants.ANDROID_PHONE_LANDSCAPE_WIDTH_FACTOR + ";\n");
                    customInitScript.Append("\tvar android_landscape_height_factor = " + Constants.ANDROID_PHONE_LANDSCAPE_HEIGHT_FACTOR + ";\n");
                    break;
                case Constants.ANDROID_TABLET:
                case Constants.IPAD:
                    customInitScript.Append("\tvar ios_landscape_width_factor = " + Constants.IPAD_LANDSCAPE_WIDTH_FACTOR + ";\n");
                    customInitScript.Append("\tvar ios_landscape_height_factor = " + Constants.IPAD_LANDSCAPE_HEIGHT_FACTOR + ";\n");
                    customInitScript.Append("\tvar android_landscape_width_factor = " + Constants.ANDROID_TABLET_LANDSCAPE_WIDTH_FACTOR + ";\n");
                    customInitScript.Append("\tvar android_landscape_height_factor = " + Constants.ANDROID_TABLET_LANDSCAPE_HEIGHT_FACTOR + ";\n");
                    break;
                }

            if((bool)State["IsProduction"])
                 customInitScript.Append("\tvar is_production = true;\n");
            else
                customInitScript.Append("\tvar is_production = false;\n");

            string device_type = x_util.GetAppDeviceType(State);
            if (device_type == Constants.IPAD || device_type == Constants.ANDROID_TABLET)
                customInitScript.Append("\tvar does_background_image_exist = false;\n");
            else
                customInitScript.Append("\tvar does_background_image_exist = true;\n");

            if (DS.DoesAppUseGoogleSpreadsheets(State))
            {
                customInitScript.Append("\tvar doesAppUseGoogleSpreadsheets = true;\n");
                customInitScript.Append("\tvar isGoogleDataLoaded = false;\n");
                customInitScript.Append("google.load('gdata', '2.x');\n");
                customInitScript.Append("google.setOnLoadCallback(onGoogleDataLoad);\n");
                customInitScript.Append("function onGoogleDataLoad() {isGoogleDataLoaded=true;}\n");
            }
//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:WebAppsUtil.cs


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