protected void Page_Load(object sender, EventArgs e) { Result result = new Result(); JavaScriptSerializer js = new JavaScriptSerializer(); try { if (!string.IsNullOrEmpty(this.Request["checkshop"])) { string checkshop = Convert.ToString(this.Request["checkshop"]); checkshop = RequestString.NoHTML(checkshop); string sql = " update Userinfo set State=1 WHERE id in (" + checkshop + ") "; int id = TableOperate <Userinfo> .Execute(sql); if (id > 0) { result.isOk = true; } else { result.msg = "设置失败"; } } } catch (Exception ex) { result.isOk = false; result.msg = ex.ToString(); } Response.ContentType = "text/json"; Response.Write(js.Serialize(result)); Response.End(); }
public void RequestPlayerUpdate() { RequestString requestString = new RequestString(Links.DeviceInformation.PlayerData.Id, Links.DeviceInformation.PlayerData.Description, RequestString.RequestStringType.ChangeUserDescription); Links.TcpClient.SendData(requestString.Serialize()); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } if (string.IsNullOrEmpty(this.Request["sn"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn)) { string error = "加密不正确"; Response.Write(error); return; } Area v = new Area(); Area condition = new Area(); condition.ExhibitionID = SeviceID; List <Area> m_lightList = TableOperate <Area> .Select(v, condition, 0, " order by OrderID asc "); string json = "{\"list\":["; for (int i = 0; i < m_lightList.Count; i++) { json += "{\"id\":" + m_lightList[i].ID + ", \"name\":\"" + m_lightList[i].AreaName + "\"},"; } json = json.Trim(','); json += "]}"; Response.Write(json); }
public void RequsetAddComment(string comment, int EventID) { RequestString requestString = new RequestString(EventID, comment, RequestString.RequestStringType.AddEventReview); Links.TcpClient.SendData(requestString.Serialize()); }
private void ParseRequest() { if (RequestString.IsNullOrWhiteSpace()) { throw new InvalidDataException(); } string[] lines = RequestString.Split("\r\n"); // first line has format METHOD ROUTE PROTOCOL string[] tokens = lines[0].Split(' '); if (tokens.Length != 3) { throw new InvalidDataException(); } Values.Add("Method", tokens[0]); Values.Add("Route", tokens[1]); Values.Add("Protocol", tokens[2]); // extract endpoint from Route string[] endpointTokens = Values["Route"].Split('/'); string endpoint = !endpointTokens[1].IsNullOrWhiteSpace() ? endpointTokens[1] : "home"; // trim out query parameters endpoint = endpoint.Contains('?') ? endpoint.Substring(0, endpoint.IndexOf('?')) : endpoint; endpoint = endpoint.IsNullOrWhiteSpace() ? "home" : endpoint; Values.Add("Endpoint", endpoint); // rest of lines has format key: value // after the empty line comes the body for (int i = 1; i < lines.Length; i++) { if (lines[i].Contains(':')) { int splitIndex = lines[i].IndexOf(':'); string key = lines[i].Substring(0, splitIndex); string value = lines[i].Substring(splitIndex + 1).Trim(); Values.Add(key, value); } else if (lines[i].IsNullOrWhiteSpace()) { Values.Add("Payload", ""); for (int j = i + 1; j < lines.Length; j++) { Values["Payload"] += lines[j] + "\n"; } break; } } Method = Values["Method"]; Endpoint = Values["Endpoint"]; Payload = Values["Payload"]; Authorization = Values.ContainsKey("Authorization") ? Values["Authorization"] : null; Route = Values["Route"]; }
protected void Page_Load(object sender, EventArgs e) { Result result = new Result(); JavaScriptSerializer js = new JavaScriptSerializer(); try { if (!string.IsNullOrEmpty(this.Request["iD"])) { int iD = Convert.ToInt32(this.Request["iD"]); result.isOk = AddLog(iD + ""); result.msg = "删除失败"; } else if (!string.IsNullOrEmpty(this.Request["checkshop"])) { string checkshop = Convert.ToString(this.Request["checkshop"]); checkshop = RequestString.NoHTML(checkshop); result.isOk = AddLog(checkshop); result.msg = "删除失败"; } } catch (Exception ex) { result.isOk = false; result.msg = ex.ToString(); } Response.ContentType = "text/json"; Response.Write(js.Serialize(result)); Response.End(); }
public Request(NetworkStream ns) { try { Headers = new Dictionary <string, string>(); var sr = new StreamReader(ns); RequestString = sr.ReadLine(); var args = RequestString.Split(' '); Method = args[0]; URL = Uri.UnescapeDataString(args[1]); Protocol = args[2]; string line; while (!string.IsNullOrEmpty(line = sr.ReadLine())) { int j = line.IndexOf(":"); if (j != -1) { string name = line.Substring(0, j); if (!Headers.ContainsKey(name)) { Headers.Add(name, line.Substring(j + 2)); } } } } catch { } }
protected void Page_Load(object sender, EventArgs e) { Light v = new Light(); Light condition = new Light(); if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn)) { string error = "加密不正确"; Response.Write(error); return; } condition.ExhibitionID = SeviceID; condition.State = 1; List <Light> m_lightList = TableOperate <Light> .Select(v, condition, 0, " order by OrderID asc "); string json = "{\"list\":["; for (int i = 0; i < m_lightList.Count; i++) { json += "{\"id\":" + m_lightList[i].ID + ", \"name\":\"" + m_lightList[i].Title + "\", \"AreaID\":" + m_lightList[i].AreaID + ", \"state\":" + m_lightList[i].State + ", \"SwitchIP\":\"" + m_lightList[i].SwitchIP + "\", \"SwitchPort\":" + m_lightList[i].SwitchPort + ", \"SwitchIndex\":" + m_lightList[i].SwitchIndex + ", \"SwitchGroup\":" + m_lightList[i].SwitchGroup + "},"; } json = json.Trim(','); json += "]}"; Response.Write(json); }
protected void Page_Load(object sender, EventArgs e) { Result result = new Result(); JavaScriptSerializer js = new JavaScriptSerializer(); try { if (!string.IsNullOrEmpty(this.Request["iD"])) { int iD = Convert.ToInt32(this.Request["iD"]); if (TableOperate <FaceLog> .Delete(iD) > 0) { result.isOk = true; } else { result.msg = "删除失败"; } } else if (!string.IsNullOrEmpty(this.Request["checkshop"])) { string checkshop = Convert.ToString(this.Request["checkshop"]); checkshop = RequestString.NoHTML(checkshop); int id = TableOperate <FaceLog> .MultiDelete(checkshop); if (id > 0) { result.isOk = true; } else { result.msg = "删除失败"; } } else if (!string.IsNullOrEmpty(this.Request["all"])) { string sql = " Delete FaceLog where ID>0 "; int id = TableOperate <FaceLog> .Execute(sql); if (id > 0) { result.isOk = true; } else { result.msg = "删除失败"; } } } catch (Exception ex) { result.isOk = false; result.msg = ex.ToString(); } Response.ContentType = "text/json"; Response.Write(js.Serialize(result)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } if (string.IsNullOrEmpty(this.Request["sn"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn)) { string error = "{\"state\":\"false\", \"msg\":\"加密错误\"}"; Response.Write(error); return; } else { string act = Convert.ToString(Request["act"]); int rootID = 0; if (!string.IsNullOrEmpty(this.Request["rootID"])) { rootID = Convert.ToInt32(Request["rootID"]); } int typeid = 0; if (!string.IsNullOrEmpty(this.Request["typeid"])) { typeid = Convert.ToInt32(Request["typeid"]); } List <QuestionType> Typelist = QusetionProvider.SelectByRootID(rootID); string json = "{\"Typelist\":["; for (int i = 0; i < Typelist.Count; i++) { json += "{\"ID\":" + Typelist[i].ID + ", \"Name\":\"" + Typelist[i].Name + "\", \"ParentID\":\"" + Typelist[i].ParentID + "\", \"Depth\":\"" + Typelist[i].Depth + "\", \"RootID\":\"" + Typelist[i].RootID + "\"},"; } json = json.Trim(','); json += "],"; View_Question condition = new View_Question(); condition.ExhibitionID = SeviceID; if (typeid != 0) { condition.TypeID = typeid; } View_Question value = new View_Question(); List <View_Question> list = TableOperate <View_Question> .Select(value, condition, 0, "order by OrderID asc"); json += "\"list\":["; for (int i = 0; i < list.Count; i++) { json += "{\"ID\":" + list[i].ID + ", \"Title\":\"" + list[i].Title + "\", \"Files\":\"UploadFiles/" + list[i].Files + "\", \"Brief\":\"" + list[i].Brief + "\", \"TypeID\":\"" + list[i].TypeID + "\",\"OptionList\":" + GetOption(list[i]) + "},"; } json = json.Trim(','); json += "]}"; Response.Write(json); } }
public void RequestVisit(string res) { RequestString requestString = new RequestString(Links.DeviceInformation.PlayerData.Id, res, RequestString.RequestStringType.MakeUserVisited); Links.TcpClient.SendData(requestString.Serialize()); RequestDescriptionChange(Links.DeviceInformation.PlayerData.Description); }
protected string GetstringKey(string key) { if (!string.IsNullOrEmpty(this.Request[key])) { string stringKey = Convert.ToString(this.Request[key]); stringKey = RequestString.NoHTML(stringKey); return(stringKey); } return(""); }
protected override void OnInit(EventArgs e) { if (User.Identity.IsAuthenticated == false) { string err = "请您先登录,谢谢!!"; err = RequestString.EncodeString(err); //. Response.Redirect("Login.aspx?returnUrl=" + this.Request.Url + "&error=" + err); } base.OnInit(e); }
/// <summary> /// 获取int类型的请求值 /// </summary> /// <param name="key"></param> /// <returns></returns> protected int GetIntKey(string key) { if (!string.IsNullOrEmpty(this.Request[key])) { string stringKey = Convert.ToString(this.Request[key]); stringKey = RequestString.NoHTML(stringKey); return(Convert.ToInt32(stringKey)); } return(0); }
public void UserShouldReturnErrorCodes(string user, int errorcode, string errormessage) { var request = new RequestString { user = user }; var requestString = CreateApiRequestString.GetQueryStringFromModel <IRequestString, RequestString>(request); var innerResult = _fixture.MongoApi.GetUser(requestString) as ErrorModel; Assert.Equal(errorcode, innerResult.StatusCode); Assert.Contains(errormessage, innerResult.message); }
public void FrontPageListThatDoesNotExistsReturnsAnErrir(string list, int errorcode, string errormessage) { var request = new RequestString { list = list }; var requestString = CreateApiRequestString.GetQueryStringFromModel <IRequestString, RequestString>(request); var response = _fixture.MongoApi.FrontPageGetWithList(requestString) as ErrorModel; Assert.Equal(errorcode, response.StatusCode); Assert.Contains(errormessage, response.message); }
public void FrontPage() { var request = new RequestString { list = "tgif" }; var requestString = CreateApiRequestString.GetQueryStringFromModel <IRequestString, RequestString>(request); var response = _fixture.MongoApi.FrontPageGetWithList(requestString) as FrontpageResponse; Assert.Equal(200, response.StatusCode); Assert.Equal(request.list, response.list); Assert.NotEmpty(response.beverages); }
public void FrontPageListsAllWork() { var response = _fixture.MongoApi.FrontPageGetWithoutList() as FrontPageListResponse; Assert.Equal(200, response.StatusCode); foreach (var resp in response.listOfFrontPages) { var request = new RequestString { list = resp.list }; var requestString = CreateApiRequestString.GetQueryStringFromModel <IRequestString, RequestString>(request); var innerResult = _fixture.MongoApi.FrontPageGetWithList(requestString) as FrontpageResponse; Assert.Equal(200, innerResult.StatusCode); Assert.Equal(request.list, innerResult.list); Assert.NotEmpty(innerResult.beverages); } }
private void Parse() { var lines = RequestString.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); if (lines.Length == 0) { return; } Headers = new List <Header>(); for (int i = 1; i < lines.Length; i++) { Regex headerRegex = new Regex(@"^([a-zA-Z\-]*):\s(.*)$"); var match = headerRegex.Match(lines[i]); Header header = new Header { Name = match.Groups[1].Value, Value = match.Groups[2].Value, }; Headers.Add(header); } ParseMethod(lines[0]); }
public void UserListWithEachUser() { var response = _fixture.MongoApi.GetUsers() as UsersResponse; Assert.Equal(200, response.StatusCode); Assert.NotEmpty(response.ActiveUsers); foreach (var user in response.ActiveUsers) { var request = new RequestString { user = user }; var requestString = CreateApiRequestString.GetQueryStringFromModel <IRequestString, RequestString>(request); var innerResult = _fixture.MongoApi.GetUser(requestString) as UserResponse; Assert.Equal(200, innerResult.StatusCode); Assert.NotEmpty(innerResult.Lists); } }
protected void Page_Load(object sender, EventArgs e) { int rootID = 0; Channel v = new Channel(); Channel condition = new Channel(); if (!string.IsNullOrEmpty(this.Request["rootID"])) { rootID = Convert.ToInt32(Request["rootID"]); } string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); List <Channel> list = ChannelProvider.SelectByRootID(rootID); string json = "{\"list\":["; for (int i = 0; i < list.Count; i++) { json += "{\"ID\":" + list[i].ID + ", \"name\":\"" + list[i].Name + "\", \"ParentID\":\"" + list[i].ParentID + "\", \"Depth\":\"" + list[i].Depth + "\", \"RootID\":\"" + list[i].RootID + "\",\"News\":" + GetNews(list[i].ID) + "},"; } json = json.Trim(','); json += "]}"; Response.Write(json); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } if (string.IsNullOrEmpty(this.Request["sn"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn)) { string error = "加密不正确"; Response.Write(error); return; } string json = ""; SpeechTitle condition = new SpeechTitle(); SpeechTitle value = new SpeechTitle(); condition.ExhibitionID = SeviceID; List <SpeechTitle> list = TableOperate <SpeechTitle> .Select(value, condition); if (list.Count > 0) { json = "{\"list\":["; for (int i = 0; i < list.Count; i++) { json += "{\"ID\":" + list[i].ID + ", \"Title\":\"" + list[i].Title + "\", \"KeyWord\":\"" + list[i].Key_Word + "\",\"CmdList\":" + GetList(list[i].ID) + "},"; } json = json.Trim(','); json += "]}"; Response.Write(json); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn)) { string error = "加密不正确"; Response.Write(error); return; } ExhibitionOpen condition = new ExhibitionOpen(); condition.ExhibitionID = SeviceID; condition.AddTime = DateTime.Now; int Sid = TableOperate <ExhibitionOpen> .InsertReturnID(condition); if (Sid > 0) { Response.Write("true"); return; } }
protected void Page_Load(object sender, EventArgs e) { Result result = new Result(); JavaScriptSerializer js = new JavaScriptSerializer(); try { if (!string.IsNullOrEmpty(this.Request["iD"])) { int iD = Convert.ToInt32(this.Request["iD"]); if (TableOperate <ModeChannel> .Delete(iD) > 0) { List <ModeChannel> channelList = ModeChannelProvider.SelectAll(); foreach (var item in channelList) { if (item.Path.IndexOf(this.Request["iD"]) > -1) { TableOperate <ModeChannel> .Delete(item.ID); } } result.isOk = true; } else { result.msg = "删除失败"; } } else if (!string.IsNullOrEmpty(this.Request["checkshop"])) { string checkshop = Convert.ToString(this.Request["checkshop"]); checkshop = RequestString.NoHTML(checkshop); int id = TableOperate <ModeChannel> .MultiDelete(checkshop); if (id > 0) { result.isOk = true; } else { result.msg = "删除失败"; } } else if (!string.IsNullOrEmpty(this.Request["all"])) { ModeChannel condition = new ModeChannel(); condition.ExhibitionID = AdminMethod.ExhibitionID; int id = TableOperate <ModeChannel> .Delete(condition); if (id > 0) { result.isOk = true; } else { result.msg = "删除失败"; } } } catch (Exception ex) { result.isOk = false; result.msg = ex.ToString(); } Response.ContentType = "text/json"; Response.Write(js.Serialize(result)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { m_ExhibitionList = ExhibitionProvider.SelectAll(); string action = GetstringKey("action"); if (action != "save") { if (!string.IsNullOrEmpty(this.Request["iD"])) { MyID = Convert.ToInt32(this.Request["iD"]); Admin_User condition = new Admin_User(); if (MyID == -1) { condition.ID = AdminMethod.AdminID; states.Disabled = true; } else { condition.ID = MyID; } news = TableOperate <Admin_User> .GetRowData(condition); iD.Value = Convert.ToString(news.ID); states.Value = Convert.ToString(news.States); } DataBind(); } else { Result result = new Result(); string logbrief = ""; Admin_User newChannelNews = new Admin_User(); newChannelNews.ID = 0; newChannelNews.AutoForm(this.Page); string title = newChannelNews.Name; string headpic = Draw.Drawing(newChannelNews.FullName, newChannelNews.FullName + "_" + newChannelNews.Name + ".png"); newChannelNews.HeadPic = headpic; string pass; if (!string.IsNullOrEmpty(this.Request["pass"])) { pass = Convert.ToString(this.Request["pass"]); pass = Md5JiaMi.JiaMi(pass); // md5加密 } else { pass = Convert.ToString(this.Request["oldpass"]); } newChannelNews.Pass = pass; int _iD; if (!string.IsNullOrEmpty(this.Request["iD"])) { _iD = Convert.ToInt32(this.Request["iD"]); TableOperate <Admin_User> .Update(newChannelNews); result.msg = "编辑成功,等待返回列表"; logbrief = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "编辑了为【" + title + "】的管理员"; } else { string name = Convert.ToString(Request["name"]); name = RequestString.NoHTML(name); if (AdminMethod.IsName(name)) { result.msg = "用户已存在"; Response.ContentType = "text/json"; Response.Write(new JavaScriptSerializer().Serialize(result)); Response.End(); return; } else { newChannelNews.AddTime = DateTime.Now; newChannelNews.AddID = AdminMethod.AdminID; newChannelNews.LastLoginTime = DateTime.Now; _iD = TableOperate <Admin_User> .InsertReturnID(newChannelNews); result.msg = "添加成功,等待返回列表"; logbrief = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "添加了为【" + title + "】的管理员"; } } if (_iD > 0) { result.isOk = true; Lognet.AddLogin(logbrief); if ((newChannelNews.Manage != AdminMethod.AdminManages) && AdminMethod.AdminID == newChannelNews.ID) { AdminMethod.UpdataManage(newChannelNews.Manage); } } else { result.msg = "操作失败"; } Response.ContentType = "text/json"; Response.Write(new JavaScriptSerializer().Serialize(result)); Response.End(); } DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string act = ""; string msg = ""; if (!string.IsNullOrEmpty(Request["act"])) { act = Convert.ToString(Request["act"]); act = RequestString.NoHTML(act); if (act == "insert") { string name = Convert.ToString(RequestString.NoHTML(Request["name"])); string nickname = Convert.ToString(RequestString.NoHTML(Request["nickname"])); string phone = Convert.ToString(RequestString.NoHTML(Request["phone"])); int sex = Convert.ToInt32(Request["sex"]); int hy = Convert.ToInt32(Request["hy"]); int faceid = Convert.ToInt32(Request["faceid"]); if (IsHave(phone)) { msg = "{\"state\":\"false\", \"msg\":\"手机号已被注册\"}"; } else { Userinfo condition = new Userinfo(); condition.Name = name; condition.NickName = nickname; condition.Gender = sex; condition.TradeID = hy; condition.Phone = phone; int id = TableOperate <Userinfo> .InsertReturnID(condition); if (id > 0) { Face face = new Face(); face.ID = faceid; face.UserinfoID = id; TableOperate <Face> .Update(face); msg = "{\"state\":\"true\", \"msg\":\"注册成功\"}"; } else { msg = "{\"state\":\"false\", \"msg\":\"注册失败\"}"; } } } else if (act == "add") { UserVistCount condition = new UserVistCount(); condition.ID = 1; UserVistCount user = TableOperate <UserVistCount> .GetRowData(condition); if (user.ID > 0) { if (user.AddTime.Date == DateTime.Now.Date) { condition.NowDayCount = user.NowDayCount + 1; } else { condition.NowDayCount = 0; } condition.AddTime = DateTime.Now; condition.Count = user.Count + 1; condition.ID = user.ID; TableOperate <UserVistCount> .Update(condition); } else { condition.AddTime = DateTime.Now; condition.NowDayCount = 1; condition.Count = 1; TableOperate <UserVistCount> .Insert(condition); } } } Response.Write(msg); }
protected void Page_Load(object sender, EventArgs e) { string act = ""; string msg = ""; if (!string.IsNullOrEmpty(Request["act"])) { act = Convert.ToString(Request["act"]); if (act == "insert") { string height = Convert.ToString(RequestString.NoHTML(Request["height"])); string weight = Convert.ToString(RequestString.NoHTML(Request["weight"])); string cardNum = Convert.ToString(RequestString.NoHTML(Request["num"])); int faceid = Convert.ToInt32(Request["faceid"]); if (!string.IsNullOrEmpty(Request["userid"])) { int userid = Convert.ToInt32(Request["userid"]); IBeaconDev condition = new IBeaconDev(); condition.IcMac = cardNum; IBeaconDev dev = TableOperate <IBeaconDev> .GetRowData(condition); if (dev.ID > 0) { condition.UserID = userid; condition.ID = dev.ID; TableOperate <IBeaconDev> .Update(condition); Userinfo userinfo = new Userinfo(); userinfo.ID = userid; Userinfo user = TableOperate <Userinfo> .GetRowData(userinfo); if (user.ID > 0) { userinfo.TradeID = user.TradeID + 1; userinfo.AddTime = DateTime.Now; TableOperate <Userinfo> .Update(userinfo); msg = "{\"state\":\"true\", \"msg\":\"IC卡绑定成功\"}"; AddCount(); } } } else { IBeaconDev condition = new IBeaconDev(); condition.IcMac = cardNum; IBeaconDev dev = TableOperate <IBeaconDev> .GetRowData(condition); if (dev.ID > 0) { Userinfo conditions = new Userinfo(); conditions.Name = DateTime.Now.ToString("yyyyMMddHHmmssfff"); conditions.NickName = weight; conditions.Phone = height; conditions.AddTime = DateTime.Now; conditions.TradeID = 1; int userid = TableOperate <Userinfo> .InsertReturnID(conditions); if (userid > 0) { Face face = new Face(); face.ID = faceid; face.UserinfoID = userid; TableOperate <Face> .Update(face); condition.UserID = userid; condition.ID = dev.ID; TableOperate <IBeaconDev> .Update(condition); msg = "{\"state\":\"true\", \"msg\":\"注册成功\"}"; AddCount(); } else { msg = "{\"state\":\"false\", \"msg\":\"注册失败\"}"; } } else { msg = "{\"state\":\"false\", \"msg\":\"IC卡不存在\"}"; } } } else if (act == "check") { string cardNum = Convert.ToString(RequestString.NoHTML(Request["num"])); IBeaconDev condition = new IBeaconDev(); condition.IcMac = cardNum; IBeaconDev dev = TableOperate <IBeaconDev> .GetRowData(condition); if (dev.ID > 0) { if (dev.UserID > 0) { msg = "{\"state\":\"true\", \"msg\":\"该卡已绑定\", \"code\":\"1\"}"; } else { msg = "{\"state\":\"true\", \"msg\":\"该卡未绑定\", \"code\":\"0\"}"; } } else { msg = "{\"state\":\"false\", \"msg\":\"该卡不存在\", \"code\":\"2\"}"; } //int faceid = Convert.ToInt32(Request["faceid"]); //Face face = new Face(); //face.ID = faceid; //Face faces = TableOperate<Face>.GetRowData(face); //if (faces.ID > 0 && face.UserinfoID > 0) //{ // Userinfo conditions = new Userinfo(); // conditions.ID = face.UserinfoID; // Userinfo userinfo = TableOperate<Userinfo>.GetRowData(conditions); // if (userinfo.ID > 0) // { // msg = "{\"state\":\"true\", \"ID\":\"" + userinfo.ID + "\", \"height\":\"" + userinfo.Name + "\", \"weight\":\"" + userinfo.NickName + "\", \"msg\":\"查询成功\"}"; // } // else // { // msg = "{\"state\":\"false\", \"msg\":\"用户不存在\"}"; // } //} //else //{ // msg = "{\"state\":\"false\", \"msg\":\"未查询到该用户\"}"; //} } } Response.Write(msg); }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } if (string.IsNullOrEmpty(this.Request["sn"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn))//对比加密后是否对照 { json = "{\"state\":\"false\", \"msg\":\"加密错误\"}"; } else { string act = ""; act = RequestString.NoHTML(Convert.ToString(Request["act"])); string openid = Convert.ToString(RequestString.NoHTML(this.Request["openid"])); if (act == "insert") { string name = RequestString.NoHTML(Convert.ToString(this.Request["name"])); string phone = RequestString.NoHTML(Convert.ToString(this.Request["phone"])); int count = Convert.ToInt32(RequestString.NoHTML(this.Request["count"])); int exid = Convert.ToInt32(RequestString.NoHTML(this.Request["exid"])); int DateType = Convert.ToInt32(Request["datetype"]); DateTime restime = Convert.ToDateTime(Request["restime"]); int DateAllCount = GetAllCount(DateType);//根据ID查询是否已经有过记录 if (count > DateAllCount) { json = "{\"state\":\"false\", \"msg\":\"人数超过最大参观人数\"}"; } else { ReserveMsg msg = new ReserveMsg(); msg.ReserveCount = count; msg.DateType = DateType; msg.ExhibitionID = exid; msg.OpenID = openid; msg.ReservePhone = phone; msg.ReserveTime = restime; msg.ReserveName = name; msg.States = 0; int id = TableOperate <ReserveMsg> .InsertReturnID(msg);//将预约数据插入并返回 if (id > 0) { json = "{\"state\":\"true\", \"msg\":\"预约成功!\"}"; } else { json = "{\"false\":\"true\", \"msg\":\"预约失败!\"}"; } } } else if (act == "selectdate") { int DateType = Convert.ToInt32(Request["datetype"]); DateTime restime = Convert.ToDateTime(Request["restime"]); ReserveMsg condition = new ReserveMsg(); condition.AddConditon("DateDiff(dd,ReserveTime,'" + restime + "')=0");//添加时间条件 condition.DateType = DateType; condition.States = 1; int count = TableOperate <ReserveMsg> .GetCountValue(condition);//查询获取总数 if (count > 0) { json = "{\"false\":\"true\", \"msg\":\"今日预约已满!\"}"; } } else if (act == "my") { View_Reserve condition = new View_Reserve(); View_Reserve value = new View_Reserve(); condition.OpenID = openid; List <View_Reserve> list = TableOperate <View_Reserve> .Select(value, condition, 0, "order by addtime desc"); } } Response.Write(json); return; }
protected void Page_Load(object sender, EventArgs e) { Device v = new Device(); Device condition = new Device(); if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn)) { string error = "加密不正确"; Response.Write(error); return; } condition.ExhibitionID = SeviceID; condition.TypeID = 1; condition.State = 1; List <Projector> projectorList = TableOperate <Projector> .Select(); List <Device> m_deviceList = TableOperate <Device> .Select(v, condition, 0, " order by OrderID asc "); string json = "{\"list\":["; for (int i = 0; i < m_deviceList.Count; i++) { if (m_deviceList[i].DeviceType == 4) { //投影机 Projector projector = GetProjectorInfo(m_deviceList[i].ProjectorType, projectorList); m_deviceList[i].OpenProtocol = projector.OpenProtocol; m_deviceList[i].QueryClose = projector.QueryClose; m_deviceList[i].QueryOpen = projector.QueryOpen; m_deviceList[i].QueryProtocol = projector.QueryProtocol; m_deviceList[i].ReCharType = projector.ReCharType; m_deviceList[i].CharType = projector.CharType; m_deviceList[i].CloseProtocol = projector.CloseProtocol; } if (m_deviceList[i].CharType != 1) { m_deviceList[i].CloseProtocol = m_deviceList[i].CloseProtocol.Replace(" ", ""); m_deviceList[i].OpenProtocol = m_deviceList[i].OpenProtocol.Replace(" ", ""); m_deviceList[i].QueryProtocol = m_deviceList[i].QueryProtocol.Replace(" ", ""); } if (m_deviceList[i].ReCharType != 1) { m_deviceList[i].QueryClose = m_deviceList[i].QueryClose.Replace(" ", ""); m_deviceList[i].QueryOpen = m_deviceList[i].QueryOpen.Replace(" ", ""); } json += "{\"id\":" + m_deviceList[i].ID + ", \"name\":\"" + m_deviceList[i].Name + "\", \"AreaID\":" + m_deviceList[i].AreaID + ",\"AreaName\":\"" + m_deviceList[i].Name + "\", \"DeviceType\":" + m_deviceList[i].DeviceType + ", \"pic\":\"" + m_deviceList[i].Pic + "\", \"ip\":\"" + m_deviceList[i].Ip + "\", \"openCount\":\"" + m_deviceList[i].OpenCount + "\", \"mac\":\"" + m_deviceList[i].Mac + "\", \"port\":" + m_deviceList[i].Port + ", \"BHome\":" + 1 + ", \"BShow\":" + 1 + ", \"BAllDone\":" + 1 + ", \"SwitchIP\":\"" + m_deviceList[i].SwitchIP + "\", \"SwitchPort\":" + m_deviceList[i].SwitchPort + ", \"SwitchIndex\":" + m_deviceList[i].SwitchIndex + ", \"SwitchGroup\":" + m_deviceList[i].SwitchGroup + ", \"ProjectorType\":" + m_deviceList[i].ProjectorType + ", \"protocol\":" + m_deviceList[i].Protocol + ", \"charType\":" + m_deviceList[i].CharType + ", \"reCharType\":" + m_deviceList[i].ReCharType + ", \"openProtocol\":\"" + m_deviceList[i].OpenProtocol + "\", \"closeProtocol\":\"" + m_deviceList[i].CloseProtocol + "\", \"queryProtocol\":\"" + m_deviceList[i].QueryProtocol + "\", \"queryOpen\":\"" + m_deviceList[i].QueryOpen + "\", \"queryClose\":\"" + m_deviceList[i].QueryClose + "\"},"; } json = json.Trim(','); json += "]}"; Response.Write(json); }
protected void Page_Load(object sender, EventArgs e) { //Response.Headers.Remove("Server"); GlobalConfig condition = new GlobalConfig(); condition.ID = 1; GlobalConfig global = TableOperate <GlobalConfig> .GetRowData(condition);//对表的操作 if (global.ID > 0) { if (global.UserIP == 1 && !AdminMethod.IsWhite()) { Response.Redirect("/ErrorPage/NOIP.html"); return; } } try { Result result = new Result(); string action = RequestString.NoHTML(Convert.ToString(Request["action"])); if (action == "save") { string isCheck = Convert.ToString(HttpContext.Current.Session["isCheck"]); if (isCheck == "") { Random random = new Random(); result.isOk = false; result.msg = "请先验证验证码!!!" + random.Next(1000); } else { string username = ""; string pass = ""; if (!string.IsNullOrEmpty(Request["username"])) { username = RequestString.NoHTML(Request["username"]); } if (!string.IsNullOrEmpty(Request["usermima"])) { pass = RequestString.NoHTML(Request["usermima"]); } if (username != "" && pass != "") { if (!IsLoginError())//超过三次清空验证码重新验证 { HttpContext.Current.Session["isCheck"] = null; result.isOk = false; result.msg = "错误次数太多请一分钟后重试!!!"; } else { bool IsSuccess = AdminMethod.VerifyPwd(username, pass); if (IsSuccess) { HttpContext.Current.Session["isCheck"] = null; HttpContext.Current.Session["LoginCount"] = null; HttpContext.Current.Session["lastTime"] = null; result.isOk = true; result.url = "index.aspx"; } else { //ClientScript.RegisterStartupScript(GetType(), "message", "<script>layer.msg('账号或密码错误!!!', { offset: 't', anim: 6});</script>"); //return; result.isOk = false; result.msg = "账号或密码错误!!!"; loglock(); } } } } Response.ContentType = "application/json"; Response.Write(JsonConvert.SerializeObject(result)); Response.End(); } else if (action == "loginout") { AdminMethod.LoginOut(); Response.Redirect("login.aspx"); } else { HttpContext.Current.Session["LoginCount"] = null; HttpContext.Current.Session["lastTime"] = null; HttpContext.Current.Session["isCheck"] = null; } } catch (Exception ex) { } }