Пример #1
0
        public SetUnitTestDisableResponse SetUnitTestDisable(Guid accountId, SetUnitTestDisableRequestData data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            var request = GetRequest <SetUnitTestDisableRequest>(accountId);

            request.Data = data;
            var dispatcher = DispatcherHelper.GetDispatcherService();

            return(dispatcher.SetUnitTestDisable(request));
        }
Пример #2
0
        public ActionResult DisableAjax(DisableDialogAjaxModel model)
        {
            if (model.Interval == DisableDialogAjaxModel.DisableInterval.Custom && !model.Date.HasValue)
            {
                ModelState.AddModelError("Date", "Пожалуйста, укажите дату");
            }

            if (!ModelState.IsValid)
            {
                return(PartialView("Dialogs/DisableDialogAjaxNew", model));
            }

            DateTime?date;

            if (model.Interval == DisableDialogAjaxModel.DisableInterval.Hour)
            {
                date = MvcApplication.GetServerDateTime().AddHours(1);
            }
            else if (model.Interval == DisableDialogAjaxModel.DisableInterval.Day)
            {
                date = MvcApplication.GetServerDateTime().AddDays(1);
            }
            else if (model.Interval == DisableDialogAjaxModel.DisableInterval.Week)
            {
                date = MvcApplication.GetServerDateTime().AddDays(7);
            }
            else
            {
                date = model.Date;
            }

            var client = GetDispatcherClient();
            var data   = new SetUnitTestDisableRequestData()
            {
                Comment    = model.Comment,
                ToDate     = date,
                UnitTestId = model.Id
            };

            client.SetUnitTestDisable(CurrentUser.AccountId, data).Check();

            return(GetSuccessJsonResponse());
        }
Пример #3
0
 public JsonResult Disable(DisableDialogPostModel model)
 {
     try
     {
         var client = GetDispatcherClient();
         var date   = model.GetDate();
         var data   = new SetUnitTestDisableRequestData()
         {
             Comment    = model.Comment,
             ToDate     = date,
             UnitTestId = model.Id
         };
         client.SetUnitTestDisable(CurrentUser.AccountId, data).Check();
         return(GetSuccessJsonResponse());
     }
     catch (Exception exception)
     {
         MvcApplication.HandleException(exception);
         return(GetErrorJsonResponse(exception));
     }
 }
 public override SetUnitTestDisableResponse Disable(SetUnitTestDisableRequestData data)
 {
     return(ResponseHelper.GetOfflineResponse <SetUnitTestDisableResponse>());
 }