public void Save(Users user) { using (var ds = new ASEntities()) { ds.Users.Attach(user); ds.SaveChanges(); } }
public void CreateGoDaddyAccount(Users user, string username, string password) { using (var ds = new ASEntities()) { ds.GoDaddyAccount.Add(new GoDaddyAccount{GoDaddyUsername = username, GoDaddyPassword = password, UserID = user.UserID, Verified = true}); 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(); } }
private static SmtpClient SmtpClient() { SmtpClient client; using (var ds = new ASEntities()) { var smtp = ds.SystemConfig.First(x => x.PropertyID == "ServiceEmailSMTP").Value; var port = ds.SystemConfig.First(x => x.PropertyID == "ServiceEmailPort").Value; var user = ds.SystemConfig.First(x => x.PropertyID == "ServiceEmailUser").Value; var password = ds.SystemConfig.First(x => x.PropertyID == "ServiceEmailPass").Value; client = new SmtpClient(smtp, int.Parse(port)) { EnableSsl = true, UseDefaultCredentials = false, Credentials = new NetworkCredential(user, password) }; } return client; }
/// <summary> /// Perform a search /// </summary> /// <param name="searchText"></param> /// <param name="numerofresults"></param> /// <returns></returns> public IQueryable<AuctionSearch> Search(string searchText, int numerofresults) { var results = GoDaddyApi.Search(searchText).Take(50); using (var ds = new ASEntities()) { var search = ds.AuctionSearch.Where(x => x.AccountID == DefaultView.GoDaddyAccount.AccountID).ToList(); foreach (var auctionSearch in search) { ds.AuctionSearch.Remove(auctionSearch); } foreach (var auctionSearch in results) { auctionSearch.AccountID = DefaultView.GoDaddyAccount.AccountID; } ds.AuctionSearch.AddRange(results); ds.SaveChanges(); } return results; }
public void Add(string message, string type = "Error") { try { using (var ds = new ASEntities()) { ds.EventLog.Add(new EventLog { CreatedDate = DateTime.Now, Event = type, Message = message }); ds.SaveChanges(); } } catch (Exception) { } }
public static void SendEmail(string to,string subject, string message) { try { using (var ds = new ASEntities()) { var email = ds.SystemConfig.First(x => x.PropertyID == "ServiceEmail").Value; var mail = new MailMessage(email, to) { Subject = subject, Body = message }; SmtpClient().Send(mail); } } catch (Exception ex) { new Error().Add("Failed to send email: " + ex.Message); } }
public bool Login(string username, string password, int attempNo = 0) { const string url = "https://auctions.godaddy.com"; var responseData = Get(url); var key = GetSubString(responseData, "spkey=", "&"); var loginUrl = string.Format("https://idp.godaddy.com/login.aspx?SPKey={0}", key); var hdoc = HtmlDocument(Get(loginUrl)); if (QuerySelector(hdoc.DocumentNode, "img[class='LBD_CaptchaImage']") != null) { //Solve Captcha var captchaId = QuerySelector(hdoc.DocumentNode, "input[id='LBD_VCID_idpCatpcha']").Attributes["value"] .Value; var imagedata = GetImage(QuerySelector(hdoc.DocumentNode, "img[class='LBD_CaptchaImage']").Attributes["src"].Value); try { imagedata.Save(Path.Combine(Path.GetTempPath(), username + ".jpg"), ImageFormat.Jpeg); Client client; using (var ds = new ASEntities()) { var user = ds.SystemConfig.First(x => x.PropertyID == "DBCUser").Value; var pass = ds.SystemConfig.First(x => x.PropertyID == "DBCPass").Value; client = new SocketClient(user, pass); } //var balance = client.GetBalance(); var captcha = client.Decode(Path.Combine(Path.GetTempPath(), username+".jpg"), 20); if (null != captcha) { /* The CAPTCHA was solved; captcha.Id property holds its numeric ID, and captcha.Text holds its text. */ Console.WriteLine(@"CAPTCHA {0} solved: {1}", captcha.Id, captcha.Text); var capturetext = captcha.Text; var view = ExtractViewStateSearch(hdoc.DocumentNode.InnerHtml); //var view = QuerySelector(hdoc.DocumentNode, "input[id='__VIEWSTATE'") == null ? "" : //QuerySelector(hdoc.DocumentNode, "input[id='__VIEWSTATE'").Attributes["value"].Value; var postData = string.Format("__VIEWSTATE={0}&Login%24userEntryPanel2%24UsernameTextBox={1}&Login%24userEntryPanel2%24PasswordTextBox={2}&captcha_value={3}&LBD_VCID_idpCatpcha={4}&Login%24userEntryPanel2%24LoginImageButton.x=0&Login%24userEntryPanel2%24LoginImageButton.y=0", view, username, password, capturetext, captchaId); responseData = Post(loginUrl, postData); if (!responseData.Contains("sessionTimeout_onLogout")) { client.Report(captcha); } return responseData.Contains("sessionTimeout_onLogout"); } } catch(Exception e) { new Error().Add(e.Message); //Email.SendEmail(AppConfig.GetSystemConfig("AlertEmail"),"Captcha Failure",e.Message); CaptchaOverload = true; } } else { var postData = string.Format("loginName={0}&password={1}", username, password); responseData = Post(loginUrl, postData); return responseData.Contains("sessionTimeout_onLogout"); } if (attempNo < 3) { Login(username, password, attempNo++); } return false; }
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 MassBids_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRow") { //incase you need the row index //int rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; var auctionRef = Guid.Parse(e.CommandArgument.ToString()); using (var ds = new ASEntities()) { ds.AuctionSearch.Remove(ds.AuctionSearch.First(x => x.AuctionID == auctionRef)); ds.SaveChanges(); } LoadSearchResults(LunchboxGridView4); SetupMultiBidLayout(LunchboxGridView4); //Response.Redirect("Default.aspx#mybids", true); //ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "javascript:document.location.reload();", true); } }
public void SetSearchValues() { SearchConfig activeSearch; using (var ds = new ASEntities()) { if (!ds.SearchConfig.Any(x => x.UserID == Account.UserID)) { AddNewSearchConfig(Account.UserID, "Default"); } var account = ds.Users.First(x => x.Username == Context.User.Identity.Name); activeSearch = ds.SearchConfig.FirstOrDefault(x => x.UserID == account.UserID && x.Active); } switch (activeSearch.KeywordSearchType) { case "starts": startswith.Checked = true; break; case "contains": contains.Checked = true; break; case "ends": endwith.Checked = true; break; } PageRankHiddenMin.Value = activeSearch.PRMin.ToString(); PageRankHiddenMax.Value = activeSearch.PRMax.ToString(); DomainAgeHiddenMin.Value = activeSearch.DomainAgeMin.ToString();// = int.Parse(string.IsNullOrEmpty() ? activeSearch.DomainAgeMin.ToString() : DomainAgeHiddenMin.Value); DomainAgeHiddenMax.Value = activeSearch.DomainAgeMax.ToString();// = int.Parse(string.IsNullOrEmpty() ? activeSearch.DomainAgeMax.ToString() : DomainAgeHiddenMax.Value); DomainPriceHiddenMin.Value = activeSearch.DomainPriceMin.ToString(); DomainPriceHiddenMax.Value = activeSearch.DomainPriceMax.ToString(); MajesticTrustflowHiddenMin.Value = activeSearch.MajesticTrustFlowMin.ToString(); MajesticTrustflowHiddenMax.Value = activeSearch.MajesticTrustFlowMax.ToString(); MajesticIPSHiddenMin.Value = activeSearch.MajesticIPSMin.ToString(); MajesticIPSHiddenMax.Value = activeSearch.MajesticIPSMax.ToString(); CitationFlowHiddenMin.Value = activeSearch.MajesticCitationFlowMin.ToString(); CitationFlowHiddenMax.Value = activeSearch.MajesticCitationFlowMax.ToString(); MajesticBacklinksHiddenMin.Value = activeSearch.MajesticBacklinksMin.ToString(); MajesticBacklinksHiddenMax.Value = activeSearch.MajesticBacklinksMAX.ToString(); MOZDAHiddenMin.Value = activeSearch.MOZDAMin.ToString(); MOZDAHiddenMax.Value = activeSearch.MOZDAMax.ToString(); MOZPAHiddenMin.Value = activeSearch.MOZPAMin.ToString(); MOZPAHiddenMax.Value = activeSearch.MOZPAMax.ToString(); var moo = string.Format("$('#PRSilder').editRangeSlider('values', {0}, {1});", activeSearch.PRMin, activeSearch.PRMax); moo += string.Format("$('#CFSilder').editRangeSlider('values', {0}, {1});", activeSearch.MajesticCitationFlowMin, activeSearch.MajesticCitationFlowMax); moo += string.Format("$('#DomainAge').editRangeSlider('values', {0}, {1});", activeSearch.DomainAgeMin, activeSearch.DomainAgeMax); moo += string.Format("$('#DomainPrice').editRangeSlider('values', {0}, {1});", activeSearch.DomainPriceMin, activeSearch.DomainPriceMax); moo += string.Format("$('#MABacklinks').editRangeSlider('values', {0}, {1});", activeSearch.MajesticBacklinksMin, activeSearch.MajesticBacklinksMAX); moo += string.Format("$('#MATrustFlow').editRangeSlider('values', {0}, {1});", activeSearch.MajesticTrustFlowMin, activeSearch.MajesticTrustFlowMax); moo += string.Format("$('#MOZPA').editRangeSlider('values', {0}, {1});", activeSearch.MOZPAMin, activeSearch.MOZPAMax); moo += string.Format("$('#MOZDA').editRangeSlider('values', {0}, {1});", activeSearch.MOZDAMin, activeSearch.MOZDAMax); moo += string.Format("$('#MajesticIPS').editRangeSlider('values', {0}, {1});", activeSearch.MajesticIPSMin, activeSearch.MajesticIPSMax); ScriptManager.RegisterStartupScript(this, typeof(Page), "fadeit", moo, true); ends_asia.Checked = activeSearch.end_asia; ends_at.Checked = activeSearch.end_at; ends_au.Checked = activeSearch.end_au; ends_be.Checked = activeSearch.end_be; ends_biz.Checked = activeSearch.end_biz; ends_ca.Checked = activeSearch.end_ca; ends_cc.Checked = activeSearch.end_cc; ends_ch.Checked = activeSearch.end_ch; ends_co.Checked = activeSearch.end_co; ends_com.Checked = activeSearch.end_com; ends_de.Checked= activeSearch.end_de; ends_eu.Checked = activeSearch.end_eu; ends_fr.Checked = activeSearch.end_fr; ends_ie.Checked = activeSearch.end_ie; ends_in.Checked = activeSearch.end_in; ends_info.Checked = activeSearch.end_info; ends_it.Checked = activeSearch.end_it; ends_me.Checked = activeSearch.end_me; ends_misc.Checked = activeSearch.end_misc; ends_mobi.Checked = activeSearch.end_mobi; ends_mx.Checked = activeSearch.end_mx; ends_net.Checked = activeSearch.end_net; ends_nl.Checked = activeSearch.end_nl; ends_nu.Checked = activeSearch.end_nu; ends_org.Checked = activeSearch.end_org; ends_pl.Checked = activeSearch.end_pl; ends_ru.Checked = activeSearch.end_ru; ends_se.Checked = activeSearch.end_se; ends_su.Checked = activeSearch.end_su; ends_tv.Checked = activeSearch.end_tv; ends_uk.Checked = activeSearch.end_uk; ends_us.Checked = activeSearch.end_us; source_DynaDot.Checked = activeSearch.Dynadot; source_GoDaddy.Checked = activeSearch.GoDaddy; source_NameJet.Checked = activeSearch.NameJet; source_Sedo.Checked = activeSearch.Sedo; source_SnapName.Checked = activeSearch.SnapName; }
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(); } }
public BidsModel(GoDaddyAccount account, IDefaultView defaultView) { Ds = new ASEntities(); Account = account; DefaultView = defaultView; }
private void AddNewSearchConfig(Guid UserID, string Name, bool Active = true) { var sql = "INSERT INTO SearchConfig(UserID,Name,Active) VALUES(@P0,@P1,@P2)"; var parameterList = new List<object>(); parameterList.Add(UserID); parameterList.Add(Name); parameterList.Add(Active); object[] parameters1 = parameterList.ToArray(); int result = new ASEntities() .Database.ExecuteSqlCommand(sql, parameters1); }
protected void Update_Godaddy(object sender, EventArgs e) { if (IsPostBack) { using (var ds = new ASEntities()) { var accountID = ds.Users.First(x => x.Username == Context.User.Identity.Name).UserID; var godaddy = ds.GoDaddyAccount.First(x => x.UserID == accountID); godaddy.GoDaddyUsername = GodaddyAccount.Text; godaddy.GoDaddyPassword = GoDaddyPassword.Text; if (GoDaddy.Login(GodaddyAccount.Text, GoDaddyPassword.Text)) { godaddy.Verified = true; ds.GoDaddyAccount.AddOrUpdate(godaddy); ds.SaveChanges(); Msg.CssClass = "alert alert-success"; Msg.Text = @"Details Saved and Confirmed"; flash.Visible = false; Response.Redirect("Default.aspx"); } else { godaddy.Verified = false; ds.GoDaddyAccount.AddOrUpdate(godaddy); ds.SaveChanges(); Msg.CssClass = "alert alert-danger"; Msg.Text = @"Changes failed. Login to GoDaddy Failed"; } Msg.Style.Clear(); } } }
protected void Update_EmailOptions(object sender, EventArgs e) { if (IsPostBack) { using (var ds = new ASEntities()) { var account = ds.Users.First(x => x.Username == Context.User.Identity.Name); account.ReceiveEmails = receiveEmails.Checked; ds.Users.AddOrUpdate(account); ds.SaveChanges(); emailmessage.Style.Clear(); emailmessage.InnerText = @"Settings Saved"; } var moo = "$('#MainContent_emailmessage').fadeIn(3000).delay(1000).fadeOut('slow'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "fadeit", moo, true); } }
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(); }
protected void MyBids_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRow") { //incase you need the row index //int rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; var auctionRef = Guid.Parse(e.CommandArgument.ToString()); using (var ds = new ASEntities()) { try { var entries = ds.Alerts.Where(x => x.AuctionID == auctionRef); if (entries.Any()) { ds.Alerts.RemoveRange(ds.Alerts.Where(x => x.AuctionID == auctionRef)); } ds.Auctions.Remove(ds.Auctions.First(x => x.AuctionID == auctionRef)); ds.SaveChanges(); } catch (Exception) { } } ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).Style.Add("display", "none"); //Response.Redirect("Default.aspx#mybids", true); ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", "javascript:document.location.reload();", true); } }
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 int CheckAuction(string auctionRef) { const string url = "https://au.auctions.godaddy.com/trpItemListing.aspx?miid={0}"; var data = Get(string.Format(url, auctionRef)); var minbid = TryParse_INT( GetSubString(HTMLDecode(data),"Bid $", " or more").Trim().Replace(",", "").Replace("$", "")); var end = GetEndDate(auctionRef); using (var ds = new ASEntities()) { var auction = ds.Auctions.FirstOrDefault(x => x.AuctionRef == auctionRef); if (auction != null) { if (auction.EndDate != end) { new Error().Add("Checked at: " + GetPacificTime + "\r\nEnd date found to be different: " + end + "\r\n" + "Old date was: " + auction.EndDate, "Date Change Value"); //auction.EndDate = end; //ds.Auctions.AddOrUpdate(auction); //ds.SaveChanges(); } } } return minbid; }
private void LoadAuctions(bool force = false) { if (!IsPostBack || force) { using (var ds = new ASEntities()) { if (GdAccount != null) { GodaddyAccount.Text = GdAccount.GoDaddyUsername; GoDaddyPassword.Text = GdAccount.GoDaddyPassword; receiveEmails.Checked = Account.ReceiveEmails; var bids = ds.Auctions.Where(x => x.AccountID == GdAccount.AccountID).ToList().AsQueryable(); LunchboxGridView2.DataSource = bids; LunchboxGridView2.DataBind(); bidcount.InnerText = bids.Count().ToString(CultureInfo.InvariantCulture); } } } }
//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(); }
private void LoadSavedSearchs() { using (var ds = new ASEntities()) { if (!ds.SearchConfig.Any(x => x.UserID == Account.UserID)) { AddNewSearchConfig(Account.UserID, "Default"); } var savedSearchs = ds.SearchConfig.Where(x => x.UserID == Account.UserID); foreach (var searchConfig in savedSearchs) { DDLSavedSearchs.Items.Add(searchConfig.Name); } DDLSavedSearchs.SelectedValue = savedSearchs.First(x => x.Active).Name; } SetSearchValues(); }
//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(); } }
protected void btnSave_Godaddy(object sender, EventArgs e) { if (IsPostBack) { using (var ds = new ASEntities()) { if (GdAccount == null) { var account = new GoDaddyAccount { GoDaddyUsername = inputEmail3.Text, GoDaddyPassword = inputPassword3.Text, UserID = Account.UserID }; ds.GoDaddyAccount.Add(account); ds.SaveChanges(); } } } }
public void Search(Guid userid) { const string url = "https://www.domcop.com/getDomains.php"; using (var ds = new ASEntities()) { var godaddyaccount = ds.GoDaddyAccount.First(x => x.UserID == userid); ds.USP_SearchQueryBuilder2(userid.ToString()); var data = "&page_rank_upper={0}&page_rank_lower={1}&fake_pr=false&require_pr=false&fake_alexa=false&require_semrush_keywords=false&require_semrush_traffic=false&adv_age_lower=0&domain_authority_upper=999&domain_authority_lower=0&page_authority_upper=999&page_authority_lower=0&citation_flow_upper=999&citation_flow_lower=0&trust_flow_upper=999&trust_flow_lower=0&maj_back_links_upper=99999&maj_back_links_lower=0&maj_ref_ips_upper=99999&maj_ref_ips_lower=0&maj_million=false&quantcast_million=false&alexa_rank=false&require_semrush_rank=false&require_similarweb_rank=false&require_available=false&hide_adult=false&hide_spammy=false&hide_brand=false&soc_fb_like_upper=99999&soc_fb_like_lower=0&soc_fb_share_upper=99999&soc_fb_share_lower=0&soc_twitter_upper=99999&soc_twitter_lower=0&soc_reditt_upper=99999&soc_reditt_lower=0&soc_pinterest_upper=99999&soc_pinterest_lower=0&soc_google_upper=99999&soc_google_lower=0&ends_in_lower=0&ends_in_upper=14&parent_category=&child_category=&parent_topical_category=&child_topical_category=&google_index=false&dmoz=false&allow_dashes=true&allow_digits=true&only_digits=false&saletype_auction=true&saletype_buynow=true&saletype_closeout=true&saletype_pending=true&saletype_offer=true&saletype_bargain=true&search_type=keyword&keyword=&keyword_search_type=contains&pattern=&patternType=&ext_6=true&ext_17=true&ext_23=true&ext_18=true&ext_5=true&ext_10=true&ext_25=true&ext_16=true&ext_27=true&ext_1=true&ext_8=true&ext_21=true&ext_11=true&ext_32=true&ext_19=true&ext_4=true&ext_15=true&ext_28=true&ext_7=true&ext_22=true&ext_2=true&ext_24=true&ext_12=true&ext_3=true&ext_31=true&ext_20=true&ext_13=true&ext_29=true&ext_26=true&ext_14=true&ext_9=true&ext_misc=true&type_godaddy=true&type_namejet=true&type_snapnames=true&type_sedo=true&type_dynadot=true&type_droplists=true"; var searchString = "sEcho=2&iColumns=17&sColumns=&iDisplayStart=0&iDisplayLength=125&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2&mDataProp_3=3&mDataProp_4=4&mDataProp_5=5&mDataProp_6=6&mDataProp_7=7&mDataProp_8=8&mDataProp_9=9&mDataProp_10=10&mDataProp_11=11&mDataProp_12=12&mDataProp_13=13&mDataProp_14=14&mDataProp_15=15&mDataProp_16=16&iSortingCols=0&bSortable_0=false&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&bSortable_5=true&bSortable_6=true&bSortable_7=true&bSortable_8=true&bSortable_9=true&bSortable_10=true&bSortable_11=true&bSortable_12=true&bSortable_13=true&bSortable_14=true&bSortable_15=true&bSortable_16=true&screen_width=1349&data_source=live"; var res = ds.SearchTable.Where(x => x.UserID == userid && x.ItemOrder < 67).OrderBy(x => x.ItemOrder); foreach (var item in res) { searchString += item.SearchValue + (item.DataType == "bit" ? item.Value == "1" ? "true" : "false" : item.Value); } var res2 = ds.SearchTable.Where(x => x.UserID == userid && x.ItemOrder >= 67).OrderBy(x => x.ItemOrder); foreach (var item in res2) { searchString += item.SearchValue + (item.DataType == "bit" ? item.Value == "1" ? "true" : "false" : item.Value); } var results = Post(url, searchString); var json = JSONSerializer.DeserializeDynamic(results.Trim()); foreach (var site in json["aaData"]) { var adv = new AdvSearch{UserID = userid}; try { var moo = site["1"]; } catch (Exception) { continue; } var content = (string)site["1"].ToString(); var hdoc = HtmlDocument((string)content); adv.DomainName = QuerySelector(hdoc.DocumentNode, "span[class='big-domain'] > a").Attributes["alt"].Value; if (content.Contains("godaddy")) { adv.DomainLink = "https://au.auctions.godaddy.com/trpItemListing.aspx?domain=" + adv.DomainName;//QuerySelector(hdoc.DocumentNode, "span[class='big-domain'] > a").Attributes["href"].Value; adv.IsGOdaddy = true; adv.IsAuction = true; //for now.. now way to tell } else if (content.Contains("namejet")) { adv.DomainLink = "http://www.namejet.com/Pages/Auctions/BackorderDetails.aspx?domainname=" + adv.DomainName; adv.IsAuction = true; } else if (content.Contains("dynadot.com")) { adv.DomainLink = "https://www.dynadot.com/market/backorder/" + adv.DomainName; adv.IsAuction = false; } else if (content.Contains("snapnames")) { adv.DomainLink = string.Format("https://www.snapnames.com/domain/{0}.action", adv.DomainName); adv.IsAuction = false; } else if (content.Contains("sedo")) { adv.DomainLink = "http://sedo.com/search/details.php4?domain=" + adv.DomainName; adv.IsAuction = true; } content = site["0"]; hdoc = HtmlDocument((string)content); adv.Ref = QuerySelector(hdoc.DocumentNode, "input").Attributes["id"].Value.Split(new []{'|'}).First(); content = site["2"].ToString(); int defval = 0; hdoc = HtmlDocument((string)content); adv.Age = int.Parse(QuerySelector(hdoc.DocumentNode, "b") == null ? "0" : QuerySelector(hdoc.DocumentNode, "b").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "b").InnerText); content = site["3"].ToString(); hdoc = HtmlDocument((string)content); adv.PageRank = int.Parse(QuerySelector(hdoc.DocumentNode, "span[class='big-text-pr']") == null ? "0" : QuerySelector(hdoc.DocumentNode, "span[class='big-text-pr']").InnerText); content = site["4"].ToString(); hdoc = HtmlDocument((string)content); adv.MOZDA = int.Parse(QuerySelector(hdoc.DocumentNode, "a") == null ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); content = site["5"].ToString(); hdoc = HtmlDocument((string)content); adv.MOZPA = int.Parse(QuerySelector(hdoc.DocumentNode, "a") == null ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); //Needs to be decimal content = site["6"].ToString(); hdoc = HtmlDocument((string)content); adv.MozRank = GetDecimal(QuerySelector(hdoc.DocumentNode, "a") == null ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); //Needs to be decimal content = site["7"].ToString(); hdoc = HtmlDocument((string)content); adv.MozTrust = GetDecimal(QuerySelector(hdoc.DocumentNode, "a") == null ? "0.00" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0.00" : QuerySelector(hdoc.DocumentNode, "a").InnerText); content = site["8"].ToString(); hdoc = HtmlDocument((string)content); adv.CF = int.Parse(QuerySelector(hdoc.DocumentNode, "a") == null ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); content = site["9"].ToString(); hdoc = HtmlDocument((string)content); adv.TF = int.Parse(QuerySelector(hdoc.DocumentNode, "a") == null ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); content = site["9"].ToString(); hdoc = HtmlDocument((string)content); adv.TF = int.Parse(QuerySelector(hdoc.DocumentNode, "a") == null ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); //Needs to be decimal - maybe content = site["10"].ToString(); hdoc = HtmlDocument((string)content); adv.AlexARank = GetDecimal((QuerySelector(hdoc.DocumentNode, "a") == null || QuerySelector(hdoc.DocumentNode, "a").InnerText == "-") ? "0.00" : QuerySelector(hdoc.DocumentNode, "a").InnerText); content = site["11"].ToString(); hdoc = HtmlDocument((string)content); adv.MozDom = GetNumbers((QuerySelector(hdoc.DocumentNode, "a") == null || QuerySelector(hdoc.DocumentNode, "a").InnerText == "-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); content = site["12"].ToString(); hdoc = HtmlDocument((string)content); adv.MajDom = GetNumbers(QuerySelector(hdoc.DocumentNode, "a") == null ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText.Contains("-") ? "0" : QuerySelector(hdoc.DocumentNode, "a").InnerText); content = site["15"].ToString(); adv.DomainPrice = GetNumbers(content); content = (string)HTMLDecode(site["16"].ToString()); if (((string)content).Contains("<")) { content = ((string) content).Split(new [] {'<'}).First().Trim(); } adv.EsitmateEnd = ExtractEndDate(content); var auc = new AuctionSearch { AuctionRef = adv.Ref, DomainName = adv.DomainName, EstimateEndDate = (DateTime)adv.EsitmateEnd, EndDate = (DateTime)adv.EsitmateEnd, MinBid = adv.DomainPrice ?? 0, AccountID = godaddyaccount.AccountID }; ds.AuctionSearch.Add(auc); ds.SaveChanges(); ds.AdvSearch.Add(adv); ds.SaveChanges(); } //json["aaData"][0]["1"] } }
public BackOrderModal(IDefaultView model) { DefaultView = model; Ds=new ASEntities(); }
private void PerformAdvSearch() { if (!DCop.Login(AppConfig.GetSystemConfig(AppSettings.DomCopUser), AppConfig.GetSystemConfig(AppSettings.DomCopPass))) return; DCop.Search(Account.UserID); using (var ds = new ASEntities()) { var results = ds.AdvSearch.Where(x => x.UserID == Account.UserID).ToList().AsQueryable(); gvAdvSearchResults.DataSource = results.Take(int.Parse(ddlTopResults.SelectedValue)); gvAdvSearchResults.DataBind(); } }
protected void grdViewCustomers_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string customerID = LunchboxGridView2.DataKeys[e.Row.RowIndex].Value.ToString(); var grdViewOrdersOfCustomer = (GridView)e.Row.FindControl("grdViewOrdersOfCustomer"); using (var ds = new ASEntities()) { var id = Guid.Parse(customerID); var history = ds.AuctionHistoryView.Where(x => x.AuctionLink == id).ToList().OrderBy(x=>x.CreatedDate); grdViewOrdersOfCustomer.DataSource = history; grdViewOrdersOfCustomer.DataBind(); var auction = ds.Auctions.First(x => x.AuctionID == id); var won = history.Any(x => x.Text == "Auction WON"); var lost = history.Any(x => x.Text == "Auction LOST"); var now = DateTime.Now; if (won) { e.Row.CssClass = "info"; e.Row.Cells[6].Text = @"WON"; e.Row.Style.Add("background-color", "#D9EDF7"); }else if (lost) { e.Row.CssClass = "danger"; e.Row.Style.Add("background-color", "#F2DEDE"); e.Row.Cells[6].Text = @"LOST"; }else if (auction.EndDate < now) { e.Row.Cells[6].Text = @"Unconfirmed"; } } var bidval = int.Parse(e.Row.Cells[7].Text); var minval = int.Parse(e.Row.Cells[4].Text); e.Row.Cells[7].Style.Add("text-align", "center"); e.Row.Cells[8].Style.Add("background-color", "#ffffff"); e.Row.Cells[9].Style.Add("background-color", "#ffffff"); //e.Row.Cells[7].Style.Add("color", "#ffffff"); if (bidval >= minval) { e.Row.Cells[7].Style.Add("background-color", "#D9EDF7"); } else { e.Row.Cells[7].Style.Add("background-color", "#F2DEDE"); } } }