public static void ReleaseCPA(CPAPostbackLog log) { try { var where = TableHelper.MakeDictionary("NetworkOfferIdInt", log.OfferId); where.Add("AdvertiserUsername", log.NetworkName); CPAOffer OurOffer = TableHelper.SelectRows <CPAOffer>(where)[0]; //TODO (What if offer has been deleted in the meantime?) //Credit CPAGPTCrediter Crediter = (CPAGPTCrediter)CrediterFactory.Acquire(log.Username, CreditType.CPAGPTOffer); var conditions = TableHelper.MakeDictionary("Username", log.Username); conditions.Add("OfferId", OurOffer.Id); conditions.Add("OfferStatus", (int)OfferStatus.Pending); OfferRegisterEntry entry = TableHelper.SelectRows <OfferRegisterEntry>(conditions)[0]; CPAManager.AcceptEntryManually(entry, new Member(entry.Username)); //Update log log.Status = CPAPostBackLogStatus.CreditedByNetworkPointsUnlocked; log.Save(); } catch (Exception ex) { ErrorLogger.Log(ex); } }
/// <summary> /// Doesnt handle CPAOfferOnHold /// No need to save /// </summary> /// <param name="Offer"></param> public static void RemoveOfferFromSync(CPAOffer Offer) { //Was synced but IT IS NOT ANYMORE Offer.IsSyncWithNetwork = false; Offer.Status = AdvertStatus.Rejected; Offer.Save(); }
protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int rowIndex = e.Row.RowIndex % DirectRefsGridView.PageSize; int ObjectId = (int)DirectRefsGridView.DataKeys[rowIndex].Value; CPAOffer BannerAd = new CPAOffer(ObjectId); //Title [0] e.Row.Cells[0].Text = (new HtmlString(BannerAd.Title)).ToHtmlString(); //Progress [4] e.Row.Cells[3].Text = HtmlCreator.GenerateCPAAdProgressHTML(BannerAd.CompletedClicks, BannerAd.CreditsBought); //category [2] e.Row.Cells[1].Text = CPAType.GetText(BannerAd.Category); // daily [5] if (BannerAd.IsDaily) { e.Row.Cells[4].Text = HtmlCreator.GetCheckboxCheckedImage(); } else { e.Row.Cells[4].Text = HtmlCreator.GetCheckboxUncheckedImage(); } //geo [7] if (BannerAd.IsGeolocated) { e.Row.Cells[5].Text = HtmlCreator.GetCheckboxCheckedImage(); } else { e.Row.Cells[5].Text = HtmlCreator.GetCheckboxUncheckedImage(); } //start[7] stop[8] Remove[9] if (BannerAd.Status != AdvertStatus.Paused) { e.Row.Cells[7].Text = " "; } if (BannerAd.Status != AdvertStatus.Active) { e.Row.Cells[8].Text = " "; } if (!BannerAd.Status.CanBeRemoved()) { e.Row.Cells[9].Text = " "; } //[7] status e.Row.Cells[6].Text = HtmlCreator.GetColoredStatus(BannerAd.Status); } }
public static void ValidatePayoutNotConnectedToAmount(Member user) { //Check the status if (user.Status == MemberStatus.VacationMode) { throw new MsgException(U4000.YOUAREINVACATIONMODE); } //Account verification if (AppSettings.Authentication.IsDocumentVerificationEnabled && user.VerificationStatus != VerificationStatus.Verified) { throw new MsgException(U5006.ACCOUNTNOTVERIFIED); } if (user.NumberOfPayoutsToday + 1 > user.Membership.MaxDailyPayouts) { throw new MsgException(string.Format(U6000.TOOMANYWITHDRAWSTODAY, user.Membership.MaxDailyPayouts)); } //Payout Days if (!AppSettings.Representatives.RepresentativesIgnoreWitdrawalRules || !user.IsRepresentative()) { PayoutManager.CheckPayoutsDays(); } //Check negative balance if (user.IsAnyBalanceIsNegative()) { throw new MsgException(U6012.NEGATIVEBALANCEWITHDRAWAL); } //Validate Credit Loans if (CreditLineManager.UserHasUnpaidLoans(user.Id)) { throw new MsgException(U6008.REPAYCREDITLINETOWITHDRAW); } //Special Check amount of collected offers from different levels if (TitanFeatures.IsBobbyDonev && CPAOffer.CheckCollectedLevelsAmount(user.Name) < 20) { throw new MsgException(String.Format("You didn't collect enaugh CPA/GPT offers from different levels yet. You have already collected and confirmed {0} levels.", CPAOffer.CheckCollectedLevelsAmount(user.Name))); } //Special Check amount of collected offers from different levels if (TitanFeatures.IsBobbyDonev && user.CashoutsProceed > 0) { throw new MsgException("You already did one payout. You can't do more."); } //Check days restriction between each withdrawals var lastWidthdrawalDate = user.GetLastWithdrawalDate(); if (lastWidthdrawalDate != null && lastWidthdrawalDate > AppSettings.ServerTime.AddDays(-user.Membership.BlockPayoutDays)) { throw new MsgException(string.Format(U6013.TIMEBETWEENPAYOUTERROR, user.Membership.BlockPayoutDays)); } }
public Money Credit(Action <Money> afterCredit) { var baseValue = new CPAOffer(Submission.OfferId).BaseValue; var amountToCredit = Money.MultiplyPercent(baseValue, User.Membership.PublishersCpaOfferProfitPercentage); base.CreditMainBalance(amountToCredit, "External Cpa Offer Submission", BalanceLogType.ExternalCpaOfferSubmission); afterCredit(amountToCredit); return(baseValue - amountToCredit); }
/// <summary> /// Removes BOTH: CPAOffer and CPAOfferOnHOld /// Needs to save CPAOfferOnHold ONLY!!!! /// </summary> /// <param name="Offer"></param> public static void RemoveOfferFromSync(CPAOfferOnHold Offer) { Offer.IsSyncWithNetwork = false; //Was synced but IT IS NOT ANYMORE var where = TableHelper.MakeDictionary("NetworkOfferIdInt", Offer.NetworkOfferId); where.Add("NetworkName", Offer.NetworkName); var PreviousOffers = TableHelper.SelectRows <CPAOffer>(where); CPAOffer PreviousOffer = PreviousOffers[0]; RemoveOfferFromSync(PreviousOffer); Offer.Save(); }
private static CreditAs GetCreditAs(CPAOffer Offer, AffiliateNetwork Network) { if (Offer.CreditOfferAs == CreditOfferAs.NetworkDefault) { return(Network.CreditAs); } if (Offer.CreditOfferAs == CreditOfferAs.NonCash) { return(CreditAs.Points); } return(CreditAs.MainBalance); }
public int DMoneyEarnedComparison(CPAOffer x, CPAOffer y) { if (x.BaseValue < y.BaseValue) { return(1); } else if (x.BaseValue == y.BaseValue) { return(0); } else { return(-1); } }
public int DRatingComparison(CPAOffer x, CPAOffer y) { if (x.Rating < y.Rating) { return(1); } else if (x.Rating == y.Rating) { return(0); } else { return(-1); } }
public int DDateAddedComparison(CPAOffer x, CPAOffer y) { if (x.DateAdded < y.DateAdded) { return(1); } else if (x.DateAdded == y.DateAdded) { return(0); } else { return(-1); } }
public int DLastCreditedComparison(CPAOffer x, CPAOffer y) { if (x.LastCredited < y.LastCredited) { return(1); } else if (x.LastCredited == y.LastCredited) { return(0); } else { return(-1); } }
public int LevelComparison(CPAOffer x, CPAOffer y) { if (Int32.Parse(x.OfferLevel) > Int32.Parse(y.OfferLevel)) { return(1); } else if (x.OfferLevel == y.OfferLevel) { return(1); } else { return(-1); } }
public int DCompletedTimesComparison(CPAOffer x, CPAOffer y) { if (x.CompletedTimes < y.CompletedTimes) { return(1); } else if (x.CompletedTimes == y.CompletedTimes) { return(0); } else { return(-1); } }
//OFFER /// <summary> /// Affect CPAOffer ONLY. Doesn't affect CPAOfferOnHold AT ALL!! /// </summary> /// <param name="ThisOffer"></param> public static void AddOfferToSync(CPAOfferOnHold ThisOffer) { //Wasnt synced, now need to ADD to sync //Check if not already in CPAOffers but deactivated (Status = rejected, issync = false) var where = TableHelper.MakeDictionary("NetworkOfferIdInt", ThisOffer.NetworkOfferId); where.Add("NetworkName", ThisOffer.NetworkName); var PreviousOffers = TableHelper.SelectRows <CPAOffer>(where); if (PreviousOffers.Count > 0) { //It already exists, activate it CPAOffer OfferToActivate = PreviousOffers[0]; OfferToActivate.Status = AdvertStatus.Active; OfferToActivate.IsSyncWithNetwork = true; OfferToActivate.Save(); } else { //We need to add it CPAOffer NewOffer = new CPAOffer(); NewOffer.IsFromAutomaticNetwork = ThisOffer.IsFromAutomaticNetwork; NewOffer.NetworkOfferId = ThisOffer.NetworkOfferId; NewOffer.Title = ThisOffer.Title; NewOffer.ImageURL = ThisOffer.ImageURL; NewOffer.TargetURL = ThisOffer.TargetURL; NewOffer.DateAdded = DateTime.Now; NewOffer.Status = AdvertStatus.Active; NewOffer.AdvertiserUsername = ThisOffer.AdvertiserUsername; NewOffer.LoginBoxRequired = ThisOffer.LoginBoxRequired; NewOffer.EmailBoxRequired = ThisOffer.EmailBoxRequired; NewOffer.LastCredited = OffersManager.DateTimeZero; NewOffer.Description = ThisOffer.Description; NewOffer.Category = ThisOffer.Category; NewOffer.BaseValue = ThisOffer.BaseValue; NewOffer.CreditsBought = ThisOffer.CreditsBought; //Infinity NewOffer.NetworkName = ThisOffer.NetworkName; NewOffer.NetworkRate = ThisOffer.NetworkRate; NewOffer.IsSyncWithNetwork = ThisOffer.IsSyncWithNetwork; // by default NewOffer.IsDaily = ThisOffer.IsDaily; NewOffer.MaxDailyCredits = ThisOffer.MaxDailyCredits; NewOffer.CopyGeolocation(ThisOffer); NewOffer.CreditOfferAs = ThisOffer.CreditOfferAs; NewOffer.RequiredMembership = Membership.Standard.Id; NewOffer.Save(); } }
public static void CreditAfterCampaignRejection(CPAOffer advert) { if (AppSettings.TitanFeatures.ReferralMatrixEnabled) { return; } Decimal CalculatedPercent = (Decimal)(AppSettings.CPAGPT.MoneyTakenFromCPAOffersPercent + 100) / (Decimal)100; CalculatedPercent = CalculatedPercent * advert.CreditsBought; var adCost = CalculatedPercent * advert.BaseValue; var user = new Member(advert.AdvertiserUsername); CreditBalance(user, advert.TargetBalance, adCost, "CPA offer rejected by administrator"); }
private void RemoveElementFromSessionList(int OfferID) { try { var offer = new CPAOffer(OfferID); var templist = ActiveRememberedList; foreach (var elem in templist) { if (elem == OfferID) { templist.Remove(elem); break; } } ActiveRememberedList = templist; } catch (Exception ex) { ErrorLogger.Log(ex); } }
protected void DirectRefsGridView_RowCommand(object sender, GridViewCommandEventArgs e) { //We want to obey OnSort and OnChart events string[] commands = new string[3] { "start", "stop", "remove" }; if (commands.Contains(e.CommandName)) { int index = e.GetSelectedRowIndex() % DirectRefsGridView.PageSize; GridViewRow row = DirectRefsGridView.Rows[index]; var Ad = new CPAOffer((int)DirectRefsGridView.DataKeys[index].Value); if (e.CommandName == "start") { Ad.Status = AdvertStatus.Active; Ad.Save(); DirectRefsGridView.DataBind(); } else if (e.CommandName == "stop") { Ad.Status = AdvertStatus.Paused; Ad.Save(); DirectRefsGridView.DataBind(); } else if (e.CommandName == "remove") { Ad.Status = AdvertStatus.Deleted; Ad.Save(); DirectRefsGridView.DataBind(); } } }
public static void ProcessRequest(HttpContext context) { try { string RequestIP = IP.Current; //Log string LogMessage = context.Request.Params.ToRawString(); ErrorLogger.Log(LogMessage, LogType.CPAGPTNetworks); AppSettings.Points.Reload(); //Get proper Network string Hash = CPAFileManager.GetHashFromClientHandlerHit(context); AffiliateNetwork Network = TableHelper.SelectRows <AffiliateNetwork>(TableHelper.MakeDictionary("Hash", Hash))[0]; //All OK string Username = GetFromRequest(context, Network.VariableNameOfUsername); //string _Balance = GetFromRequest(context, Network.VariableNameOfBalance); string OfferID = GetFromRequest(context, Network.VariableNameOfOfferId); string _WebsiteId = GetFromRequest(context, Network.VariableNameOfWebsiteId); //Can be null string OfferTitle = GetFromRequest(context, Network.VariableNameOfOfferName); //Can be null string _CreditVal = GetFromRequest(context, Network.VariableNameOfType); //Can be null string Signature = GetFromRequest(context, Network.VariableNameOfSignature); //Can be null string UserIP = GetFromRequest(context, Network.VariableNameOfMemberIP); //Can be null string ShortOfferTitle = OfferTitle != null ? ": " + ShortenString(OfferTitle, 8) + "..." : ""; string TrackingInfo = OfferID; bool isLocked = false; //Points Locking feature Money Balance = new Money(0); //try //{ // Balance = Money.Parse(_Balance); //} //catch (Exception ex) { } //Check Status and IP restrictions bool ActiveRestriction = Network.Status == NetworkStatus.Active; bool IPRestriction = !Network.HasRestrictedIPs || (Network.HasRestrictedIPs && Network.RestrictedIPs.Contains(RequestIP)); if (ActiveRestriction && IPRestriction) { //Check condition if (Signature == null || Signature.Trim() == CPAParser.ParseSignatureCondition(Network.SIgnatureCondition, context).Trim()) { //All OK, Verified CPAPostBackLogStatus Status = CPAPostBackLogStatus.Null; Money Calculated = new Money(0); //Let's get our offer CPAOffer OurOffer = null; try { var where = TableHelper.MakeDictionary("NetworkOfferIdInt", OfferID); where.Add("AdvertiserUsername", Network.Name); where.Add("Status", (int)AdvertStatus.Active); OurOffer = TableHelper.SelectRows <CPAOffer>(where)[0]; Balance = OurOffer.BaseValue; } catch (Exception ex) { ErrorLogger.Log(ex); } if (OurOffer != null) { //Lets find submission try { Member User = new Member(Username); CreditAs As = GetCreditAs(OurOffer, Network); PostbackActionType ActionType = CPAHandler.GetActionType(Network, Balance, _CreditVal); var conditions = TableHelper.MakeDictionary("Username", Username); conditions.Add("OfferId", OurOffer.Id); conditions.Add("OfferStatus", (int)OfferStatus.Pending); int IsSubmissionPresent = TableHelper.CountOf <OfferRegisterEntry>(conditions); //Add submission automatically if credit and not found if (IsSubmissionPresent == 0 && ActionType == PostbackActionType.Credit) { OfferRegisterEntry.CheckDuplicateAndStatus(User.Name, OurOffer, true); OfferRegisterEntry.AddNew(OurOffer, User.Name, OfferStatus.Pending, String.Empty, String.Empty); IsSubmissionPresent = TableHelper.CountOf <OfferRegisterEntry>(conditions); } if (IsSubmissionPresent > 0) { OfferRegisterEntry ThisEntry = TableHelper.SelectRows <OfferRegisterEntry>(conditions)[0]; if (ActionType == PostbackActionType.Reverse) { CPAPostbackLog oldLog = PointsLockingHelper.FindSimilarCpaLog(User.Name, Network.Name, TrackingInfo); if (oldLog == null) { Calculated = CPAManager.DenyEntryFromPostback(ThisEntry, Balance, As, OurOffer.Id, Network.Name, OfferTitle, Network.RequiresConversion); Status = CPAPostBackLogStatus.ReversedByNetwork; } else { Status = CPAPostBackLogStatus.ReversedByNetwork; oldLog.Status = Status; CPAManager.DenyEntry(ThisEntry, User, OfferTitle); } } if (ActionType == PostbackActionType.Credit) { if (PointsLockingManager.CPAGPTShouldBeLocked(Balance, As, User, Network.RequiresConversion)) { ThisEntry.HasBeenLocked = true; ThisEntry.Save(); Calculated = CPAGPTCrediter.CalculatePostback(Balance, Network.RequiresConversion, User, As); Status = CPAPostBackLogStatus.CreditedAndPointsLocked; History.AddOfferLocked(User.Name, Network.Name, OfferTitle, Calculated, As); } else { var where = TableHelper.MakeDictionary("Id", ThisEntry._OfferId); var CpaOffer_entryId = TableHelper.SelectRows <CPAOffer>(where); Calculated = CPAManager.AcceptEntryFromPostback(ThisEntry, Balance, As, OurOffer.Id, Network.Name, CpaOffer_entryId[0].Title, Network.RequiresConversion, out isLocked); Status = CPAPostBackLogStatus.CreditedByNetwork; } } //Add CPAPostbackLog CPAPostbackLog.Create(Network, Username, Balance, Calculated, TrackingInfo, Status); //If All was handled OK, than succResponse context.Response.Write(Network.ValueOfSuccessfulResponse); } else { CPAPostbackLog.Create(Network, Username, Balance, Calculated, TrackingInfo, CPAPostBackLogStatus.SubmissionNotFound); } } catch (MsgException ex) { //Offer has been already submited and it's not daily //Offer is daily, but was submited today //Offer is daly and can be submited X times a day, but was submited >= X today CPAPostbackLog.Create(Network, Username, Balance, Calculated, TrackingInfo, CPAPostBackLogStatus.ExceededSubmissionLimitForThisOffer); context.Response.Write(Network.ValueOfSuccessfulResponse); } catch (Exception ex) { ErrorLogger.Log(ex); CPAPostbackLog.Create(Network, Username, Balance, Calculated, TrackingInfo, CPAPostBackLogStatus.Null); } } else { CPAPostbackLog.Create(Network, Username, Balance, null, TrackingInfo, CPAPostBackLogStatus.OfferNotFoundByOfferId); } } else { CPAPostbackLog.Create(Network, Username, Balance, null, TrackingInfo, CPAPostBackLogStatus.WrongSignature); } } else if (IPRestriction) { CPAPostbackLog.Create(Network, Username, Balance, null, TrackingInfo, CPAPostBackLogStatus.NetworkInactive); } else if (ActiveRestriction) { CPAPostbackLog.Create(Network, Username, Balance, null, TrackingInfo, CPAPostBackLogStatus.SentFromUnallowedIP); } } catch (Exception ex) { Prem.PTC.ErrorLogger.Log(ex); } }
public ExternalCpaOfferEventArgs(CPAOffer cpaOffer, string loginId, string emailId) { CPAOffer = cpaOffer; LoginId = loginId; EmailId = emailId; }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(Member.IsLogged && AppSettings.TitanFeatures.EarnersRoleEnabled && AppSettings.TitanFeatures.EarnCPAGPTEnabled && Member.CurrentInCache.IsEarner); FrequencySelectionPlaceHolder.Visible = AppSettings.CPAGPT.DailyNotDailyButtonsEnabled; PreviousPageButton.Visible = CurrentPageNumber > 0; #region Handlers if (Request.QueryString["ignore"] != null) { //ACTION 1 //Proceed with Ignore int OfferId = Convert.ToInt32(Request.QueryString["ignore"]); var Offer = new CPAOffer(OfferId); OfferRegisterEntry.AddNew(Offer, Member.CurrentName, OfferStatus.Ignored); RemoveElementFromSessionList(OfferId); NotificationManager.Refresh(NotificationType.NewCPAOffers); this.DataBind(); Response.Redirect("cpaoffers.aspx?keeporder=1"); } else if (Request.QueryString["report"] != null) { //ACTION 2 //Proceed with Report int OfferId = Convert.ToInt32(Request.QueryString["report"]); var Offer = new CPAOffer(OfferId); string ReportText = "none"; foreach (var t in Request.Form.AllKeys) { if (t.EndsWith("ReportMessage" + OfferId)) { ReportText = Request.Form[t]; break; } } //Validate string regex = @"[a-zA-Z0-9\.\-\,\!\?\&\:\$\@\(\)\+\=\%\*|\\\t\\\n|\\\r|\\\s]{1,600}"; var match = Regex.Match(ReportText, regex, RegexOptions.IgnoreCase); if (match.Success) { // does match var report = new CPAReport(); report.DateReported = DateTime.Now; report.ReportText = ReportText; report.ReportingUsername = Member.CurrentName; report.OfferId = OfferId; report.Save(); OfferRegisterEntry.AddNew(Offer, Member.CurrentName, OfferStatus.Reported, report.Id.ToString()); if (!AppSettings.CPAGPT.ReadOnlyModeEnabled) { RemoveElementFromSessionList(OfferId); } NotificationManager.Refresh(NotificationType.NewCPAOffers); Response.Redirect("cpaoffers.aspx?keeporder=1"); } else { WriteError(L1.BADERRREP); } } else if (Request.QueryString["submit"] != null) { //ACTION 3 //Proceed with Submit int OfferId = Convert.ToInt32(Request.QueryString["submit"]); string LoginID = ""; string EmailID = ""; foreach (var t in Request.Form.AllKeys) { if (t.EndsWith("LoginID" + OfferId)) { LoginID = Request.Form[t]; break; } } foreach (var t in Request.Form.AllKeys) { if (t.EndsWith("EmailID" + OfferId)) { EmailID = Request.Form[t]; break; } } //Validate CPAOffer ThisOffer = new CPAOffer(OfferId); bool isOk1 = true; bool isOk2 = true; if (ThisOffer.LoginBoxRequired) { string regex1 = @"[a-zA-Z0-9\.\-\,\!\?\&\:\$\@\(\)\+\=\%\*|\\\t\\\n|\\\r|\\\s]{1,80}"; var match1 = Regex.Match(LoginID, regex1, RegexOptions.IgnoreCase); isOk1 = match1.Success; } if (ThisOffer.EmailBoxRequired) { string regex2 = @"[a-zA-Z0-9\.\-\,\!\?\&\:\$\@\(\)\+\=\%\*|\\\t\\\n|\\\r|\\\s]{1,400}"; var match2 = Regex.Match(EmailID, regex2, RegexOptions.IgnoreCase); isOk2 = match2.Success; } if (isOk1 && isOk2) { //Does match //Check for duplicates first try { OfferRegisterEntry.CheckDuplicateAndStatus(Member.CurrentName, ThisOffer); if (ThisOffer.GlobalDailySubmitsRestricted) { int submissionsGloballyToday = OfferRegisterEntry.GetAllTodaysSubmissionsCountForOffer(ThisOffer.Id); if (submissionsGloballyToday >= ThisOffer.MaxGlobalDailySubmits) { throw new MsgException(U3900.DAILYBUTABOVETHELIMIT.Replace("%n1%", submissionsGloballyToday.ToString()) .Replace("%n2%", ThisOffer.MaxGlobalDailySubmits.ToString())); } } var entry = OfferRegisterEntry.AddNew(ThisOffer, Member.CurrentName, OfferStatus.Pending, LoginID, EmailID); if (AppSettings.CPAGPT.AutoApprovalEnabled) { CPAManager.AcceptEntryManually(entry, Member.Current); } else { ThisOffer.PerformStatusControlCheck(); } RemoveElementFromSessionList(OfferId); NotificationManager.RefreshWithMember(NotificationType.NewCPAOffers, Member.Current); Response.Redirect("cpaoffers.aspx?keeporder=1"); } catch (MsgException ex) { WriteError(ex.Message); } } else { WriteError(L1.ONEFIELDSABAD); } } else if (Request.QueryString["undo"] != null) { if (Request.QueryString["sender"] != null && Request.QueryString["sender"] != "undefined") { int offerId = Convert.ToInt32(Request.QueryString["undo"]); var where = TableHelper.MakeDictionary("OfferId", offerId); where.Add("Username", Member.CurrentName); if (Request.QueryString["sender"] == "ignored") { where.Add("OfferStatus", (int)OfferStatus.Ignored); } else if (Request.QueryString["sender"] == "pending") { where.Add("OfferStatus", (int)OfferStatus.Pending); } else if (Request.QueryString["sender"] == "reported") { where.Add("OfferStatus", (int)OfferStatus.Reported); } TableHelper.DeleteRows <OfferRegisterEntry>(where); var offer = new CPAOffer(offerId); offer.PerformStatusControlCheck(); } NotificationManager.Refresh(NotificationType.NewCPAOffers); Response.Redirect("cpaoffers.aspx?keeporder=0"); } #endregion Handlers if (!Page.IsPostBack) { PreviousPageButton.Text = "← " + U4000.PREVIOUSPAGE; NextPageButton.Text = U4000.NEXTPAGE + " →"; if (AppSettings.CPAGPT.ReadOnlyModeEnabled) { NavigationPlaceHolder.Visible = false; } if (AppSettings.CPAGPT.ReadOnlyModeEnabled || AppSettings.CPAGPT.AutoApprovalEnabled) { SortBy1.Items.Remove(SortBy1.Items.FindByValue("ARating")); SortBy1.Items.Remove(SortBy1.Items.FindByValue("ALast")); SortBy1.Items.Remove(SortBy1.Items.FindByValue("ATimes")); SortBy1.Items.Remove(SortBy1.Items.FindByValue("DRating")); SortBy1.Items.Remove(SortBy1.Items.FindByValue("DLast")); SortBy1.Items.Remove(SortBy1.Items.FindByValue("DTimes")); } if (TitanFeatures.IsJ5Walter) { InformationPlaceHolder.Visible = false; } if (TitanFeatures.IsJ5WalterFreebiesFromHome) { CustomPageHeaderPlaceHolder.Visible = true; StandardPageHeaderPlaceHolder.Visible = false; SearchBox1.CssClass = "form-control"; SearchButton1.Attributes["style"] = "padding: 6px 12px"; SortBy1.Items.Remove(SortBy1.Items.FindByValue("AMoney")); SortBy1.Items.Remove(SortBy1.Items.FindByValue("DMoney")); } if (TitanFeatures.IsTami9191) { IsDailyCategoryList = true; } if (AppSettings.CPAGPT.AutoApprovalEnabled) // Do not show Pending/Under review/Denied tabs { Button4.Visible = Button6.Visible = Button7.Visible = false; } if (Request.QueryString["o"] != null) { //Show particular offer try { int offerId = Convert.ToInt32(Request.QueryString["o"]); CPAOffer offer = new CPAOffer(offerId); var list = OM.AllActiveOffersForMember; bool exists = false; foreach (var elem in list) { if (elem.Id == offerId) { exists = true; } } OffersPanel0.Controls.Clear(); if (exists) { OffersPanel0.Controls.Add(offer.ToPanel(CurrentUser.Membership.CPAProfitPercent)); } else { Literal temp = new Literal(); temp.Text = U4000.OFFERNOTAVAIL; OffersPanel0.Controls.Add(temp); } MakeCategoriesList(); MakeSortingList(); makeButtons(); } catch (Exception ex) { ErrorLogger.Log(ex); } } else { //Preset the desired device (Desktop is preselected as default) if (AppSettings.CPAGPT.DeviceTypeDistinctionEnabled && Device.Current == DeviceType.Mobile) { OffersDeviceType = DeviceType.Mobile; MobileDeviceTypeButton.CssClass = "ViewSelected"; DesktopDeviceTypeButton.CssClass = ""; } KeepOrder = (Request.QueryString["keeporder"] != null && Request.QueryString["keeporder"] == "1"); DecideAndUpdate(); //ACTIVE //Categories List and active boxes MakeCategoriesList(); MakeSortingList(); makeButtons(); //Recreate if needed //Only for ACTIVE if (KeepOrder && MenuMultiView.ActiveViewIndex == 0) { SearchBox1.Text = SearchBoxInput; CategoriesList.SelectedIndex = CategoryIdInput; SortBy1.SelectedIndex = SortIdInput; } } } //Disabling Daily/Other groups for specific client if (TitanFeatures.IsBobbyDonev) { FrequencySelectionPlaceHolder.Visible = !AppSettings.TitanFeatures.OfferLevelsEnabled; GroupOfferLevelsPlaceHolder.Visible = AppSettings.TitanFeatures.OfferLevelsEnabled; } else { GroupOfferLevelsPlaceHolder.Visible = false; } if (IsDailyCategoryList) { DailyCategoriesButton.CssClass = "ViewSelected"; OtherCategoriesButton.CssClass = ""; } }
private void DecideAndUpdate(int forceRefreshIndex = -1) { PreviousPageButton.Visible = CurrentPageNumber > 0; // 0 = Active, 1 = completed, 2 = denied, 3 = ignored, 4 = pending, 5 = reported, 6 = under List <CPAOffer> list = new List <CPAOffer>(); int data = MenuMultiView.ActiveViewIndex; if (forceRefreshIndex != -1) { data = forceRefreshIndex; } switch (data) { case 0: if (KeepOrder) { //We are back from 'Submit' 'Ignore' or 'Report' //Lets keep the list the way it was //Additional record is gone list = ParseIntList(ActiveRememberedList); } else { list = AdjustActiveOffers(OM.AllActiveOffersForMember, true); ActiveRememberedList = ParseCPAList(list); //Save Other SearchBoxInput = SearchBox1.Text; CategoryIdInput = CategoriesList.SelectedIndex; SortIdInput = SortBy1.SelectedIndex; } OffersPanel0.Controls.Clear(); foreach (var elem in list) { OffersPanel0.Controls.Add(elem.ToPanel(CurrentUser.Membership.CPAProfitPercent)); } break; case 1: foreach (var sub in OM.SubmissionsCompleted) { CPAOffer off = sub.Offer; off.Temp_Time = sub.DateCompleted; off.Temp = sub.Id; list.Add(off); } list = AdjustActiveOffers(list); OffersPanel1.Controls.Clear(); foreach (var elem in list) { OffersPanel1.Controls.Add(elem.ToCompletedPanel(elem.Temp_Time, CurrentUser.Membership.CPAProfitPercent, elem.Temp)); } break; case 2: foreach (var sub in OM.SubmissionsDenied) { CPAOffer off = sub.Offer; off.Temp = sub.Id; list.Add(off); } list = AdjustActiveOffers(list); OffersPanel2.Controls.Clear(); foreach (var elem in list) { OffersPanel2.Controls.Add(elem.ToDeniedPanel(CurrentUser.Membership.CPAProfitPercent, elem.Temp)); } break; case 3: foreach (var sub in OM.SubmissionsIgnored) { CPAOffer off = sub.Offer; off.Temp = sub.Id; list.Add(off); } list = AdjustActiveOffers(list); OffersPanel3.Controls.Clear(); foreach (var elem in list) { OffersPanel3.Controls.Add(elem.ToIgnoredPanel(CurrentUser.Membership.CPAProfitPercent, elem.Temp, "ignored")); } break; case 4: foreach (var sub in OM.SubmissionsPending) { CPAOffer off = sub.Offer; off.Temp_LoginID = sub.LoginID; off.Temp_EmailID = sub.EmailID; off.Temp = sub.Id; list.Add(off); } list = AdjustActiveOffers(list); OffersPanel4.Controls.Clear(); foreach (var elem in list) { OffersPanel4.Controls.Add(elem.ToPendingPanel(CurrentUser.Membership.CPAProfitPercent, elem.Temp_LoginID, elem.Temp_EmailID, elem.Temp, "pending")); } break; case 5: foreach (var sub in OM.SubmissionsReported) { CPAOffer off = sub.Offer; var report = new CPAReport(Convert.ToInt32(sub.LoginID)); off.Temp_LoginID = report.ReportText; off.Temp = sub.Id; list.Add(off); } list = AdjustActiveOffers(list); OffersPanel5.Controls.Clear(); foreach (var elem in list) { OffersPanel5.Controls.Add(elem.ToReportedPanel(CurrentUser.Membership.CPAProfitPercent, elem.Temp_LoginID, elem.Temp, "reported")); } OffersPanel5.DataBind(); break; case 6: foreach (var sub in OM.SubmissionsUnderReview) { CPAOffer off = sub.Offer; off.Temp = sub.Id; list.Add(off); } list = AdjustActiveOffers(list); OffersPanel6.Controls.Clear(); foreach (var elem in list) { OffersPanel6.Controls.Add(elem.ToUnderReviewPanel(CurrentUser.Membership.CPAProfitPercent, elem.Temp)); } break; } }