protected void Page_Load(object sender, EventArgs e) { string UserEmail = ""; HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; // Read the cookie information and display it. if (myTestCookie != null) { // User details collected UserEmail = myTestCookie.Value; } else { // No user cookie redirect to login Response.Redirect("/"); } UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(myTestCookie.Value); FirstName.Text = objUser.FirstName; LastName.Text = objUser.LastName; Email.Text = objUser.Email; Password.Text = objUser.Password; }
protected void Page_Load(object sender, EventArgs e) { // Check user logged in! string UserEmail = ""; HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; // Read the cookie information and display it. if (myTestCookie != null) { // User details collected UserEmail = myTestCookie.Value; } else { // No user cookie redirect to login Response.Redirect("/"); } UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(UserEmail); CalendarLiteral.Text = "<script>\n"; CalendarLiteral.Text += "$(document).ready(function () {\n"; CalendarLiteral.Text += "$('#calendar').fullCalendar({\n"; CalendarLiteral.Text += "header: {\n"; CalendarLiteral.Text += "left: 'prev,next today',\n"; CalendarLiteral.Text += "center: 'title',\n"; CalendarLiteral.Text += "right: 'month,agendaWeek,agendaDay'\n"; CalendarLiteral.Text += "},\n"; CalendarLiteral.Text += "// defaultDate: '2015-02-12',\n"; CalendarLiteral.Text += "editable: true,\n"; CalendarLiteral.Text += "eventLimit: true, // allow more link when too many events\n"; CalendarLiteral.Text += "events: {\n"; CalendarLiteral.Text += "url: 'get-events.aspx?AgentID=" + objUser.UserID + "&isAgent="+ objUser.isAgent +"',\n"; CalendarLiteral.Text += "error: function () {\n"; CalendarLiteral.Text += "$('#script-warning').show();\n"; CalendarLiteral.Text += "}\n"; CalendarLiteral.Text += "},\n"; CalendarLiteral.Text += "loading: function (bool) {\n"; CalendarLiteral.Text += "$('#loading').toggle(bool);\n"; CalendarLiteral.Text += "}\n"; CalendarLiteral.Text += "})\n;"; CalendarLiteral.Text += "});\n"; CalendarLiteral.Text += "</script>"; }
protected void SaveBtn_Click(object sender, EventArgs e) { UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; objUser.getUserFromEmail(myTestCookie.Value); objUser.FirstName = FirstName.Text; objUser.LastName = LastName.Text; objUser.Email = Email.Text; objUser.Password = Password.Text; objUser.Save(); }
protected void Page_Load(object sender, EventArgs e) { string UserEmail = ""; HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; // Read the cookie information and display it. if (myTestCookie != null) { // User details collected UserEmail = myTestCookie.Value; } else { // No user cookie redirect to login Response.Redirect("/"); } int thisPageIndex = 0; string thisQuery = ""; string thisSQL = ""; DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect); DBCommand = DBConnection.CreateCommand(); if (!string.IsNullOrEmpty(Request.QueryString["Query"])) { thisQuery = Request.QueryString["Query"]; thisSQL = " and (Name like '%" + thisQuery + "%' or Company like '%" + thisQuery + "%' or Tel like '%" + thisQuery + "%' or Mobile Like '%" + thisQuery + "%' or Email Like '%" + thisQuery + "%')"; SearchQuery.Text = thisQuery; } if (string.IsNullOrEmpty(Request.QueryString["PageIndex"])) { thisPageIndex = 0; } else { thisPageIndex = Convert.ToInt32(Request.QueryString["PageIndex"]); } DBConnection.Open(); UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(UserEmail); if (objUser.isAgent) DBCommand.CommandText = "select * from Contacts where AgentID = '" + objUser.UserID + "' and (ContactType = 2 or ContactType is null) " + thisSQL + " order by RecordID desc limit " + thisPageIndex + ", 25;"; else DBCommand.CommandText = "select * from Contacts where (ContactType = 2 or ContactType is null) " + thisSQL + " order by RecordID desc limit " + thisPageIndex + ", 25;"; DBResult = DBCommand.ExecuteReader(); Results.Text = ""; while (DBResult.Read()) { Results.Text += "<tr><th scope=\"row\">" + DBResult["Name"].ToString() + "</td><td>" + DBResult["Company"].ToString() + "</td><td>" + DBResult["Tel"].ToString() + "</td><td>" + DBResult["Mobile"].ToString() + "</td><td><a href=\"/ContactDetails.aspx?ContactID=" + DBResult["ContactID"].ToString() + "\" class=\"btn-default btn\">View</a> <a class=\"btn-default btn\" href=\"javascript: if (confirm('Remove contact?')) { document.location.href = '/RemoveContact.aspx?ContactID=" + DBResult["ContactID"].ToString() + "&Op=/Productioncompanies.aspx';}\">Remove</a></td></tr>"; } int PreviousPageIndex = 0; int NextPageIndex = 0; Paging.Text = ""; if (thisPageIndex > 0) { PreviousPageIndex = thisPageIndex - 25; Paging.Text = "<a class=\"btn-default btn\" href=\"Productioncompanies.aspx?Query=" + Request.QueryString["Query"] + "&PageIndex=" + PreviousPageIndex + "\">< Previous</a> "; } NextPageIndex = thisPageIndex + 25; Paging.Text += "<a class=\"btn-default btn\" href=\"Productioncompanies.aspx?Query=" + Request.QueryString["Query"] + "&PageIndex=" + NextPageIndex + "\">Next ></a>"; DBResult.Close(); DBConnection.Close(); DBConnection.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { // Check user authorised! string UserEmail = ""; string UserID = ""; // Read System Cookie for User Email / ID HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; // Read the cookie information and display it. if (myTestCookie != null) { // User details collected UserEmail = myTestCookie.Value; } else { // No user cookie redirect to login Response.Redirect("/"); } // Continue normal programming string thisOp = Request.QueryString["Op"]; // Get Messages // Check details against DB DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect); DBCommand = DBConnection.CreateCommand(); UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(UserEmail); UserID = objUser.UserID; // Get Tasks int myCount = 0; switch (thisOp) { case "AllTasks": TableHeaderLiteral.Text = "<tr><th>User</th><th>Task</th><th width=\"150\">Date Created</th><th width=\"180\"></th></tr>"; DBConnection.Open(); DBCommand.CommandText = "select Tasks.*, userdetails.firstname from Tasks left join Userdetails on userdetails.UserID = Tasks.AssignedUserID where IsComplete = 0 order by DateAdded asc;"; DBResult = DBCommand.ExecuteReader(); Messages.Text = ""; myCount = 0; while (DBResult.Read()) { string isAction = ""; if (!string.IsNullOrEmpty(DBResult["TaskAction"].ToString())) { isAction = "<a href=\"/" + UK_Film_Location_Class.UKFilmLocation.getTaskFromAction(DBResult["TaskAction"].ToString(), DBResult["TaskAttributes"].ToString()) + "\" class=\"btn-default btn\">Do</a> "; } Messages.Text += "<tr><td scope=\"row\">" + DBResult["FirstName"].ToString() + "</td><td>" + DBResult["Task"].ToString() + "</td><td>" + DBResult["DateAdded"].ToString() + "</td><td align=\"right\">" + isAction + "<a href=\"javascript:if (confirm('Are you sure you want to sign off this task?')) {document.location.href='/completetask.aspx?TaskID=" + DBResult["RecordID"].ToString() + "';}\" class=\"btn-default btn\">Complete</a></td></tr>"; myCount++; } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Outstanding Tasks : " + myCount + "<br>"; break; case "LocationTasks": DBConnection.Open(); DBCommand.CommandText = "select * from Locations where Approved = 0 and Removed = 0 order by RecordID desc;"; DBResult = DBCommand.ExecuteReader(); Messages.Text = ""; myCount = 0; while (DBResult.Read()) { string thisAction = ""; TableHeaderLiteral.Text = "<tr><th>Task</th><th width=\"50\"></th></tr>"; thisAction += "This property needs to be approved!<br>"; if (string.IsNullOrEmpty(DBResult["LocationID"].ToString())) { thisAction += "This property needs an ID!<br>"; } string thisPath = ""; thisPath = Server.MapPath("~/Locations/") + "/" + DBResult["LocationID"].ToString() + "/" + DBResult["LocationID"].ToString() + "_1-64x64.jpg"; if (!File.Exists(thisPath)) { thisAction += "This property needs an image!"; } if (!string.IsNullOrEmpty(thisAction)) { Messages.Text += "<tr><td scope=\"row\"><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\">Location : " + DBResult["LocationID"].ToString() + " - " + DBResult["Title"].ToString() + "<br>" + thisAction + "</a></td><td><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\" class=\"btn-default btn\">Do</a></td></tr>"; } myCount++; } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Locations needing approval : " + myCount + "<br>"; // Check Images DBConnection.Open(); DBCommand.CommandText = "select Locations.RecordID, Locations.LocationID, Locations.Title, (select count(*) from LocationImages where locationimages.LocationID = locations.LocationID ) as NumRecs from Locations where Approved = 1 order by RecordID asc;"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string thisAction = ""; if (DBResult["NumRecs"].ToString() == "0") { thisAction = "Location : " + DBResult["LocationID"].ToString() + " - " + DBResult["Title"].ToString() + "<br>This location needs an image!"; } if (!string.IsNullOrEmpty(thisAction)) { Messages.Text += "<tr><th scope=\"row\"><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\">" + thisAction + "</a></td><td><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\" class=\"btn-default btn\">Do</a></td></tr>"; myCount++; } } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Locations needing images : " + myCount + "<br>"; break; case "KitchenTasks": // Check Images DBConnection.Open(); DBCommand.CommandText = "SELECT distinct(Locations.LocationID), locations.Title, locations.RecordID, (select COUNT(LocationImages.LocationID) from LocationImages where LocationImages.LocationID = Locations.LocationID and LocationImages.Target = 'Kitchen') AS ImageCount, Locations.Approved FROM Locations LEFT JOIN LocationImages on Locations.LocationID = LocationImages.LocationID where Locations.Approved = 1 and (not Locations.kitchentype = '' and not Locations.kitchentype is null) having ImageCount = 0;"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string thisAction = ""; if (DBResult["ImageCount"].ToString() == "0") { thisAction = "Location : " + DBResult["LocationID"].ToString() + " - " + DBResult["Title"].ToString() + "<br>This location needs an image!"; } if (!string.IsNullOrEmpty(thisAction)) { Messages.Text += "<tr><th scope=\"row\"><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\">" + thisAction + "</a></td><td><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\" class=\"btn-default btn\">Do</a></td></tr>"; myCount++; } } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Kitchen locations needing images : " + myCount + "<br>"; break; case "WarehouseTasks": // Check Images DBConnection.Open(); DBCommand.CommandText = "SELECT distinct(Locations.LocationID), locations.Title, locations.RecordID, (select COUNT(LocationImages.LocationID) from LocationImages where LocationImages.LocationID = Locations.LocationID and LocationImages.Target = 'Warehouse') AS ImageCount, Locations.Approved FROM Locations LEFT JOIN LocationImages on Locations.LocationID = LocationImages.LocationID where Locations.Approved = 1 and Locations.TypeID like '%2162%' having ImageCount = 0;"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string thisAction = ""; if (DBResult["ImageCount"].ToString() == "0") { thisAction = "Location : " + DBResult["LocationID"].ToString() + " - " + DBResult["Title"].ToString() + "<br>This location needs an image selected!"; } if (!string.IsNullOrEmpty(thisAction)) { Messages.Text += "<tr><th scope=\"row\"><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\">" + thisAction + "</a></td><td><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\" class=\"btn-default btn\">Do</a></td></tr>"; myCount++; } } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Warehouse locations needing images selecting : " + myCount + "<br>"; break; case "AddressTasks": // Check Images DBConnection.Open(); DBCommand.CommandText = "SELECT distinct(Locations.LocationID), locations.Title, locations.RecordID FROM Locations where Removed = 0 and (Locations.Address = '' or Locations.Address is null or Locations.Postcode = '' or Locations.Postcode is null);"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string thisAction = ""; thisAction = "Location : " + DBResult["LocationID"].ToString() + " - " + DBResult["Title"].ToString() + "<br>This location needs address details checked!"; if (!string.IsNullOrEmpty(thisAction)) { Messages.Text += "<tr><th scope=\"row\"><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\">" + thisAction + "</a></td><td><a href=\"/LocationDetails.aspx?RecordID=" + DBResult["RecordID"].ToString() + "\" class=\"btn-default btn\">Do</a></td></tr>"; myCount++; } } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Locations needing address details : " + myCount + "<br>"; break; case "MissingEmail": // Check Images DBConnection.Open(); DBCommand.CommandText = "SELECT ContactID, Name, Email, Tel, Mobile, RecordID FROM Contacts where email is null or email = '';"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string thisAction = ""; thisAction = DBResult["Name"].ToString() + "<br>Tel : " + DBResult["Tel"].ToString() + "<br>Mobile : " + DBResult["Mobile"].ToString() + "<br>This contact needs details checked!"; if (!string.IsNullOrEmpty(thisAction)) { Messages.Text += "<tr><th scope=\"row\"><a href=\"/ContactDetails.aspx?ContactID=" + DBResult["ContactID"].ToString() + "\">" + thisAction + "</a></td><td><a href=\"/ContactDetails.aspx?ContactID=" + DBResult["ContactID"].ToString() + "\" class=\"btn-default btn\">Do</a></td></tr>"; myCount++; } } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Locations needing address details : " + myCount + "<br>"; break; default: TableHeaderLiteral.Text = "<tr><th colspan=\"2\">Task</th><th width=\"150\">Date Created</th><th width=\"180\"></th></tr>"; DBConnection.Open(); if (objUser.isAgent) DBCommand.CommandText = "select * from Tasks where (AssignedUserID = '" + UserID + "') and IsComplete = 0 order by DateAdded asc;"; else DBCommand.CommandText = "select * from Tasks where (AssignedUserID = '" + UserID + "' or AssignedUserID = '0') and IsComplete = 0 order by DateAdded asc;"; DBResult = DBCommand.ExecuteReader(); Messages.Text = ""; myCount = 0; while (DBResult.Read()) { string isAction = ""; if (!string.IsNullOrEmpty(DBResult["TaskAction"].ToString())) { isAction = "<a href=\"/" + UK_Film_Location_Class.UKFilmLocation.getTaskFromAction(DBResult["TaskAction"].ToString(), DBResult["TaskAttributes"].ToString()) + "\" class=\"btn-default btn\">Do</a> "; } UK_Film_Location_Class.Tasks objTask = new UK_Film_Location_Class.Tasks(); objTask.getTask(Convert.ToInt32(DBResult["RecordID"].ToString())); Messages.Text += "<tr><td scope=\"row\" width=\"36\">" + UK_Film_Location_Class.Tasks.getTaskPriorityIcon(Convert.ToInt32(DBResult["Priority"].ToString()), 32) + "</td><td>" + objTask.Text + "</td><td>" + DBResult["DateAdded"].ToString() + "</td><td>" + isAction + "<a href=\"javascript:if (confirm('Are you sure you want to sign off this task?')) {document.location.href='/completetask.aspx?TaskID=" + DBResult["RecordID"].ToString() + "';}\" class=\"btn-default btn\">Complete</a></td></tr>"; myCount++; } DBResult.Close(); DBConnection.Close(); StatsLiteral.Text += "Outstanding Tasks : " + myCount + "<br>"; break; } DBConnection.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { string thisID = Request.QueryString["RecceID"]; if (!string.IsNullOrEmpty(thisID)) { string Message = ""; HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(myTestCookie.Value); UK_Film_Location_Class.RecceDates objRecce = new UK_Film_Location_Class.RecceDates(); objRecce.getRecceAppointment(thisID); UK_Film_Location_Class.OpportunityDetails objOpportunity = new UK_Film_Location_Class.OpportunityDetails(); objOpportunity.getOpportunity(objRecce.OpportunityID); UK_Film_Location_Class.ContactDetails objProductionContact = new UK_Film_Location_Class.ContactDetails(); objProductionContact.getContact(objOpportunity.ContactID); UK_Film_Location_Class.LocationDetails objLocation = new UK_Film_Location_Class.LocationDetails(); objLocation.getLocationFromID(objOpportunity.LocationID); UK_Film_Location_Class.ContactDetails objLocationContact = new UK_Film_Location_Class.ContactDetails(); objLocationContact.getContact(objLocation.ContactID); // Check Fields // Update or Create Record DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect); DBCommand = DBConnection.CreateCommand(); // Location Address string thisAddress = ""; if (!string.IsNullOrEmpty(objLocation.Address)) thisAddress += objLocation.Address; if (!string.IsNullOrEmpty(objLocation.Street)) thisAddress += ", " + objLocation.Street; if (!string.IsNullOrEmpty(objLocation.Town)) thisAddress += ", " + objLocation.Town; if (!string.IsNullOrEmpty(objLocation.County)) thisAddress += ", " + objLocation.County; if (!string.IsNullOrEmpty(objLocation.Postcode)) thisAddress += ", " + objLocation.Postcode; DBConnection.Open(); // Update Record DBCommand.CommandText = "update Tasks set IsComplete = '1', DateComplete = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLDate(DateTime.Now.ToString()) + "' where TaskAttributes = '" + thisID + "' and TaskAction = 'RECCE REQUEST'"; DBCommand.ExecuteNonQuery(); DBConnection.Close(); DBConnection.Open(); // Update Record DBCommand.CommandText = "update RecceDates set EmailSent = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLDate(DateTime.Now.ToString()) + "' where RecordID = '" + thisID + "'"; DBCommand.ExecuteNonQuery(); DBConnection.Close(); // Send Owner Email Message = "<p>" + objLocationContact.Name + ", we are pleased to confirm the date(s) of the recce for " + objProductionContact.Name + " at location " + objLocation.LocationID + ". </p>"; Message += "<p>"; Message += "Below are the details of the confirmed recce booking. You can also view all your recce requests on our website, <a href=\"http://ukfilmlocation.dev/MyRecces.aspx\">click here</a>. If you have any questions please let us know, telephone 0844 669 5245.</p>"; Message += "<p>You can download a PDF version of this appointment by <a target=\"_blank\" href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/RecceAppointment.php?RecceDateID=" + thisID + "&Recipient=" + objLocationContact.ContactID + "\">clicking here</a>.</p>"; Message += "<h2>Recce Details</h2>"; Message += "<p>Location Ref : <a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/Location.aspx?LocationID=" + objLocation.LocationID + "\">" + objLocation.LocationID + "</a><br>"; Message += "Address : " + thisAddress + "</p>"; Message += "<p>"; // Message += "<p>Date Of Recce : " + DateTime.Parse(RecceDateLiteral.Text).ToShortDateString() + "<br>"; // Message += "Time Of Recce : " + RecceTimeLiteral.Text + "<br>"; Message += "Contact : " + objProductionContact.Name + "<br>"; Message += "Contact Tel : " + objProductionContact.Tel + "<br>"; Message += "Contact Mobile : " + objProductionContact.Mobile + "<br>"; // Message += "Notes : " + RecceNotesTextBox.Text; Message += "</p>"; Message += "<h2>Recce Details</h2>"; Message += "<p>"; if (!string.IsNullOrEmpty(objRecce.RecceDate.ToShortDateString())) Message += "Date Of Recce : " + objRecce.RecceDate.ToShortDateString().Replace(" 00:00:00", "") + "<br>"; if (!string.IsNullOrEmpty(objRecce.Time)) Message += "Time Of Recce : " + objRecce.Time + "<br>"; if (!string.IsNullOrEmpty(objOpportunity.TypeOfShoot)) Message += "Type Of Shoot : " + objOpportunity.TypeOfShoot + "<br>"; //if (!string.IsNullOrEmpty(AgreedRateTextBox.Text)) Message += "Agreed Agency Rate % : " + AgreedRateTextBox.Text + "<br>"; if (!string.IsNullOrEmpty(objRecce.Notes)) Message += "Notes : " + objRecce.Notes.Replace("\n", "<br>"); Message += "</p>"; Message += "<p>Agent : " + objUser.FirstName + " " + objUser.LastName + "<br>"; Message += "Agent Email : " + objUser.Email + "<br>"; Message += "Agent Tel : 0844 669 5245 / 01782 388090</p>"; Message += "<p>We appreciate your feedback, please let us know how it went.</p>"; Message += "<p><i>UKFilmLocation.com</i><br>"; Message += "Tel 0844 669 5245</p>"; UK_Film_Location_Class.UKFilmLocation.sendEmail(objLocationContact.Email, objUser.FirstName + " " + objUser.LastName, objUser.Email, "UKFilmLocation.com - Recce Confirmation for Location: " + objLocation.LocationID + " (" + UK_Film_Location_Class.LocationDetails.getTitleFromID(objLocation.LocationID) + ")", Message); // Send Project Company Email // Send emails Message = "<p>" + objProductionContact.Name + ", we are pleased to confirm the date(s) of your recce at location " + objLocation.LocationID + ". We hope the location lives up to your expectations.</p><p>You can download a printable PDF for this location by <a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/LocationPDF.php?LocationID=" + objLocation.LocationID + "\" target=\"_blank\">clicking here</a>.</p>"; Message += "<p>"; Message += "Below are the details of the confirmed recce booking. You can also view all your recce requests on our website, <a href=\"http://ukfilmlocation.dev/MyRecces.aspx\">click here</a>. If you have any questions please let us know, telephone 0844 669 5245.</p>"; Message += "<p>You can download a PDF version of this appointment by <a target=\"_blank\" href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/RecceAppointment.php?RecceDateID=" + thisID + "&Recipient=" + objProductionContact.ContactID + "\">clicking here</a>.</p>"; Message += "<h2>Recce Details</h2>"; Message += "<p>Location Ref : <a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/Location.aspx?LocationID=" + objLocation.LocationID + "\">" + objLocation.LocationID + "</a><br>"; Message += "Address : " + thisAddress + "</p>"; Message += "<p>"; // Date Of Recce : " + DateTime.Parse(RecceDateLiteral.Text).ToShortDateString() + "<br>"; // Message += "Time Of Recce : " + RecceTimeLiteral.Text + "<br>"; Message += "Owner : " + objLocationContact.Name + "<br>"; Message += "Owner Tel : " + objLocationContact.Tel + "<br>"; Message += "Owner Mobile : " + objLocationContact.Mobile + "<br>"; // Message += "Notes : " + RecceNotesTextBox.Text; Message += "</p>"; Message += "<h2>Recce Details</h2>"; Message += "<p>"; if (!string.IsNullOrEmpty(objRecce.RecceDate.ToShortDateString())) Message += "Date Of Recce : " + objRecce.RecceDate.ToShortDateString().Replace(" 00:00:00", "") + "<br>"; if (!string.IsNullOrEmpty(objRecce.Time)) Message += "Time Of Recce : " + objRecce.Time + "<br>"; if (!string.IsNullOrEmpty(objOpportunity.TypeOfShoot)) Message += "Type Of Shoot : " + objOpportunity.TypeOfShoot + "<br>"; //if (!string.IsNullOrEmpty(AgreedRateTextBox.Text)) Message += "Agreed Agency Rate % : " + AgreedRateTextBox.Text + "<br>"; if (!string.IsNullOrEmpty(objRecce.Notes)) Message += "Notes : " + objRecce.Notes.Replace("\n", "<br>"); Message += "</p>"; Message += "<p>Agent : " + objUser.FirstName + " " + objUser.LastName + "<br>"; Message += "Agent Email : " + objUser.Email + "<br>"; Message += "Agent Tel : 0844 669 5245 / 01782 388090</p>"; Message += "<p><i>UKFilmLocation.com</i><br>"; Message += "Tel 0844 669 5245</p>"; UK_Film_Location_Class.UKFilmLocation.sendEmail(objProductionContact.Email, objUser.FirstName + " " + objUser.LastName, objUser.Email, "UKFilmLocation.com - Recce Confirmation for Location: " + objLocation.LocationID + " (" + UK_Film_Location_Class.LocationDetails.getTitleFromID(objLocation.LocationID) + ")", Message); Response.Redirect("/OpportunityDetails.aspx?OpportunityID=" + objOpportunity.OpportunityID); } DBConnection.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { string UserEmail = ""; HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; // Read the cookie information and display it. if (myTestCookie != null) { // User details collected UserEmail = myTestCookie.Value; } else { // No user cookie redirect to login Response.Redirect("/"); } if (!IsPostBack) { UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(UserEmail); UK_Film_Location_Class.BookingDetails objBooking = new UK_Film_Location_Class.BookingDetails(); UK_Film_Location_Class.OpportunityDetails objOpportunity = new UK_Film_Location_Class.OpportunityDetails(); objBooking.UserID = objUser.RecordID.ToString(); objBooking.BookingID = Request.QueryString["BookingID"]; objOpportunity.OpportunityID = Request.QueryString["OpportunityID"]; if (!string.IsNullOrEmpty(objBooking.BookingID)) { objBooking.getBooking(objBooking.BookingID); objOpportunity.OpportunityID = objBooking.OpportunityID; CreatePanel.Visible = false; BookingPanel.Visible = true; } else { objBooking.DateBooked = DateTime.Now; CreatePanel.Visible = true; BookingPanel.Visible = false; } BookingID.Value = objBooking.BookingID; objOpportunity.getOpportunity(objOpportunity.OpportunityID); UK_Film_Location_Class.LocationDetails objLocation = new UK_Film_Location_Class.LocationDetails(); objLocation.getLocationFromID(objOpportunity.LocationID); UK_Film_Location_Class.ContactDetails objLocationContact = new UK_Film_Location_Class.ContactDetails(); objLocationContact.getContact(objLocation.ContactID); UK_Film_Location_Class.ContactDetails objProjectContact = new UK_Film_Location_Class.ContactDetails(); objProjectContact.getContact(objOpportunity.ContactID); UK_Film_Location_Class.ProjectDetails objProject = new UK_Film_Location_Class.ProjectDetails(); objProject.getProjectDetails(objOpportunity.ProjectID); if (!string.IsNullOrEmpty(objBooking.BookingID)) BookingRefLiteral.Text = "(" + objBooking.BookingID + ") <a class=\"btn-default btn\" target=\"_blank\" href=\"/BookingFormPDF.php?BookingID=" + objBooking.BookingID + "\">Booking Form <i class=\"fa fa-file-pdf-o\"></i></a>"; if (!string.IsNullOrEmpty(objBooking.ContractTemplate)) BookingRefLiteral.Text += " <a class=\"btn-default btn\" target=\"_blank\" href=\"" + objBooking.ContractTemplate + "\">Contract <i class=\"fa fa-file-word-o\"></i></a>"; BookingRefLiteral.Text += " <a class=\"btn-default btn\" target=\"_blank\" href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/InvoicePDF.php?BookingID=" + objBooking.BookingID + "\">Preview Invoice <i class=\"fa fa-file-pdf-o\"></i></a>"; BookingLocationLiteral.Text = "<table width=\"100%\">"; BookingLocationLiteral.Text += "<tr><td width=\"150\" style=\"font-size: larger;\">Job Ref</td><td style=\"font-size: larger;\"><a href=\"/OpportunityDetails.aspx?OpportunityID=" + objOpportunity.OpportunityID + "\">" + objOpportunity.JobRef + "-" + objBooking.BookingID + " <i class=\"fa fa-external-link-square\" title=\"Opportunity Details\"></i></a></td></tr>"; BookingLocationLiteral.Text += "<tr><td>Project Title</td><td><a href=\"/ProjectDetails.aspx?ProjectID=" + objProject.ProjectID + "\">" + objProject.WorkingTitle + " <i class=\"fa fa-external-link-square\" title=\"Project Details\"></i></a></td></tr>"; BookingLocationLiteral.Text += "</table><br>"; BookingLocationLiteral.Text += "<table width=\"100%\">"; BookingLocationLiteral.Text += "<tr><td width=\"150\" style=\"font-size: larger;\">Location Ref</td><td style=\"font-size: larger;\"><a href=\"/LocationDetails.aspx?LocationID=" + objOpportunity.LocationID + "\">" + objOpportunity.LocationID + " <i class=\"fa fa-external-link-square\" title=\"Location Details\"></i></a></td></tr>"; BookingLocationLiteral.Text += "<tr><td>Date Booked</td><td>" + objBooking.DateBooked.ToShortDateString() + "</td></tr>"; BookingLocationLiteral.Text += "<tr><td>Location Contact</td><td><a href=\"/ContactDetails.aspx?ContactID=" + objLocation.ContactID + "\">" + objLocationContact.Name + " <i class=\"fa fa-external-link-square\" title=\"Contact Details\"></i></a></td></tr>"; BookingLocationLiteral.Text += "<tr><td>Company</td><td>" + objLocationContact.Company + "</td></tr>"; BookingLocationLiteral.Text += "<tr><td>Tel</td><td>" + objLocationContact.Tel + "</td></tr>"; BookingLocationLiteral.Text += "<tr><td>Mobile</td><td>" + objLocationContact.Mobile + "</td></tr>"; BookingLocationLiteral.Text += "</table><br>"; BookingLocationLiteral.Text += "<table width=\"100%\">"; BookingLocationLiteral.Text += "<tr><td width=\"150\">Project Contact</td><td><a href=\"/ContactDetails.aspx?ContactID=" + objProjectContact.ContactID + "\">" + objProjectContact.Name + " <i class=\"fa fa-external-link-square\" title=\"Contact Details\"></i></a></td></tr>"; BookingLocationLiteral.Text += "<tr><td>Company</td><td>" + objProjectContact.Company + "</td></tr>"; BookingLocationLiteral.Text += "<tr><td>Tel</td><td>" + objProjectContact.Tel + "</td></tr>"; BookingLocationLiteral.Text += "<tr><td>Mobile</td><td>" + objProjectContact.Mobile + "</td></tr>"; BookingLocationLiteral.Text += "</table><br>"; if (!string.IsNullOrEmpty(objBooking.ContractTemplate)) { BookingLocationLiteral.Text += "<p>"; BookingLocationLiteral.Text += "Contract Generated : <a class=\"btn-default btn\" href=\"/Bookings/" + objBooking.BookingID + "/" + objBooking.BookingID + ".docx\" target=\"_blank\">Download <i class=\"fa fa-file-word-o\"></i></a>"; BookingLocationLiteral.Text += "</p>"; } BookingFeesLiteral.Text += "<table width=\"100%\">"; BookingFeesLiteral.Text += "<tr><td>Agreed Agency Rate</td><td align=\"right\">" + objOpportunity.AgreedRate + "%</td></tr>"; BookingFeesLiteral.Text += "<tr><td>VAT Rate</td><td align=\"right\">" + objOpportunity.VATRate + "%</td></tr>"; BookingFeesLiteral.Text += "<tr><td>Agreed Location Rate (per day)</td><td align=\"right\">£" + objOpportunity.LocationRate.ToString("0.00") + "</td></tr>"; BookingFeesLiteral.Text += "<tr><td>Agreed Location VAT (per day)</td><td align=\"right\">£" + objOpportunity.LocationVAT.ToString("0.00") + "</td></tr>"; // BookingFeesLiteral.Text += "<tr><td>Agreed Agency Fee</td><td align=\"right\">£" + objOpportunity.AgencyRate.ToString("0.00") + "</td></tr>"; // BookingFeesLiteral.Text += "<tr><td>Agreed Agency VAT</td><td align=\"right\">£" + objOpportunity.AgencyVAT.ToString("0.00") + "</td></tr>"; BookingFeesLiteral.Text += "<tr><td>Location Deposit</td><td align=\"right\">£" + objOpportunity.Deposit.ToString("0.00") + "</td></tr>"; BookingFeesLiteral.Text += "<tr><td>Damage Deposit</td><td align=\"right\">£" + objOpportunity.DamageDeposit.ToString("0.00") + "</td></tr>"; BookingFeesLiteral.Text += "</table><br>"; // Get list of bookings DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect); DBCommand = DBConnection.CreateCommand(); // Opportunities DBConnection.Open(); DBCommand.CommandText = "select BookingDates.NoCrew, BookingDates.BookingDate, BookingDates.BookingID, BookingDates.StartTime, BookingDates.EndTime, BookingDates.Notes, BookingDates.BookingDateID, BookingDates.AgreedDayRate from BookingDates where BookingDates.BookingID = '" + objBooking.BookingID + "' order by BookingDates.BookingDate asc;"; DBResult = DBCommand.ExecuteReader(); int noDays = 0; double totalDayHire = 0; while (DBResult.Read()) { double AgreedRate = double.Parse(DBResult["AgreedDayRate"].ToString()); BookingsLiteral.Text += "<tr><td><i class=\"fa fa-calendar-o fa-2x\"></i></td><td>" + DateTime.Parse(DBResult["BookingDate"].ToString()).ToShortDateString() + "</td><td>" + DBResult["StartTime"].ToString() + "</td><td>" + DBResult["EndTime"].ToString() + "</td><td>" + DBResult["NoCrew"].ToString() + "</td><td align=\"right\" width=\"150\">£" + AgreedRate.ToString("0.00") + "</td><td align=\"right\" width=\"180\"><a href=\"/BookingDateDetails.aspx?BookingDateID=" + DBResult["BookingDateID"].ToString() + "\" class=\"btn-default btn\">View / Change</a></td></tr>"; BookingsLiteral.Text += "<tr><td colspan=\"3\">" + DBResult["Notes"].ToString() + "</td><td></td></tr>"; if (!string.IsNullOrEmpty(DBResult["AgreedDayRate"].ToString())) { totalDayHire += double.Parse(DBResult["AgreedDayRate"].ToString()); } noDays++; } DBResult.Close(); DBConnection.Close(); if (noDays > 0) GenerateContractBTN.Visible = true; double thisLocationVAT = 0; BookingFeesLiteral.Text += "<table width=\"100%\">"; if (objLocation.VATRegistered == "1") { BookingFeesLiteral.Text += "<tr><td>Total Location hire for " + noDays + " days</td><td align=\"right\">£" + totalDayHire.ToString("0.00") + " + VAT = £" + ((totalDayHire * (objOpportunity.VATRate / 100)) + totalDayHire).ToString("0.00") + "</td></tr>"; thisLocationVAT = (totalDayHire * (objOpportunity.VATRate / 100)); } else { BookingFeesLiteral.Text += "<tr><td>Total Location hire for " + noDays + " days</td><td align=\"right\">£" + totalDayHire.ToString("0.00") + "</td></tr>"; } BookingFeesLiteral.Text += "</table><br>"; BookingFeesLiteral.Text += "<table width=\"100%\">"; double thisAgencyFee = totalDayHire * (objOpportunity.AgreedRate / 100); double thisAgencyVAT = thisAgencyFee * (objOpportunity.VATRate / 100); BookingFeesLiteral.Text += "<tr><td>Agency Fee @ " + objOpportunity.AgreedRate.ToString() + "%</td><td align=\"right\">£" + thisAgencyFee.ToString("0.00") + "</td></tr>"; BookingFeesLiteral.Text += "<tr><td>Agency VAT</td><td align=\"right\">£" + thisAgencyVAT.ToString("0.00") + "</td></tr>"; BookingFeesLiteral.Text += "</table><br>"; BookingFeesLiteral.Text += "<table width=\"100%\">"; // BookingFeesLiteral.Text += "Day Hire = " + totalDayHire + ", AgencyFee = " + thisAgencyFee + ", AgencyVAT = " + thisAgencyVAT + ", Location VAT = " + thisLocationVAT; BookingFeesLiteral.Text += "<tr><td><span style=\"font-size: larger;\">Total Hire</span></td><td align=\"right\"><span style=\"font-size: larger;\">£" + (totalDayHire + thisAgencyFee + thisAgencyVAT + thisLocationVAT).ToString("0.00") + "</span></td></tr>"; BookingFeesLiteral.Text += "<tr><td colspan=\"2\">Plus £" + (objOpportunity.Deposit + objOpportunity.DamageDeposit).ToString("0.00") + " deposit(s)</td></tr>"; BookingFeesLiteral.Text += "<tr><td><span style=\"font-size: larger;\">Total Payable</span></td><td align=\"right\"><span style=\"font-size: larger;\"><b>£" + (totalDayHire + thisAgencyFee + thisAgencyVAT + thisLocationVAT + objOpportunity.Deposit + objOpportunity.DamageDeposit).ToString("0.00") + "</b></span></td></tr>"; BookingFeesLiteral.Text += "</table>"; if (objBooking.InvoiceSent.ToString() != "01/01/0001 00:00:00") { UK_Film_Location_Class.InvoiceDetails objInvoice = new UK_Film_Location_Class.InvoiceDetails(); objInvoice.getInvoice(BookingID.Value); BookingFeesLiteral.Text += "<p><b>"; BookingFeesLiteral.Text += "<br><br>Invoice Sent : " + objBooking.InvoiceSent.ToString().Substring(0, 10) + " #" + objInvoice.RecordID; BookingFeesLiteral.Text += "</b></p>"; } DBConnection.Dispose(); } }
protected void SaveBtn_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(StartDateTextBox.Text) && !string.IsNullOrEmpty(NoDaysTextBox.Text) && !string.IsNullOrEmpty(StartTimeTextBox.Text) && !string.IsNullOrEmpty(FinishTimeTextBox.Text)) { string UserEmail = ""; HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; // Read the cookie information and display it. if (myTestCookie != null) { // User details collected UserEmail = myTestCookie.Value; } UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(UserEmail); // Save Booking Data UK_Film_Location_Class.BookingDetails objBooking = new UK_Film_Location_Class.BookingDetails(); if (!string.IsNullOrEmpty(BookingID.Value)) { objBooking.getBooking(BookingID.Value); } else { objBooking.DateBooked = DateTime.Now; objBooking.OpportunityID = Request.QueryString["OpportunityID"]; objBooking.UserID = objUser.RecordID.ToString(); } objBooking.saveBooking(); // From the start date DateTime thisDate = DateTime.Parse(StartDateTextBox.Text); int thisNoDays = Convert.ToInt32(NoDaysTextBox.Text); UK_Film_Location_Class.OpportunityDetails objOpportunity = new UK_Film_Location_Class.OpportunityDetails(); objOpportunity.getOpportunity(objBooking.OpportunityID); int i = 0; for (i = 0; i < thisNoDays; i++) { // Create Booked Days ready for editing! UK_Film_Location_Class.BookingDates objDate = new UK_Film_Location_Class.BookingDates(); objDate.BookingDate = thisDate; objDate.BookingID = objBooking.BookingID; objDate.StartTime = StartTimeTextBox.Text; objDate.EndTime = FinishTimeTextBox.Text; objDate.AgreedDayRate = objOpportunity.LocationRate; try { objDate.NoCrew = Convert.ToInt32(objOpportunity.NoCrew); } catch { } objDate.Save(); thisDate = thisDate.AddDays(1); } string thisPath = Server.MapPath("~/Bookings/") + "/" + objBooking.BookingID; if (!System.IO.Directory.Exists(thisPath)) { System.IO.Directory.CreateDirectory(thisPath); } Response.Redirect("/BookLocation.aspx?BookingID=" + objBooking.BookingID); } }
protected void SuggestButton_Click(object sender, EventArgs e) { string OpportunityID = UK_Film_Location_Class.ProjectDetails.addLocationToProject(ProjectsDropDownList.SelectedValue, Request.QueryString["LocationID"], ProjectContactsDropDownList.SelectedValue); UK_Film_Location_Class.ContactDetails objContact = new UK_Film_Location_Class.ContactDetails(); objContact.getContact(ProjectContactsDropDownList.SelectedValue); HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(myTestCookie.Value); string Message = ""; string PersonalMessage = ""; if (!string.IsNullOrEmpty(MessageTextBox.Text)) PersonalMessage = "<p>" + MessageTextBox.Text.Replace("\n", "<br>") + "</p>"; Message = "<h1>UKFilmLocation.com : Suggested location : " + Request.QueryString["LocationID"] + "</h1><p>Hi " + objContact.Name + ",<br><br>As discussed " + objUser.FirstName + " has suggested you recce location <a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/Location.aspx?LocationID=" + Request.QueryString["LocationID"] + "\">" + Request.QueryString["LocationID"] + ".</a></p>" + PersonalMessage + "<p><a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/ProjectDetails.aspx?ProjectID=" + ProjectsDropDownList.SelectedValue + "\">View all details surrounding this project here.</a><p><a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/ProjectDetails.aspx?ProjectID=" + ProjectsDropDownList.SelectedValue + "\">View all details surrounding this project here</a> or <a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/MyRecces.aspx\">keep track of your recce appointments here</a>.</p>"; UK_Film_Location_Class.UKFilmLocation.sendEmail(objContact.Email, objUser.FirstName + " " + objUser.LastName, objUser.Email, "Suggest recce for location : " + Request.QueryString["LocationID"], Message); Response.Redirect("/LocationDetails.aspx?LocationID="+ Request.QueryString["LocationID"]); }
protected void SaveBtn_Click(object sender, EventArgs e) { string thisRecordID = Request.QueryString["RecordID"]; string thisContactID = Request.QueryString["ContactID"]; string thisOp = Request.QueryString["Op"]; // Check Fields bool isOK = true; if (string.IsNullOrEmpty(ContactName.Text)) { isOK = false; NamePanel.CssClass = "has-error"; } //if (string.IsNullOrEmpty(Email.Text)) //{ // isOK = false; // EmailPanel.CssClass = "has-error"; //} // if (string.IsNullOrEmpty(Password.Text)) isOK = false; if (!isOK) ErrorLabel.Text = "<div class=\"alert alert-danger\" role=\"alert\"><strong>Save Failed!</strong> Please check the details and try again.</div>"; else { DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect); DBCommand = DBConnection.CreateCommand(); DBConnection.Open(); string isVAT = "0"; if (VATRegisteredCheckBox.Checked) isVAT = "1"; if (string.IsNullOrEmpty(thisRecordID) && string.IsNullOrEmpty(thisContactID)) { Guid ContactID = Guid.NewGuid(); // Create Record DBCommand.CommandText = "insert into Contacts set ContactID = '" + ContactID.ToString() + "', Position = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Position.Text) + "', Email = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Email.Text) + "', Name = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(ContactName.Text) + "', Company = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Company.Text) + "', Address = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Address.Text) + "', Street = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Street.Text) + "', Town = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Town.Text) + "', County = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(County.Text) + "', PostCode = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(PostCode.Text) + "', Country = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Country.Text) + "', Tel = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Tel.Text) + "', Mobile = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Mobile.Text) + "', Password = '******', ContactType = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(ContactType.SelectedValue) + "', isVATRegistered = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(isVAT) + "', Notes = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(NotesTextBox.Text) + "', AgentID = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(AgentID.SelectedValue) + "', Activated = '1', DateRegistered = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLDate(DateTime.Now.ToShortDateString()) + "';"; DBCommand.ExecuteNonQuery(); DBConnection.Close(); DBConnection.Dispose(); // Send contact an email UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; objUser.getUserFromEmail(myTestCookie.Value); string thisMessage = "<h1>Your details have been registered</h1><p>Hi " + ContactName.Text + ",</p><p>Your details have been registered by " + objUser.FirstName + " </p><p>Please verify your email address by clicking this link;</p><p><a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/verify.aspx?ID=" + ContactID.ToString() + "\">http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/verify.aspx?ID=" + ContactID.ToString() + "</a></p><p>Once you have confirmed your details you will be able to track any recce appointments through your personal <a href=\"http://" + UK_Film_Location_Class.UKFilmLocation.DefaultWebsite + "/Dashboard.aspx\">dashboard</a>.</p><p>If you have any problems completing your registration or have any questions please feel free to call us 0844 669 5245.</p><p><b>Thank you.</b></p>"; // Send Email UK_Film_Location_Class.UKFilmLocation.sendEmail(Email.Text, "UKFilmLocation.com", "*****@*****.**", "UKFilmLocation.com : Your details have been registered", thisMessage); if (!string.IsNullOrEmpty(Request.QueryString["Op"])) { Response.Redirect(Request.QueryString["Op"]); } else { Response.Redirect("/ContactDetails.aspx?ContactID=" + ContactID); } } else { string WhereClause = ""; if (!string.IsNullOrEmpty(thisRecordID)) { WhereClause= " RecordID = " + thisRecordID + ";"; } else { WhereClause = " ContactID = '" + thisContactID + "';"; } // Update Record DBCommand.CommandText = "update Contacts set Email = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Email.Text) + "', Name = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(ContactName.Text) + "', Position = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Position.Text) + "', Company = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Company.Text) + "', Address = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Address.Text) + "', Street = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Street.Text) + "', Town = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Town.Text) + "', County = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(County.Text) + "', PostCode = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(PostCode.Text) + "', Country = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Country.Text) + "', Tel = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Tel.Text) + "', Mobile = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(Mobile.Text) + "', Password = '******', ContactType = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(ContactType.SelectedValue) + "', AgentID = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(AgentID.SelectedValue) + "', isVATRegistered = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(isVAT) + "', Notes = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(NotesTextBox.Text) + "' where " + WhereClause; DBCommand.ExecuteNonQuery(); DBConnection.Close(); DBConnection.Dispose(); if (!string.IsNullOrEmpty(Request.QueryString["Op"])) { Response.Redirect(Request.QueryString["Op"]); } } ErrorLabel.Text = "<div class=\"alert alert-success\" role=\"alert\"><strong>OK!</strong> Contact Details Saved.</div>"; } }
protected void Page_Load(object sender, EventArgs e) { // Check user logged in! string UserEmail = ""; HttpCookie myTestCookie = new HttpCookie("UKFilmLocationAdmin"); myTestCookie = Request.Cookies["UKFilmLocationAdmin"]; // Read the cookie information and display it. if (myTestCookie != null) { // User details collected UserEmail = myTestCookie.Value; } else { // No user cookie redirect to login Response.Redirect("/"); } UK_Film_Location_Class.UserDetails objUser = new UK_Film_Location_Class.UserDetails(); objUser.getUserFromEmail(UserEmail); if (!IsPostBack) { string thisRecordID = Request.QueryString["RecordID"]; string thisContactID = Request.QueryString["ContactID"]; if (string.IsNullOrEmpty(ContactID.Value)) { ContactID.Value = thisContactID; } // Contact Type ContactType.Items.Clear(); ListItem newItem = new ListItem(); newItem.Text = "<Select Contact Type>"; newItem.Value = "0"; ContactType.Items.Add(newItem); newItem = new ListItem(); newItem.Text = "Location Contact"; newItem.Value = "1"; ContactType.Items.Add(newItem); newItem = new ListItem(); newItem.Text = "Project Contact"; newItem.Value = "2"; ContactType.Items.Add(newItem); DBConnection = new MySqlConnection(objUKFilmLocation.DBConnect); DBCommand = DBConnection.CreateCommand(); // Get Agents DBConnection.Open(); DBCommand.CommandText = "select * from UserDetails order by FirstName asc, LastName asc;"; DBResult = DBCommand.ExecuteReader(); newItem = new ListItem(); newItem.Text = "<Select Agent>"; newItem.Value = ""; AgentID.Items.Add(newItem); while (DBResult.Read()) { newItem = new ListItem(); newItem.Text = DBResult["FirstName"].ToString() + " " + DBResult["LastName"].ToString(); newItem.Value = DBResult["UserID"].ToString(); AgentID.Items.Add(newItem); } DBResult.Close(); DBConnection.Close(); if (!string.IsNullOrEmpty(thisContactID) || !string.IsNullOrEmpty(thisRecordID)) { DBConnection.Open(); if (!string.IsNullOrEmpty(thisRecordID)) { DBCommand.CommandText = "select * from Contacts where RecordID = " + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(thisRecordID) + ";"; } else { DBCommand.CommandText = "select * from Contacts where ContactID = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(thisContactID) + "';"; } DBResult = DBCommand.ExecuteReader(); if (DBResult.Read()) { ContactID.Value = DBResult["ContactID"].ToString(); thisContactID = DBResult["ContactID"].ToString(); ContactName.Text = DBResult["Name"].ToString(); Email.Text = DBResult["Email"].ToString(); Tel.Text = DBResult["Tel"].ToString(); Mobile.Text = DBResult["Mobile"].ToString(); Password.Text = DBResult["Password"].ToString(); Address.Text = DBResult["Address"].ToString(); Street.Text = DBResult["Street"].ToString(); Town.Text = DBResult["Town"].ToString(); County.Text = DBResult["County"].ToString(); PostCode.Text = DBResult["PostCode"].ToString(); Country.Text = DBResult["Country"].ToString(); Company.Text = DBResult["Company"].ToString(); NotesTextBox.Text = DBResult["Notes"].ToString(); Position.Text = DBResult["Position"].ToString(); AgentID.SelectedValue = DBResult["AgentID"].ToString(); if (DBResult["IsVATRegistered"].ToString() == "1") VATRegisteredCheckBox.Checked = true; if (!string.IsNullOrEmpty(DBResult["DateRegistered"].ToString())) DateRegistered.Text = DateTime.Parse(DBResult["DateRegistered"].ToString()).ToShortDateString(); if (DBResult["Activated"].ToString() == "1") Activated.Text = "YES"; else Activated.Text = "NO"; ContactType.SelectedValue = DBResult["ContactType"].ToString(); AddLocationLiteral.Text = "<a href=\"/locationdetails.aspx?ContactID=" + ContactID.Value + "\" class=\"btn-default btn\">Add Location</a>"; CreateProjectLiteral.Text = " <a class=\"btn-default btn\" href=\"/ProjectDetails.aspx?ContactID=" + ContactID.Value + "\">Create Project</a>"; } DBResult.Close(); DBConnection.Close(); // Bookings DBConnection.Open(); if (ContactType.SelectedValue == "2") { DBCommand.CommandText = "select ProjectDetails.WorkingTitle, ProjectDetails.ProjectID, ProjectDetails.RecordID as JobRef, OpportunityDetails.OpportunityID, Locations.LocationID, Locations.Title as LocationTitle, (select count(*) from bookingdetails where bookingdetails.OpportunityID = opportunitydetails.OpportunityID) as NumBookings from ProjectDetails left join OpportunityDetails on projectdetails.ProjectID = opportunitydetails.ProjectID left join locations on locations.locationid = opportunitydetails.LocationID where ProjectDetails.ContactID = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(thisContactID) + "' having NumBookings > 0;"; } else { DBCommand.CommandText = "select ProjectDetails.WorkingTitle, ProjectDetails.ProjectID, ProjectDetails.RecordID as JobRef, OpportunityDetails.OpportunityID, Locations.LocationID, Locations.Title as LocationTitle, (select count(*) from bookingdetails where bookingdetails.OpportunityID = opportunitydetails.OpportunityID) as NumBookings from locations left join opportunitydetails on locations.LocationID = opportunitydetails.LocationID left join projectdetails on opportunitydetails.ProjectID = projectdetails.ProjectID where locations.ContactID = '" + UK_Film_Location_Class.UKFilmLocation.makeSQLSafe(thisContactID) + "' having NumBookings > 0;"; } int myCount = 0; DBResult = DBCommand.ExecuteReader(); while (DBResult.Read()) { BookingsLabel.Text += "<tr><td scope=\"row\"><i class=\"fa fa-calendar-o\"></i></i></td><td>J"+ DBResult["JobRef"].ToString() +"</td><td>" + DBResult["LocationID"].ToString() + " " + DBResult["LocationTitle"].ToString() + "<br>(" + DBResult["WorkingTitle"].ToString() + ")</td><td align=\"right\"><a href=\"/ProjectDetails.aspx?ProjectID=" + DBResult["ProjectID"].ToString() + "\" class=\"btn-default btn\">View</a></td></tr>"; myCount++; } DBResult.Close(); DBConnection.Close(); NoBookingsLiteral.Text = myCount.ToString(); // recces DBConnection.Open(); DBCommand.CommandText = "select reccedates.RecordID, reccedates.OpportunityID, RecceDates.ReccePurpose, RecceDates.RecceDate, RecceDates.RecceTime, opportunitydetails.ProjectID, opportunitydetails.LocationID, opportunitydetails.contactid as OpportunityContactID, projectdetails.WorkingTitle, Locations.ContactID as LocationContactID, Locations.Title as LocationTitle from reccedates left join opportunitydetails on opportunitydetails.OpportunityID = reccedates.OpportunityID left join projectdetails on opportunitydetails.ProjectID = projectdetails.ProjectID left join locations on opportunitydetails.LocationID = locations.LocationID having OpportunityContactID = '" + thisContactID + "' or LocationContactID = '" + thisContactID + "';"; myCount = 0; DBResult = DBCommand.ExecuteReader(); while (DBResult.Read()) { string isApproved = ""; string thisRecceDate = ""; if (string.IsNullOrEmpty(DBResult["RecceDate"].ToString())) { isApproved = "<i class=\"fa fa-star icon-state-warning\"></i>"; } else { thisRecceDate = DateTime.Parse(DBResult["RecceDate"].ToString()).ToShortDateString(); } // Check Image Exists if (ContactType.SelectedValue == "2") { ReccesList.Text += "<tr><td scope=\"row\">" + isApproved + "</td><td>" + thisRecceDate + "</td><td><a href=\"/LocationDetails.aspx?LocationID=" + DBResult["LocationID"].ToString() + "\">" + DBResult["LocationID"].ToString() + ": " + DBResult["LocationTitle"].ToString().Replace(DBResult["LocationID"].ToString(), "") + "</a><br>" + DBResult["ReccePurpose"].ToString() + "</td><td align=\"right\"><a href=\"/OpportunityDetails.aspx?OpportunityID=" + DBResult["OpportunityID"].ToString() + "\" class=\"btn-default btn\">View</a> <a href=\"/BookLocation.aspx?OpportunityID=" + DBResult["OpportunityID"].ToString() + "&LocationID=" + DBResult["LocationID"].ToString() + "\" class=\"btn-default btn\">Book Location</a> <a class=\"btn-default btn\" href=\"javascript: if (confirm('Cancel Recce?')) { document.location.href='/RemoveRecce.aspx?RecordID=" + DBResult["RecordID"] + "&Op=/ContactDetails.aspx?ContactID=" + ContactID.Value + "';}\">X</a></td></tr>"; } else { ReccesList.Text += "<tr><td scope=\"row\">" + isApproved + "</td><td>" + thisRecceDate + "</td><td><a href=\"/LocationDetails.aspx?LocationID=" + DBResult["LocationID"].ToString() + "\">" + DBResult["LocationID"].ToString() + ": " + DBResult["LocationTitle"].ToString().Replace(DBResult["LocationID"].ToString(), "") + "</a><br>" + DBResult["ReccePurpose"].ToString() + "</td><td align=\"right\"><a href=\"/OpportunityDetails.aspx?OpportunityID=" + DBResult["OpportunityID"].ToString() + "\" class=\"btn-default btn\">View</a> <a class=\"btn-default btn\" href=\"javascript: if (confirm('Cancel Recce?')) { document.location.href='/RemoveRecce.aspx?RecordID=" + DBResult["RecordID"] + "&Op=/ContactDetails.aspx?ContactID=" + ContactID.Value + "';}\">X</a></td></tr>"; } myCount++; } DBResult.Close(); DBConnection.Close(); NoReccesLiteral.Text = myCount.ToString(); // Locations interested in DBConnection.Open(); DBCommand.CommandText = "select OpportunityDetails.OpportunityID, OpportunityDetails.LocationID, OpportunityDetails.ProjectID, OpportunityDetails.RecceDate, OpportunityDetails.ContactID, (select Contacts.Name from Contacts where Contacts.ContactID = OpportunityDetails.ContactID limit 0,1) as ContactName, Locations.Title as locationTitle, Locations.ContactID as LocationContactID from OpportunityDetails left join locations on Locations.LocationID = OpportunityDetails.LocationID where (OpportunityDetails.ContactID = '" + thisContactID + "' or Locations.ContactID = '" + thisContactID + "') and (OpportunityDetails.RequestDate is null or OpportunityDetails.RequestDate = '') order by OpportunityDetails.RecordID desc;"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string isApproved = ""; string thisRecceDate = ""; if (string.IsNullOrEmpty(DBResult["RecceDate"].ToString())) { isApproved = "<i class=\"fa fa-star icon-state-warning\"></i>"; } else { thisRecceDate = DateTime.Parse(DBResult["RecceDate"].ToString()).ToShortDateString(); } if (ContactType.SelectedValue == "2") { InterestedList.Text += "<tr><td scope=\"row\">" + isApproved + "</td><td>" + thisRecceDate + "</td><td><a href=\"/LocationDetails.aspx?LocationID=" + DBResult["LocationID"].ToString() + "\">" + DBResult["LocationID"].ToString() + ": " + DBResult["LocationTitle"].ToString().Replace(DBResult["LocationID"].ToString(), "") + "</a></td><td><a href=\"/OpportunityDetails.aspx?OpportunityID=" + DBResult["OpportunityID"].ToString() + "\" class=\"btn-default btn\">View</a> <a class=\"btn-default btn\" href=\"/RecceDateDetails.aspx?OpportunityID=" + DBResult["OpportunityID"].ToString() + "\">Book Recce</a> <a href=\"/BookLocation.aspx?ContactID=" + DBResult["ContactID"].ToString() + "&OpportunityID=" + DBResult["OpportunityID"].ToString() + "&ProjectID=" + DBResult["ProjectID"].ToString() + "&LocationID=" + DBResult["LocationID"].ToString() + "\" class=\"btn-default btn\">Book Location</a></td></tr>"; myCount++; } else { InterestedList.Text += "<tr><td scope=\"row\">" + isApproved + "</td><td>" + thisRecceDate + "</td><td><a href=\"/LocationDetails.aspx?LocationID=" + DBResult["LocationID"].ToString() + "\">" + DBResult["LocationID"].ToString() + ": " + DBResult["LocationTitle"].ToString().Replace(DBResult["LocationID"].ToString(), "") + "</a></td><td><a href=\"/OpportunityDetails.aspx?OpportunityID=" + DBResult["OpportunityID"].ToString() + "\" class=\"btn-default btn\">View</a></td></tr>"; } } if (ContactType.SelectedValue == "2") NoInterestedLocationsLiteral.Text = myCount.ToString(); DBResult.Close(); DBConnection.Close(); // Projects DBConnection.Open(); DBCommand.CommandText = "select * from ProjectDetails where ContactID = '" + thisContactID + "' order by RecordID desc;"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string isApproved = ""; string thisRecceDate = ""; if (string.IsNullOrEmpty(DBResult["RequestDate"].ToString())) { isApproved = "<i class=\"fa fa-star icon-state-warning\"></i>"; } else { thisRecceDate = DateTime.Parse(DBResult["RequestDate"].ToString()).ToShortDateString(); } // Check Image Exists ProjectList.Text += "<tr><td scope=\"row\">" + isApproved + "</td><td>" + thisRecceDate + "</td><td><a href=\"/ProjectDetails.aspx?ProjectID=" + DBResult["ProjectID"].ToString() + "\">" + DBResult["WorkingTitle"].ToString() + "</a></td><td><a href=\"/ProjectDetails.aspx?ProjectID=" + DBResult["ProjectID"].ToString() + "\" class=\"btn-default btn\">View</a></td></tr>"; myCount++; } DBResult.Close(); DBConnection.Close(); NoProjectsLiteral.Text = myCount.ToString(); switch (ContactType.SelectedValue) { case "1": LocationPanel.Visible = true; ReccePanel.Visible = true; ContactIcon.Text = "<i class=\"fa fa-map-marker\" style=\"float: right;\"></i> "; break; case "2": ReccePanel.Visible = true; ProjectPanel.Visible = true; InterestedPanel.Visible = true; ContactIcon.Text = "<i class=\"fa fa-video-camera\" style=\"float: right;\"></i> "; break; default: ContactIcon.Text = "<i class=\"fa fa-question\" style=\"float: right;\"></i> "; break; } // locations DBConnection.Open(); DBCommand.CommandText = "select * from Locations where ContactID = '" + thisContactID + "';"; DBResult = DBCommand.ExecuteReader(); myCount = 0; while (DBResult.Read()) { string isApproved = ""; string isRemovedStart = ""; string isRemovedEnd = ""; if (DBResult["Removed"].ToString() == "1") { isRemovedStart = "<del>"; isRemovedEnd = "</del>"; } isApproved = DBResult["Approved"].ToString(); if (isApproved == "0") { isApproved = "<i class=\"fa fa-star icon-state-warning\"></i>"; } else { isApproved = ""; } Locations.Text += "<tr><td scope=\"row\">" + isApproved + "</td><td>" + isRemovedStart + DBResult["LocationID"].ToString() + isRemovedEnd + "</td><td><a href=\"/LocationDetails.aspx?LocationID=" + DBResult["LocationID"].ToString() + "\">" + isRemovedStart + DBResult["Title"].ToString() + isRemovedEnd + "</a></td></tr>"; myCount++; } DBResult.Close(); DBConnection.Close(); if (ContactType.SelectedValue == "1") NoLocationsLiteral.Text = myCount.ToString(); DBConnection.Dispose(); } } }