public static void EmailTicketRunStatusUpdate(TicketPromoterEvent ticketPromoterEvent) { // Email promoter: list of all ticket runs for the specified event detailing: status, tickets sold, money earned, end datetime. Includes links to ticket runs, event, promoter, and doorlist. // Email copy to accounts try { if (ticketPromoterEvent != null && ticketPromoterEvent.TicketRuns != null && ticketPromoterEvent.TicketRuns.Count > 0) { Mailer mailer = new Mailer(); string emailSubject = "DontStayIn ticket runs update for " + ticketPromoterEvent.Event.FriendlyName; mailer.Subject = emailSubject; mailer.Body = "<h2>" + emailSubject + "</h2>"; if (ticketPromoterEvent.Promoter != null) { mailer.Body += @"<p>Promoter: <a href=""[LOGIN(" + ticketPromoterEvent.Promoter.Url() + "\")]>" + ticketPromoterEvent.Promoter.Name + "</a></p>"; mailer.RedirectUrl = ticketPromoterEvent.Promoter.UrlApp("allticketruns"); } mailer.Body += @"<p>Event: <a href=""[LOGIN(" + ticketPromoterEvent.Event.Url() + "\")]>" + ticketPromoterEvent.Event.FriendlyName + "</a></p>"; mailer.Body += "<p>Ticket runs:</p><ul>"; DateTime lastTicketRunEndDateTime = DateTime.MinValue; List<TicketRun> ticketRunsToUpdate = new List<TicketRun>(); foreach (TicketRun ticketRun in ticketPromoterEvent.TicketRuns) { mailer.Body += @"<li><a href=""[LOGIN(" + ticketRun.Url() + "\")]>" + ticketRun.PriceBrandName + @"</a> <br>Status: " + Utilities.CamelCaseToString(ticketRun.Status.ToString()) + "<br>Sold: " + ticketRun.ValidTicketQuantity.ToString() + "<br>Money earned: " + Utilities.MoneyToHTML(ticketRun.ValidTicketQuantity * ticketRun.Price) + "<br>Ends: " + ticketRun.EndDateTime.ToString("ddd dd/MM/yyyy HH:mm") + "</li>"; lastTicketRunEndDateTime = lastTicketRunEndDateTime > ticketRun.EndDateTime ? lastTicketRunEndDateTime : ticketRun.EndDateTime; if (ticketRun.EndDateTime < DateTime.Now && !ticketRun.EmailSent) { ticketRun.EmailSent = true; ticketRunsToUpdate.Add(ticketRun); } } mailer.Body += "</ul>"; mailer.Body += @"<p>Doorlist: <a href=""[LOGIN(" + ticketPromoterEvent.Event.DoorlistUrl + "\")]>" + ticketPromoterEvent.Event.Name + " doorlist</a></p>"; if (lastTicketRunEndDateTime < DateTime.Now) { mailer.Body += "<p>Please note that all your current ticket runs for " + ticketPromoterEvent.Event.Name + " have ended. Please print off the doorlist and make sure you verify card details at the door.</p>"; } else { mailer.Body += "<p>Please note that your last ticket run for " + ticketPromoterEvent.Event.Name + " will end on " + lastTicketRunEndDateTime.ToString("ddd dd/MM/yyyy") + " at " + lastTicketRunEndDateTime.ToString("HH:mm") + ". Please wait for all ticket runs to end before printing off the doorlist. Make sure you verify card details at the door.</p>"; } if (!ticketPromoterEvent.Promoter.EnableTickets) { mailer.Body += "<br><p>We have not yet received your ticket application form. Without a processed ticket application form, you cannot receive any funds from ticket sales.</p><p>This is an automated email reminder. If you have already sent it in, please ignore this email.</p><p>" + @"<a href=""[LOGIN(" + ticketPromoterEvent.Promoter.UrlApp("plus") + "\")]>Click here for ticket application form</a></p>"; } // Send email to each user in the AdminUsrs for the Promoter account if (!Vars.DevEnv) { if (ticketPromoterEvent.Promoter != null) { mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; foreach (Usr usr in ticketPromoterEvent.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } } } foreach (TicketRun ticketRun in ticketRunsToUpdate) ticketRun.Update(); // Change for internal use mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; if (Vars.DevEnv) mailer.Subject = "TEST - " + mailer.Subject; // now send to our tickets email address mailer.To = Vars.EMAIL_ADDRESS_TICKETS; mailer.Send(); } } catch (Exception ex) { EmailException(ex, "Occurred in Utilities.EmailTicketPromoterEvent(): Promoter K= " + ticketPromoterEvent.PromoterK + ", Event K= " + ticketPromoterEvent.EventK, ticketPromoterEvent); } }
public static void EmailTicketPromoterEvent(TicketPromoterEvent ticketPromoterEvent) { // Email promoter: stating funds have been released and applied to their DSI promoter account // Attach Transfer if != null // Email copy to accounts try { if (ticketPromoterEvent.Promoter.EnableTickets && ticketPromoterEvent.FundsTransfer != null && Math.Round(ticketPromoterEvent.TotalFunds, 2) != 0) { Mailer mailer = new Mailer(); string emailSubject = "DontStayIn " + Utilities.CamelCaseToString(Transfer.Methods.TicketSales.ToString()).ToLower() + " (" + ticketPromoterEvent.TotalFunds.ToString("c") + ") for " + ticketPromoterEvent.Event.FriendlyName; mailer.Subject = emailSubject; mailer.Body = "<h2>" + emailSubject + "</h2>"; if (ticketPromoterEvent.Promoter != null) { mailer.Body += @"<p>Promoter: <a href=""[LOGIN(" + ticketPromoterEvent.Promoter.Url() + "\")]>" + ticketPromoterEvent.Promoter.Name + "</a></p>"; mailer.Body += @"<p>Event: <a href=""[LOGIN(" + ticketPromoterEvent.Event.Url() + "\")]>" + ticketPromoterEvent.Event.FriendlyName + "</a></p>"; mailer.RedirectUrl = ticketPromoterEvent.Promoter.UrlApp("allticketruns"); } mailer.Body += "<p>Total funds: " + Utilities.MoneyToHTML(ticketPromoterEvent.TotalFunds) + "</p>"; mailer.Body += @"<p>Tickets sold: " + ticketPromoterEvent.SoldTickets.ToString() + "<br>"; int cancelledTicketCount = 0; foreach (TicketRun ticketRun in ticketPromoterEvent.TicketRuns) { mailer.Body += ticketRun.SoldTickets.ToString() + " x " + ticketRun.PriceBrandName + "<br>"; cancelledTicketCount += ticketRun.CancelledTicketQuantity; } mailer.Body += "</p>"; if (cancelledTicketCount > 0) { mailer.Body += @"<p>Tickets cancelled: " + cancelledTicketCount.ToString() + "<br>"; foreach (TicketRun ticketRun in ticketPromoterEvent.TicketRuns) { mailer.Body += ticketRun.CancelledTicketQuantity.ToString() + " x " + ticketRun.PriceBrandName + "<br>"; } mailer.Body += "</p>"; } try { AddSelfBillingInvoiceToEmail(mailer, ticketPromoterEvent); } catch { } // Send email to each user in the AdminUsrs for the Promoter account if (!Vars.DevEnv) { if (ticketPromoterEvent.Promoter != null) { mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; foreach (Usr usr in ticketPromoterEvent.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } } } // Change for internal use mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; if (!Vars.DevEnv && ticketPromoterEvent.Promoter.SalesUsr != null) { mailer.UsrRecipient = ticketPromoterEvent.Promoter.SalesUsr; mailer.Send(); } mailer.UsrRecipient = null; if (Vars.DevEnv) mailer.Subject = "TEST - " + mailer.Subject; // now send to our tickets email address mailer.To = Vars.EMAIL_ADDRESS_TICKETS; try { mailer.To += ", " + ticketPromoterEvent.Promoter.SalesUsr.Email; } catch { } mailer.Send(); } } catch (Exception ex) { EmailException(ex, "<p>Occurred in Utilities.EmailTicketPromoterEvent(): Promoter K= " + ticketPromoterEvent.PromoterK + ", Event K= " + ticketPromoterEvent.EventK + "</p>", ticketPromoterEvent); } }
public static void AddSelfBillingInvoiceToEmail(Mailer mailer, TicketPromoterEvent ticketPromoterEvent) { if (ticketPromoterEvent != null && ticketPromoterEvent.FundsTransfer != null && mailer != null) { mailer.Attachments.Add(new System.Net.Mail.Attachment(Utilities.GenerateReportMemoryStream(false, ticketPromoterEvent), "DontStayIn " + Utilities.CamelCaseToString(ticketPromoterEvent.FundsTransfer.Method.ToString()) + " #" + ticketPromoterEvent.FundsTransferK.ToString() + ".doc", "application/word")); if (ticketPromoterEvent.Promoter != null) { mailer.Body += @"<p><a href=""[LOGIN(" + ticketPromoterEvent.UrlReport() + "\")]>" + ticketPromoterEvent.TypeAndK + "</a> for " + Utilities.MoneyToHTML(Math.Abs(ticketPromoterEvent.FundsTransfer.Amount)) + " has been released to your " + ticketPromoterEvent.Promoter.LinkEmail() + " promoter account.</p>"; } } }
private void SaveTicketRun() { bool redirect = true; Page.Validate("SaveTicketRun"); if (Page.IsValid) { try { base.VerifyUserPermissions(); // Do not save for new ticket run when duplicate guid exists in DB if (!((CurrentTicketRun.K == 0) && Bobs.TicketRun.DoesDuplicateGuidExistInDb((Guid)this.ViewState["DuplicateGuid"]))) { if (!CurrentTicketRun.IsUpdateable) { LoadScreenFromTicketRun(); ErrorMessageCustomValidator.ErrorMessage = "This ticket run is not updateable."; ErrorMessageCustomValidator.IsValid = false; return; } LoadTicketRunFromScreen(); //try //{ // UK countryK = 224 if (CurrentPromoter.AddressCountryK != 224 || (CurrentPromoter.VatCountryK != 224 && CurrentPromoter.VatCountryK != 0)) { ErrorMessageCustomValidator.ErrorMessage = NO_TICKET_SALES_FOR_NONUK_PROMOTERS; ErrorMessageCustomValidator.IsValid = false; return; } //} //catch //{ // ErrorMessageCustomValidator.ErrorMessage = "Unable to find the country where the venue is located. Ticket sales are not currently available outside the UK."; // ErrorMessageCustomValidator.IsValid = false; // return; //} if (CurrentTicketRun.IsCircularDependancy()) { LoadScreenFromTicketRun(); ErrorMessageCustomValidator.ErrorMessage = "Cannot follow ticket run " + CurrentTicketRun.FollowsTicketRun.PriceBrandName + ". This would create a circular dependancy."; ErrorMessageCustomValidator.IsValid = false; return; } CurrentTicketRun.Update(); try { TicketPromoterEvent tpe = new TicketPromoterEvent(CurrentTicketRun.PromoterK, CurrentTicketRun.EventK); if (ContactEmailTextBox.Text.Trim().Length != 0) { tpe.ContactEmail = ContactEmailTextBox.Text.Trim(); tpe.Update(); } if (CurrentTicketRun.EndDateTime <= DateTime.Now && !CurrentTicketRun.EmailSent) { Utilities.EmailTicketRunStatusUpdate(tpe); CurrentTicketRun.EmailSent = true; CurrentTicketRun.Update(); } } catch { TicketPromoterEvent tpe = new TicketPromoterEvent(); tpe.PromoterK = CurrentTicketRun.PromoterK; tpe.EventK = CurrentTicketRun.EventK; if (ContactEmailTextBox.Text.Trim().Length != 0) tpe.ContactEmail = ContactEmailTextBox.Text.Trim(); tpe.Update(); if (CurrentPromoter == null) throw new Exception("SaveTicketRunButton_Click(): CurrentPromoter==null"); if (!CurrentPromoter.EnableTickets) { // send out email reminding them to fill out ticket application form Utilities.EmailPromoterReminderToSubmitTicketApplicationForm(tpe); } } CurrentTicketRun.Event.UpdateIsTicketsAvailable(false); CurrentTicketRun.Event.UpdateHasHighlight(false); CurrentTicketRun.Event.Update(); } } catch (Exception ex) { SavingErrorCustomValidator.IsValid = false; Utilities.AdminEmailAlert("Exception occurred in TicketRunScreen SaveTicketRun for promoter " + CurrentPromoter.Name + " (" + CurrentPromoter.K.ToString() + ")" + " TicketRunK=" + CurrentTicketRun.K.ToString(), "Exception occurred in TicketRunScreen SaveTicketRun for promoter " + CurrentPromoter.Name + " (" + CurrentPromoter.K.ToString() + ")" + " TicketRunK=" + CurrentTicketRun.K.ToString(), ex, CurrentTicketRun); } if (redirect) { // Redirect to page user was on before entering this page RedirectToReferringPage(); } } }
public static void EmailPromoterReminderToSubmitTicketApplicationForm(TicketPromoterEvent ticketPromoterEvent) { try { if (!ticketPromoterEvent.Promoter.EnableTickets) { Mailer mailer = new Mailer(); mailer.Subject = "DontStayIn has not yet received your ticket application form, promoter: " + ticketPromoterEvent.Promoter.Name; mailer.Body = "<h2>" + mailer.Subject + "</h2>"; mailer.Body += ticketPromoterEvent.Promoter.LinkEmailFull; mailer.Body += @"<p>You recently setup ticket sales for event: " + ticketPromoterEvent.Event.LinkEmail + "</p><p>We have not yet received your ticket application form. Without a processed ticket application form, you cannot receive any funds from ticket sales.</p><p>This is an automated email reminder. If you have already sent it in, please ignore this email.</p><p>" + @"<a href=""[LOGIN(" + ticketPromoterEvent.Promoter.UrlApp("plus") + "\")]>Click here for ticket application form</a></p>"; mailer.RedirectUrl = ticketPromoterEvent.Promoter.Url(); mailer.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; if (!Vars.DevEnv) { foreach (Usr usr in ticketPromoterEvent.Promoter.AdminUsrs) { mailer.UsrRecipient = usr; mailer.Send(); } } // Change subject for internal use mailer.Subject += " (K=" + ticketPromoterEvent.PromoterK.ToString() + ")"; // now send to our accounts email address mailer.UsrRecipient = null; mailer.TemplateType = Mailer.TemplateTypes.AdminNote; mailer.To = Vars.EMAIL_ADDRESS_TICKETS; try { mailer.To += ", " + ticketPromoterEvent.Promoter.SalesUsr.Email; } catch { } mailer.Send(); } } catch (Exception ex) { List<IBobAsHTML> bobsAsHtml = new List<IBobAsHTML>(); bobsAsHtml.Add(ticketPromoterEvent.Promoter); bobsAsHtml.Add(ticketPromoterEvent.Event); EmailException(ex, "Occurred in Utilities.EmailPromoterReminderToSubmitTicketApplicationForm()", bobsAsHtml); } }
public void EndTicketRun() { if (this.EndDateTime > DateTime.Now) { this.EndDateTime = DateTime.Now; this.Update(); try { TicketPromoterEvent tpe = new TicketPromoterEvent(this.PromoterK, this.EventK); Utilities.EmailTicketRunStatusUpdate(tpe); this.EmailSent = true; this.Update(); } catch (Exception ex) { Utilities.AdminEmailAlert("Exception in TicketRun.EndTicketRun(). TicketRun K=" + this.K.ToString(), "Exception in TicketRun.EndTicketRun()", ex, this); } } }
public static void Refund(Usr actionUsr, List<Ticket> tickets, bool refundIncludeBookingFee, decimal chargeToPromoter) { try { if (tickets.Count > 0 && actionUsr.IsSuperAdmin) { chargeToPromoter = Math.Abs(chargeToPromoter); List<int> ticketRunKs = new List<int>(); int promoterK = tickets[0].TicketRun.PromoterK; int eventK = tickets[0].TicketRun.EventK; foreach (Ticket ticket in tickets) { if (promoterK != ticket.TicketRun.PromoterK) throw new Exception("Cannot automate refund for tickets belonging to more than 1 promoter."); if (eventK != ticket.TicketRun.EventK) throw new Exception("Cannot automate refund for tickets belonging to more than 1 event."); } TicketPromoterEvent ticketPromoterEvent = new TicketPromoterEvent(promoterK, eventK); bool chargePromoterTicketPrice = ticketPromoterEvent.FundsReleased && ticketPromoterEvent.FundsTransfer != null && ticketPromoterEvent.FundsTransfer.Status == Transfer.StatusEnum.Success; bool areFundsAlreadyReleased = chargePromoterTicketPrice; decimal sumTicketPrice = 0; string failedTicketKs = ""; List<Exception> failedRefundExceptions = new List<Exception>(); int successfulRefundTransferCount = 0; int successfulRefundQuantity = 0; foreach (Ticket ticket in tickets) { try { RefundTicket(actionUsr, ticket, refundIncludeBookingFee, areFundsAlreadyReleased); if (ticket.Cancelled) { if (!ticketRunKs.Contains(ticket.TicketRunK)) ticketRunKs.Add(ticket.TicketRunK); successfulRefundTransferCount++; successfulRefundQuantity += ticket.Quantity; if (chargePromoterTicketPrice) sumTicketPrice += ticket.Price; } } catch (Exception ex) { failedRefundExceptions.Add(ex); failedTicketKs += ticket.K.ToString() + ", "; } } if (successfulRefundTransferCount > 0 && (chargePromoterTicketPrice || chargeToPromoter > 0)) { // create invoice with tickets.count * chargeToPromoter invoice item for refund. DateTime now = DateTime.Now; InvoiceDataHolder refundChargeInvoiceDH = new InvoiceDataHolder(); refundChargeInvoiceDH.ActionUsrK = Usr.Current.K; refundChargeInvoiceDH.CreatedDateTime = now; refundChargeInvoiceDH.DueDateTime = now.AddDays(tickets[0].TicketRun.Promoter.InvoiceDueDaysEffective > Vars.InvoiceDueDaysDefault ? tickets[0].TicketRun.Promoter.InvoiceDueDaysEffective : Vars.InvoiceDueDaysDefault); refundChargeInvoiceDH.DuplicateGuid = Guid.NewGuid(); refundChargeInvoiceDH.PromoterK = tickets[0].TicketRun.PromoterK; refundChargeInvoiceDH.TaxDateTime = now; refundChargeInvoiceDH.Type = Invoice.Types.Invoice; if (tickets[0].TicketRun.Promoter.PrimaryUsrK != 0) refundChargeInvoiceDH.UsrK = tickets[0].TicketRun.Promoter.PrimaryUsrK; else refundChargeInvoiceDH.UsrK = Usr.Current.K; refundChargeInvoiceDH.VatCode = Invoice.VATCodes.T1; if (chargePromoterTicketPrice) { InvoiceItemDataHolder iidhPrice = new InvoiceItemDataHolder(); iidhPrice.RevenueStartDate = now; iidhPrice.RevenueEndDate = now; iidhPrice.Description = "Ticket price refund charge for " + successfulRefundQuantity.ToString() + " ticket" + (successfulRefundQuantity > 1 ? "s" : ""); iidhPrice.ShortDescription = "Ticket price refund charge"; iidhPrice.Type = InvoiceItem.Types.Misc; iidhPrice.VatCode = InvoiceItem.VATCodes.T9; iidhPrice.SetTotal(Math.Round(sumTicketPrice, 2)); refundChargeInvoiceDH.InvoiceItemDataHolderList.Add(iidhPrice); } InvoiceItemDataHolder iidh = new InvoiceItemDataHolder(); iidh.RevenueStartDate = now; iidh.RevenueEndDate = now; iidh.Description = "Ticket refund charge for " + successfulRefundTransferCount.ToString() + " ticket" + (successfulRefundTransferCount > 1 ? "s" : "") + " transfers"; iidh.ShortDescription = "Ticket refund charge"; iidh.Type = InvoiceItem.Types.Misc; iidh.VatCode = InvoiceItem.VATCodes.T1; iidh.SetTotal(Math.Round(successfulRefundTransferCount * chargeToPromoter, 2)); refundChargeInvoiceDH.InvoiceItemDataHolderList.Add(iidh); Invoice refundChargeInovice = refundChargeInvoiceDH.UpdateInsertDelete(); foreach (int ticketRunK in ticketRunKs) { new TicketRun(ticketRunK).CalculateSoldTicketsAndUpdate(); } refundChargeInovice.UpdateAndAutoApplySuccessfulTransfersWithAvailableMoney(); Utilities.EmailInvoice(refundChargeInovice, true); if (areFundsAlreadyReleased) ticketPromoterEvent.CalculateTotalFundsAndVat(); } failedTicketKs = failedTicketKs.Trim(); if (failedTicketKs.Length > 0) { string exceptionMessages = ""; foreach (Exception ex in failedRefundExceptions) exceptionMessages += ex.Message + "\n\n"; failedTicketKs = failedTicketKs.Substring(0, failedTicketKs.Length - 1); throw new Exception("Failed to refund the following tickets #" + failedTicketKs + ". Exception messages: " + exceptionMessages); } } } catch (Exception ex) { Utilities.AdminEmailAlert("Exception in Ticket.Refund(List<Ticket> tickets)", "Exception in Ticket.Refund(List<Ticket> tickets)", ex, tickets.ConvertAll(ticket => (IBobAsHTML)ticket)); throw ex; } }
public static void CreateNewTicketPromoterEventsWhenNeeded() { try { // Testing started in May 2007, so include all events after that date. We do not want to include past ticket runs, SW4 2006. Query ticketPromoterEventNotCreatedQuery = new Query(new And(new Q(TicketPromoterEvent.Columns.EventK, QueryOperator.IsNull, null), new Q(Event.Columns.DateTime, QueryOperator.LessThan, DateTime.Today), new Q(Event.Columns.DateTime, QueryOperator.GreaterThanOrEqualTo, Vars.TICKETS_NEW_SYSTEM_START_DATE))); ticketPromoterEventNotCreatedQuery.TableElement = new Join(new Join(TicketRun.Columns.EventK, Event.Columns.K), new TableElement(TablesEnum.TicketPromoterEvent), QueryJoinType.Left, new And(new Q(TicketPromoterEvent.Columns.EventK, Event.Columns.K, true), new Q(TicketPromoterEvent.Columns.PromoterK, TicketRun.Columns.PromoterK, true))); ticketPromoterEventNotCreatedQuery.Columns = new ColumnSet(TicketRun.Columns.PromoterK, TicketRun.Columns.EventK); ticketPromoterEventNotCreatedQuery.GroupBy = new GroupBy(new GroupBy(TicketRun.Columns.PromoterK), new GroupBy(TicketRun.Columns.EventK)); TicketRunSet ticketRunsWithoutTicketPromoterEvents = new TicketRunSet(ticketPromoterEventNotCreatedQuery); foreach (TicketRun ticketRunWithoutTicketPromoterEvent in ticketRunsWithoutTicketPromoterEvents) { TicketPromoterEvent ticketPromoterEvent = new TicketPromoterEvent(); try { ticketPromoterEvent = new TicketPromoterEvent(ticketRunWithoutTicketPromoterEvent.PromoterK, ticketRunWithoutTicketPromoterEvent.EventK); } catch { ticketPromoterEvent.PromoterK = ticketRunWithoutTicketPromoterEvent.PromoterK; ticketPromoterEvent.EventK = ticketRunWithoutTicketPromoterEvent.EventK; ticketPromoterEvent.FundsLockText = ""; ticketPromoterEvent.FundsReleased = false; ticketPromoterEvent.Update(); if (!ticketPromoterEvent.Promoter.EnableTickets) { Utilities.EmailPromoterReminderToSubmitTicketApplicationForm(ticketPromoterEvent); } } } } catch (Exception ex) { Utilities.AdminEmailAlert("Exception in TicketPromoterEvent.CreateTicketPromoterEventsWhenNeeded()", "Exception in TicketPromoterEvent.CreateTicketPromoterEventsWhenNeeded()", ex); } }
protected void Page_Load(object sender, EventArgs e) { string type = ""; int k = 0; int pk = 0; if (ContainerPage.Url["type"].Exists) type = ContainerPage.Url["type"].Value; if (ContainerPage.Url["K"].Exists && ContainerPage.Url["K"].IsInt) k = Convert.ToInt32(ContainerPage.Url["K"].Value); if (ContainerPage.Url["PK"].Exists && ContainerPage.Url["PK"].IsInt) pk = Convert.ToInt32(ContainerPage.Url["PK"].Value); //Promoter CurrentPromoter = new Promoter(pk); Usr.KickUserIfNotLoggedIn(); //if (!Usr.Current.IsPromoter && !Usr.Current.IsAdmin) //{ // throw new Exception("You must be a promoter to view this page"); //} //if (CurrentPromoter != null) //{ // if (!Usr.Current.IsPromoterK(CurrentPromoter.K) && !Usr.Current.IsAdmin) // throw new Exception("You can't view these details."); //} if (type.ToUpper() == "STATEMENT") { Promoter promoter = new Promoter(pk); if (!promoter.IsUsrAllowedAccess(Usr.Current)) throw new Exception(Vars.CANT_VIEW_DETAILS); int month = DateTime.Now.Month; int year = DateTime.Now.Year; if (ContainerPage.Url["M"].Exists && ContainerPage.Url["M"].IsInt) month = Convert.ToInt32(ContainerPage.Url["M"].Value); if (ContainerPage.Url["Y"].Exists && ContainerPage.Url["Y"].IsInt) year = Convert.ToInt32(ContainerPage.Url["Y"].Value); Response.Write(promoter.GenerateMonthlyStatementStringBuilder(month, year, true).ToString()); } else if(type.ToUpper().Equals("TICKETFUNDSINVOICE")) { TicketPromoterEvent tpe = new TicketPromoterEvent(pk, k); if (!tpe.IsUsrAllowedAccess(Usr.Current)) throw new Exception(Vars.CANT_VIEW_DETAILS); Response.Write(tpe.GenerateReportStringBuilder(true).ToString()); } else { IBobReport bobReport; switch (type.ToUpper()) { case "TRANSFER": bobReport = new Transfer(k); break; case "INVOICE": // goto credit case "CREDIT": bobReport = new Bobs.Invoice(k); break; case "TICKET": bobReport = new Ticket(k); break; case "TICKETFORPRINTING": bobReport = new TicketForPrinting(k); break; case "INSERTIONORDER": bobReport = new InsertionOrder(k); break; default: bobReport = null; break; } if (bobReport != null) { if (!bobReport.IsUsrAllowedAccess(Usr.Current)) throw new Exception(Vars.CANT_VIEW_DETAILS); Response.Write(bobReport.GenerateReportStringBuilder(true).ToString()); } } }
protected void TicketPromoterEventFundsGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditTicketPromoterEvent") { GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent; TicketPromoterEvent ticketPromoterEvent = new TicketPromoterEvent(Convert.ToInt32(((TextBox)row.FindControl("PromoterKTextBox")).Text), Convert.ToInt32(((TextBox)row.FindControl("EventKTextBox")).Text)); EventK = ticketPromoterEvent.EventK; PromoterK = ticketPromoterEvent.PromoterK; LoadTicketPromoterEventToScreen(); } else return; }