示例#1
0
        public static async Task WriteOrUpdateProcedure(string procedureURL)
        {
            DataBaseOpeartions.UpdateProcedure(procedureURL);

            string result = await Scrapper.Scrapper.Scrap("Conamer", procedureURL);

            DataBaseOpeartions.AddProcedure(procedureURL, result);
        }
示例#2
0
        public static async Task UpdateAllProcedures()
        {
            List <string> proceduresUrl = DataBaseOpeartions.GetAllProceduresURLs();

            foreach (string procedureUrl in proceduresUrl)
            {
                await WriteOrUpdateProcedure(procedureUrl);
            }
        }
示例#3
0
        public static async Task <string> GetProcedure(string procedureURL)
        {
            if (!IsCurrent(procedureURL))
            {
                await WriteOrUpdateProcedure(procedureURL);
            }
            DataRow row = DataBaseOpeartions.GetProcedure(procedureURL);

            return(row[3].ToString());
        }
示例#4
0
        public static bool IsCurrent(string procedureURL)
        {
            DataRow row = DataBaseOpeartions.GetProcedure(procedureURL);

            DateTime lastUpdateDate = Convert.ToDateTime(row[2].ToString());
            DateTime currentDate    = DateTime.Now;

            TimeSpan differenceDate = currentDate - lastUpdateDate;
            int      differenceDays = differenceDate.Days;

            if (differenceDays >= ValidityProcedureDays)
            {
                return(false);
            }

            return(true);
        }
示例#5
0
        public static object Transform(string url)
        {
            string  conamerRawJson = DataBaseOpeartions.GetProcedure(url)[3].ToString();
            dynamic conamer        = JsonConvert.DeserializeObject(conamerRawJson);

            GetGeneralInfo(conamer);
            GetFundamentoJuridicoOrigenTramite(conamer);

            List <Requerimientos> requerimientosList = GetRequisitosList(conamer);

            output.Requerimientos = requerimientosList;

            output.FundamentosJuridicosOrigen = GetFundamentoJuridicoOrigenTramite(conamer);

            string outputJson = JsonConvert.SerializeObject(output, Formatting.Indented);

            return(JsonConvert.DeserializeObject(outputJson));
        }