예제 #1
0
 public void ExcluirEvento(int idEvento)
 {
     if (idEvento != 0)
     {
         _agendaService.Delete(idEvento);
     }
 }
예제 #2
0
        public IHttpActionResult ExcluiAgenda(string id)
        {
            var retorno = _agendaService.Delete(id);

            if (!retorno.Status)
            {
                return(new InvalidListMessageResult(retorno.Message));
            }

            return(Ok(retorno));
        }
예제 #3
0
        public IActionResult DeleteAgenda(int id)
        {
            Agenda agenda = _agendaService.Delete(id);

            if (agenda == null)
            {
                return(NotFound());
            }

            return(Ok(agenda));
        }
예제 #4
0
 public IActionResult CancelarAgendamento(int id, string data)
 {
     try
     {
         _service.Delete(id, data);
         return(new NoContentResult());
     }
     catch (ArgumentException ex)
     {
         return(NotFound(ex));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
예제 #5
0
        public async Task <IActionResult> Delete(Guid id)
        {
            try
            {
                var response = await _service.Delete(id);

                if (!response.IsSuccessful)
                {
                    return(BadRequest(response));
                }
                return(Ok(response));
            }
            catch
            {
                return(StatusCode(500, "Internal Server Error."));
            }
        }
예제 #6
0
        public HttpResponseMessage AgendaAjax()
        {
            IEnumerable <KeyValuePair <string, string> > queryString = Request.GetQueryNameValuePairs();
            AgendaParams agendaParams = KTUtils.GetObjectFromRequest <AgendaParams>(queryString);

            if (agendaParams.CM.ToUpper() == "MICSAVE")
            {
                Schedule schedule = KTUtils.GetObjectFromRequest <Schedule>(queryString);
                schedule.discriminator = "P";
                schedule.startTime     = schedule.startMillis.TimeOfDay.TotalMilliseconds.ObjToInt();
                schedule.duration      = schedule.endMillis.Subtract(schedule.startMillis).TotalMilliseconds;

                IScheduleService scheduleService = new ScheduleService();
                Schedule         resultS         = scheduleService.Insert(schedule);

                // 保存
                string id     = agendaService.Maxid().id.ToString();
                Agenda agenda = KTUtils.GetObjectFromRequest <Agenda>(queryString);
                agenda.id           = id;
                agenda.typeid       = agenda.type.ObjToInt();
                agenda.authorid     = this.UserID.ToString();
                agenda.creator      = this.UserInfo.UserName;
                agenda.lastModifier = this.UserInfo.UserName;
                agenda.creationDate = DateTime.Now;
                agenda.lastModified = DateTime.Now;
                agenda.icalId       = "TW_" + id;
                agenda.exceptions   = string.Empty;
                agenda.scheduleid   = resultS.scheduleid;
                Agenda result = agendaService.Insert(agenda);

                // 写入关联人员
                List <AgendaTarget> listTar = new List <AgendaTarget>();
                string[]            ids     = (agendaParams.WG_IDS ?? "").Split(',');
                for (int i = 0; i < ids.Length; i++)
                {
                    listTar.Add(new AgendaTarget {
                        agendaid = result.id, resid = ids[i]
                    });
                }

                if (listTar.Count > 0)
                {
                    IAgendaTargetService agendaTargetService = new AgendaTargetService();
                    agendaTargetService.Insert(listTar);
                }

                // 查询
                string returnstr = GetAgendaList(agendaParams);
                return(new JsonResult(returnstr));
            }
            else if (agendaParams.CM.ToUpper() == "GETEVENTS")
            {
                // 查询
                agendaParams.userID = this.UserID.ToString();

                // 时间范围计算
                string returnstr = GetAgendaList(agendaParams);
                return(new JsonResult(returnstr));
            }
            else if (agendaParams.CM.ToUpper() == "DELEV")
            {
                // 删除
                agendaService.Delete(agendaParams);

                string returnstr = GetAgendaList(agendaParams);
                return(new JsonResult(returnstr));
            }
            else
            {
                var    obj       = new { ok = true, events = "" };
                string returnstr = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
                return(new JsonResult(returnstr));
            }
        }
예제 #7
0
 public IActionResult Delete(int id)
 {
     return(Ok(
                _agendaService.Delete(id)
                ));
 }
예제 #8
0
 // DELETE: api/Agenda/5
 public void Delete(int id)
 {
     _agendaService.Delete(id);
 }