public static BannerBiddingDimensionsDictionary Initialize() { var result = new Dictionary <int, Dictionary <int, List <BannerAdvert> > >(); var dimensions = TableHelper.SelectAllRows <BannerAdvertDimensions>(); foreach (var dimension in dimensions) { var positionDictionary = new Dictionary <int, List <BannerAdvert> >(); List <BannerAdvert> adverts = new List <BannerAdvert>(); BannerAdvert current = BannerAuctionManager.GetCurrentBanner(dimension, 1); if (current != null) { adverts.Add(current); } if (adverts.Count == 0) { //Show Administrator banners var dict = new Dictionary <string, object>(); dict.Add("Status", (int)AdvertStatus.Active); dict.Add("BannerAdvertDimensionId", dimension.Id); dict.Add("CreatedBy", (int)Advertiser.Creator.Admin); adverts = TableHelper.SelectRows <BannerAdvert>(dict); } positionDictionary[1] = adverts; result.Add(dimension.Id, positionDictionary); } return(new BannerBiddingDimensionsDictionary(result)); }
protected void BidButton_Click(object sender, EventArgs e) { BannerAuction target = this.target; ErrPanel.Visible = false; SucPanel.Visible = false; try { BannerAdvert advert = new BannerAdvert(Convert.ToInt32(ddlOptions.SelectedValue)); Member User = Member.Current; Money bidValue = target.NextMinBidValue; //Status check if (target.Status != BannerAuctionStatus.Opened) { throw new MsgException(U4000.AUCTIONCLOSED); } //Balance check if (bidValue > User.PurchaseBalance) { throw new MsgException(L1.NOTENOUGHFUNDS); } //Take money User.SubtractFromPurchaseBalance(bidValue, "Banner bid"); User.SaveBalances(); //Add bid BannerBid bid = new BannerBid(); bid.BidValue = bidValue; bid.BannerAdvertId = advert.Id; bid.BannerAuctionId = target.Id; bid.Username = User.Name; BannerAuctionManager.AddBid(bid, target, User); //Refresh bids field GenerateBidFields(target); PlaceBidPanel.Visible = false; SucPanel.Visible = true; SucMess.Text = U4000.BIDPLACED; AuctionGrid.DataBind(); } catch (MsgException ex) { ErrPanel.Visible = true; ErrMess.Text = ex.Message; } catch (Exception ex) { ErrorLogger.Log(ex); } }
public static void ProceedDailyTasks() { log = new StringBuilder(); var Entry = new CronEntry(); Entry.Date = DateTime.Now; try { Log("Starting CRON procedure"); //Make sure it runs only once if (CanRun()) { AppSettings.IsOffline = true; AppSettings.Misc.LastCRONRun = DateTime.Now; AppSettings.Misc.Save(); stime = DateTime.Now; AntiCheatSystem.CRON(); Log("OK [1] AntiCheatSystem. Elapsed time: " + GetTimeString(stime)); RentReferralsSystem.CRON(); Log("OK [2] RentedReferralsSystem. Elapsed time: " + GetTimeString(stime)); StatisticsManager.CRON(); Log("OK [3a] StatisticsManager. Elapsed time: " + GetTimeString(stime)); //MUST BE RUN BEFORE MEMBERMANAGER.CRON() !!! CustomFeaturesManager.CRON(); Log("OK [3b] CustomFeaturesManager. Elapsed time: " + GetTimeString(stime)); MemberManager.CRON(); Log("OK [4] Member. Elapsed time: " + GetTimeString(stime)); SyncedNetworkFactory.SynchronizeAll(); Log("OK [5] CPA Offers. Elapsed time: " + GetTimeString(stime)); AppSettings.Payments.CRON(); Log("OK [6] Payments. Elapsed time: " + GetTimeString(stime)); ShoutboxManager.CRON(); Log("OK [7] Shoutbox. Elapsed time: " + GetTimeString(stime)); CLPManager.CRON(); Log("OK [8] CLPManager. Elapsed time: " + GetTimeString(stime)); BannerAuctionManager.CRON(); Log("OK [10] BannerAuctionManager. Elapsed time: " + GetTimeString(stime)); PointsLockingManager.CRON(); Log("OK [11] PointsLockingManager. Elapsed time: " + GetTimeString(stime)); DBArchiver.CRON(); Log("OK [12] DBArchiver. Elapsed time: " + GetTimeString(stime)); RevenueSharesDistributionManager.CRON(); Log("OK [13] RevenueSharesDistributionManager. Elapsed time: " + GetTimeString(stime)); CreditLineManager.CRON(); Log("OK [14] CreditLineManager. Elapsed time: " + GetTimeString(stime)); PoolRotatorManager.CRON(); Log("OK [15] PoolRotatorManager. Elapsed time: " + GetTimeString(stime)); JackpotManager.CRON(); Log("OK [16] JackpotManager. Elapsed time: " + GetTimeString(stime)); TrafficExchangeManager.CRON(); Log("OK [17] TrafficExchangeManager. Elapsed time: " + GetTimeString(stime)); DailyPoolManager.CRON(); Log("OK [18] DailyPoolManager. Elapsed time: " + GetTimeString(stime)); //Matrix MatrixBase matrix = MatrixFactory.GetMatrix(); if (matrix != null) { matrix.CRON(); } Log("OK [19] MatrixBase. Elapsed time: " + GetTimeString(stime)); ApiAccessToken.CRON(); Log("OK [20] ApiAccessToken. Elapsed time: " + GetTimeString(stime)); InvestmentPlatformManager.CRON(); Log("OK [21] InvestmentPlatformManager. Elapsed time: " + GetTimeString(stime)); MarketplaceBalanceLogManager.CRON(); Log("OK [22] MarketplaceBalanceLogManager. Elapsed time: " + GetTimeString(stime)); MiniVideoManager.CRON(); Log("OK [23] MiniVideoManager. Elapsed time: " + GetTimeString(stime)); PaidToPromoteManager.CRON(); Log("OK [24] PaidToPromoteManager. Elapsed time: " + GetTimeString(stime)); RollDiceLotteryManager.CRON(); Log("OK [25] RollDiceLotteryManager. Elapsed time: " + GetTimeString(stime)); WalletManager.CRON(); Log("OK [26] WalletManager. Elapsed time: " + GetTimeString(stime)); NewsManager.CRON(); Log("OK [27] NewsManager. Elapsed time: " + GetTimeString(stime)); Entry.Type = 1; Entry.Text = "Procedure completed successfully (27/27 100%) after " + GetTimeString(stime); } else { Entry.Type = 2; Entry.Text = "Procedure prevented from multiple run"; } } catch (Exception ex) { ErrorLogger.Log(ex); Log("Fatal error (exception thrown).."); Entry.Type = 3; Entry.Text = "Fatal error during procedure execution. Check logs for more information"; Mailer.SendCRONFailureMessage(); } finally { ErrorLogger.Log(log.ToString(), LogType.CRON); AppSettings.IsOffline = false; Entry.Save(); HttpContext.Current.Response.Write(Entry.Text); } }