private static String getHandlerDetails(UserShows userShow, User currentUser, int ShowDetailsID) { String html = "<div class='handlerDetails'>"; html += "<div class='handler'>Handler Name:" + currentUser.Name + "</div>"; html += "<div class='showRef'>Show Ref:" + userShow.ID.ToString("000000") + "</div>"; UserCamping userCamping = new UserCamping(userShow.ID); if (userCamping.ID > -1) { String tmp = ""; if (userCamping.PitchNo == -1) { tmp = "Not Allocated"; } else { tmp = userCamping.PitchNo.ToString(); } html += "<div class='campingDetails'>Camping Pitch No:" + tmp + "</div>"; } Helpers helper = new Helpers(currentUser.UserID, ShowDetailsID); if (helper.ID > -1) { html += "<div class='helpingDetails'>Helping on Ring " + helper.RingNo.ToString() + " - " + helper.expandJob() +"</div>"; } html += "</div>"; return html; }
protected void Page_Load(object sender, EventArgs e) { int ShowID = Convert.ToInt32(Request["showid"]); String userIDs = Request["ids"].ToString(); String[] IDsList = userIDs.Split(','); String html = ""; foreach (String id in IDsList) { List <int >defaultUsers = new List<int>(); int UserID = Convert.ToInt32(id); UserShows userShow = new UserShows(UserID, ShowID); html += printRingForUser(userShow, UserID, ref defaultUsers); List<int> tmp = null; foreach (int defid in defaultUsers) { html += printRingForUser(userShow, defid, ref tmp); } } ringPlanContainer.InnerHtml = html; }
protected void Page_Load(object sender, EventArgs e) { int ShowID = Convert.ToInt32(Request["showid"]); String userIDs; if (Request["ids"] == null ) { FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = identity.Ticket; // get the roles stored as UserData into the ticket String[] userData = ticket.UserData.Split(':'); String[] roles = userData[0].Split(','); userIDs = userData[1]; } else { userIDs = Request["ids"].ToString(); } String[] IDsList = userIDs.Split(','); String html = ""; int pageCount = 0; foreach (String id in IDsList) { List <int >defaultUsers = new List<int>(); int UserID = Convert.ToInt32(id); UserShows userShow = new UserShows(UserID, ShowID); html += printRingForUser(userShow, UserID, ref defaultUsers, ref pageCount); List<int> tmp = null; foreach (int defid in defaultUsers) { if (pageCount % 2 != 0) { html += "<div class='pagebreak'></div><br><div class='pagebreak'> </div>"; } pageCount = 0; html += printRingForUser(userShow, defid, ref tmp, ref pageCount); } if (pageCount % 2 != 0) { html += "<div class='pagebreak'></div><br><div class='pagebreak'> </div>"; } pageCount = 0; } ringPlanContainer.InnerHtml = html; }
public void ProcessRequest(HttpContext context) { int ShowID = Convert.ToInt32(context.Request["showid"]); String userIDs = context.Request["ids"].ToString(); String[] IDsList = userIDs.Split(','); Shows show = new Shows(ShowID); Document doc = new Document(PageSize.A4.Rotate(), 10, 10, -5, -5); Stream output = new MemoryStream(); var writer = PdfWriter.GetInstance(doc, output); StyleSheet sheet = new StyleSheet(); doc.Open(); int pageCount = 0; foreach (String id in IDsList) { List<int> defaultUsers = new List<int>(); int UserID = Convert.ToInt32(id); UserShows userShow = new UserShows(UserID, ShowID); printRingForUser(userShow, UserID, doc, ref defaultUsers, ref pageCount); List<int> tmp = null; foreach (int defid in defaultUsers) { if (pageCount % 2 != 0) { doc.NewPage(); } pageCount = 0; printRingForUser(userShow, defid, doc, ref tmp, ref pageCount); } if (pageCount % 2 != 0) { doc.NewPage(); } pageCount = 0; } doc.Close(); context.Response.ClearContent(); context.Response.ContentType = "application/pdf"; context.Response.AddHeader("content-disposition", String.Format("inline;filename=PreviewSchedule.pdf")); context.Response.BinaryWrite((output as MemoryStream).ToArray()); }
private static String getHandlerDetails(UserShows userShow, User currentUser, int ShowDetailsID, List<int> dogsRunningToday) { String html = "<table ><tr><td style='width:600px' valign='top'><div class='handlerDetails'>"; html += "<div class='handler'>Handler Name:" + currentUser.Name + "</div>"; html += "<div class='showRef'>Show Ref:" + userShow.ID.ToString("000000") + "</div>"; UserCamping userCamping = new UserCamping(userShow.ID); if (userCamping.ID > -1) { String tmp = ""; if (userCamping.PitchNo == -1) { tmp = "Not Allocated"; } else { tmp = userCamping.PitchNo.ToString(); } html += "<div class='campingDetails'>Camping Pitch No:" + tmp + "</div>"; } Helpers helper = new Helpers(currentUser.UserID, ShowDetailsID); if (helper.ID > -1) { if (helper.RingNo > 0) { html += "<div class='helpingDetails'>Helping on Ring " + helper.RingNo.ToString() + " - " + helper.expandJob() + "</div>"; } else { html += "<div class='helpingDetails'>Helping " + helper.expandJob() + "</div>"; } } html += "</div>"; html += "</td><td valign='top' >"; foreach (int dogid in dogsRunningToday) { Dogs dd = new Dogs(dogid); html += String.Format("<div>Ring Number:{0} - {1}</div>", dd.GetRingNumbersForDog(userShow.ShowID), dd.KCName); } html += "</td></tr></table>"; return html; }
public static AdminTotals getAdminTotals(int ShowID, int EnteredBy) { String moduleSettings = ModuleConfig.GetSettings(); UserShows us = new UserShows(); DataSet ds = us.getAllUsersForShow(ShowID); AdminTotals adminTotals = new AdminTotals(); foreach (DataRow row in ds.Tables[0].Rows) { UserShows usdetails = new UserShows(row); User u = new User(usdetails.Userid); Transaction trans = new Transaction(usdetails.Userid, ShowID); if (EnteredBy == trans.EnteredBy) { adminTotals.Entries++; adminTotals.Runs += DogClasses.countDogsInClassForShow(usdetails.Userid, ShowID); } } return adminTotals; }
public static List<Dogs> GetAllDogsForHandlerAtShow(int ShowID, int HandlerID) { String moduleSettings = ModuleConfig.GetSettings(); Data.Dogs dogData = new Fpp.WebModules.Data.Dogs(moduleSettings); List<Dogs> dogList = new List<Dogs>(); UserShows us = new UserShows(HandlerID, ShowID); if (us.ID != -1) { DataSet ds = dogData.GetAllDogsForHandler(HandlerID); foreach (DataRow row in ds.Tables[0].Rows) { dogList.Add(new Dogs(row)); } } return dogList; }
protected void Page_Load(object sender, EventArgs e) { //Post back to either sandbox or live string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr"; //string strLive = "https://www.paypal.com/cgi-bin/webscr"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox); String ttt = Context.Request.QueryString.ToString(); String item_number ;//= getValue(ttt, "item_number"); String payment_date ;//= getValue(ttt, "payment_date"); String txnID;// = getValue(ttt, "txnID"); String mc_gross ;//= getValue(ttt, "mc_gross"); //Set values for the request back req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength); string strRequest = Encoding.ASCII.GetString(param); strRequest += "&cmd=_notify-validate"; req.ContentLength = strRequest.Length; //for proxy //WebProxy proxy = new WebProxy(new Uri("http://url:port#")); //req.Proxy = proxy; //Send the request to PayPal and get the response StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII); streamOut.Write(strRequest); streamOut.Close(); StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream()); string strResponse = streamIn.ReadToEnd(); streamIn.Close(); if (strResponse == "VERIFIED") { //check the payment_status is Completed //check that txnID has not been previously processed //check that receiver_email is your Primary PayPal email //check that payment_amount/payment_currency are correct //process payment item_number = getValue(strRequest, "item_number"); payment_date = getValue(strRequest, "payment_date"); txnID = getValue(strRequest, "txnID"); mc_gross = getValue(strRequest, "mc_gross"); int item_no = Convert.ToInt32(item_number.Substring(11, 6)); Decimal amount = Convert.ToDecimal(mc_gross); WebModules.Business.UserShows us = new Fpp.WebModules.Business.UserShows(item_no); us.Status = (int)UserShows.UserStatus.STATUS_ENTERED_AND_PAID; us.Save(); // // Add to transaction log for auditing purposes Transaction tr = new Transaction(); tr.Amount = Convert.ToDecimal(mc_gross); tr.RefCode = txnID; tr.Showid = us.ShowID; tr.TransactionDate = ConvertFromPayPalDate(payment_date, 0); // // } else if (strResponse == "INVALID") { //log for manual investigation } else { //log response/ipn data for manual investigation } }
protected void Page_Load(object sender, EventArgs e) { String url = ConfigurationManager.AppSettings["PaymentProcessorURL"]; HttpWebRequest req; req = (HttpWebRequest)WebRequest.Create(url); AppException.LogEvent("Check:" + url); String ttt = Context.Request.QueryString.ToString(); AppException.LogEvent("Check:" + ttt); String item_number ;//= getValue(ttt, "item_number"); String payment_date ;//= getValue(ttt, "payment_date"); String txn_id;// = getValue(ttt, "txn_id"); String mc_gross ;//= getValue(ttt, "mc_gross"); String comment; //Set values for the request back req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength); string strRequest ; if (param.Length == 0) { strRequest = ttt; } else { strRequest = Encoding.ASCII.GetString(param); } strRequest += "&cmd=_notify-validate"; req.ContentLength = strRequest.Length; AppException.LogEvent("Sending Response"); //for proxy //WebProxy proxy = new WebProxy(new Uri("http://url:port#")); //req.Proxy = proxy; string strResponse = ""; try { //Send the request to PayPal and get the response StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII); streamOut.Write(strRequest); streamOut.Close(); StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream()); strResponse = streamIn.ReadToEnd(); streamIn.Close(); AppException.LogEvent("Response Received:" + strResponse); } catch (Exception writeOutEx) { AppException.LogEvent("Here 2 " + writeOutEx.Message); } if (strResponse == "VERIFIED") { //check the payment_status is Completed //check that txn_id has not been previously processed //check that receiver_email is your Primary PayPal email //check that payment_amount/payment_currency are correct //process payment try { Dictionary<String, String> httpParsedResponse = new Dictionary<string, string>(); String[] httpKVArray = strRequest.Split('&'); foreach (String i in httpKVArray) { String[] pair = i.Split('='); if (pair.Length > 1) { httpParsedResponse.Add(pair[0], pair[1]); } else { httpParsedResponse.Add(pair[0], ""); } } AppException.LogEvent("Adding here 2.1:[" + strRequest + "]"); item_number = getValue(strRequest, "item_number"); payment_date = getValue(strRequest, "payment_date"); txn_id = getValue(strRequest, "txn_id"); mc_gross = getValue(strRequest, "mc_gross"); comment = getValue(strRequest, "custom"); AppException.LogEvent("Adding here 2.2:" + item_number); AppException.LogEvent(String.Format("item_number={0}, payment_date={1}, txn_id={2}, mc_gross={3}, comment={4}", item_number, payment_date, txn_id, mc_gross, comment)); int item_no = Convert.ToInt32(item_number); Decimal amount = Convert.ToDecimal(mc_gross); WebModules.Business.UserShows us = new Fpp.WebModules.Business.UserShows(item_no); us.Status = (int)UserShows.UserStatus.STATUS_ENTERED_AND_PAID; us.Save(); AppException.LogEvent("Adding Transaction"); // // Add to transaction log for auditing purposes Transaction.Add(item_number, 1, Convert.ToDecimal(mc_gross), txn_id, us.ShowID, us.Userid, ConvertFromPayPalDate(payment_date, 0)); } catch (Exception e1) { AppException.LogEvent("here3: " + e1.Message); } // // } else if (strResponse == "INVALID") { //log for manual investigation AppException.LogEvent("Check: INVALID"); } else { //log response/ipn data for manual investigation AppException.LogEvent("Not processed"); } }
private void printRingForUser(UserShows userShow, int UserID, Document doc, ref List<int> defaultUsers, ref int pageCount) { String html = ""; float[] ringColumns = new float[] { 300, 300, 300, 300}; Font pageFont = FontFactory.GetFont("Arial", 22, Font.NORMAL); Font headerFont = new Font(Font.HELVETICA, 16, Font.BOLD, Color.BLACK); Font judgeFont = FontFactory.GetFont("Arial", 9, Font.BOLD); Font notInClassFont = new Font(Font.HELVETICA, 6, Font.NORMAL, Color.BLACK); Font inClassFont = new Font(Font.HELVETICA, 9, Font.NORMAL, Color.BLACK); Font font = new Font(Font.HELVETICA, 10, Font.NORMAL, Color.BLACK); Font font1 = FontFactory.GetFont("Arial", 18, Font.BOLD); Font dogNotInClass = new Font(Font.HELVETICA, 6, Font.NORMAL, Color.BLACK); Font dogInClass = new Font(Font.HELVETICA, 9, Font.NORMAL, Color.BLACK); Font dogDetailsInClass = new Font(Font.HELVETICA, 9, Font.BOLD, Color.BLACK); Fpp.WebModules.Business.User currentUser = new User(userShow.Userid); Shows show = new Shows(userShow.ShowID); List<ShowDetails> showDetailsList = ShowDetails.GetShowDaysList(userShow.ShowID); doc.Add(new Paragraph(show.ShowName, pageFont)); Rings r = new Rings(); DataSet ringList = r.GetAllRingsForShow(userShow.ShowID, "ShowDate"); Dogs d = new Dogs(); DogClasses dc = new DogClasses(); DateTime dt = DateTime.Now; int currentRingID = 0; int ShowDetailsID = -1; int PrevShowDetailsID = -1; PdfPTable rings = new PdfPTable(ringColumns); int ringCnt = 0; PdfPCell cell = null; PdfPTable ringDetails = null; PdfPTable classDetailsTable = null; List<int> dogsRunningToday = new List<int>(); foreach (DataRow ringRow in ringList.Tables[0].Rows) { int RingID = Convert.ToInt32(ringRow["RingID"]); ShowDetailsID = Convert.ToInt32(ringRow["ShowDetailsID"]); if (ringRow.IsNull("ClassID")) { continue; } int ClassID = Convert.ToInt32(ringRow["ClassID"]); DateTime rowDT = Convert.ToDateTime(ringRow["ShowDate"]); if (rowDT != dt) { if (currentRingID != 0) { if (ringCnt % 4 != 0) { var remind = ringCnt % 4; while (remind-- > 0) { cell = new PdfPCell(new Phrase(new Chunk(" ", pageFont))); cell.BorderWidth = 0; rings.AddCell(cell); } } doc.Add(rings); if (currentUser.UserID == UserID) { doc.Add(getHandlerDetails(userShow, currentUser, PrevShowDetailsID, dogsRunningToday)); } else { User defaultHandler = new User(UserID); doc.Add(getHandlerDetails(userShow, defaultHandler, PrevShowDetailsID, dogsRunningToday)); } doc.NewPage(); if (dogsRunningToday.Count > 0) { pageCount++; } } dogsRunningToday.Clear(); doc.Add(new Paragraph(rowDT.ToString("dddd d MMM"), headerFont)); doc.Add(new Paragraph(" ", judgeFont)); dt = rowDT; rings = new PdfPTable(ringColumns); rings.WidthPercentage = 100; ringCnt = 0; } if (currentRingID != RingID) { ringCnt++; ringDetails = new PdfPTable(1); rings.AddCell(new PdfPCell( ringDetails)); List<Judge> judgeList = Judge.getJudgesForRingList(RingID); cell = new PdfPCell(new Phrase(new Chunk("Ring No " + ringRow["RingNo"].ToString(), judgeFont))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; ringDetails.AddCell(cell); foreach (Judge judge in judgeList) { cell = new PdfPCell(new Phrase(new Chunk(judge.Name, judgeFont))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; ringDetails.AddCell(cell); } currentRingID = RingID; classDetailsTable = new PdfPTable(new float[] { 50, 225, 100 }); classDetailsTable.DefaultCell.BorderWidth = 0; ringDetails.AddCell(classDetailsTable); } html += "<tr>"; DataSet dogsList = d.GetDogsInClass(userShow.Userid, ClassID); int DogsInClass = d.dogsInClassCount(ClassID); String clsName = String.Format("{0} {1} {2} {3}", ShowClasses.expandCatagory(ringRow), ShowClasses.expandHeight(ringRow), ringRow["LongName"], ringRow["name"]); String grades = ShowClasses.shortenGrades(ringRow); int ix = clsName.IndexOf("Grd"); if (ix == -1) ix = clsName.IndexOf("Cmb"); if (ix > -1) { clsName = clsName.Substring(0, ix + 3) + " " + grades + " " + clsName.Substring(ix + 4); } else { ix = clsName.IndexOf(" "); clsName = clsName.Substring(0, ix) + " " + grades + " " + clsName.Substring(ix + 1); } if (dogsList.Tables[0].Rows.Count > 0) { Phrase[] tmpCells = new Phrase[3]; tmpCells[0] = new Phrase(new Chunk(ringRow["ClsNo"].ToString(), dogInClass)); tmpCells[1] = new Phrase(new Chunk(clsName, dogInClass)); tmpCells[2] = new Phrase(new Chunk(String.Format("({0})", DogsInClass), dogInClass)); int countDogs = 0; int DefaultHandler; Paragraph p = new Paragraph(); foreach (DataRow dogRow in dogsList.Tables[0].Rows) { int DogID = Convert.ToInt32(dogRow["DogID"]); DefaultHandler = Convert.ToInt32(dogRow["DefaultHandler"]); if (DefaultHandler == 0) DefaultHandler = -1; if ((DefaultHandler == -1 && currentUser.UserID == UserID) || (DefaultHandler == UserID) ) { if (countDogs == 0) { cell = new PdfPCell(tmpCells[0]); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; classDetailsTable.AddCell(cell); p.Add(tmpCells[1]); p.Add(Chunk.NEWLINE); } if (!dogsRunningToday.Contains(DogID)) { dogsRunningToday.Add(DogID); } String img = "<img src='data:image/gif;base64," + CreateImage(dogRow["DogColour"].ToString()) + "' />"; String dogName = dogRow["DogName"].ToString(); if (dogName.Length == 0) { dogName = dogRow["KCName"].ToString(); } var chunk = new Chunk(" ", dogDetailsInClass); chunk.SetBackground(new Color( System.Drawing.ColorTranslator.FromHtml(dogRow["DogColour"].ToString()) )); p.Add(new Phrase(chunk)); p.Add(new Phrase(new Chunk(String.Format(" [{1}] {0}", dogName, dogRow["RO"]), dogDetailsInClass))); p.Add(Chunk.NEWLINE); int AltHandler = Convert.ToInt32(dogRow["AltHandler"]); String HandlerName = ""; if (AltHandler > 0) { User u = new User(AltHandler); HandlerName = u.Name; html += "<div class='altHandler'>Handler:" + AltHandler + "</div>"; p.Add(Chunk.NEWLINE); p.Add(new Phrase(new Chunk(String.Format("Handler:", AltHandler),dogInClass))); } countDogs++; } else { if (defaultUsers != null && defaultUsers.IndexOf(DefaultHandler) == -1) { defaultUsers.Add(DefaultHandler); } } } if (countDogs == 0) { cell = new PdfPCell(new Phrase(new Chunk(ringRow["ClsNo"].ToString(), dogNotInClass))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; classDetailsTable.AddCell(cell); cell = new PdfPCell(new Phrase(new Chunk(clsName, dogNotInClass))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT; cell.NoWrap = true; classDetailsTable.AddCell(cell); cell = new PdfPCell(new Phrase(new Chunk(String.Format("({0})", DogsInClass), dogNotInClass))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; classDetailsTable.AddCell(cell); } else { cell = new PdfPCell(p); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT; cell.NoWrap = true; classDetailsTable.AddCell(cell); cell = new PdfPCell(tmpCells[2]); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; classDetailsTable.AddCell(cell); } } else { cell = new PdfPCell(new Phrase(new Chunk(ringRow["ClsNo"].ToString(), dogNotInClass))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; classDetailsTable.AddCell(cell); cell = new PdfPCell(new Phrase(new Chunk(clsName, dogNotInClass))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT; classDetailsTable.AddCell(cell); cell = new PdfPCell(new Phrase(new Chunk(String.Format("({0})", DogsInClass), dogNotInClass))); cell.BorderWidth = 0; cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; classDetailsTable.AddCell(cell); } PrevShowDetailsID = ShowDetailsID; } if (ringCnt % 4 != 0) { var remind = ringCnt % 4; while (remind-- > 0) { cell = new PdfPCell(new Phrase(new Chunk(" ", pageFont))); cell.BorderWidth = 0; rings.AddCell(cell); } } if (currentUser.UserID == UserID) { doc.Add(getHandlerDetails(userShow, currentUser, PrevShowDetailsID, dogsRunningToday)); } else { User defaultHandler = new User(UserID); doc.Add(getHandlerDetails(userShow, defaultHandler, PrevShowDetailsID, dogsRunningToday)); } doc.NewPage(); }
private PdfPTable getHandlerDetails(UserShows userShow, User currentUser, int ShowDetailsID, List<int> dogsRunningToday) { Font headerFont = new Font(Font.HELVETICA, 17, Font.NORMAL, Color.BLACK); Font ringNumberFont = new Font(Font.HELVETICA, 10, Font.NORMAL, Color.BLACK); var summaryTable = new PdfPTable(2); summaryTable.WidthPercentage = 100; Paragraph p = new Paragraph(); p.Add(new Chunk(String.Format("Handler Name:{0}", currentUser.Name), headerFont)); p.Add(Chunk.NEWLINE); p.Add(new Chunk(String.Format("Show Ref:{0,6}", userShow.ID), headerFont)); p.Add(Chunk.NEWLINE); UserCamping userCamping = new UserCamping(userShow.ID); if (userCamping.ID > -1) { String tmp = ""; if (userCamping.PitchNo == -1) { tmp = "Not Allocated"; } else { tmp = userCamping.PitchNo.ToString(); } p.Add(new Phrase(new Chunk(String.Format("Camping PitchNo:{0}", tmp), headerFont))); p.Add(new Phrase(Chunk.NEWLINE)); } Helpers helper = new Helpers(currentUser.UserID, ShowDetailsID); if (helper.ID > -1) { p.Add(new Phrase(new Chunk(String.Format("Camping PitchNo:{0}", helper.RingNo), headerFont))); p.Add(new Phrase(Chunk.NEWLINE)); } var cell = new PdfPCell(p); cell.BorderWidth = 0; summaryTable.AddCell(cell); p = new Paragraph(); foreach (int dogid in dogsRunningToday) { Dogs dd = new Dogs(dogid); p.Add(new Phrase(new Chunk(String.Format("Ring Number:{0} - {1}", dd.GetRingNumbersForDog(userShow.ShowID), dd.KCName), ringNumberFont))); p.Add(new Phrase(Chunk.NEWLINE)); } cell = new PdfPCell(p); cell.BorderWidth = 0; summaryTable.AddCell(new PdfPCell(cell)); return summaryTable; }
private String printRingForUser(UserShows userShow, int UserID, ref List<int> defaultUsers) { String html = ""; Fpp.WebModules.Business.User currentUser = new User(userShow.Userid); Shows show = new Shows(userShow.ShowID); List<ShowDetails> showDetailsList = ShowDetails.GetShowDaysList(userShow.ShowID); html += "<h2>" + show.ShowName + "</h2>"; Rings r = new Rings(); DataSet ringList = r.GetAllRingsForShow(userShow.ShowID, "ShowDate"); Dogs d = new Dogs(); DogClasses dc = new DogClasses(); DateTime dt = DateTime.Now; Boolean newday = false; int currentRingID = 0; int ShowDetailsID = -1; int PrevShowDetailsID = -1; foreach (DataRow ringRow in ringList.Tables[0].Rows) { try { int RingID = Convert.ToInt32(ringRow["RingID"]); int EntryType = Convert.ToInt32(ringRow["EntryType"]); ShowDetailsID = Convert.ToInt32(ringRow["ShowDetailsID"]); if (ringRow.IsNull("ClassID")) { continue; } int ClassID = Convert.ToInt32(ringRow["ClassID"]); DateTime rowDT = Convert.ToDateTime(ringRow["ShowDate"]); if (rowDT != dt) { newday = true; if (currentRingID != 0) { html += "</table></div></div>"; if (currentUser.UserID == UserID) { html += getHandlerDetails(userShow, currentUser, PrevShowDetailsID); } else { User defaultHandler = new User(UserID); html += getHandlerDetails(userShow, defaultHandler, PrevShowDetailsID); } html += "<div class='pagebreak'></div>"; } html += "<div class='day group'>"; html += "<div class='clsDate'>" + rowDT.ToString("dddd d MMM") + "</div>"; dt = rowDT; } if (currentRingID != RingID) { List<Judge> judgeList = Judge.getJudgesForRingList(RingID); if (currentRingID != 0 && !newday) { html += "</table></div>"; } html += "<div class='Ring'>"; html += "<table class='roClassesTbl'>"; html += "<tr class='ringInfo'>"; html += "<td colspan='3'>" + "<div class='roTitle centered'>Ring No " + ringRow["RingNo"].ToString() + "</div>"; foreach (Judge judge in judgeList) { html += "<div class='roTitle centered'>" + judge.Name + "</div>"; } html += "</td></tr>"; currentRingID = RingID; } html += "<tr>"; DataSet dogsList = d.GetDogsInClass(userShow.Userid, ClassID); int DogsInClass = d.dogsInClassCount(ClassID); String clsName = String.Format("{0} {1} {2} {3}", ShowClasses.expandCatagory(ringRow), ShowClasses.expandHeight(ringRow), ringRow["LongName"], ringRow["name"]); String grades = ShowClasses.shortenGrades(ringRow); int ix = clsName.IndexOf("Grd"); if (ix == -1) ix = clsName.IndexOf("Cmb"); if (ix > -1) { clsName = clsName.Substring(0, ix + 3) + " " + grades + " " + clsName.Substring(ix + 4); } else { ix = clsName.IndexOf(" "); clsName = clsName.Substring(0, ix) + " " + grades + " " + clsName.Substring(ix + 1); } if (dogsList.Tables[0].Rows.Count > 0) { String tmphtml = "<td valign='top' class='clsRing InClass'>" + ringRow["ClsNo"] + "</td>" + "<td valign='top' class='clsDetails InClass'><div>" + clsName + "</div>"; int countDogs = 0; int DefaultHandler; foreach (DataRow dogRow in dogsList.Tables[0].Rows) { int DogID = Convert.ToInt32(dogRow["DogID"]); DefaultHandler = Convert.ToInt32(dogRow["DefaultHandler"]); if (DefaultHandler == 0) DefaultHandler = -1; if ((DefaultHandler == -1 && currentUser.UserID == UserID) || (DefaultHandler == UserID) ) { html += tmphtml; tmphtml = ""; String img = "<img src='data:image/gif;base64," + CreateImage(dogRow["DogColour"].ToString()) + "' />"; String dogName = dogRow["DogName"].ToString(); if (dogName.Length == 0) { dogName = dogRow["KCName"].ToString(); } html += String.Format("<div class='dogInClass'><div style='background:{2};' class='dogIcon'>{3}</div>[{1}] {0}</div>", dogName, dogRow["RO"], dogRow["DogColour"], img); int AltHandler = Convert.ToInt32(dogRow["AltHandler"]); String HandlerName = ""; if (AltHandler > 0) { User u = new User(AltHandler); HandlerName = u.Name; html += "<div class='altHandler'>Handler:" + AltHandler + "</div>"; } // Pairs if (EntryType == 4) { MultiDog md = new MultiDog(UserID, DogID, ClassID); html += String.Format("<div class='dogInClass'><div style='width:8px;height:10px;' class='dogIcon'></div>[{1}] {0}</div>", md.Dogname, dogRow["RO"]); } countDogs++; } else { if (defaultUsers != null && defaultUsers.IndexOf(DefaultHandler) == -1) { defaultUsers.Add(DefaultHandler); } } } if (countDogs == 0) { html += "<td valign='top' class='clsRing notInClass'>" + ringRow["ClsNo"] + "</td>"; html += "<td valign='top' class='clsDetails notInClass'>" + clsName + "</td>"; html += "<td valign='top' class='clsEntry notInClass'><div>(" + DogsInClass + ")</div></td>"; } else { html += "</td>"; html += "<td valign='top' class='clsEntry'><div>(" + DogsInClass + ")</div></td>"; } } else { html += "<td valign='top' class='clsRing notInClass'>" + ringRow["ClsNo"] + "</td>"; html += "<td valign='top' class='clsDetails notInClass'>" + clsName + "</td>"; html += "<td valign='top' class='clsEntry notInClass'><div>(" + DogsInClass + ")</div></td>"; } html += "</tr>"; newday = false; PrevShowDetailsID = ShowDetailsID; } catch (Exception e) { AppException.LogEvent("Printing Ring Plan: " + e.Message); } } html += "</table>"; html += "</div>"; html += "</div>"; if (currentUser.UserID == UserID) { html += getHandlerDetails(userShow, currentUser, PrevShowDetailsID); } else { User defaultHandler = new User(UserID); html += getHandlerDetails(userShow, defaultHandler, PrevShowDetailsID); } html += "<div class='pagebreak'></div>"; return html; }
public static void Cancel(User currentUser, int showid) { DogClasses dc = new DogClasses(); Shows show = new Shows(showid); UserShows us = new UserShows(currentUser.ID, showid); UserCamping.DeleteForUser(us.ID); String refcode = us.ID.ToString("000000"); us.Delete(); //us.Status =(int) UserShows.UserStatus.STATUS_PENDING_REFUND; //us.Save(); DogClasses.deleteUserDogs(currentUser.ID, showid); MultiDog.DeleteUserFromShow(currentUser.ID, showid); if (us.Status != (int)UserShows.UserStatus.STATUS_SAVED) { String htmlContents = readTemplate("CancelledEntry", "html", show, refcode); String plainContents = readTemplate("CancelledEntry", "txt", show, refcode); List<Transaction> transList = Transaction.getTransactionForUserRefCode(showid, currentUser.ID, us.ID); if (us.Status == (int)UserShows.UserStatus.STATUS_ENTERED_NOT_PAID) { htmlContents = htmlContents.Replace("[PAYMENT_NOTE]", ""); plainContents = plainContents.Replace("[PAYMENT_NOTE]", ""); Transaction.Add(refcode, 4, -transList[0].Amount, "Entry Fee Returned", showid, currentUser.ID, DateTime.Now); } else { if (transList.Count > 0) { // // if handler is cancelling the show and there have paid, then // mark in their account history that there have a refund htmlContents = htmlContents.Replace("[PAYMENT_NOTE]", "Your payment will be refunded in the next 24 - 48 hours"); plainContents = plainContents.Replace("[PAYMENT_NOTE]", "Your payment will be refunded in the next 24 - 48 hours"); int transid = Transaction.Add(refcode, 2, -transList[0].Amount, "Refund Requested", showid, currentUser.ID, DateTime.Now); Transaction.SetEnteredBy(transid, Transaction.ENTERED_BY.ONLINE_ENTRY); } else { htmlContents = htmlContents.Replace("[PAYMENT_NOTE]", ""); plainContents = plainContents.Replace("[PAYMENT_NOTE]", ""); } } MailMessage mm = new MailMessage(); AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlContents, null, MediaTypeNames.Text.Html); LinkedResource logoImage = new LinkedResource(HttpContext.Current.Server.MapPath("~/Assets/logo.gif"), MediaTypeNames.Image.Gif); logoImage.ContentId = "LogoImage"; //htmlView.LinkedResources.Add(logoImage); AlternateView plainView = AlternateView.CreateAlternateViewFromString(plainContents, null, MediaTypeNames.Text.Plain); mm.AlternateViews.Add(plainView); mm.AlternateViews.Add(htmlView); SmtpClient client = new SmtpClient("localhost"); mm.From = new MailAddress("*****@*****.**", "First Place Processing"); mm.To.Add(new MailAddress(currentUser.EmailAddress, currentUser.Name)); mm.Subject = String.Format("Entry Cancellation {0} ({1:dd MMM yyyy})", show.ShowName, show.ShowDate); client.Send(mm); if (us.Status == (int)UserShows.UserStatus.STATUS_ENTERED_AND_PAID) { mm = new MailMessage(); mm.From = new MailAddress("*****@*****.**", "First Place Processing"); mm.To.Add(new MailAddress("*****@*****.**", "First Place Processing")); mm.Subject = "Entry Cancellation Request"; mm.Body = String.Format("Refund Request from {0}\r\n\r\nRefcode: {1}\r\n\r\nEmail: {2}\r\n\r\nShow: {3}\r\n", currentUser.Name, refcode, currentUser.EmailAddress, show.ShowName); client.SendAsync(mm, null); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { testing = Config.GetInt("testing"); String cmd = Request["cmd"]; int iShowID = Convert.ToInt32(Request["showid"]); Shows show = new Shows(iShowID); ShowID.Value = iShowID.ToString(); showName = show.ShowName; int startingID = -1; if (!String.IsNullOrEmpty(Request["ShowDetailsID"])) startingID = Convert.ToInt32(Request["ShowDetailsID"]); UserShows us = new UserShows(); DataSet ds = us.getAllUsersForShow(iShowID); String html = ""; html = "<input type='button' id='btnAdd' value='Add Entry' />"; html += "<input type='button' id='btnBulkEmail' value='Email Everyone!' />"; html += "<div class='innerContainer'>"; int online = 0; int offline = 0; int Entries = ds.Tables[0].Rows.Count; foreach (DataRow row in ds.Tables[0].Rows) { UserShows usdetails = new UserShows(row); User u = new User(usdetails.Userid); //Transaction.ENTERED_BY EnteredBy = Transaction.hasShowAdminUpdateEntry(iShowID, usdetails.Userid); Transaction trans = new Transaction(usdetails.Userid, iShowID); Transaction.ENTERED_BY EnteredBy = (Transaction.ENTERED_BY )trans.EnteredBy; String EntryType = ""; if (EnteredBy == Transaction.ENTERED_BY.ONLINE_ENTRY) { EntryType = "O"; online++; //onlineDogs += DogClasses.countDogsInClassForShow(usdetails.Userid, iShowID); } else { EntryType = "A"; offline++; //offlineDogs += DogClasses.countDogsInClassForShow(usdetails.Userid, iShowID); } String tmp = ""; if (usdetails.Status == 2 ) { tmp = "NotPaid"; } else { tmp = (EnteredBy == 0 ? "OnlineEntry" : ""); } String ht = " "; if (usdetails.HandlerType == 1) { ht = "M"; } else if (usdetails.HandlerType == 2) { ht = "J"; } /* String ps = " "; if (usdetails.Status == (int)UserShows.UserStatus.STATUS_SAVED) { ps = "S"; } else if (usdetails.Status == (int)UserShows.UserStatus.STATUS_ENTERED_NOT_PAID) { ps = "N"; } * */ String showRef = usdetails.ID.ToString("000000"); html += "<div userid='" + usdetails.Userid.ToString() + "' class='user " + tmp + "'><div class='printRP'>P</div><div class='showref'>" + showRef + "</div><div class='userShowDetails'>" + EntryType + "</div><div class='handlerType'>" + ht + "</div><div class='userName'>" + u.Name + "</div><div class='delete'>x</div></div>"; } html += "</tbody></table></div>"; handlerList.InnerHtml = html; showStatus = String.Format("Online Entries:{0} Offline Entries:{1}", online, offline); strClassNosGradeList = fastJSON.JSON.Instance.ToJSON(ShowClasses.GetAllClassesForShow(iShowID)); } }
public static UserShows SaveEntry(HttpContext context, String data, Fpp.WebModules.Business.User currentUser, Shows thisShow) { DogClasses dc = new DogClasses(); int handlertype = Convert.ToInt32(context.Request["handlertype"]); String[] dogs = data.Split(','); String[] altHandlersList = context.Request["althandlerslist"].Split(','); int waitingList = Convert.ToInt32(context.Request["waitinglist"]); // // Multidog format is packed as // <dogid>@<clsid>:<handlername>.<dogname>[;<handlername>.<dogname>][,<dogid>#<clsid>:<handlername>.<dogname>[;<handlername>.<dogname>]] // MultiDog.DeleteUserFromShow(currentUser.ID, thisShow.ID); String[] pairTeams = context.Request["pairteams"].Split(','); if (!String.IsNullOrEmpty(context.Request["pairteams"])) { foreach (String pairTeam in pairTeams) { String[] pt = pairTeam.Split(';'); int DogID = -1; int ClsID = -1; ; foreach (String p in pt) { String[] dogcls; String[] otherHandlerDog; if (p.IndexOf(':') > 0) { dogcls = p.Split(':')[0].Split('@'); DogID = Convert.ToInt32(dogcls[0]); ClsID = Convert.ToInt32(dogcls[1]); otherHandlerDog = p.Split(':')[1].Split('.'); String []handlerDetails = otherHandlerDog[0].Split('-'); if (handlerDetails.Length > 1) { String handlerName = handlerDetails[0]; int handlerID = -1; int.TryParse(handlerDetails[1], out handlerID); String[] dogDetails = otherHandlerDog[1].Split('-'); String dogName = dogDetails[0]; int dogID = -1; int.TryParse(dogDetails[1], out dogID ); MultiDog.Add(currentUser.ID, DogID, ClsID, thisShow.ID, handlerName, dogName, handlerID, dogID); } else { MultiDog.Add(currentUser.ID, DogID, ClsID, thisShow.ID, otherHandlerDog[0], otherHandlerDog[1]); } } else { otherHandlerDog = p.Split('.'); String[] handlerDetails = otherHandlerDog[0].Split('-'); if (handlerDetails.Length > 1) { String handlerName = handlerDetails[0]; int handlerID = -1; int.TryParse(handlerDetails[1], out handlerID); String[] dogDetails = otherHandlerDog[1].Split('-'); String dogName = dogDetails[0]; int dogID = -1; int.TryParse(dogDetails[1], out dogID); MultiDog.Add(currentUser.ID, DogID, ClsID, thisShow.ID, handlerName, dogName, handlerID, dogID); } } } } } foreach (String dog in dogs) { String[] details = dog.Split(':'); int dogid = Convert.ToInt32(details[0]); String[] clslist = details[1].Split('.'); List<int> classes = new List<int>(); List<int> altHandlers = new List<int>(); foreach (String clsid in clslist) { if (clsid.Length > 0) { int altid = 0; classes.Add(Convert.ToInt32(clsid)); for (int ii = 0; ii < altHandlersList.Length; ii++) { String[] kvPairs = altHandlersList[ii].Split(':'); if (kvPairs[0] == clsid && kvPairs[2] == details[0]) { altid = Convert.ToInt32(kvPairs[1]); } } altHandlers.Add(altid); } } dc.Save(dogid, thisShow.ID, classes, altHandlers); } UserShows us = new UserShows(currentUser.ID, thisShow.ID); us.Status = us.Status = (int)UserShows.UserStatus.STATUS_SAVED ; // // add check to see if this person is on the judging list. if (Judge.isJudgeAtShow(currentUser.ID, thisShow.ID)) { us.HandlerType = (int)UserShows.HandlerTypes.JUDGE; } else { us.HandlerType = handlertype; } if ( !String.IsNullOrEmpty(context.Request["optout"] ) ) { us.Optout = Convert.ToInt32(context.Request["optout"]); } us.Save(); Camping camping = new Camping(thisShow.ID); if (camping.ID > -1) { String campParty = ""; String campDays = ""; String campComments = ""; if (!String.IsNullOrEmpty(context.Request["campingdays"])) campDays = context.Request["campingdays"]; if (!String.IsNullOrEmpty(context.Request["campingparty"])) campParty = context.Request["campingparty"]; if (!String.IsNullOrEmpty(context.Request["campcomments"])) campComments = context.Request["campcomments"]; if (campDays.Length > 0) { UserCamping.Add(us.ID, campParty, campComments, campDays); } } if (waitingList == 1) { WaitingList.Add(us.ShowID, us.Userid); } return us; }
protected void Page_Load(object sender, EventArgs e) { siteDetails.InnerHtml = "<span class='lolight'>© First Place Processing</span> * " + "<a href='/docs/?_=cpf'>Card Payment Fees</a> * " + "<a href='/docs/?_=tandc'>Terms & Conditions</a> * " + "<a href='/docs/?_=pp'>Privacy Policy</a>"; String paymentReturnStatus = ""; if (Context.Session["paymentStatus"] != null) { paymentReturnStatus = Context.Session["paymentStatus"].ToString(); Context.Session["paymentStatus"] = ""; }; if (paymentReturnStatus == "cancelled") { paymentStatus = "<div class='paymentStatus'>Your last payment was cancelled</div>"; } else if (paymentReturnStatus == "paysuccess") { if (Context.Session["paymentStatusShowName"] != null) { String showName = Context.Session["paymentStatusShowName"].ToString(); Context.Session["paymentStatus"] = ""; Context.Session["paymentStatusShowName"] = ""; paymentStatus = "<h2><div class='paymentStatus'>Your Payment has been gratefully received for " + showName + "</div><br><div>Thank you.</div></h2>"; } else { Context.Session["paymentStatus"] = ""; Context.Session["paymentStatusShowName"] = ""; paymentStatus = "<h2><div class='paymentStatus'>Your Payment has been gratefully received.</div><br><div>Thank you.</div></h2>"; } } if (!String.IsNullOrEmpty(Request["_"] ) ) { sectionDisplay = Request["_"]; } HttpCookie cookie = Context.Request.Cookies[".FPPAUTH"]; if (cookie != null) { FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value); String[] lists = ticket.UserData.Split(':'); int userid = Convert.ToInt32(lists[1]); UserID.Value = userid.ToString(); showadmin = (lists[0].Contains("showadmin")); user = new User(userid); List<Dogs> userDogs = Dogs.GetAllDogsForHandler(userid, DateTime.Now); handlerDogs = userDogs.Count; FirstTime = user.firstTime; loginInUser.InnerHtml = user.Name; String enteredShows = ""; Shows shows = new Shows(); DataSet ds = shows.GetAllEnteredShows(userid); foreach (DataRow row in ds.Tables[0].Rows) { var show = new Shows(row); var us = new UserShows(userid, show.ID); var notPaid = ""; if (us.Status == (int)UserShows.UserStatus.STATUS_ENTERED_NOT_PAID) { notPaid = " <div class='flagUnpaid'></div>"; } enteredShows += String.Format("<div class='showsEnteredItem'><div class='ShowDetails ' data-showtype='2' status='{6}' showid='{5}' showdate='{2:dd MMM yyyy}' closingdate='{1:dd MMM yyyy}' venue='{3}' venuepostcode='{4}'>{0}{7}</div></div>", row["Name"], DateCheck(row, "ClosingDate"), DateCheck(row, "ShowDate"), row["Venue"], row["VenuePostcode"], row["showid"], row["status"], notPaid); // + "<div class='ShowDate'>" + String.Format("{0:dd MMM yyyy}", Convert.ToDateTime(row["ShowDate"])) + "</div>"; } lstEnteredShows.InnerHtml = enteredShows; SavedList= ""; ds = shows.GetAllSavedShows(userid); foreach (DataRow row in ds.Tables[0].Rows) { SavedList += String.Format("<div class='ShowDetails' data-showtype='1' showid='{5}' showdate='{2:dd MMM yyyy}' closingdate='{1:dd MMM yyyy}' venue='{3}' venuepostcode='{4}'>{0}</div>", row["Name"], DateCheck(row, "ClosingDate"), DateCheck(row, "ShowDate"), row["Venue"], row["VenuePostcode"], row["showid"]); // + "<div class='ShowDate'>" + String.Format("{0:dd MMM yyyy}", Convert.ToDateTime(row["ShowDate"])) + "</div>"; } lstSavedShows.InnerHtml = SavedList; lstAvailableShows.InnerHtml = ""; List<Shows> showsList = Shows.getPublishedShows(userid); if (showsList.Count > 0) { foreach (Shows show in showsList) { List<ShowDetails> showDetailsList = ShowDetails.GetShowDaysList(show.ShowID); String classLimit = ""; if (showDetailsList.Count > 0) { classLimit = String.Format(" classlimit='{0}' ", showDetailsList[0].ClassLimit); } lstAvailableShows.InnerHtml += String.Format("<div data-showtype='0' data-dvshow='{7}' data-auto='false' class='ShowDetails' {6} showid='{5}' showdate='{2:dd MMM yyyy}' closingdate='{1:dd MMM yyyy}' venue='{3}' venuepostcode='{4}'>{0}</div>", show.ShowName, show.ClosingDate, show.ShowDate, show.Venue, show.VenuePostcode, show.ShowID, classLimit, (show.OrgID == 1)); } } else { lstAvailableShows.InnerHtml = "<div class='noshowsavailable'>No Shows Available</div>"; } user.firstTime = true; } else { Response.Redirect("~/"); } }