/// <summary> /// 查找指定账号名的所有会话信息 /// </summary> /// <param name="account">账号名信息</param> /// <returns>查找到的会话信息列表,会话倒叙排列</returns> public List <SessionHistory> FindSessionHistoriesByAccount(string account) { List <SessionHistory> result = new List <SessionHistory>(); using (var ctx = new NtripForwardDB()) { result = ctx.SessionHistories.Where <SessionHistory>(s => s.AccountName == account && s.ConnectionEnd != null).OrderByDescending(s => s.ConnectionStart).ToList(); } return(result); }
/// <summary> /// 查找所有会话信息 /// </summary> /// <returns>所有会话信息列表</returns> public List <SessionHistory> FindAllSessionHistories() { List <SessionHistory> result = new List <SessionHistory>(); using (var ctx = new NtripForwardDB()) { result = ctx.SessionHistories.ToList(); } return(result); }
/// <summary> /// 查找所有在线系统账号基本信息 /// </summary> /// <returns>所有在线系统账号列表</returns> public List <ACCOUNTSYS> FindAllAccountSYSOnline() { List <ACCOUNTSYS> result = new List <ACCOUNTSYS>(); using (var ctx = new NtripForwardDB()) { result = ctx.ACCOUNTSYS.Where <ACCOUNTSYS>(a => a.isDelete == false && a.AccountSYS_IsOnline == true).ToList <ACCOUNTSYS>(); } return(result); }
/// <summary> /// 查找所有在线会话,包含GGA数据信息 /// </summary> /// <returns>所有在线会话信息列表</returns> public List <SessionHistory> FindAllOnlineSessions() { List <SessionHistory> result = new List <SessionHistory>(); using (var ctx = new NtripForwardDB()) { result = ctx.SessionHistories.Include("GGAHistories").Where(s => s.ConnectionEnd == null).ToList(); } return(result); }
/// <summary> /// 通过系统账户名查找系统账号全部信息 /// </summary> /// <param name="id">系统账号名</param> /// <returns>系统账号信息</returns> public ACCOUNTSYS FindAccountSYSByName(string name) { ACCOUNTSYS accountSYS = new ACCOUNTSYS(); using (var ctx = new NtripForwardDB()) { accountSYS = ctx.ACCOUNTSYS.FirstOrDefault(a => a.AccountSYS_Name == name && a.isDelete == false); } return(accountSYS); }
/// <summary> /// 通过账户名查找账号全部信息 /// </summary> /// <param name="name">账号名</param> /// <returns>账号信息</returns> public ACCOUNT FindAccountByName(string name) { ACCOUNT account = new ACCOUNT(); using (var ctx = new NtripForwardDB()) { account = ctx.ACCOUNTs.FirstOrDefault(a => a.Account_Name == name && a.isDelete == false); } return(account); }
/// <summary> /// 查找指定会话的GGA信息 /// </summary> /// <param name="session">会话实体</param> /// <returns>查找到的GGA信息列表,定位之间倒叙排列</returns> public List <GGAHistory> FindGGAHistoriesBySessionHistory(SessionHistory session) { List <GGAHistory> result = new List <GGAHistory>(); using (var ctx = new NtripForwardDB()) { result = ctx.GGAHistories.Where <GGAHistory>(g => g.SessionID == session.ID).OrderByDescending(g => g.FixedTime).ToList(); } return(result); }
/// <summary> /// 查找指定账号名的GGA信息 /// </summary> /// <param name="account">账号名信息</param> /// <returns>查找到的GGA信息列表,定位之间倒叙排列</returns> public List <GGAHistory> FindGGAHistoriesByAccount(string account) { List <GGAHistory> result = new List <GGAHistory>(); using (var ctx = new NtripForwardDB()) { result = ctx.GGAHistories.Include("SessionHistory").Where <GGAHistory>(g => g.Account == account).OrderByDescending(g => g.FixedTime).ToList(); } return(result); }
/// <summary> /// 添加会话 /// </summary> /// <param name="session">会话信息</param> /// <returns>是否添加成功</returns> public bool AddSessionHistory(SessionHistory session) { bool result = false; using (var ctx = new NtripForwardDB()) { ctx.SessionHistories.Add(session); result = ctx.SaveChanges() == 1; } return(result); }
/// <summary> /// 添加单个账号 /// </summary> /// <param name="account">账号信息</param> /// <returns>是否添加成功</returns> public bool AddAccount(ACCOUNT account) { bool result = false; using (var ctx = new NtripForwardDB()) { ctx.ACCOUNTs.Add(account); result = ctx.SaveChanges() == 1; } return(result); }
/// <summary> /// 添加概略位置 /// </summary> /// <param name="session">概略位置信息</param> /// <returns>是否添加成功</returns> public bool AddGGAHistory(GGAHistory gga) { bool result = false; using (var ctx = new NtripForwardDB()) { ctx.GGAHistories.Add(gga); result = ctx.SaveChanges() == 1; } return(result); }
/// <summary> /// 更新会话历史基础信息 /// </summary> /// <param name="session">会话信息</param> /// <returns>是否更新成功</returns> public bool UpdateSessionHistory(SessionHistory session) { bool result = false; using (var ctx = new NtripForwardDB()) { if (session.ID != null) { ctx.SessionHistories.Attach(session); ctx.Entry(session).State = EntityState.Modified; result = ctx.SaveChanges() >= 1; } } return(result); }
/// <summary> /// 更新系统账号资料 /// </summary> /// <param name="accountSYS">需要更新的系统账号</param> /// <returns>是否更新成功</returns> public bool UpdateAccountSYS(ACCOUNTSYS accountSYS) { bool result = false; using (var ctx = new NtripForwardDB()) { if (accountSYS.ID != null) { ctx.ACCOUNTSYS.Attach(accountSYS); ctx.Entry(accountSYS).State = EntityState.Modified; result = ctx.SaveChanges() >= 1; } } return(result); }
/// <summary> /// 更新账号基础资料 /// </summary> /// <param name="account">需要更新的账号</param> /// <returns>是否更新成功</returns> public bool UpdateAccount(ACCOUNT account) { bool result = false; using (var ctx = new NtripForwardDB()) { if (account.ID != null) { ctx.ACCOUNTs.Attach(account); ctx.Entry(account).State = EntityState.Modified; //只更新基础信息不更新关联信息 ctx.Entry(account).Property("Account_Company").IsModified = false; ctx.Entry(account).Property("Account_AddUser").IsModified = false; result = ctx.SaveChanges() >= 1; } } return(result); }
/// <summary> /// 账号拨号以后查找适合使用的系统账号 /// </summary> /// <returns>返回的系统账号系统</returns> public ACCOUNTSYS FindSuitableAccountSYS() { ACCOUNTSYS accountSYS = new ACCOUNTSYS(); using (var ctx = new NtripForwardDB()) { List <ACCOUNTSYS> temp = ctx.ACCOUNTSYS.Where <ACCOUNTSYS>( a => a.isDelete == false && a.AccountSYS_IsOnline == false && a.AccountSYS_IsLocked == false && a.AccountSYS_Expire > DateTime.Now) .ToList <ACCOUNTSYS>(); int age = int.MaxValue; foreach (var item in temp) { if (item.AccountSYS_Age < age) { age = (int)item.AccountSYS_Age; accountSYS = item; } } } return(accountSYS); }