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


C# Util.GetUsernameFromCustomerID方法代码示例

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


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

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

示例2: ApplicationInit

    /*
        public bool ApplicationInit(Hashtable State, RadComboBox AppsList, string AppID, string AppCGCustomerCode)
        {
            Util util = new Util();
            string app = AppsList.SelectedValue;

            if (app.Contains("->"))
                return false;

            State["SelectedApp"] = app;

            State["SelectedAppType"] = util.GetAppType(State);

            State["application_id"] = util.GetAppID(State);
            AppID = State["application_id"].ToString();

            AppCGCustomerCode = getAppPaidSKU(State);

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

            XmlUtil x_util = new XmlUtil();
            State["SelectedDeviceView"] = State["SelectedDeviceType"] = x_util.GetAppDeviceType(State);

            string username = State["Username"].ToString();
            State["customer_id"] = util.GetCustomerIDFromUsername(State,username);

            return true;
        }
    */
    //public void StorePaidServicesDB(Customer returnCustomer, Hashtable State, bool paid)
    public void StorePaidServicesDB(string confirm, string sku, Hashtable State, bool paid)
    {
        try
            {
                Util util = new Util();

                string customer_id = "";

                if (State["customer_id"] != null)
                    customer_id = State["customer_id"].ToString();

                string NOW = DateTime.Now.ToUniversalTime().ToString("u").Replace("Z", "");
                string purchase_date = DateTime.Now.ToUniversalTime().ToString("d");
                string application_id = State["application_id"].ToString();
                string app_name = State["SelectedApp"].ToString();

                DB db = new DB();

                string sql = "UPDATE customers SET status='active'    WHERE status!='active' AND customer_id='" + customer_id + "'";
                try
                {
                    db.ViziAppsExecuteNonQuery(State, sql);
                }
                catch (Exception ex)
                {
                    util.LogError(State, ex);

                    if (!ex.Message.ToLower().Contains("duplicate"))
                        throw new Exception(ex.Message);
                }

                StringBuilder b_sql = new StringBuilder("INSERT INTO paid_services SET ");
                b_sql.Append("purchase_date='" + purchase_date + "',");
                b_sql.Append("sku='" + sku + "',");
                b_sql.Append("confirmation='" + confirm + "',");
                string username = util.GetUsernameFromCustomerID(State, customer_id);
                b_sql.Append("username='" + username + "',");
                b_sql.Append("customer_id='" + customer_id + "',");
                b_sql.Append("purchase_date_time='" + NOW + "',");
                b_sql.Append("application_id='" + application_id + "'");
                b_sql.Append(", app_name='" + app_name + "'");

                if (paid)
                    b_sql.Append(", status='paid'");

                System.Diagnostics.Debug.WriteLine("b_sql =" + b_sql.ToString());
                string sql_string = b_sql.ToString();

                try
                {
                    db.ViziAppsExecuteNonQuery(State, sql_string);
                }
                catch (Exception ex)
                {
                    util.LogError(State, ex);

                    if (!ex.Message.ToLower().Contains("duplicate"))
                        throw new Exception(ex.Message);
                }

                db.CloseViziAppsDatabase(State);

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message.ToString() + ex.StackTrace.ToString());

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


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