public ActionResult DemoGetAccount()
        {
            string        systemName = Request["systemName"];
            string        area = "", city = "", realIP = "";
            Sql_DemoModel data = null;

            try
            {
                HttpWebRequest reqHttpWeb     = (HttpWebRequest)WebRequest.Create(string.Format("http://ip.ws.126.net/ipquery?ip=", realIP));
                StreamReader   responseReader = new StreamReader(reqHttpWeb.GetResponse().GetResponseStream(), System.Text.Encoding.Default);
                string         json           = responseReader.ReadToEnd();
                Match          m = Regex.Match(json, @"var lo=""(.*?)"", lc=""(.*?)""(.*)", RegexOptions.IgnoreCase | RegexOptions.Singleline); //[\s]*
                if (m.Success)
                {
                    area = m.Result("$1");
                    city = m.Result("$2");
                }
            }
            catch { }
            if (!string.IsNullOrEmpty(Request["userId"]) && !string.IsNullOrEmpty(Request["gamedemoId"]))
            {
                int userId     = int.Parse(Request["userId"]);
                int gamedemoId = int.Parse(Request["gamedemoId"]);
                data = GameDemoBll.DemoGetAccount(gamedemoId, userId, systemName, area, city);
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public Sql_DemoModel DemoGetAccount(int demoId, int userId, string sName, string area, string city)
        {
            SqlParameter[] pms =
            {
                new SqlParameter("@demoid",     SqlDbType.Int)
                {
                    Value = demoId
                },
                new SqlParameter("@userid",     SqlDbType.Int)
                {
                    Value = userId
                },
                new SqlParameter("@sname",      SqlDbType.NVarChar)
                {
                    Value = sName
                },
                new SqlParameter("@userarea",   SqlDbType.NVarChar)
                {
                    Value = area
                },
                new SqlParameter("@usercity",   SqlDbType.NVarChar)
                {
                    Value = city
                },
                new SqlParameter("@uname",      SqlDbType.NVarChar,  200),
                new SqlParameter("@pass",       SqlDbType.NVarChar,  200),
                new SqlParameter("@systemname", SqlDbType.NVarChar,  200),
                new SqlParameter("@url",        SqlDbType.NVarChar,  500),
                new SqlParameter("@err",        SqlDbType.NVarChar, 1000),
            };
            pms[5].Direction = ParameterDirection.Output;
            pms[6].Direction = ParameterDirection.Output;
            pms[7].Direction = ParameterDirection.Output;
            pms[8].Direction = ParameterDirection.Output;
            pms[9].Direction = ParameterDirection.Output;
            var           data  = dbSession.ExecuteQuery <Sql_DemoModel>("exec DemosDole @demoid, @userid,@sname,@userarea,@usercity,@uname out, @pass out,@systemname out,@url out,@err out", pms).FirstOrDefault();
            Sql_DemoModel model = new Sql_DemoModel()
            {
                UName      = pms[5].Value.ToString(),
                Pass       = pms[6].Value.ToString(),
                Systemname = pms[7].Value.ToString(),
                Url        = pms[8].Value.ToString(),
                Err        = pms[9].Value.ToString(),
            };

            return(model);
        }