public void SaveBackOrder(BackOrders backorder) { var history = new AuctionHistory(); history.AuctionLink = backorder.OrderID; history.CreatedDate = DefaultView.GetPacificTime; history.Text = "Added"; Ds.AuctionHistory.Add(history); Ds.BackOrders.AddOrUpdate(backorder); Ds.SaveChanges(); }
public void AddHistoryItem(Guid ID, String Message) { using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = Message, CreatedDate = Settings.GetPacificTime(), AuctionLink = ID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } }
//Run the check private void CheckDB() { using (var ds = new ASEntities()) { CheckTimer.Stop(); var tomorrow = Settings.GetPacificTime().AddDays(1); var auctionsToProcess = ds.Auctions.Where(x => x.Processed == false && x.EndDate <= tomorrow).ToList(); foreach (var auction in auctionsToProcess) { var ts = auction.EndDate.Subtract(Settings.GetPacificTime()); if (ts.TotalSeconds < Convert.ToInt32(Properties.Settings.Default.BidTime) && (auction.MinBid < auction.MyBid || auction.MinBid == auction.MyBid) && ts.TotalSeconds > 0) { try { auction.Processed = true; ds.Auctions.AddOrUpdate(auction); ds.SaveChanges(); var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Process Started", CreatedDate = Settings.GetPacificTime(), AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); var account = ds.GoDaddyAccount.First(x => x.AccountID == auction.AccountID); var auction1 = auction; var auction2 = auction; var th = new Thread(() => { try { var gd = new GoDaddyAuctions2Cs(); gd.PlaceBid(account, auction1); Email.SendEmail("*****@*****.**", "Placing a bid", "Account: " + account.GoDaddyUsername + Environment.NewLine + "Site: " + auction2.DomainName); } catch (Exception e) { SendErrorReport(e); } }); th.SetApartmentState(ApartmentState.STA); th.IsBackground = true; th.Start(); } catch (Exception ex) { SendErrorReport(ex); } } } CheckTimer.Start(); } }
private void CheckBackOrders() { using (var ds = new ASEntities()) { CheckTimer.Stop(); var tomorrow = Settings.GetPacificTime().AddDays(1); var backordersToProcess = ds.BackOrders.Where(x => x.Processed == false && x.DateToOrder <= tomorrow).ToList(); foreach (var order in backordersToProcess) { var ts = order.DateToOrder.Subtract(Settings.GetPacificTime()); if (ts.TotalSeconds < Convert.ToInt32(Properties.Settings.Default.BidTime) && ts.TotalSeconds > 0) { try { order.Processed = true; ds.BackOrders.AddOrUpdate(order); ds.SaveChanges(); var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Order Process Started", CreatedDate = Settings.GetPacificTime(), AuctionLink = order.OrderID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); var account = ds.GoDaddyAccount.First(x => x.AccountID == order.GoDaddyAccount); var th = new Thread(() => { try { var gd = new GoDaddyAuctions2Cs(); if (gd.Login(account.GoDaddyUsername, account.GoDaddyPassword)) { AddHistoryItem(order.OrderID, "Logged in: " + account.GoDaddyUsername); } if (gd.CheckBackOrderDomain_IsValid(order.DomainName)) { AddHistoryItem(order.OrderID, "Domain confirmed valid: " + order.DomainName); if (gd.ValidateMonitorEmail(order.AlertEmail1, order.AlertEmail2)) { AddHistoryItem(order.OrderID, "Alert Email validated: " + order.AlertEmail1); AddHistoryItem(order.OrderID, "Final submission failed, please check the error log "); } else { AddHistoryItem(order.OrderID, "Alert Email invalid, order not procesed: " + order.AlertEmail1); } } else { AddHistoryItem(order.OrderID, "Domain invalid, order not procesed: " + order.DomainName); } } catch (Exception e) { SendErrorReport(e); } }); th.SetApartmentState(ApartmentState.STA); th.IsBackground = true; th.Start(); } catch (Exception ex) { SendErrorReport(ex); } } } CheckTimer.Start(); } }
//private const int Timediff = -8; /// <summary> /// Emai Alerts Trigger /// </summary> /// <summary> /// Emai Alerts Trigger /// </summary> private void CheckAlerts() { var ds = new ASEntities(); AlertTimer.Stop(); var alertsToProcess = ds.Alerts.Where(x => x.Processed == false).ToList(); foreach (var alert in alertsToProcess) { var ts = alert.TriggerTime.Subtract(Settings.GetPacificTime()); if (ts.TotalSeconds < Convert.ToInt32(Properties.Settings.Default.BidTime)) { try { alert.Processed = true; ds.Alerts.AddOrUpdate(alert); ds.SaveChanges(); var id = alert.AuctionID; var user = from a in ds.Auctions join gda in ds.GoDaddyAccount on a.AccountID equals gda.AccountID join u in ds.Users on gda.UserID equals u.UserID where (a.AuctionID == id) select new {u.Username, a.DomainName, a.AuctionRef, a.MyBid, gda.GoDaddyUsername, gda.GoDaddyPassword, u.ReceiveEmails}; if (!user.Any()) { continue; } var account = user.First(); var alert1 = alert; var gd = new GoDaddyAuctions2Cs(); if (alert1.Description == "WIN ALERT") { gd.Login(account.GoDaddyUsername, account.GoDaddyPassword); if (gd.WinCheck(account.DomainName)) { if (Settings.GetPacificTime() > alert1.TriggerTime.AddHours(4)) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction Check (Delayed)", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); var item2 = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction WON", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); ds.AuctionHistory.Add(item2); } else { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction WON", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); } ds.SaveChanges(); } else { if (Settings.GetPacificTime() > alert1.TriggerTime.AddHours(4)) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction Check (Delayed)", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); var item2 = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction LOST", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); ds.AuctionHistory.Add(item2); } else { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction LOST", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); } ds.SaveChanges(); } } else { var minBid = gd.CheckAuction(account.AuctionRef); if (account.MyBid >= minBid) { if (account.ReceiveEmails) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Reminder Email Sent", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); API.Email(account.Username, "12 Hour Auction Reminder", "A quick reminder!" + Environment.NewLine + "Your maximum bid of $" + account.MyBid + "will (thus far!) seal the win!" + Environment.NewLine + "Site: " + account.DomainName, "Domain Auction Sniper"); } } else { if (account.ReceiveEmails) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Alerted - Auction will be lost", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); API.Email(account.Username, "Auction will be lost", "A quick reminder!" + Environment.NewLine + "If you don't increase your maximum bid to $" + minBid + " or more you will loose!" + Environment.NewLine + "Site: " + account.DomainName, "Domain Auction Sniper"); } else { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction will be lost - Email warning is disabled", CreatedDate = Settings.GetPacificTime(), AuctionLink = alert1.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } } } } catch (Exception ex) { SendErrorReport(ex); ds.Dispose(); AlertTimer.Start(); } } } ds.Dispose(); AlertTimer.Start(); }
public void PlaceBid(GoDaddyAccount account, Auctions auction) { ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; var url = "https://auctions.godaddy.com/trpSearchResults.aspx"; using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Logging In", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } if (Login(account.GoDaddyUsername, account.GoDaddyPassword)) { var postData = string.Format("action=review_selected_add&items={0}_B_{1}_1|&rnd={2}&JlPYXTX=347bde7", auction.AuctionRef, auction.MyBid, RandomDouble(0, 1).ToString("0.00000000000000000")); var responseData = Post(url, postData); using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Setting Max Bid: " + auction.MyBid, CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } //Review url = "https://auctions.godaddy.com/trpMessageHandler.aspx"; postData = "q=ReviewDomains"; responseData = Post(url, postData); if (responseData.Contains("ERROR: Bid must be a minimum of")) { using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Process Ended - Your max bid is already too small to place", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } return; } //KeepAlive Get("https://auctions.godaddy.com/trpMessageHandler.aspx?keepAlive=1"); Get("https://idp.godaddy.com/KeepAlive.aspx?SPKey=GDDNAEB002"); url = string.Format("https://img.godaddy.com/pageevents.aspx?page_name=/trphome.aspx&ci=37022" + "&eventtype=click&ciimpressions=&usrin=&relativeX=659&relativeY=325&absoluteX=659&" + "absoluteY=1102&r={0}&comview=0", RandomDouble(0, 1).ToString("0.00000000000000000")); responseData = Get(url); // Buy var view = ExtractViewStateSearch(responseData); url = @"https://auctions.godaddy.com/trpItemListingReview.aspx"; postData = "__VIEWSTATE=" + Viewstates + string.Format("&hidAdvSearch=ddlAdvKeyword%3A1%7CtxtKeyword%3Aportal" + "%7CddlCharacters%3A0%7CtxtCharacters%3A%7CtxtMinTraffic%3A%7CtxtMaxTraffic%3A%" + "7CtxtMinDomainAge%3A%7CtxtMaxDomainAge%3A%7CtxtMinPrice%3A%7CtxtMaxPrice%3A%7Cdd" + "lCategories%3A0%7CchkAddBuyNow%3Afalse%7CchkAddFeatured%3Afalse%7CchkAddDash%3Atrue" + "%7CchkAddDigit%3Atrue%7CchkAddWeb%3Afalse%7CchkAddAppr%3Afalse%7CchkAddInv%3Afalse%7" + "CchkAddReseller%3Afalse%7CddlPattern1%3A%7CddlPattern2%3A%7CddlPattern3%3A%7CddlPattern4" + "%3A%7CchkSaleOffer%3Afalse%7CchkSalePublic%3Atrue%7CchkSaleExpired%3Afalse%7CchkSaleCloseouts" + "%3Afalse%7CchkSaleUsed%3Afalse%7CchkSaleBuyNow%3Afalse%7CchkSaleDC%3Afalse%7CchkAddOnSale" + "%3Afalse%7CddlAdvBids%3A0%7CtxtBids%3A%7CtxtAuctionID%3A%7CddlDateOffset%3A%7CddlRecordsPerPageAdv" + "%3A3&hidADVAction=p_&txtKeywordContext=&ddlRowsToReturn=3&hidAction=&hidItemsAddedToCart=" + "&hidGetMemberInfo=&hidShopperId=46311038&hidValidatedMemberInfo=&hidCheckedDomains=&hidMS90483566" + "=O&hidMS86848023=O&hidMS70107049=O&hidMS91154790=O&hidMS39351987=O&hidMS94284110=O&hidMS53775077=" + "O&hidMS75408187=O&hidMS94899096=B&hidMS94899097=B&hidMS94899098=B&hidMS94899099=B&hidMS94937468=" + "B&hidMS95047168=B&hidMS{0}=B&hid_Agree1=on", auction.AuctionRef); using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Process Completed", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } var hdoc = HtmlDocument(Post(url, postData)); bool confirmed = false; foreach (var items in QuerySelectorAll(hdoc.DocumentNode, "tr")) { if (items.InnerHtml.Contains(auction.AuctionRef) && items.InnerHtml.Contains("the high bidder")) { confirmed = true; using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Confirmed - You are the high bidder!", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } break; } if (items.InnerHtml.Contains(auction.AuctionRef) && items.InnerHtml.Contains("ERROR: Not an auction")) { confirmed = true; using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Failed - The site is no longer an auction", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } break; } } if (!confirmed) { using (var ds = new ASEntities()) { try { var content = hdoc.DocumentNode.InnerHtml; new Error().Add(content); } catch (Exception) { } var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Not Confirmed - Data logged", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } } } else { using (var ds = new ASEntities()) { if (CaptchaOverload) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Appologies - 3rd party capture solve failure. This has been reported.", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); } else { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Appologies - Login to account has failed. 3 Seperate attempts made", CreatedDate = GetPacificTime, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); } //ds.GoDaddyAccount.First(x => x.AccountID == account.AccountID).Verified = false; ds.SaveChanges(); } } }
public void PlaceBid(GoDaddyAccount account, Auctions auction) { ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Logging In", CreatedDate = GetPacificTime.AddSeconds(15), AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } var logindata = Login(account.GoDaddyUsername, account.GoDaddyPassword); HttpWebRequest request; HttpWebResponse response; var responseData = ""; var strUrl = "https://auctions.godaddy.com/trpSearchResults.aspx"; var postData = string.Format("action=review_selected_add&items={0}_B_{1}_1|&rnd={2}&JlPYXTX=347bde7", auction.AuctionRef, auction.MyBid, randomDouble(0, 1).ToString("0.00000000000000000")); request = (HttpWebRequest)WebRequest.Create(strUrl); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postData.Length; request.Accept = "text/html, application/xhtml+xml, */*"; request.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/x-silverlight, application/x-silverlight-2-b2, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*"; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11"; request.Headers.Add("Accept-Encoding", "deflate"); request.Referer = "auctions.godaddy.com"; request.Headers["my-header"] = "the-value"; request.KeepAlive = true; request.CookieContainer = cookies; request.Timeout = Timeout.Infinite; using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Setting Max Bid: " + auction.MyBid, CreatedDate = GetPacificTime.AddSeconds(15), AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } var stOut = new StreamWriter(request.GetRequestStream()); stOut.Write(postData); stOut.Flush(); stOut.Close(); stOut = null; response = (HttpWebResponse)request.GetResponse(); response.Cookies = request.CookieContainer.GetCookies(request.RequestUri); var encoding = new System.Text.UTF8Encoding(); var responseReader = new StreamReader(response.GetResponseStream(), encoding, true); encoding = new System.Text.UTF8Encoding(); responseReader = new StreamReader(response.GetResponseStream(), encoding, true); responseData = responseReader.ReadToEnd(); response.Close(); responseReader.Close(); foreach (Cookie ck in response.Cookies) { request.CookieContainer.Add(ck); } strUrl = "https://auctions.godaddy.com/trpMessageHandler.aspx"; postData = "q=ReviewDomains"; request = (HttpWebRequest)WebRequest.Create(strUrl); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postData.Length; request.Accept = "text/html, application/xhtml+xml, */*"; request.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/x-silverlight, application/x-silverlight-2-b2, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*"; request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; request.Headers.Add("Accept-Encoding", "deflate"); request.Referer = "auctions.godaddy.com"; request.Headers["my-header"] = "the-value"; request.KeepAlive = true; request.CookieContainer = cookies; request.Timeout = Timeout.Infinite; request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; stOut = new StreamWriter(request.GetRequestStream()); stOut.Write(postData); stOut.Flush(); stOut.Close(); stOut = null; response = (HttpWebResponse)request.GetResponse(); response.Cookies = request.CookieContainer.GetCookies(request.RequestUri); encoding = new System.Text.UTF8Encoding(); responseReader = new StreamReader(response.GetResponseStream(), encoding, true); responseData = responseReader.ReadToEnd(); response.Close(); responseReader.Close(); foreach (Cookie ck in response.Cookies) { request.CookieContainer.Add(ck); } strUrl = "https://auctions.godaddy.com/trpMessageHandler.aspx?keepAlive=1"; postData = ""; request = (HttpWebRequest)WebRequest.Create(strUrl); request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postData.Length; request.CookieContainer = cookies; request.Referer = "https://auctions.godaddy.com/?t=22"; request.Timeout = System.Threading.Timeout.Infinite; request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; request.Headers.Add("Accept-Encoding", ""); request.KeepAlive = true; response = (HttpWebResponse)request.GetResponse(); response.Cookies = request.CookieContainer.GetCookies(request.RequestUri); encoding = new System.Text.UTF8Encoding(); responseReader = new StreamReader(response.GetResponseStream(), encoding, true); responseData = responseReader.ReadToEnd(); response.Close(); responseReader.Close(); foreach (Cookie ck in response.Cookies) { request.CookieContainer.Add(ck); } strUrl = "https://idp.godaddy.com/KeepAlive.aspx?SPKey=GDDNAEB003"; postData = ""; request = (HttpWebRequest)WebRequest.Create(strUrl); request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postData.Length; request.CookieContainer = cookies; request.Referer = "https://auctions.godaddy.com/?t=22"; request.Timeout = System.Threading.Timeout.Infinite; request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; request.Headers.Add("Accept-Encoding", ""); request.KeepAlive = true; response = (HttpWebResponse)request.GetResponse(); response.Cookies = request.CookieContainer.GetCookies(request.RequestUri); encoding = new System.Text.UTF8Encoding(); responseReader = new StreamReader(response.GetResponseStream(), encoding, true); responseData = responseReader.ReadToEnd(); response.Close(); responseReader.Close(); foreach (Cookie ck in response.Cookies) { request.CookieContainer.Add(ck); } strUrl = string.Format("https://img.godaddy.com/pageevents.aspx?page_name=/trphome.aspx&ci=37022" + "&eventtype=click&ciimpressions=&usrin=&relativeX=659&relativeY=325&absoluteX=659&" + "absoluteY=1102&r={0}&comview=0", randomDouble(0, 1).ToString("0.00000000000000000")); postData = ""; request = (HttpWebRequest)WebRequest.Create(strUrl); request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postData.Length; request.CookieContainer = cookies; request.Referer = "https://auctions.godaddy.com/?t=22"; request.Timeout = System.Threading.Timeout.Infinite; request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; request.Headers.Add("Accept-Encoding", ""); request.KeepAlive = true; request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; response = (HttpWebResponse)request.GetResponse(); response.Cookies = request.CookieContainer.GetCookies(request.RequestUri); encoding = new System.Text.UTF8Encoding(); responseReader = new StreamReader(response.GetResponseStream(), encoding, true); responseData = responseReader.ReadToEnd(); response.Close(); responseReader.Close(); foreach (Cookie ck in response.Cookies) { request.CookieContainer.Add(ck); } strUrl = @"https://auctions.godaddy.com/trpItemListingReview.aspx"; postData = _viewstates + string.Format("&hidAdvSearch=ddlAdvKeyword%3A1%7CtxtKeyword%3Aportal" + "%7CddlCharacters%3A0%7CtxtCharacters%3A%7CtxtMinTraffic%3A%7CtxtMaxTraffic%3A%" + "7CtxtMinDomainAge%3A%7CtxtMaxDomainAge%3A%7CtxtMinPrice%3A%7CtxtMaxPrice%3A%7Cdd" + "lCategories%3A0%7CchkAddBuyNow%3Afalse%7CchkAddFeatured%3Afalse%7CchkAddDash%3Atrue" + "%7CchkAddDigit%3Atrue%7CchkAddWeb%3Afalse%7CchkAddAppr%3Afalse%7CchkAddInv%3Afalse%7" + "CchkAddReseller%3Afalse%7CddlPattern1%3A%7CddlPattern2%3A%7CddlPattern3%3A%7CddlPattern4" + "%3A%7CchkSaleOffer%3Afalse%7CchkSalePublic%3Atrue%7CchkSaleExpired%3Afalse%7CchkSaleCloseouts" + "%3Afalse%7CchkSaleUsed%3Afalse%7CchkSaleBuyNow%3Afalse%7CchkSaleDC%3Afalse%7CchkAddOnSale" + "%3Afalse%7CddlAdvBids%3A0%7CtxtBids%3A%7CtxtAuctionID%3A%7CddlDateOffset%3A%7CddlRecordsPerPageAdv" + "%3A3&hidADVAction=p_&txtKeywordContext=&ddlRowsToReturn=3&hidAction=&hidItemsAddedToCart=" + "&hidGetMemberInfo=&hidShopperId=46311038&hidValidatedMemberInfo=&hidCheckedDomains=&hidMS90483566" + "=O&hidMS86848023=O&hidMS70107049=O&hidMS91154790=O&hidMS39351987=O&hidMS94284110=O&hidMS53775077=" + "O&hidMS75408187=O&hidMS94899096=B&hidMS94899097=B&hidMS94899098=B&hidMS94899099=B&hidMS94937468=" + "B&hidMS95047168=B&hidMS{0}=B&hid_Agree1=on", auction.AuctionRef); request = (HttpWebRequest)WebRequest.Create(strUrl); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postData.Length; request.Accept = "text/html, application/xhtml+xml, */*"; request.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/x-silverlight, application/x-silverlight-2-b2, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*"; request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; request.Headers.Add("Accept-Encoding", "deflate"); request.Referer = "auctions.godaddy.com"; request.Headers["my-header"] = "the-value"; request.KeepAlive = true; request.CookieContainer = cookies; request.Timeout = Timeout.Infinite; stOut = new StreamWriter(request.GetRequestStream()); stOut.Write(postData); stOut.Flush(); stOut.Close(); stOut = null; response = (HttpWebResponse)request.GetResponse(); response.Cookies = request.CookieContainer.GetCookies(request.RequestUri); encoding = new System.Text.UTF8Encoding(); responseReader = new StreamReader(response.GetResponseStream(), encoding, true); responseData = responseReader.ReadToEnd(); response.Close(); responseReader.Close(); using (var ds = new ASEntities()) { var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Bid Process Completed", CreatedDate = GetPacificTime.AddSeconds(15), AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); ds.SaveChanges(); } }
protected void SubmitMultiBids(object sender, EventArgs e) { using (var ds = new ASEntities()) { var account = ds.Users.First(x => x.Username == Context.User.Identity.Name); var accountID = account.UserID; var godaddy = ds.GoDaddyAccount.FirstOrDefault(x => x.UserID == accountID); var bidvalue = fullApplyvalue.Value; if (godaddy != null) { var bids = ds.AuctionSearch.Where( x => x.AccountID == godaddy.AccountID); foreach (GridViewRow auc in LunchboxGridView4.Rows) { var myminbid = (auc.FindControl("bidvalue") as TextBox).Text; var auctionRef = auc.Cells[1].Text; var bid = bids.First( x => x.AuctionRef == auctionRef); var enddate = new GoDaddyAuctions().GetEndDate(bid.AuctionRef); var linkedRuid = Guid.NewGuid(); var auction = new Auctions { AuctionID = linkedRuid, AuctionRef = bid.AuctionRef, DomainName = bid.DomainName, BidCount = bid.BidCount, Traffic = bid.Traffic, Valuation = bid.Valuation, Price = bid.Price, MinBid = bid.MinBid, MinOffer = bid.MinOffer, BuyItNow = bid.BuyItNow, EndDate = enddate, EstimateEndDate = bid.EstimateEndDate, AccountID = bid.AccountID, Status = bid.Status, MyBid = string.IsNullOrEmpty(myminbid) ? int.Parse(bidvalue) : TryParse_INT(myminbid, int.Parse(bidvalue)) }; var toRemove = ds.Auctions.FirstOrDefault( x => x.AccountID == godaddy.AccountID && x.AuctionRef == bid.AuctionRef); if (toRemove != null) { ds.Auctions.Remove(toRemove); } ds.Auctions.AddOrUpdate(auction); ds.SaveChanges(); var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction Added", CreatedDate = DateTime.Now, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); var winalert = new Alerts { AuctionID = auction.AuctionID, Custom = false, Description = "WIN ALERT", TriggerTime = auction.EndDate.AddMinutes(5) }; ds.Alerts.Add(winalert); var bidalert = new Alerts { AlertID = Guid.NewGuid(), AuctionID = auction.AuctionID, Custom = false, Description = "12 Hour Alert", TriggerTime = auction.EndDate.AddHours(-12) }; ds.Alerts.Add(bidalert); var bidalert2 = new Alerts { AlertID = Guid.NewGuid(), AuctionID = auction.AuctionID, Custom = false, Description = "1 Hour Alert", TriggerTime = auction.EndDate.AddHours(-1) }; ds.Alerts.Add(bidalert2); ds.SaveChanges(); } } ds.SaveChanges(); } const string script = "window.location='" + "Default.aspx?redirect=mybids" + "';"; ScriptManager.RegisterStartupScript(this, typeof(Page), "RedirectTo", script, true); //Response.Redirect("Default.aspx#mybids", true); }
protected void Page_Load(object sender, EventArgs e) { Title = @"Auction Sniper WEB"; Welcome.Text = @"Hello, " + Context.User.Identity.Name + @" "; if (IsPostBack) { SaveSearchSettings(); SetSearchValues(); } SetSearchValues(); //FixHiddenValues(); if (!IsPostBack) { LoadSavedSearchs(); SetupAdv(); if (Request.QueryString["redirect"] != null) { Response.Redirect("Default.aspx#" + Request.QueryString["redirect"], true); } if (Request.QueryString["bookId"] != null && Request.QueryString["bidvalue"] != null) { using (var ds = new ASEntities()) { var biddref = Request.QueryString["bookId"]; var mybid = Request.QueryString["bidvalue"]; if (GdAccount != null) { var bid = ds.AuctionSearch.First( x => x.AccountID == GdAccount.AccountID && x.AuctionRef == biddref); var enddate = new GoDaddyAuctions().GetEndDate(biddref); var linkedRuid = Guid.NewGuid(); var auction = new Auctions { AuctionID = linkedRuid, AuctionRef = bid.AuctionRef, DomainName = bid.DomainName, BidCount = bid.BidCount, Traffic = bid.Traffic, Valuation = bid.Valuation, Price = bid.Price, MinBid = bid.MinBid, MinOffer = bid.MinOffer, BuyItNow = bid.BuyItNow, EndDate = enddate, EstimateEndDate = bid.EstimateEndDate, AccountID = bid.AccountID, Status = bid.Status, MyBid = int.Parse(mybid) }; var toRemove = ds.Auctions.FirstOrDefault(x => x.AccountID == GdAccount.AccountID && x.AuctionRef == biddref); if (toRemove != null) { ds.Auctions.Remove(toRemove); } ds.Auctions.AddOrUpdate(auction); ds.SaveChanges(); var item = new AuctionHistory { HistoryID = Guid.NewGuid(), Text = "Auction Added", CreatedDate = DateTime.Now, AuctionLink = auction.AuctionID }; ds.AuctionHistory.Add(item); var winalert = new Alerts { AuctionID = auction.AuctionID, Custom = false, Description = "WIN ALERT", TriggerTime = auction.EndDate.AddMinutes(5) }; ds.Alerts.Add(winalert); var bidalert = new Alerts { AlertID = Guid.NewGuid(), AuctionID = auction.AuctionID, Custom = false, Description = "12 Hour Alert", TriggerTime = auction.EndDate.AddHours(-12) }; ds.Alerts.Add(bidalert); var bidalert2 = new Alerts { AlertID = Guid.NewGuid(), AuctionID = auction.AuctionID, Custom = false, Description = "1 Hour Alert", TriggerTime = auction.EndDate.AddHours(-1) }; ds.Alerts.Add(bidalert2); ds.SaveChanges(); } } Response.Redirect("Default.aspx#mybids"); } } LoadAuctions(); }