private void UpdateSites()
        {
            _logger.Information("Updating Sites");
            SiteDal  dal        = new SiteDal(_configuration, _logger);
            DateTime?lastUpdate = dal.GetLastAdded();

            if (lastUpdate == null || lastUpdate.Value.Year == 0)
            {
                InitialiseSites();
            }
            else
            {
                IEnumerable <SiteModel> siteModels = new SOAPHelper(_autotaskApiUsername, _autotaskApiPassword, _autotaskApiIntegrationCode, _autotaskApiUrl, _logger)
                                                     .RetrieveNewSites(lastUpdate.Value);
                if (siteModels != null &&
                    siteModels.Count() > 0)
                {
                    _logger.Information($"{siteModels.Count()} new Sites found");
                }
                {
                    foreach (SiteModel site in siteModels)
                    {
                        Domain.Enums.CRUDEnums.ActionResult actionResult = dal.Put(site).GetAwaiter().GetResult();
                    }
                }
            }
        }
Exemple #2
0
        public async Task <Response> CogeActividades <T>(
            string urlBase,
            string tokenfam,
            string centrofam,
            string nexp,
            string f1)


        {
            try
            {
                //  var url = "https://comocomen.com/main_control/servidor_ws.php";
                var action     = "infoActividades";
                var soapAction = "https://comocomen.com/main_control/servidor_ws.php";
                var parms      = new Dictionary <string, string>();

                parms.Add("token", tokenfam);
                parms.Add("centro", centrofam);
                parms.Add("f1", f1);
                parms.Add("nexp", nexp);


                string result = SOAPHelper.SendSOAPRequest(urlBase,
                                                           action,
                                                           parms,
                                                           soapAction,
                                                           false);
                var        soap = XDocument.Parse(result);
                XNamespace ns1  = "https://comocomen.com/";


                string miresul = (string)
                                 (from el in soap.Descendants(ns1 + "infoActividadesResponse") select el).First();

                //       MainViewModel.GetInstance().Familia = new FamiliaViewModel(result);
                var resul = Newtonsoft.Json.JsonConvert.DeserializeObject <List <T> >(miresul);



                return(new Response
                {
                    IsSuccess = true,
                    Result = resul,
                });
            }
            catch
            {
                var miresul = "[{\"cod_act\":\"5\",\"nom_act\":\"Yoga moderno\",\"dias_semana\":\" L X J V D \",\"lun_hdes_act\":\"10:00:00\",\"lun_hhas_act\":\"11:00:00\",\"mar_hdes_act\":\"00:00:00\",\"mar_hhas_act\":\"00:00:00\",\"mie_hdes_act\":\"10:00:00\",\"mie_hhas_act\":\"11:00:00\",\"jue_hdes_act\":\"10:00:00\",\"jue_hhas_act\":\"11:00:00\",\"vie_hdes_act\":\"10:00:00\",\"vie_hhas_act\":\"11:00:00\",\"sab_hdes_act\":\"00:00:00\",\"sab_hhas_act\":\"00:00:00\",\"dom_hdes_act\":\"10:00:00\",\"dom_hhas_act\":\"11:00:00\"}]";
                var kk      = "kk";
                var resul   = Newtonsoft.Json.JsonConvert.DeserializeObject <List <T> >(miresul);

                kk = "kk";
                return(new Response
                {
                    IsSuccess = true,
                    Result = resul,
                });
            }
        }
Exemple #3
0
        public async Task <Response> CogeAvisos <T>(
            string urlBase,
            string tokenfam,
            string centrofam,
            string fam)



        {
            try
            {
                //  var url = "https://comocomen.com/main_control/servidor_ws.php";
                var action     = "infoMensajeria";
                var soapAction = "https://comocomen.com/main_control/servidor_ws.php";
                var parms      = new Dictionary <string, string>();

                parms.Add("token", tokenfam);
                parms.Add("centro", centrofam);
                parms.Add("idfam", fam);


                string result = SOAPHelper.SendSOAPRequest(urlBase,
                                                           action,
                                                           parms,
                                                           soapAction,
                                                           false);
                var        soap = XDocument.Parse(result);
                XNamespace ns1  = "https://comocomen.com/";


                string miresul = (string)
                                 (from el in soap.Descendants(ns1 + "infoMensajeriaResponse") select el).First();

                //       MainViewModel.GetInstance().Familia = new FamiliaViewModel(result);
                var resul = Newtonsoft.Json.JsonConvert.DeserializeObject <List <T> >(miresul);

                return(new Response
                {
                    IsSuccess = true,
                    Result = resul,
                });
            }
            catch
            {
                var miresul = "[{'fecha':'2001-03-04','textoAviso':'Sin Avisos','alumnos':'ERROR' ,'nexp':'1' } ]";
                var resul   = Newtonsoft.Json.JsonConvert.DeserializeObject <List <T> >(miresul);



                return(new Response
                {
                    IsSuccess = true,
                    Result = resul,
                });
            }
        }
Exemple #4
0
        public async Task <Response> CogeMenusesMes <T>(
            string urlBase,
            string tokenfam,
            string centrofam,
            string nexp,
            string fam,
            string f1,
            string f2,
            string servicio)

        {
            try
            {
                //  var url = "https://comocomen.com/main_control/servidor_ws.php";
                var action     = "infoMenu";
                var soapAction = "https://comocomen.com/main_control/servidor_ws.php";
                var parms      = new Dictionary <string, string>();

                parms.Add("token", tokenfam);
                parms.Add("centro", centrofam);
                parms.Add("f1", f1);
                parms.Add("f2", f2);
                parms.Add("servicio", servicio);
                parms.Add("fam", fam);


                string result = SOAPHelper.SendSOAPRequest(urlBase,
                                                           action,
                                                           parms,
                                                           soapAction,
                                                           false);
                var        soap = XDocument.Parse(result);
                XNamespace ns1  = "https://comocomen.com/";


                string miresul = (string)
                                 (from el in soap.Descendants(ns1 + "infoMenuResponse") select el).First();

                //       MainViewModel.GetInstance().Familia = new FamiliaViewModel(result);
                var resul = Newtonsoft.Json.JsonConvert.DeserializeObject <List <T> >(miresul);

                return(new Response
                {
                    IsSuccess = true,
                    Result = resul,
                });
            }
            catch
            {
                return(new Response
                {
                    IsSuccess = false,
                });
            }
        }
Exemple #5
0
        public async Task <string> Avisarsistencia(
            string urlBase,
            string token,
            string centro,
            string idfam,
            string nexp,
            string fecha,
            string servicio,
            string tipo)
        {
            try
            {
                var action     = "addAvisos";
                var soapAction = "https://comocomen.com/main_control/servidor_ws.php";
                var parms      = new Dictionary <string, string>();

                parms.Add("token", token);
                parms.Add("centro", centro);
                parms.Add("idfam", idfam);
                parms.Add("nexp", nexp);
                parms.Add("fecha", fecha);
                parms.Add("servicio", servicio);
                parms.Add("tipo", tipo);


                string result = SOAPHelper.SendSOAPRequest(urlBase,
                                                           action,
                                                           parms,
                                                           soapAction,
                                                           false);

                var        soap = XDocument.Parse(result);
                XNamespace ns1  = "https://comocomen.com/";


                string miresul = (string)
                                 (from el in soap.Descendants(ns1 + "addAvisosResponse") select el).First();



                //   var resul = Newtonsoft.Json.JsonConvert.DeserializeObject<LoginResponse>(miresul);
                return(miresul);
            }
            catch
            {
                return("No se ha podido procesar la petición");

                {
                }
            }
        }
Exemple #6
0
        public async Task <LoginResponse> GetLogin(
            string urlBase,
            string username,
            string password,
            string centro)
        {
            try
            {
                var action     = "login";
                var soapAction = "https://comocomen.com/main_control/servidor_ws.php";
                var parms      = new Dictionary <string, string>();

                parms.Add("user", username);
                parms.Add("pass", password);
                parms.Add("centro", centro);

                string result = SOAPHelper.SendSOAPRequest(urlBase,
                                                           action,
                                                           parms,
                                                           soapAction,
                                                           false);

                var        soap = XDocument.Parse(result);
                XNamespace ns1  = "https://comocomen.com/";


                string miresul = (string)
                                 (from el in soap.Descendants(ns1 + "loginResponse") select el).First();

                //       MainViewModel.GetInstance().Familia = new FamiliaViewModel(result);
                var resul = Newtonsoft.Json.JsonConvert.DeserializeObject <LoginResponse>(miresul);
                return(resul);
            }
            catch
            {
                return(new LoginResponse
                {
                    AccessToken = null,
                });
            }
        }
        private void UpdateTickets()
        {
            _logger.Information("Updating Tickets");
            TicketDal dal        = new TicketDal(_configuration, _logger);
            DateTime? lastUpdate = dal.GetLastUpdated();

            if (lastUpdate == null || lastUpdate.Value.Year == 0)
            {
                _logger.Information("No tickets found trying initalisation");
                InitialiseTickets();
            }
            else
            {
                IEnumerable <TicketModel> ticketModels = new SOAPHelper(_autotaskApiUsername, _autotaskApiPassword, _autotaskApiIntegrationCode, _autotaskApiUrl, _logger)
                                                         .RetriveUpdatedTickets(lastUpdate.Value);
                if (ticketModels != null &&
                    ticketModels.Count() > 0)
                {
                    _logger.Information($"{ticketModels.Count()} updated Tickets found");
                    Domain.Enums.CRUDEnums.ActionResult actionResult = dal.PutOrPost(ticketModels).GetAwaiter().GetResult();
                }
            }
        }