Example #1
0
        /// <summary>
        /// 更新启用状态
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public UpdateStatusResponse UpdateStatus(UpdateStatusRequest request)
        {
            var response = new UpdateStatusResponse();

            try
            {
                var entity = _appIdAuthTokenRepository.Find <AppIdAuthPo>(e => e.IsValid == 1 && e.Id == request.Id);

                if (entity == null)
                {
                    throw new Exception("修改应用授权不存在");
                }

                entity.Status = request.Status;
                EntityLogger.UpdateEntity(entity);

                _appIdAuthTokenRepository.UpdateColumns(entity, (e) => new { e.Status, e.UpdateTime, e.UpdateUserId });

                var key = entity.AppId.AddCachePrefix("AppIdAuth");

                CacheManager.RedisDefault.Del(key);
            }
            catch (Exception ex)
            {
                response.IsSuccess   = false;
                response.MessageCode = "-1";
                response.MessageText = ex.Message;
                LogManager.LogicLogger.ErrorFormat("更新启用状态出错:{0}", new { request, err = ex.ToString() }.ToJson());
            }
            return(response);
        }
Example #2
0
        public LogResponse[] UpdateStatus(UpdateStatusRequest request, int C_ID)
        {
            using (var connection = OpenConnection())
            {
                var E_ID1  = request.E_ID1;
                var E_ID2  = request.E_ID2;
                var Status = request.Status;
                var temp   = connection.Execute(ScriptProvider.Get("UpdateElementsStatus"),
                                                new
                {
                    E_ID1,
                    E_ID2,
                    Status
                });

                var temp2 = connection.Execute(ScriptProvider.Get("UpdateLog"),
                                               new
                {
                    C_ID,
                    E_ID1,
                    E_ID2,
                    Status
                });
                var result = connection.Query <LogResponse>(ScriptProvider.Get("GetLog"));
                return(result.ToArray());
            }
        }
Example #3
0
        /// <summary>
        /// Returns a list of the server's IPs.
        /// </summary>
        ///  <param name="server_id">Unique server's identifier.</param>
        ///
        public ServerResponse UpdateStatus(UpdateStatusRequest body, string server_id)
        {
            try
            {
                var request = new RestRequest("/servers/{server_id}/status/action", Method.PUT)
                {
                    RequestFormat  = DataFormat.Json,
                    JsonSerializer = new CustomSerializer()
                };
                request.AddUrlSegment("server_id", server_id);
                request.AddHeader("Content-Type", "application/json");
                request.AddBody(body);

                var result = restclient.Execute <ServerResponse>(request);
                if (result.StatusCode != HttpStatusCode.Accepted)
                {
                    throw new Exception(result.Content);
                }
                return(result.Data);
            }
            catch
            {
                throw;
            }
        }
Example #4
0
 public override Task <Reply> UpdateStatus(UpdateStatusRequest request, ServerCallContext context)
 {
     return(UpdateFields(request.Id, context, async user =>
     {
         user.Status = request.UserStatus == Users.User.Types.Status.Disabled ? 0 : 1ul;
         await _userService.ClearUser(request.Id);
         return Error.None;
     }));
 }
        public async Task <IActionResult> UpdateStatus([FromBody] UpdateStatusRequest request)
        {
            var success = await _userBusiness.UpdateStatus(request);

            if (success)
            {
                return(Ok());
            }
            return(BadRequest());
        }
        public void UpdateStatus(UpdateStatusRequest model, int userId)
        {
            string procname = "[dbo].[Events_Update_V4]";

            _data.ExecuteNonQuery(procname, inputParamMapper : delegate(SqlParameterCollection col)
            {
                col.AddWithValue("Id", model.Id);
                col.AddWithValue("@EventStatusId", model.EventStatusId);
            },
                                  returnParameters: null);
        }
        private static async void CancelBulkStatusAsync(String bulkId)
        {
            UpdateStatusRequest updateStatusRequest = new UpdateStatusRequest {
                Status = BulkStatus.CANCELED
            };
            ManageBulkStatusExecuteContext context = new ManageBulkStatusExecuteContext {
                BulkId = bulkId
            };

            await new ManageBulkStatus(BASIC_AUTH_CONFIGURATION).ExecuteAsync(context, updateStatusRequest);
        }
Example #8
0
 public IActionResult UpdateStatus([FromForm] UpdateStatusRequest request, [FromQuery] int ID)
 {
     try
     {
         var result = _elementsService.UpdateStatus(request, ID);
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Example #9
0
        public IActionResult updateOrderStatus(UpdateStatusRequest request, int v)
        {
            Order result = context.Order.Where(s => s.UserId == v && s.OrderId == request.orderID).FirstOrDefault();

            if (result != null)
            {
                result.Status = request.status;
                context.SaveChanges();
                return(new OkObjectResult(result));
            }
            else
            {
                return(new BadRequestResult());
            }
        }
Example #10
0
        public async Task <IActionResult> SetStatus([FromForm] UpdateStatusRequest updateStatusModel)
        {
            if (updateStatusModel == null)
            {
                throw new ArgumentNullException(nameof(updateStatusModel));
            }
            var updatedUser = await _infoService.SetStatus(updateStatusModel.Id, updateStatusModel.NewStatus);

            if (updatedUser == null)
            {
                return(StatusCode((int)HttpStatusCode.NotModified));
            }
            var adaptToResponse = updatedUser.AdaptModelToResponse();

            return(Ok(new { Consumes = "application/x-www-form-urlencoded", Values = adaptToResponse }));
        }
Example #11
0
 public void UpdatePositiveSubjectStatus(UpdateStatusRequest usData)
 {
     try
     {
         var stProc = UpdateStatusPositiveSubjects;
         var pList  = new List <SqlParameter>()
         {
             new SqlParameter("@BarcodeNo", usData.barcodeNo ?? usData.barcodeNo),
             new SqlParameter("@ANMID", usData.userId),
             new SqlParameter("@NotifiedOn", usData.notifiedOn ?? usData.notifiedOn),
         };
         UtilityDL.ExecuteNonQuery(stProc, pList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #12
0
        public StatusResponse ToggleStatus(UpdateStatusRequest model)
        {
            try
            {
                var item = _allowedIpService.UpdateAppStatus(model.CurrentStatus.ToString());

                return(new StatusResponse()
                {
                    Success = true, Message = "Status successfully updated"
                });
            }
            catch (Exception e)
            {
                return(new StatusResponse()
                {
                    Success = false, Message = "There was an error updating the status" + e.Message
                });
            }
        }
        public ActionResult <SuccessResponse> Update(UpdateStatusRequest model)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                _service.UpdateStatus(model, userId);

                response = new SuccessResponse();
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse($"Generic Errors: { ex.Message}");
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }
Example #14
0
        // Update status
        public async Task UpdateStatus(int id, UpdateStatusRequest model)
        {
            if (!await _context.Reports.AnyAsync(r => r.Id == id))
            {
                throw new KeyNotFoundException("User not found");
            }

            var reportInDb = await _context.Reports.FirstOrDefaultAsync(r => r.Id == id);

            if (reportInDb == null)
            {
                throw new KeyNotFoundException("Report not found");
            }
            reportInDb.Status = (ReportStatus)Enum.Parse(typeof(ReportStatus), model.Status);

            _context.Reports.Update(reportInDb);

            if (await _context.SaveChangesAsync() <= 0)
            {
                throw new AppException("Failed to send report");
            }
        }
Example #15
0
        public LogResponse[] UpdateStatus(UpdateStatusRequest request, int ID)
        {
            var result = _elementsDA.UpdateStatus(request, ID);

            return(result);
        }
Example #16
0
        public async Task <IActionResult> UpdateReportStatus(int id, UpdateStatusRequest model)
        {
            await _reportService.UpdateStatus(id, model);

            return(Ok(new { message = "Report updated successfully" }));
        }
 public IActionResult updateStatusOrder([FromBody] UpdateStatusRequest request)
 {
     return(repository.updateOrderStatus(request, GetUserId()));
 }
Example #18
0
 public async Task <bool> UpdateStatus(UpdateStatusRequest request)
 {
     return(await _userRepository.UpdateAsync(request.Ids, it => it.IsActive == request.IsActive));
 }
Example #19
0
 ChangedStatusRequest IOmegaService.UpdateStatusRequest(ApplicationVersion applicationVersion, UpdateStatusRequest item, RequestRealisation requestRealisation)
 {
     return(RunSecurity(applicationVersion, user =>
     {
         CheckRightsRequests(user);
         return _repository.UpdateStatusRequest(item, user, requestRealisation);
     }));
 }
Example #20
0
        public async Task <BulkStatusResponse> ExecuteAsync(ManageBulkStatusExecuteContext context, UpdateStatusRequest bodyObject)
        {
            using (var client = HttpClientProvider.GetHttpClient(configuration))
            {
                NameValueCollection queryParameters = HttpUtility.ParseQueryString(string.Empty);
                SetQueryParamIfNotNull(queryParameters, "bulkId", context.BulkId);

                string queryString = queryParameters.ToString();
                string endpoint    = path + "?" + queryString;

                string      requestJson = JsonConvert.SerializeObject(bodyObject, Settings);
                HttpContent content     = new StringContent(requestJson, Encoding.UTF8, "application/json");

                var response = await client.PutAsync(endpoint, content);

                string contents = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <BulkStatusResponse>(contents, Settings));
                }
                else
                {
                    throw new InfobipApiException(
                              response.StatusCode,
                              JsonConvert.DeserializeObject <ApiErrorResponse>(contents, Settings)
                              );
                }
            }
        }