using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Globalization; using MySql.Data.Common; using MySql.Data.Types; using MySql.Data.MySqlClient; using Admin.ClientAdmin.dao; using Admin.VenueAdmin.dao; using Admin.ShowAdmin.dao; namespace Admin.ShowAdmin { public partial class ShowAdd : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) populateDropdowns(); } protected void populateDropdowns() { populateClientDropdown(); populateVenueDropdown(); } protected void populateClientDropdown() { ClientAdminDAO dao = new ClientAdminDAO(); DataTable rdr = dao.getAllClients(); ddlClientList.DataSource = rdr; ddlClientList.DataTextField = "client_name"; ddlClientList.DataValueField = "client_info_tb_id"; ddlClientList.DataBind(); } protected void populateVenueDropdown() { VenueAdminDAO dao = new VenueAdminDAO(); DataTable rdr = dao.getAllVenues(); ddlVenueList.DataSource = rdr; ddlVenueList.DataTextField = "venue_name"; ddlVenueList.DataValueField = "venue_tb_id"; ddlVenueList.DataBind(); } protected void btnAddShow_Click(object sender, EventArgs e) { ShowAdminDAO dao = new ShowAdminDAO(); int iVenueId = int.Parse(ddlVenueList.SelectedItem.Value); int iClientId = int.Parse(ddlClientList.SelectedItem.Value); int iPersonnel = int.Parse(tbNumPersonnel.Text); string sPrepStart = tbArrivalDateTime.Text; DateTime dtShowPrepStart = DateTime.ParseExact(sPrepStart, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture); string sShowStart = tbStartDateTime.Text; DateTime dtShowStart = DateTime.ParseExact(sShowStart, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture); string sShowEnd = tbEndDateTime.Text; DateTime dtShowEnd = DateTime.ParseExact(sShowEnd, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture); string sShowDepart = tbDepartDateTime.Text; DateTime dtShowDepart = DateTime.ParseExact(sShowDepart, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture); int iShowQuoted = 0; int iShowConfirmed = 0; int iShowCompleted = 0; dao.addShow(iVenueId, iClientId, iPersonnel, dtShowPrepStart, dtShowStart, dtShowEnd, dtShowDepart, iShowQuoted, iShowConfirmed, iShowCompleted); /////////////////////// Now Add XRef Entries ///////////////////////// double dPrepTime = dtShowStart.Subtract(dtShowPrepStart).TotalHours; double dShowTime = dtShowEnd.Subtract(dtShowStart).TotalHours; double dTeardownTime = dtShowDepart.Subtract(dtShowEnd).TotalHours; double dTotalTime = dPrepTime + dShowTime + dTeardownTime; int iShowId = dao.ShowID; //This is set after the show insert automatically double dVenueTypeQuant = dTotalTime; int iVenueTypeRef = int.Parse(ddlVenueType.Text); dao.addFeeStructureXREF(iShowId, iVenueTypeRef, dVenueTypeQuant); double dVenueCapacity = double.Parse(tbVenueCapacity.Text); int iVenueCapacityRef = int.Parse(hfVenueCapacity.Value); dao.addFeeStructureXREF(iShowId, iVenueCapacityRef, dVenueCapacity); double dRegCompliance = double.Parse(tbRegCompliance.Text); int iRegComplianceRef = int.Parse(hfRegCompliance.Value); dao.addFeeStructureXREF(iShowId, iRegComplianceRef, dRegCompliance); if (cbCustomChoreography.Checked) { double dCustomChoreography = double.Parse(tbCustomChoreographyTime.Text); int iCustomChoreographyRef = int.Parse(ddlCustomChoreography.SelectedValue); dao.addFeeStructureXREF(iShowId, iCustomChoreographyRef, dCustomChoreography); } double dVenueSurvey = double.Parse(tbVenueSurveyHrs.Text); int iVenueSurveyRef = int.Parse(hfVenueSurveyHrs.Value); dao.addFeeStructureXREF(iShowId, iVenueSurveyRef, dVenueSurvey); double dNumPersonnel = (double)iPersonnel; int iLaborXref = int.Parse(hfNumPersonnel.Value); dao.addFeeStructureXREF(iShowId, iLaborXref, dNumPersonnel); double dTotalLaserWattage = double.Parse(tbLaserWattage.Text); int iTotalWattageXref = int.Parse(hfLaserWattage.Value); dao.addFeeStructureXREF(iShowId, iTotalWattageXref, dTotalLaserWattage); double dHardwareSetup = dPrepTime; int iHardwareSetupXref = int.Parse(hfHardwareSetupHrs.Value); dao.addFeeStructureXREF(iShowId, iHardwareSetupXref, dHardwareSetup); double dDisplayZoneConfig = double.Parse(tbDisplayZoneConfig.Text); int iDisplayZoneConfigXref = int.Parse(hfDisplayZoneConfig.Value); dao.addFeeStructureXREF(iShowId, iDisplayZoneConfigXref, dDisplayZoneConfig); double dShowType = dShowTime; int iShowTypeXref = int.Parse(ddlShowType.SelectedValue); dao.addFeeStructureXREF(iShowId, iShowTypeXref, dShowType); if (cbAudienceScanning.Checked) { double dAudienceScanning = dShowTime; int iAudienceScanningXref = int.Parse(hfAudienceScanning.Value); dao.addFeeStructureXREF(iShowId, iAudienceScanningXref, dAudienceScanning); } if (cbGamingConsole.Checked) { double dGamingConsole = dShowTime; int iGamingConsoleXref = int.Parse(hfGamingConsole.Value); dao.addFeeStructureXREF(iShowId, iGamingConsoleXref, dGamingConsole); } if (cbKinect.Checked) { double dKinect = dShowTime; int iKinectXref = int.Parse(hfKinect.Value); dao.addFeeStructureXREF(iShowId, iKinectXref, dKinect); } double dHardwareTeardown = dTeardownTime; int iHardwareTeardownXref = int.Parse(hfHardwareTeardown.Value); dao.addFeeStructureXREF(iShowId, iHardwareTeardownXref, dHardwareTeardown); if (!string.IsNullOrEmpty(tbMileage.Text) && !(tbMileage.Text.Equals("0"))) { double dMileage = double.Parse(tbMileage.Text); int iMileageXref = int.Parse(hfMileage.Value); dao.addFeeStructureXREF(iShowId, iMileageXref, dMileage); } if (!string.IsNullOrEmpty(tbFoodBoard.Text) && !(tbFoodBoard.Text.Equals("0"))) { double dFoodBoard = double.Parse(tbFoodBoard.Text); int iFoodBoardXref = int.Parse(hfFoodBoard.Value); dao.addFeeStructureXREF(iShowId, iFoodBoardXref, dFoodBoard); } if (!string.IsNullOrEmpty(tbAirfare.Text) && !(tbAirfare.Text.Equals("0"))) { double dAirfare = double.Parse(tbAirfare.Text); int iAirfareXref = int.Parse(hfAirfare.Value); dao.addFeeStructureXREF(iShowId, iAirfareXref, dAirfare); } if (!string.IsNullOrEmpty(tbAutoRental.Text) && !(tbAutoRental.Text.Equals("0"))) { double dAutoRental = double.Parse(tbAutoRental.Text); int iAutoRentalXref = int.Parse(hfAutoRental.Value); dao.addFeeStructureXREF(iShowId, iAutoRentalXref, dAutoRental); } if (!string.IsNullOrEmpty(tbPercentDiscount.Text) && !(tbPercentDiscount.Text.Equals("0"))) { double dPercentDiscount = double.Parse(tbPercentDiscount.Text); int iPercentDiscountXref = int.Parse(hfPercentDiscount.Value); dao.addFeeStructureXREF(iShowId, iPercentDiscountXref, dPercentDiscount); } if (!string.IsNullOrEmpty(tbFlatDiscount.Text) && !(tbFlatDiscount.Text.Equals("0"))) { double dFlatDiscount = double.Parse(tbFlatDiscount.Text); int iFlatDiscountXref = int.Parse(hfFlatDiscount.Value); dao.addFeeStructureXREF(iShowId, iFlatDiscountXref, dFlatDiscount); } /////////////////// If We Got This Far, Redirect Back to Main Mgt Page /////// Response.Redirect("./ShowAdminMain.aspx", false); } } }