예제 #1
0
        public IHttpActionResult UpdateAccountSYS(AccountSYSEntity accountSYS)
        {
            bool         isUpdateSuccess = false;
            ResultEntity result          = new ResultEntity();

            try
            {
                isUpdateSuccess = this.dal.UpdateAccountSYS(accountSYS.ToACCOUNTSYS());
                result.Data     = accountSYS;
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                NtripProxyLogger.LogExceptionIntoFile("调用接口api/AccountSYS/UpdateAccountSYS异常,异常信息为:" + e.Message);
            }
            result.IsSuccess = isUpdateSuccess;

            return(Json <ResultEntity>(result));
        }
        /// <summary>
        /// 模型ACCOUNTSYS类扩展方法,转换基础信息到AccountEntity
        /// </summary>
        /// <param name="accountSYS">DAL层系统账号</param>
        /// <returns>WebApi层系统账号实体</returns>
        public static AccountSYSEntity ToAccountSYSEntity(this ACCOUNTSYS accountSYS)
        {
            AccountSYSEntity accountSYSEntity = new AccountSYSEntity
            {
                ID         = accountSYS.ID,
                Name       = accountSYS.AccountSYS_Name,
                Password   = accountSYS.AccountSYS_Password,
                Register   = accountSYS.AccountSYS_Register,
                Expire     = accountSYS.AccountSYS_Expire,
                LastLogin  = accountSYS.AccountSYS_LastLogin,
                Age        = (int)accountSYS.AccountSYS_Age,
                IsOnline   = (bool)accountSYS.AccountSYS_IsOnline,
                IsLocked   = (bool)accountSYS.AccountSYS_IsLocked,
                IsDelete   = (bool)accountSYS.isDelete,
                CreateTime = (DateTime)accountSYS.createTime
            };

            return(accountSYSEntity);
        }
예제 #3
0
        public IHttpActionResult AddAccountSYS(AccountSYSEntity accountSYS)
        {
            bool         isAddSuccess = false;
            ResultEntity result       = new ResultEntity();

            try
            {
                ACCOUNTSYS temp = accountSYS.ToACCOUNTSYS();
                isAddSuccess = dal.AddAccountSYS(temp);
                result.Data  = accountSYS;
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                NtripProxyLogger.LogExceptionIntoFile("调用接口api/AccountSYS/AddAccountSYS异常,异常信息为:" + e.Message);
            }

            result.IsSuccess = isAddSuccess;
            return(Json <ResultEntity>(result));
        }
예제 #4
0
        public IHttpActionResult GetAccountSYSByID(string id)
        {
            AccountSYSEntity accountEntity = new AccountSYSEntity();
            ResultEntity     result        = new ResultEntity();

            try
            {
                ACCOUNTSYS temp = dal.FindAccountSYSByID(new Guid(id));
                accountEntity = temp.ToAccountSYSEntity();
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                NtripProxyLogger.LogExceptionIntoFile("调用接口api/AccountSYS/GetAccountSYSByID/{id}异常,异常信息为:" + e.Message);
            }

            result.IsSuccess = result.Message == null;
            result.Data      = accountEntity;
            return(Json <ResultEntity>(result));
        }