コード例 #1
0
 public SiteMapping(SiteRow tablotto)
 {
     Url      = tablotto.Url;
     State    = tablotto.IsStateNull() ? false : tablotto.State;
     PreHtml  = tablotto.IsPreHTMLNull() ? "" : tablotto.PreHTML;
     PostHTML = tablotto.IsPostHTMLNull() ? "" : tablotto.PostHTML;
     Email    = tablotto.IsEmailNull() ? "*****@*****.**" : tablotto.Email;
     Ore      = tablotto.Ore;
     Tag      = tablotto.IsTagNull() ? "" : tablotto.Tag;
     Active   = tablotto.IsActiveNull() ? false : tablotto.Active == 1;
 }
コード例 #2
0
        public static async Task <bool> AddUpdateSiteAsync(SiteRow row)
        {
            try
            {
                //      return true;
                if (row.Active == 0)
                {
                    return(false);
                }
                if (String.IsNullOrEmpty(row.Url))
                {
                    return(false);
                }
                if (row.Url.ToLower().CompareTo(@"https://acpol2.army.mil/vacancy/vacancy_list.asp") == 0)
                {
                    Console.WriteLine("CARICO " + row.Url);
                    var ris = await SendRequestAsync(row.Url, "POST", new Dictionary <string, string> {
                        { "FormAction2", "2" }
                    });

                    if (row.IsPreHTMLNull() || row.PreHTML == String.Empty)
                    {
                        row.PreHTML = ElaboraCampDearby(ris);
                    }
                    else
                    {
                        row.PostHTML = row.PreHTML;
                        row.PreHTML  = ElaboraCampDearby(ris);
                    }
                    row.State = (row.PostHTML == row.PreHTML || row.PostHTML != string.Empty);
                }
                else
                {
                    Console.WriteLine("CARICO " + row.Url);
                    var ris = await SendRequestAsync(row.Url, "GET", new Dictionary <string, string> {
                        { "FormAction2", "2" }
                    });

                    if (row.IsPreHTMLNull() || row.PreHTML == String.Empty)
                    {
                        row.PreHTML = ElaboraByTag(ris, row.Tag);
                    }
                    else
                    {
                        row.PostHTML = row.PreHTML;
                        row.PreHTML  = ElaboraByTag(ris, row.Tag);
                        if (row.PostHTML != row.PreHTML)
                        {
                            //send mail
                            Mail.SendMessage(row);
                        }
                    }
                }
                DsSiteSave();
                return(true);
            }
            catch (Exception EX)
            {
                Console.WriteLine(EX.ToString());
                return(false);
            }
        }