/// <summary> /// 清除在线状态 /// </summary> /// <param name="info"></param> public static void RemoveOnlineUser(ISessionKey info) { Database db = DataBaseManger.GetDB(""); //info.Token var clearSql = new Sql("delete from FBOnlineUser where UserID=@0 and DeviceType='PC'", info.UserID); db.Execute(clearSql); }
private static void CheckPCState(ISessionKey user) { Database db = DataBaseManger.GetDB(""); var sql = new Sql("select count(1) from FBOnlineUser where UserToken=@0 and UserID=@1 and DeviceType='PC'", user.Token, user.UserID); if (db.ExecuteScalar <long>(sql) <= 0) { throw new Exception("您的登录身份已过期,请重新登录,"); } }
public static string CreateServerStateToken(ISessionKey info) { Database db = DataBaseManger.GetDB(""); var token = Guid.NewGuid().ToString(); // 这里要预留出pc端登陆的接口 var clearSql = new Sql("delete from FBOnlineUser where UserID=@0 and DeviceType='PC'", info.UserID); db.Execute(clearSql); var sql = new Sql("insert into FBOnlineUser(ID,UserID,LoginIP,LoginMachine,UserState,CreateTime,UserToken,DeviceType) values(@0,@1,@2,@3,@4,@5,@0,@6)", token, info.UserID, info.IPAddress, WebHelper.GetMachineName(), "1", DateTime.Now.ToString(), "PC"); db.Execute(sql); return(token); }
public string remoteCheck(CheckExits model, string frmID, string dataModelID) { Sql sql = new NPoco.Sql(string.Format("select count(1) from {0} where {1}='{2}'", model.TableName, model.ValidField, model.ValidValue)); if (!string.IsNullOrEmpty(model.DataID)) { sql.Append(string.Format(" and {0}<>'{1}' ", model.KeyField, model.DataID)); } if (model.Filter != null) { sql.Append(ConditionParser.Serialize(model.Filter)); } var ds = DataModelCom.getDataSource(dataModelID, this.Db); Database ywdb = DataBaseManger.GetDB(ds); if (ywdb.Single <long>(sql) > 0) { return(string.Format("{0}的值已存在", model.Label)); } return(""); }
private static Database getModelDataSource(string DataSource) { return(DataBaseManger.GetDB(DataSource)); }