Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var basicValueTypes = new BaseValueTypes();

            basicValueTypes.ValueTypeAssignation();
            basicValueTypes.ValueTypePassBetweenFunctions();
            basicValueTypes.ValueTypePassBetweenFunctionsWithResult();

            var customValueTypes = new CustomValueTypes();

            customValueTypes.CustomValueTypeAssignation();
            customValueTypes.CustomValueTypeAssignation();

            var referenceType = new ReferenceTypesExamples.ReferenceTypesExamples();

            referenceType.CallAllPublicMethods();


            Console.WriteLine("**************** HOMEWORK RESULTS *******************************************");
            var agedaService = new AgendaService();

            agedaService.ComputeAgenda();

            Console.WriteLine("**************** END OF HOMEWORK RESULTS *******************************************");

            Console.WriteLine("Press any key");

            Console.ReadLine();
        }
Пример #2
0
        public MainForm()
        {
            InitializeComponent();
            string myServerCredentials = "Server=192.168.9.219;Database=Agenda;User Id=corso;Password=corso;";

            _agendaService = new AgendaService(myServerCredentials);
        }
Пример #3
0
        public void DeveLancaExceptionDaTempoForaDoHorarioExpediente()
        {
            var lista = new List <Agenda>();

            queryAgendas = lista.AsQueryable();
            mockDbSetAgenda.As <IQueryable <Agenda> >().Setup(m => m.Provider).Returns(queryAgendas.Provider);
            mockDbSetAgenda.As <IQueryable <Agenda> >().Setup(m => m.Expression).Returns(queryAgendas.Expression);
            mockDbSetAgenda.As <IQueryable <Agenda> >().Setup(m => m.ElementType).Returns(queryAgendas.ElementType);
            mockDbSetAgenda.As <IQueryable <Agenda> >().Setup(m => m.GetEnumerator()).Returns(queryAgendas.GetEnumerator());


            mockRepositoryAgenda.Setup(m => m.Get).Returns(mockDbSetAgenda.Object);



            Agenda agendaPost = new Agenda()
            {
                Id         = 1,
                Cliente    = repositoryCliente.Find(1),
                Data       = UtilsTest.AddDateAndHours(DateTime.Now, 5, 19),
                Modalidade = 30,
                Obs        = ""
            };


            AgendaService service = new AgendaService(mockRepositoryAgenda.Object, repositoryCliente);

            Assert.That(() => service.Post <AgendaValidator>(agendaPost), Throws.TypeOf <FluentValidation.ValidationException>());
        }
Пример #4
0
        public Status deleteMultipe(int meetingID)
        {
            MeetingDAO meetingDao = Factory.getInstance <MeetingDAO>();

            //初始化会议操作
            meeting_initOperator(meetingID);

            //判断会议是否 未开启,如果 不是”未开启“,直接退出
            if (!meeting_isNotOpen())
            {
                return(Status.MEETING_OPENED);
            }
            AgendaService   agendaService   = new AgendaService();
            DelegateService delegateService = new DelegateService();

            //注意调用会议中其他内容的服务,级联删除。
            //删除议程
            agendaService.deleteAll(meetingID);
            //删除参会人员
            delegateService.deleteAll(meetingID);
            //删除当前会议
            int checkNum = meetingDao.delete(meetingID);

            return(Status.SUCCESS);
        }
Пример #5
0
        public async Task Activate()
        {
            _agendaService = new AgendaService();
            var sessions = await _agendaService.GetSessionsAsync();

            CodecampSessions = new ObservableCollection <Session>(sessions);
        }
Пример #6
0
        public ActionResult WorkgroupPopup()
        {
            WorkgroupParams             workgroupParams = KTUtils.GetObjectFromRequest <WorkgroupParams>(Request.QueryString);
            XmlNode                     node            = KTList.GetConfigNode("workgroupgAjax.xml", "WGSRCPEOPLE");
            string                      renderHTML      = string.Empty;
            List <KTResourceSimpleView> listNew         = new List <KTResourceSimpleView>();

            if (node != null)
            {
                IEnumerable <KTResource> list = resourceService.GetList2(workgroupParams);
                listNew    = GetNewList(list);
                renderHTML = KTList.GetDataList <KTResourceSimpleView>(node, 0, 0, listNew);
            }

            string renderHTMLSelected            = string.Empty;
            IEnumerable <KTResource>    listTar  = new AgendaService().GetResourceList(workgroupParams.WG_IDS.Split(','));
            List <KTResourceSimpleView> listNew2 = GetNewList(listTar);

            renderHTMLSelected = KTList.GetDataList <KTResourceSimpleView>(node, 0, 0, listNew2);

            //ViewBag.ListHTML = renderHTML;
            //ViewBag.ListHTMLSelected = renderHTMLSelected;
            ViewBag.resourceList = JsonConvert.SerializeObject(listNew2);
            ViewBag.selectedIds  = workgroupParams.WG_IDS;

            // 获取数据
            return(View());
        }
 public EventoController(IEventoRepository repo, IMapper mapper, EventoService service, AgendaService serviceAgenda)
 {
     _serviceAgenda = serviceAgenda;
     _service       = service;
     _mapper        = mapper;
     _repo          = repo;
 }
        public HttpResponseMessage Conclui(int agendaId)
        {
            try
            {
                var agendaService    = new AgendaService();
                var pacienteLogadoId = PacienteService.ObtemUsuarioLogadoId((User.Identity as ClaimsIdentity).Claims.ToList());

                agendaService.Conclui(agendaId);
                var agenda = agendaService.Get(pacienteLogadoId);

                if (agendaService.ResponseService.Type == ResponseTypeEnum.Error)
                {
                    return(Request.CreateErrorResponse(
                               HttpStatusCode.BadRequest, agendaService.ResponseService.Message));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new
                    {
                        Agenda = agenda,
                        Message = agendaService.ResponseService.Message,
                        Type = agendaService.ResponseService.Type.ToString(),
                        Fields = agendaService.ResponseService.FieldsInvalids
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Erro ao confirmar."));
            }
        }
        public HttpResponseMessage GetAgendaClinica(int medicoId, string data)
        {
            try
            {
                var agendaService = new AgendaService();

                var clinicaLogadoId = ClinicaService.ObtemUsuarioLogadoId((User.Identity as ClaimsIdentity).Claims.ToList());
                var agenda          = agendaService.GetAgendaClinica(clinicaLogadoId, medicoId, data);

                if (agendaService.ResponseService.Type.Equals("Error"))
                {
                    return(Request.CreateErrorResponse(
                               HttpStatusCode.BadRequest, agendaService.ResponseService.Message));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new
                    {
                        Agenda = agenda,
                        Message = agendaService.ResponseService.Message,
                        Type = agendaService.ResponseService.Type
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.BadRequest, "Erro ao recuperar a agenda."));
            }
        }
        public HttpResponseMessage Save(Agenda agenda)
        {
            try
            {
                var agendaService = new AgendaService();

                agenda.Clinica = new Clinica()
                {
                    Id = ClinicaService.ObtemUsuarioLogadoId((User.Identity as ClaimsIdentity).Claims.ToList())
                };

                agendaService.Save(agenda);

                if (agendaService.ResponseService.Type == ResponseTypeEnum.Error)
                {
                    return(Request.CreateErrorResponse(
                               HttpStatusCode.BadRequest, agendaService.ResponseService.Message));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new
                    {
                        Message = agendaService.ResponseService.Message,
                        Type = agendaService.ResponseService.Type.ToString(),
                        Fields = agendaService.ResponseService.FieldsInvalids
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Erro ao cadastrar."));
            }
        }
Пример #11
0
        public IActionResult Edit(int id, Agenda agenda)
        {
            if (id != agenda.AgendaID || agenda == null)
            {
                return(NotFound());
            }

            try
            {
                if (ModelState.IsValid)
                {
                    AgendaService service = new AgendaService();
                    service.ValidarCampos(agenda);

                    _agenda.Atualizar(agenda);
                    return(RedirectToAction(nameof(Index)));
                }
                return(View(agenda));
            }
            catch (Exception ex)
            {
                Mensagem = ex.Message.ToString();
                ModelState.AddModelError(String.Empty, Mensagem);
                return(View(agenda));
            }
        }
Пример #12
0
        public PersonForm(int?personId = null)
        {
            InitializeComponent();

            _currentPersonId = personId;
            _agenda          = new AgendaService(Program.ConnectionString);
        }
Пример #13
0
        protected override async Task OnInitializedAsync()
        {
            PlayDates = await AgendaService.GetAgendaAsync();

            var futurePlayDates = PlayDates.Where(pd => pd.Date >= DateTime.Today).Select(pd => pd.Date.Date);

            NextPlayDate = (futurePlayDates.Any() ? futurePlayDates.Min() : new Nullable <DateTime>());
        }
Пример #14
0
        public ActionResult Index_organizor(int meetingID)
        {
            AgendaService     agendaService = new AgendaService();
            List <AgendaInfo> agendas       = null;
            Status            status        = agendaService.getAll(meetingID, out agendas);

            Session["meetingID"] = meetingID;

            return(View(agendas));
        }
Пример #15
0
 public HomeController()
 {
     consultaService    = new ConsultaService();
     personaService     = new PersonaService();
     odontogramaService = new OdontogramaService();
     periodonciaService = new PeriodonciaService();
     usuarioService     = new UsuarioService();
     agendaService      = new AgendaService();
     medicamentoService = new MedicamentoService();
     EntityService      = new AppointmentService();
 }
Пример #16
0
 public AppointmentController()
 {
     Title                     = "Agendas";
     PersonaService            = new PersonaService();
     horarioService            = new HorarioService();
     EmpresaService            = new EmpresaService();
     UsuarioService            = new UsuarioService();
     TipoIdentificacionService = new TipoIdentificacionService();
     agendaService             = new AgendaService();
     EntityService             = new AppointmentService();
 }
Пример #17
0
        public JsonResult Delete_organizor(List <int> IDs)
        {
            Status status = Status.SUCCESS;

            AgendaService agendaService = new AgendaService();

            status = agendaService.deleteMultipe(IDs);

            return(Json(
                       new RespondModel(status, ""),
                       JsonRequestBehavior.AllowGet));
        }
 public IActionResult GetEventos([FromHeader] EventoImortais evento)
 {
     try
     {
         AgendaService agendaService = new AgendaService(this._context);
         agendaService.BuscarEventos(evento.DataEvento);
         return(Ok(agendaService.eventos));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { message = ex.Message }));
     }
 }
Пример #19
0
 public ActionResult EditarContacto(ContactoViewModel contactoViewModel)
 {
     try
     {
         AgendaService agendaService = new AgendaService();
         var           model         = agendaService.Update(ParseContacto(contactoViewModel));
         return(RedirectToAction("Detalle", "Agenda"));
     }
     catch (System.Exception)
     {
         return(View("Error"));
     }
 }
Пример #20
0
 public ActionResult EliminarContacto(int id)
 {
     try
     {
         AgendaService agendaService = new AgendaService();
         var           model         = agendaService.Delete(id);
         return(RedirectToAction("Detalle", "Agenda"));
     }
     catch (System.Exception)
     {
         return(View("Error"));
     }
 }
Пример #21
0
        public void CreatePersonWithStringInBirthdayTest()
        {
            //Prepare
            var agendaService = new AgendaService();
            var person        = new Person {
                Id       = Guid.NewGuid(),
                Name     = "José",
                Birthday = "1990-01-01"
            };

            //Assert Action
            // Assert.ThrowsException<BirthdayStringException>(() => agendaService.AddPerson(person))
        }
Пример #22
0
        public AgendaModulo()
            : base("/agenda")
        {
            Get["emailpaciente/"] = x =>
            {
                DateTime dataIni = Convert.ToDateTime(Request.Query["dataIni"].ToString());
                DateTime dataFim = Convert.ToDateTime(Request.Query["dataFim"].ToString());
                string email = Request.Query["email"].ToString();

                var service = new AgendaService();

                return Response.AsJson(service.RecuperarAgendaPaciente(dataIni,dataFim,email));
            };
        }
Пример #23
0
        public void CreatePersonWithEmptyNameTest()
        {
            //Prepare
            var agendaService = new AgendaService();
            var person        = new Person
            {
                Id       = Guid.NewGuid(),
                Name     = "",
                Birthday = new DateTime(2010, 02, 5, 10, 20, 00)
            };

            //Assert Action
            Assert.ThrowsException <EmptyNameException>(() => agendaService.AddPerson(person));
        }
Пример #24
0
        public void CreatePersonWithInvalidBirthdayTest()
        {
            //Prepare
            var agendaService = new AgendaService();
            var person        = new Person
            {
                Id       = Guid.NewGuid(),
                Name     = "Jo�o",
                Birthday = new DateTime(1700, 02, 15, 10, 20, 00)
            };

            //Assert Action
            Assert.ThrowsException <BirthdayTooOldException>(() => agendaService.AddPerson(person));
        }
Пример #25
0
        public ActionResult Detalle()
        {
            try
            {
                AgendaService agendaService = new AgendaService();
                var           model         = agendaService.GetList();

                return(View(model));
            }
            catch (System.Exception)
            {
                return(View("Error"));
            }
        }
        public async Task <IActionResult> GetAgendaSchedule([FromQuery] int professionalid, [FromQuery] string jsdate)
        {
            var agenda = _context.Agenda.Include(o => o.AppointmentType).FirstOrDefault(o => o.ProfessionalID == professionalid);

            if (agenda == null)
            {
                return(new EmptyResult());
            }

            var date           = DateTime.Parse(jsdate, CultureInfo.InvariantCulture);
            var agendaSchedule = new AgendaService(new AgendaRepository(_context)).GetAgendaScheduleRange(agenda.ID, date);

            return(new JsonResult(await agendaSchedule));
        }
        public IActionResult EnviarEmail([FromBody] EnviarEmail value)
        {
            try
            {
                AgendaService agendaService = new AgendaService(this._context);
                agendaService.EnviarEmail(value);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
Пример #28
0
        public ActionResult Edit_organizor(int agendaID)
        {
            AgendaService agendaService = new AgendaService();
            AgendaInfo    agenda        = null;
            Status        status        = agendaService.getOne(agendaID, out agenda);

            DelegateService         delegateService   = new DelegateService();
            List <SpeakerForAgenda> speakersForAgenda = null;

            status = delegateService.getSpeakerForAgenda(agenda.meetingID, out speakersForAgenda);

            Session["meetingID"] = agenda.meetingID;

            return(View(Tuple.Create(agenda, speakersForAgenda)));
        }
        public async Task <IActionResult> GetUserAgendaAppointment()
        {
            var agendaRepository = new AgendaRepository(_context);
            var agendaService    = new AgendaService(agendaRepository);
            var userRepository   = new UserRepository(_context);

            var authenticadedUser = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault()?.Value;
            var user = await userRepository.GetUserFromEmailOrOauthID(authenticadedUser);

            if (user == null)
            {
                return(NotFound("Usuário não encontrado"));
            }

            return(Json(agendaService.GetUserAgendaAppointment(user).Result));
        }
Пример #30
0
        public void CreateAcceptablePersonTest()
        {
            //Prepare
            var agendaService = new AgendaService();
            var person        = new Person
            {
                Id       = Guid.NewGuid(),
                Name     = "Jo�o da Silva",
                Birthday = new DateTime(2010, 02, 5, 10, 20, 00)
            };

            //Action/Call Test Function
            bool result = agendaService.AddPerson(person);

            //Assert
            Assert.IsTrue(result); //Se result for verdadeiro => passa no teste
        }
        public async Task <IActionResult> GetProfessionalSchedule([FromQuery] string jsdate)
        {
            var agendaRepository = new AgendaRepository(_context);
            var agendaService    = new AgendaService(agendaRepository);
            var userRepository   = new UserRepository(_context);
            var date             = DateTime.Parse(jsdate, CultureInfo.InvariantCulture);

            var authenticadedUser = ((ClaimsIdentity)User.Identity).Claims.FirstOrDefault()?.Value;
            var user = await userRepository.GetUserFromEmailOrOauthID(authenticadedUser);

            if (user == null)
            {
                return(NotFound("Usuário não encontrado"));
            }

            return(Json(agendaService.GetProfessionalUserSchedules(user, date).Result));
        }