Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
        /// <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);
        }