Exemplo n.º 1
0
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb = (CustomBot)bc.Bot;
                int       _MaxDownloadedFileLength = Bot.Properties.Web.Default.MaxDownloadedFileLength;

                if (!Download)
                {
                    Bot.Properties.Web.Default.MaxDownloadedFileLength = 0;
                }
                bool rc = cb.hr.GetPage(Url);

                Bot.Properties.Web.Default.MaxDownloadedFileLength = _MaxDownloadedFileLength;
                if (!rc)
                {
                    if (cb.hr.Status == WebRoutineStatus.UNACCEPTABLE_CONTENT_TYPE)
                    {
                        return;
                    }
                    if (cb.hr.HWResponse.StatusCode == System.Net.HttpStatusCode.NotFound)
                    {
                        FileWriter.This.WriteLine(ParentLink.Url, Url);
                    }
                    //site2boken_urls[item.Site.Url] = site2boken_urls[item.Site.Url] + "\n" + item.Url;
                    else
                    {
                        throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + Url);
                    }
                    return;
                }
                if (Download)
                {
                    cb.get_links(Depth + 1);
                }
            }
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb = (CustomBot)bc.Bot;

                if (!cb.HR.Get(Url))
                {
                    throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + Url);
                }

                DataSifter.Capture gc = cb.product.Parse(cb.HR.HtmlResult);

                Fhr.CrawlerHost.Product product = new Fhr.CrawlerHost.Product(
                    id: gc.ValueOf("Id"),
                    url: Url,
                    name: gc.ValueOf("Name"),
                    sku: gc.ValueOf("Sku"),
                    price: gc.ValueOf("Price"),
                    category_branch: gc.ValuesOf("Category"),
                    image_urls: Spider.GetAbsoluteUrls(gc.ValuesOf("ImageUrl"), Url, cb.HR.HtmlResult),
                    stock: gc.ValueOf("Stock") != null ? (decimal)Fhr.CrawlerHost.Product.StockValue.IN_STOCK : (decimal)Fhr.CrawlerHost.Product.StockValue.NOT_IN_STOCK,
                    description: gc.ValueOf("Description")
                    );
                if (!Cliver.Fhr.CrawlerHost.CrawlerApi.SaveProductAsJson(product))
                {
                    throw new ProcessorException(ProcessorExceptionType.ERROR, "Product was not saved.");
                }
            }
Exemplo n.º 3
0
            /// <summary>
            /// InputItem can define a method to process it.
            /// When it is not defined within InputItem class, it must be defined in CustomBot as PROCESSOR_[InputItem class name]
            /// </summary>
            /// <param name="bc">BotCycle that keeps the current thread</param>
            override public void __Processor(BotCycle bc)
            {
                bc.Add(new Category(url: Url + "?q=1", t: new Category.Tag(name: "fff", description: "ttttt")));

                //it is possible to get the current CustomBot when access to common members is needed
                ((CustomSession)bc.Session).counter++;
            }
Exemplo n.º 4
0
                override public void __Processor(BotCycle bc)
                {
                    CustomBotCycle cbc = (CustomBotCycle)bc;
                    string         url = "http://www.yellowpages.com/search?search_terms=" + Keyword + "&geo_location_terms=" + Location;

                    cbc.search_processor(url);
                }
Exemplo n.º 5
0
            override public void __Processor(BotCycle bc)
            {
                int _MaxDownloadedFileLength = BotWeb.Settings.Web.MaxDownloadedFileLength;

                if (!Download)
                {
                    BotWeb.Settings.Web.MaxDownloadedFileLength = 0;
                }
                HttpRoutine hr = new HttpRoutine();
                bool        rc = hr.GetPage(Url);

                BotWeb.Settings.Web.MaxDownloadedFileLength = _MaxDownloadedFileLength;
                if (!rc)
                {
                    if (hr.Status == WebRoutineStatus.UNACCEPTABLE_CONTENT_TYPE)
                    {
                        return;
                    }
                    if (hr.HWResponse.StatusCode == System.Net.HttpStatusCode.NotFound)
                    {
                        FileWriter.This.WriteLine(ParentLink.Url, Url);
                    }
                    //site2boken_urls[item.Site.Url] = site2boken_urls[item.Site.Url] + "\n" + item.Url;
                    else
                    {
                        throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + Url);
                    }
                    return;
                }
                if (Download)
                {
                    ((CustomSession)bc.Session).get_links(Depth + 1, hr, bc);
                }
            }
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb = (CustomBot)bc.Bot;

                if (!cb.HR.Get(Url))
                {
                    throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + Url);
                }

                DataSifter.Capture gc = cb.list.Parse(cb.HR.HtmlResult);

                {
                    string url = gc.ValueOf("NextPageUrl");
                    if (url != null)
                    {
                        cb.BotCycle.Add(new ListItem(Spider.GetAbsoluteUrl(url, cb.HR.ResponseUrl)));
                    }
                }

                string[] urls = Spider.GetAbsoluteUrls(gc.ValuesOf("ProductUrl"), cb.HR.ResponseUrl, cb.HR.HtmlResult);
                foreach (string url in urls)
                {
                    cb.BotCycle.Add(new ProductItem(url));
                }
            }
Exemplo n.º 7
0
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb = (CustomBot)bc.Bot;

                string name = FieldPreparation.Html.GetCsvField(Name);

                if (!cb.HR.GetPage(Url))
                {
                    throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + Url);
                }

                DataSifter.Capture c        = product.Parse(cb.HR.HtmlResult);
                string             zip_code = Regex.Replace(c.ValueOf("ZipCode"), @"[^\d]", "", RegexOptions.Singleline);
                string             url2     = "http://www.yellowpages.com/search?search_terms=" + name + "&geo_location_terms=" + zip_code;
                string             email    = null;
                string             url3     = url2;

                if (cb.HR.GetPage(url2))
                {
                    DataSifter.Capture c2         = yp.Parse(cb.HR.HtmlResult);
                    string             regex_name = get_stripped_name(name);
                    regex_name = Regex.Escape((regex_name.Length > 10 ? regex_name.Substring(0, 10) : regex_name).Trim());
                    foreach (DataSifter.Capture cc in c2["Company"])
                    {
                        if (cc.ValueOf("ZipCode") != null &&
                            Regex.Replace(cc.ValueOf("ZipCode"), @"[^\d]", "", RegexOptions.Singleline) == zip_code &&
                            Regex.IsMatch(get_stripped_name(cc.ValueOf("Name")), regex_name, RegexOptions.IgnoreCase)
                            )
                        {
                            url3 = Spider.GetAbsoluteUrl(cc.ValueOf("Url"), url2);
                            if (!cb.HR.GetPage(url3))
                            {
                                throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + url3);
                            }

                            DataSifter.Capture c3 = yp2.Parse(cb.HR.HtmlResult);
                            email = c3.ValueOf("Email");
                            break;
                        }
                    }
                }
                else if (cb.HR.HWResponse.StatusCode != HttpStatusCode.NotFound)
                {
                    throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + url2);
                }

                FileWriter.This.PrepareAndWriteHtmlLineWithHeader(
                    "Name", Name,
                    "City", City,
                    "ZipCode", zip_code,
                    "State", State,
                    "Phone", Phone,
                    "Email", email,
                    "Url", Url,
                    "Url2", url3
                    );
            }
Exemplo n.º 8
0
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb = (CustomBot)bc.Bot;

                if (!cb.hr.GetPage(Url))
                {
                    throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get site: " + Url);
                }
                cb.get_links(1);
            }
Exemplo n.º 9
0
            override public void __Processor(BotCycle bc)
            {
                for (int i = 0; i < 3; i++)
                {
                    bc.Add(new Product(url: i + Url));
                }

                //list next page
                bc.Add(new Category(url: "qqqqq2", t: T));
            }
Exemplo n.º 10
0
                override public void __Processor(BotCycle bc)
                {
                    CustomBotCycle cbc = (CustomBotCycle)bc;

                    if (!cbc.hr.GetPage(Url))
                    {
                        throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get site: " + Url);
                    }
                    cbc.get_links(1);
                }
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb = (CustomBot)bc.Bot;

                if (!cb.HR.Get(Url))
                {
                    throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + Url);
                }

                DataSifter.Capture gc   = cb.category.Parse(cb.HR.HtmlResult);
                string[]           urls = Spider.GetAbsoluteUrls(gc.ValuesOf("CategoryUrl"), cb.HR.ResponseUrl, cb.HR.HtmlResult);
                foreach (string url in urls)
                {
                    cb.BotCycle.Add(new CategoryItem(url));
                }
            }
        public void get_links(int depth2, string queue)
        {
            if (depth2 > Bot.Properties.Spider.Default.MaxDownloadLinkDepth)
            {
                return;
            }

            string domain     = Spider.GetDomain(hr.ResponseUrl);
            int    page_count = domain2page_count[domain];

            if (Bot.Properties.Spider.Default.MaxPageCountPerSite > -1 && page_count >= Bot.Properties.Spider.Default.MaxPageCountPerSite)
            {
                return;
            }
            string queue2 = domain + "-" + depth2.ToString();

            if (depth2 > 1)
            {
                Session.SetInputItemQueuePositionAfterQueue(queue2, queue);//by default queue name is item type name but it can be different if needed
            }
            AgileSpider    ags = new AgileSpider(hr.ResponseUrl, hr.HtmlResult);
            List <WebLink> wls = ags.GetWebLinks(WebLinkType.Anchor | WebLinkType.Area | WebLinkType.Form | WebLinkType.MetaTag | WebLinkType.Frame | WebLinkType.Image | WebLinkType.Javascript);
            List <WebLink> beyond_domain_web_links;

            wls = Spider.GetSpiderableLinks(ags.BaseUri, wls, out beyond_domain_web_links);
            bool download = true;

            if (depth2 >= Bot.Properties.Spider.Default.MaxDownloadLinkDepth)
            {
                download = false;
            }
            foreach (WebLink wl in wls)
            {
                BotCycle.Add(queue2, new Link(url: wl.Url, depth: depth2, download: download));
                page_count++;
                if (Bot.Properties.Spider.Default.MaxPageCountPerSite > -1 && Bot.Properties.Spider.Default.MaxPageCountPerSite <= page_count)
                {
                    Log.Warning(domain + " reached MaxPageCountPerSite: " + Bot.Properties.Spider.Default.MaxPageCountPerSite.ToString());
                    break;
                }
            }
            domain2page_count[domain] = page_count;
            foreach (WebLink wl in beyond_domain_web_links)
            {
                BotCycle.Add(queue2, new Link(url: wl.Url, depth: depth2, download: false));//by default queue name is item type name but it can be deifferent if needed
            }
        }
Exemplo n.º 13
0
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb  = (CustomBot)bc.Bot;
                string    url = "http://www.rent.com/" + Regex.Replace(State, @"\s", "-");

                if (!cb.HR.GetPage(url))
                {
                    throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + url);
                }

                DataSifter.Capture c = cities.Parse(cb.HR.HtmlResult);

                string[] us = c.ValuesOf("Url");
                for (int i = 0; i < us.Length; i++)
                {
                    bc.Add(new SearchItem("http://www.rent.com" + us[i]));
                }
            }
Exemplo n.º 14
0
        public void get_links(int depth2)
        {
            if (depth2 > Bot.Properties.Spider.Default.MaxDownloadLinkDepth)
            {
                return;
            }

            string domain     = Spider.GetDomain(hr.ResponseUrl);
            int    page_count = domain2page_count[domain];

            if (Bot.Properties.Spider.Default.MaxPageCountPerSite > -1 && page_count >= Bot.Properties.Spider.Default.MaxPageCountPerSite)
            {
                return;
            }

            AgileSpider    ags = new AgileSpider(hr.ResponseUrl, hr.HtmlResult);
            List <WebLink> wls = ags.GetWebLinks(WebLinkType.Anchor | WebLinkType.Area | WebLinkType.Form | WebLinkType.MetaTag | WebLinkType.Frame | WebLinkType.Image | WebLinkType.Javascript);
            List <WebLink> beyond_domain_web_links;

            wls = Spider.GetSpiderableLinks(ags.BaseUri, wls, out beyond_domain_web_links);
            bool download = true;

            if (depth2 >= Bot.Properties.Spider.Default.MaxDownloadLinkDepth)
            {
                download = false;
            }
            foreach (WebLink wl in wls)
            {
                BotCycle.Add(new Link(url: wl.Url, depth: depth2, download: download));
                page_count++;
                if (Bot.Properties.Spider.Default.MaxPageCountPerSite > -1 && Bot.Properties.Spider.Default.MaxPageCountPerSite <= page_count)
                {
                    Log.Warning(domain + " reached MaxPageCountPerSite: " + Bot.Properties.Spider.Default.MaxPageCountPerSite.ToString());
                    break;
                }
            }
            domain2page_count[domain] = page_count;
            foreach (WebLink wl in beyond_domain_web_links)
            {
                BotCycle.Add(new Link(url: wl.Url, depth: depth2, download: false));
            }
        }
Exemplo n.º 15
0
        void search_processor(string url)
        {
            if (!HR.GetPage(url))
            {
                throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + url);
            }

            DataSifter.Capture c0 = search.Parse(HR.HtmlResult);

            string npu = c0.ValueOf("NextPageUrl");

            if (npu != null)
            {
                BotCycle.Add(new SearchNextPageItem(npu));
            }

            foreach (DataSifter.Capture c in c0["Product"])
            {
                BotCycle.Add(new CompanyItem(Spider.GetAbsoluteUrl(c.ValueOf("Url"), url), c.ValueOf("Name"), c.ValueOf("City"), c.ValueOf("State"), c.ValueOf("Phone")));
            }
        }
Exemplo n.º 16
0
                override public void __Processor(BotCycle bc)
                {
                    CustomBotCycle cbc = (CustomBotCycle)bc;

                    if (!cbc.HR.GetPage(Url))
                    {
                        throw new ProcessorException(ProcessorExceptionType.RESTORE_AS_NEW, "Could not get: " + Url);
                    }

                    DataSifter.Capture c = yp2.Parse(cbc.HR.HtmlResult);

                    FileWriter.This.PrepareAndWriteHtmlLineWithHeader(
                        "Name", c.ValueOf("Name"),
                        "City", c.ValueOf("City"),
                        "ZipCode", c.ValueOf("ZipCode"),
                        "State", c.ValueOf("State"),
                        "Phone", c.ValueOf("Phone"),
                        "Email", c.ValueOf("Email"),
                        "Site", c.ValueOf("Site"),
                        "Url", Url
                        );
                }
            override public void __Processor(BotCycle bc)
            {
                CustomSession session = (CustomSession)bc.Session;

                string address  = new System.Globalization.CultureInfo("en-US", false).TextInfo.ToTitleCase(Address.ToLower());
                string file_dir = PathRoutines.CreateDirectory(session.output_dir + "\\" + address, true);

                string output_pdf = file_dir + "\\" + Regex.Replace(address + " RPA.pdf", @"\s+", " ");
                {
                    //lock (template_pdf)
                    //{
                    //    File.Copy(template_pdf, pdf);
                    //}

                    PdfReader.unethicalreading = true;
                    PdfReader pr = new PdfReader(template_pdf);
                    //pr.RemoveUsageRights();
                    //pr.SelectPages("7,8");
                    PdfStamper ps = new PdfStamper(pr, new FileStream(output_pdf, FileMode.Create, FileAccess.Write, FileShare.None));

                    //string fs = "";
                    //foreach (KeyValuePair<string, AcroFields.Item> kvp in ps.AcroFields.Fields)
                    //    fs += "\n{\"" + kvp.Key + "\", \"\"},";

                    set_field(ps.AcroFields, "Todays Date", DateTime.Today.ToShortDateString());
                    set_field(ps.AcroFields, "Buyer Name", Settings.Parties.BuyerProfile.Name);
                    set_field(ps.AcroFields, "Address and Unit Number", address + " " + UnitNumber);
                    set_field(ps.AcroFields, "City/Town", City);
                    //set_field(ps.AcroFields, "CLARK", );
                    set_field(ps.AcroFields, "Zip", ZipCode);
                    set_field(ps.AcroFields, "PARCEL NUMBER", ParcelNumber);
                    set_field(ps.AcroFields, "OfferAmt", OfferAmt);
                    string offer_amt_ = Regex.Replace(OfferAmt, @"[^\d]", "");
                    if (offer_amt_.Length > 0)
                    {
                        set_field(ps.AcroFields, "OfferAmt in words", ConvertionRoutines.NumberToWords(int.Parse(offer_amt_)).ToUpper());
                    }
                    set_field(ps.AcroFields, "EMD", Settings.Offer.Emd);
                    //set_field(ps.AcroFields, "Check Box1", );
                    //set_field(ps.AcroFields, "Balance", );
                    set_field(ps.AcroFields, "Co Buyer Name", Settings.Parties.BuyerProfile.CoBuyerName);
                    set_field(ps.AcroFields, "<address> <UnitNumber> <City/town> NV <ZIP Code>", address + " " + UnitNumber + ", " + City + " NV " + ZipCode);
                    set_field(ps.AcroFields, "ML#", "ALL PER ML# " + ML_Id);
                    set_field(ps.AcroFields, "Title Company", Settings.Parties.EscrowProfile.TitleCompany);
                    set_field(ps.AcroFields, "Escrow Officer", Settings.Parties.EscrowProfile.Officer);
                    set_field(ps.AcroFields, "Close of Escrow", Settings.Offer.CloseOfEscrow.ToShortDateString());

                    //String[] values = ps.AcroFields.GetAppearanceStates("Licensee Yes");
                    //String[] values2 = ps.AcroFields.GetAppearanceStates("Licensee No");
                    if (Settings.Parties.BuyerProfile.UseLicensee)
                    {
                        set_field(ps.AcroFields, "Licensee Yes", "Yes");
                        //set_field(ps.AcroFields, "Licensee No", "Off");
                        //set_field(ps.AcroFields, "Licensee relationship", DateTime.Today.ToShortDateString());
                        set_field(ps.AcroFields, "Licensee relationship", Settings.Parties.BuyerProfile.LicenseeRelationship);
                        switch (Settings.Parties.BuyerProfile.RelationshipType)
                        {
                        case "Family Firm":
                            set_field(ps.AcroFields, "Licensee Family Firm", "Yes");
                            break;

                        case "Principal":
                            set_field(ps.AcroFields, "Licensee Principal", "Yes");
                            break;
                        }
                    }
                    else
                    {
                        set_field(ps.AcroFields, "Licensee No", "Yes");
                        //set_field(ps.AcroFields, "Licensee Yes", "Off");
                    }

                    DateTime date = DateTime.Now.AddDays(7);
                    set_field(ps.AcroFields, "Response Month", date.ToString("MMMM"));
                    set_field(ps.AcroFields, "Response day", date.ToString("%d"));
                    set_field(ps.AcroFields, "year", date.ToString("yyyy"));;
                    string emd_ = Regex.Replace(Settings.Offer.Emd, @"[^\d]", "");
                    if (offer_amt_.Length > 0 && emd_.Length > 0)
                    {
                        set_field(ps.AcroFields, "Balance", (int.Parse(offer_amt_) - int.Parse(emd_)).ToString());
                    }

                    //                    string AdditionalTerms = @"This form is available for use by the real estate industry. It is not intended to identify the user as a REALTOR®.
                    //8 REALTOR® is a registered collective membership mark which may be used only by members of the NATIONAL
                    //9 ASSOCIATION OF REALTORS® who subscribe to its Code.";
                    string s = AdditionalTerms;
                    s = fill_field_by_words(ps.AcroFields, "AdditionalTerms1", s);
                    s = fill_field_by_words(ps.AcroFields, "AdditionalTerms2", s);
                    s = fill_field_by_words(ps.AcroFields, "AdditionalTerms3", s);
                    if (s.Length > 0)
                    {
                        s = AdditionalTerms;
                        s = fill_field_by_chars(ps.AcroFields, "AdditionalTerms1", s);
                        s = fill_field_by_chars(ps.AcroFields, "AdditionalTerms2", s);
                        set_field(ps.AcroFields, "AdditionalTerms3", s);
                    }

                    set_field(ps.AcroFields, "Buyer Broker", Settings.Parties.BrokerProfile.Name);
                    set_field(ps.AcroFields, "Agent Name", Settings.Parties.AgentProfile.Name);
                    set_field(ps.AcroFields, "ListAgentFullName", ListAgentFullName);
                    set_field(ps.AcroFields, "Company Name", Settings.Parties.BrokerProfile.Company);
                    set_field(ps.AcroFields, "ListOfficeName", ListOfficeName);
                    set_field(ps.AcroFields, "Agents License", Settings.Parties.AgentProfile.LicenseNo);
                    set_field(ps.AcroFields, "Brokers License", Settings.Parties.BrokerProfile.LicenseNo);
                    set_field(ps.AcroFields, "Office Address", Settings.Parties.BrokerProfile.Address);
                    set_field(ps.AcroFields, "Office Phone", Settings.Parties.BrokerProfile.Phone);
                    set_field(ps.AcroFields, "City State Zip", Settings.Parties.BrokerProfile.City + " " + Settings.Parties.BrokerProfile.State + " " + Settings.Parties.BrokerProfile.Zip);
                    set_field(ps.AcroFields, "Agent Email", Settings.Parties.AgentProfile.Email);
                    //set_field(ps.AcroFields, "Response Month", );
                    //set_field(ps.AcroFields, "Response day", );
                    //set_field(ps.AcroFields, "year", );
                    //set_field(ps.AcroFields,  "Date_2", );
                    //set_field(ps.AcroFields, "Date_3", );
                    //set_field(ps.AcroFields, "Sellers Broker", );
                    set_field(ps.AcroFields, "Agents Name_2", Settings.Parties.AgentProfile.Name);
                    set_field(ps.AcroFields, "Company Name_2", Settings.Parties.BrokerProfile.Company);
                    set_field(ps.AcroFields, "Agents License Number_2", Settings.Parties.AgentProfile.LicenseNo);
                    set_field(ps.AcroFields, "Brokers License Number_2", Settings.Parties.BrokerProfile.LicenseNo);
                    set_field(ps.AcroFields, "Office Address_2", Settings.Parties.BrokerProfile.Address);
                    set_field(ps.AcroFields, "Phone_2", Settings.Parties.BrokerProfile.Phone);
                    set_field(ps.AcroFields, "City State Zip_2", Settings.Parties.BrokerProfile.Zip);
                    set_field(ps.AcroFields, "Email_2", Settings.Parties.AgentProfile.Email);
                    set_field(ps.AcroFields, "ListAgentEmail", ListAgentEmail);

                    ps.FormFlattening = true;

                    for (int i = 1; i <= pr.NumberOfPages; i++)
                    {
                        var pcb = ps.GetOverContent(i);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.InitialFile), new System.Drawing.Point(497, 67));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerInitialFile), new System.Drawing.Point(536, 67));
                        }
                    }
                    {
                        var pcb = ps.GetOverContent(3);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.InitialFile), new System.Drawing.Point(140, 103));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerInitialFile), new System.Drawing.Point(280, 103));
                        }
                    }
                    {
                        var pcb = ps.GetOverContent(9);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.SignatureFile), new System.Drawing.Point(60, 190));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerSignatureFile), new System.Drawing.Point(60, 155));
                        }
                    }

                    ps.Close();
                    pr.Close();
                }

                string output_addendum_pdf = null;

                if (Settings.Offer.ShortSaleAddendum)
                {
                    output_addendum_pdf = file_dir + "\\" + Regex.Replace(address + " SS Addendum.pdf", @"\s+", " ");

                    PdfReader.unethicalreading = true;
                    PdfReader  pr = new PdfReader(template_addendum_pdf);
                    PdfStamper ps = new PdfStamper(pr, new FileStream(output_addendum_pdf, FileMode.Create, FileAccess.Write, FileShare.None));

                    string fs = "";
                    foreach (KeyValuePair <string, AcroFields.Item> kvp in ps.AcroFields.Fields)
                    {
                        fs += "\n{\"" + kvp.Key + "\", \"\"},";
                    }

                    if (Settings.Parties.BuyerProfile.UseCoBuyer)
                    {
                        set_field(ps.AcroFields, "<Buyer Name> and <Co Buyer Name>", Settings.Parties.BuyerProfile.Name + " and " + Settings.Parties.BuyerProfile.CoBuyerName);
                    }
                    else
                    {
                        set_field(ps.AcroFields, "<Buyer Name> and <Co Buyer Name>", Settings.Parties.BuyerProfile.Name);
                    }
                    set_field(ps.AcroFields, "Todays Date", DateTime.Today.ToShortDateString());
                    set_field(ps.AcroFields, "<Address> <UnitNumber> <City/Town> NV <Zip Code>", address + " " + UnitNumber + ", " + City + " NV " + ZipCode);
                    set_field(ps.AcroFields, "Agent Name", Settings.Parties.AgentProfile.Name);
                    //set_field(ps.AcroFields, "Agent Phone", );

                    ps.FormFlattening = true;

                    for (int i = 1; i <= pr.NumberOfPages; i++)
                    {
                        var pcb = ps.GetOverContent(i);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.InitialFile), new System.Drawing.Point(120, 70));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerInitialFile), new System.Drawing.Point(157, 70));
                        }
                    }
                    {
                        var pcb = ps.GetOverContent(1);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.InitialFile), new System.Drawing.Point(140, 400));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerInitialFile), new System.Drawing.Point(197, 400));
                        }
                    }
                    {
                        var pcb = ps.GetOverContent(3);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.SignatureFile), new System.Drawing.Point(150, 547));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerSignatureFile), new System.Drawing.Point(150, 504));
                        }
                    }

                    ps.Close();
                    pr.Close();
                }

                string output_addendum1_pdf = null;

                if (Settings.Offer.OtherAddendum1)
                {
                    output_addendum1_pdf       = file_dir + "\\" + Regex.Replace("duites " + address + ".pdf", @"\s+", " ");
                    PdfReader.unethicalreading = true;
                    PdfReader  pr = new PdfReader(template_addendum1_pdf);
                    PdfStamper ps = new PdfStamper(pr, new FileStream(output_addendum1_pdf, FileMode.Create, FileAccess.Write, FileShare.None));

                    string fs = "";
                    foreach (KeyValuePair <string, AcroFields.Item> kvp in ps.AcroFields.Fields)
                    {
                        fs += "\n{\"" + kvp.Key + "\", \"\"},";
                    }

                    set_field(ps.AcroFields, "AgentName", Settings.Parties.AgentProfile.Name);
                    set_field(ps.AcroFields, "LicenseNumber", Settings.Parties.AgentProfile.LicenseNo);
                    set_field(ps.AcroFields, "Buyer Name", Settings.Parties.BuyerProfile.Name);
                    set_field(ps.AcroFields, "Co-Buyer Name", Settings.Parties.BuyerProfile.CoBuyerName);
                    set_field(ps.AcroFields, "BrokerName", Settings.Parties.BrokerProfile.Name);
                    set_field(ps.AcroFields, "Company", Settings.Parties.BrokerProfile.Company);
                    set_field(ps.AcroFields, "Date_3", DateTime.Now.ToShortDateString());
                    set_field(ps.AcroFields, "Time_3", DateTime.Now.ToShortTimeString());
                    set_field(ps.AcroFields, "Date_4", DateTime.Now.ToShortDateString());
                    set_field(ps.AcroFields, "Time_4", DateTime.Now.ToShortTimeString());

                    ps.FormFlattening = true;

                    {
                        var pcb = ps.GetOverContent(1);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.InitialFile), new System.Drawing.Point(70, 190));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerInitialFile), new System.Drawing.Point(140, 190));
                        }
                    }
                    {
                        var pcb = ps.GetOverContent(1);
                        add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.SignatureFile), new System.Drawing.Point(110, 85));
                        if (Settings.Parties.BuyerProfile.UseCoBuyer)
                        {
                            add_image(pcb, System.Drawing.Image.FromFile(Settings.Parties.BuyerProfile.CoBuyerSignatureFile), new System.Drawing.Point(110, 85));
                        }
                    }

                    ps.Close();
                    pr.Close();
                }

                bc.Add(new EmailItem(output_pdf, output_addendum_pdf, output_addendum1_pdf));
            }
Exemplo n.º 18
0
            override public void PROCESSOR(BotCycle bc)
            {
                CustomBot cb = (CustomBot)bc.Bot;

                cb.search_processor(Url);
            }
Exemplo n.º 19
0
                override public void __Processor(BotCycle bc)
                {
                    CustomBotCycle cbc = (CustomBotCycle)bc;

                    cbc.search_processor(Url);
                }
            override public void __Processor(BotCycle bc)
            {
                CustomSession session = (CustomSession)bc.Session;

                session.send(Data, Pdf, Addendum, Addendum1);
            }