public void PropertyUpload(Auctions prp) { //Auction chkPrp = ObjectFactory.Query<Auction>(AppSettings.Instance.MySqlConn, string.Format("SELECT * FROM Property WHERE PropertyUrl='{0}'", prp.PropertyUrl)); //if (chkPrp != null) //{ // if (prp.Price < chkPrp.Price) // { // DBHelper.SQLUpdate(string.Format("INSERT INTO PropertyPriceDrops (PropertyUrl, OldPrice, NewPrice, ChangeDate) VALUES ('{0}', '{1}', '{2}', '{3}')" // , prp.PropertyUrl, chkPrp.Price, prp.Price, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"))); // this.Msg(ErrorSeverity.Info, "Price Change Recorded..."); // } //} //DBHelper.SQLUpdate(string.Format("INSERT INTO Property (Address, City, State, ZipCode, PropertyUrl, Status, PropertyType, Price, SquareFeet, ListDate, YearBuilt, LastChecked) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}' ,'{6}' ,{7} ,{8}, '{9}', '{10}', '{11}') ON DUPLICATE KEY UPDATE Address='{0}', City='{1}', State='{2}', ZipCode='{3}', PropertyUrl='{4}', Status='{5}', PropertyType='{6}', Price={7}, SquareFeet={8}, ListDate='{9}', YearBuilt='{10}', LastChecked='{11}'", prp.Address, prp.City, prp.State, prp.ZipCode, prp.PropertyUrl, prp.Status, prp.Type.ToString(), prp.Price, prp.SquareFeet, prp.ListDate.ToString("yyyy-MM-dd hh:mm:ss") == "0001-01-01 12:00:00" ? DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") : prp.ListDate.ToString("yyyy-MM-dd hh:mm:ss"), prp.YearBuilt.ToString("yyyy-MM-dd hh:mm:ss"), DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"))); ////PauseConsole(); }
public HtmlDocument Download(Auctions e) { //this.Msg(ErrorSeverity.Info, "Scraping " + e.Address); //return this.Download(e.PropertyUrl); return null; }
public Auctions GenerateAuction() { var p = new Auctions(); return p; }
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 IQueryable<AuctionHistoryView> GetAuctionHistory(Auctions auction) { return Ds.AuctionHistoryView.Where(x => x.AuctionLink == auction.AuctionID).ToList().AsQueryable(); }
public IQueryable<AuctionHistoryView> LoadAuctionHistory(Auctions auction) { return Model.GetAuctionHistory(auction); }
private void GetMyOfferDetails(ref Auctions auction) { HttpWebRequest request; HttpWebResponse response; #region Post details var responseData = ""; var strUrl = string.Format("https://auctions.godaddy.com/trpMessageHandler.aspx?h={0}&rnd={1}", auction.AuctionRef, randomDouble(0, 1).ToString("0.00000000000000000")); request = (HttpWebRequest)WebRequest.Create(strUrl); request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = 0; request.CookieContainer = cookies; 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); var encoding = new System.Text.UTF8Encoding(); var responseReader = new StreamReader(response.GetResponseStream(), encoding, true); responseData = responseReader.ReadToEnd(); response.Close(); responseReader.Close(); #endregion HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(responseData); foreach (var row in QuerySelectorAll(doc.DocumentNode, "tr")) { if (QuerySelector(row, "td:nth-child(3)") != null && QuerySelector(row, "td:nth-child(3)").InnerText == "My Offer") { auction.MyBid = TryParse_INT( QuerySelector(row, "td:nth-child(4)").InnerText .Replace("C", "").Replace("$", "").Replace(",", "")); break; } } auction.EndDate = GetEndDate(auction.AuctionRef); }
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(); }