protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(GUID))
            {
                SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
                SQLParamList sqlParams = new SQLParamList();
                UserInfo     ui        = SessionWrapper.Get <UserInfo>("UserInfo");
                sqlParams.Add("@GUID", GUID)
                .Add("@UpdateLastViewedTime", !(ui != null || RequestVars.Get <string>("a", null) != null));
                DataSet ds = sql.ExecStoredProcedureDataSet("[spFeedback_GetGuestItem]", sqlParams);
                if (!sql.HasError)
                {
                    Data = ds;

                    GCCPropertyShortCode sc = (GCCPropertyShortCode)Conversion.StringToInt(ds.Tables[0].Rows[0]["PropertyID"].ToString(), 1);

                    Master.ForceSpecificProperty      = sc;
                    MessageTimeline.PropertyShortCode = sc;

                    MessageTimeline.Messages = ds.Tables[1];
                    int feedbackStatus = Conversion.StringToInt(ds.Tables[0].Rows[0]["FeedbackStatusID"].ToString());
                    MessageTimeline.HideReplyBox = ui != null || RequestVars.Get <string>("a", null) != null;

                    Title = PropertyTools.GetCasinoName((int)sc) + " Feedback";
                }
            }
        }
        protected void btnContinue_Click(object sender, EventArgs e)
        {
            GCCPropertyShortCode prop = (GCCPropertyShortCode)ddlProperty.SelectedValue.StringToInt();
            GEISurveyLanguage    GEILIndex;

            if (Master.IsPropertyUser)
            {
                if (ddlProperty.SelectedValue == "18" || ddlProperty.SelectedValue == "19" || ddlProperty.SelectedValue == "22")
                {
                    GEILIndex = (GEISurveyLanguage)ddlSurveyLang.SelectedValue.StringToInt();
                }
                else
                {
                    GEILIndex = (GEISurveyLanguage)1;
                }
                Session["SurveyLang"] = GEILIndex;
                Response.Redirect("/SurveyS/" + User.PropertyShortCode.ToString());
                return;
            }

            if (ddlProperty.SelectedValue == "18" || ddlProperty.SelectedValue == "19" || ddlProperty.SelectedValue == "22")
            {
                GEILIndex = (GEISurveyLanguage)ddlSurveyLang.SelectedValue.StringToInt();
            }
            else
            {
                GEILIndex = (GEISurveyLanguage)1;
            }

            Session["SurveyLang"] = GEILIndex;

            Response.Redirect("/SurveyS/" + prop.ToString());
            return;
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(GUID))
            {
                SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
                SQLParamList sqlParams = new SQLParamList();
                sqlParams.Add("@GUID", GUID);
                DataSet ds = sql.ExecStoredProcedureDataSet("[spFeedback_GetItem]", sqlParams);
                if (!sql.HasError)
                {
                    Data = ds;

                    //Check permissions
                    GCCPropertyShortCode sc = (GCCPropertyShortCode)Data.Tables[0].Rows[0]["PropertyID"].ToString().StringToInt(1);
                    if ((User.Group == UserGroups.PropertyManagers && User.PropertyShortCode != sc && User.PropertyShortCode != GCCPropertyShortCode.None) ||
                        (User.Group == UserGroups.PropertyStaff && User.PropertyShortCode != sc)
                        )
                    {
                        Data = null;
                        TopMessage.ErrorMessage  = "You do not have permission to view this piece of feedback.";
                        TopMessage.TitleOverride = "Unauthorized";
                        return;
                    }


                    MessageTimeline.Messages = ds.Tables[1];
                    int feedbackStatus = Conversion.StringToInt(ds.Tables[0].Rows[0]["FeedbackStatusID"].ToString());
                    MessageTimeline.HideReplyBox      = IssueIsClosed;
                    MessageTimeline.PropertyShortCode = (GCCPropertyShortCode)ds.Tables[0].Rows[0]["PropertyID"].ToString().StringToInt(1);

                    //Reset tier DDL item labels
                    ddlTier.Items[0].Text = "Tier 1";
                    ddlTier.Items[1].Text = "Tier 2";
                    ddlTier.Items[2].Text = "Tier 3";

                    //Set the selected values and append " (Current)" to the current one for this record
                    ddlTier.SelectedValue      = Data.Tables[0].Rows[0]["Tier"].ToString();
                    hdnOldTier.Value           = ddlTier.SelectedValue;
                    ddlTier.SelectedItem.Text += " (Current)";

                    //Add JS check to notify the user what happens on change to Tier 3
                    btnSaveTier.OnClientClick = "var oldTier=" + ds.Tables[0].Rows[0]["Tier"] + ",newTier=parseInt($('#" + ddlTier.ClientID + "').val());if(oldTier!=newTier&&3==newTier&&!confirm('Are you sure you want to set this to Tier 3? This will cause a notification to be sent to the appropriate staff members.'))return false;";

                    //Hide Invalid Button if Case Closed
                    if (IssueIsClosed)
                    {
                        //Work in progress
                        //btnShowInvalidModal.Visible = false;
                    }
                }
            }
        }
Beispiel #4
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            sql.CommandTimeout = 90;
            DataTable dt = sql.ExecStoredProcedureDataTable("spReports_Monthly_Hotel",
                                                            new SqlParameter("@MonthStart", ddlMonth.SelectedValue + "-01"),
                                                            new SqlParameter("@PropertyID", ddlProperty.SelectedValue));

            if (sql.HasError)
            {
                TopMessage.ErrorMessage = "Unable to query report data from the database.";
                return;
            }

            using (ExcelPackage p = new ExcelPackage())
            {
                string[] date = ddlMonth.SelectedValue.Split('-');
                DateTime mon  = new DateTime(date[0].StringToInt(2017), date[1].StringToInt(1), 1);

                GCCPropertyShortCode sc = (GCCPropertyShortCode)ddlProperty.SelectedValue.StringToInt(0);

                p.Workbook.Worksheets.Add(PropertyTools.GetCasinoName((int)sc));
                ExcelWorksheet worksheet = p.Workbook.Worksheets[1];
                worksheet.Cells.Style.Font.Size        = 10;        //Default font size for whole sheet
                worksheet.Cells.Style.Font.Name        = "Calibri"; //Default Font name for whole sheet
                worksheet.Cells.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
                worksheet.Cells.Style.Fill.BackgroundColor.SetColor(Color.White);

                worksheet.Column(1).Width = 12.71f;
                worksheet.Column(2).Width = 54.85f;

                worksheet.Column(3).Width  = 10f;
                worksheet.Column(4).Width  = 15.42f;
                worksheet.Column(5).Width  = 14.57f;
                worksheet.Column(6).Width  = 19.28f;
                worksheet.Column(7).Width  = 19.28f;
                worksheet.Column(8).Width  = 4.14f;
                worksheet.Column(9).Width  = 10.71f;
                worksheet.Column(10).Width = 10.71f;
                worksheet.Column(11).Width = 10.71f;
                worksheet.Column(12).Width = 10.71f;;

                //Sheet title
                worksheet.Cells["A1"].Value = PropertyTools.GetCasinoName((int)sc).ToUpper() + " HOTEL GUEST EXPERIENCE REPORT";
                using (ExcelRange r = worksheet.Cells["A1:C2"])
                {
                    r.Merge                     = true;
                    r.Style.Font.Size           = 14;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.CenterContinuous;
                    r.Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Bottom;
                }
                worksheet.Cells["A3"].Value = String.Format("REPORTING PERIOD: {0}", mon.ToString("MMMM, yyyy"));
                using (ExcelRange r = worksheet.Cells["A3:B8"])
                {
                    r.Merge                     = true;
                    r.Style.Font.Size           = 14;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.CenterContinuous;
                    r.Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Top;
                }

                AddMergedCell(worksheet, "C7", "D7", "Green: +10% change or more", r => r.Style.Font.Bold = true);
                AddMergedCell(worksheet, "E7", "F7", "Red: -10% change or more", r => r.Style.Font.Bold   = true);

                float titleFontSize = 10f;

                AddMergedCell(worksheet, "C9", "C10", "CURRENT PERIOD", r =>
                {
                    r.Style.WrapText            = true;
                    r.Style.Font.Bold           = true;
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                });

                AddMergedCell(worksheet, "D9", "G9", "VARIANCE FROM", r =>
                {
                    r.Style.Font.Bold = true;
                    r.Style.Font.Size = titleFontSize;
                    r.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                });

                AddMergedCell(worksheet, "I9", "L9", "PERFORMANCE " + (mon.AddYears(-1)).ToString("yyyy"), r =>
                {
                    r.Style.Font.Bold = true;
                    r.Style.Font.Size = titleFontSize;
                    r.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                });

                AddMergedCell(worksheet, "A10", "B10", "Total Sample:", r =>
                {
                    r.Style.Font.Bold           = true;
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Right;
                });

                using (ExcelRange r = worksheet.Cells["D10"])
                {
                    r.Value                     = "PREVIOUS PERIOD";
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["E10"])
                {
                    r.Value                     = "M/M Change";
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["F10"]) {
                    r.Value                     = "Last 12 Mo";
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["G10"]) {
                    r.Value                     = "Change from L12M";
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["I10"])
                {
                    r.Value                     = "Q1/FY" + (mon.AddYears(-1)).ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["J10"])
                {
                    r.Value                     = "Q2/FY" + (mon.AddYears(-1)).ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["K10"])
                {
                    r.Value                     = "Q3/FY" + (mon.AddYears(-1)).ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["L10"])
                {
                    r.Value                     = "Q4/FY" + (mon.AddYears(-1)).ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                //Set up the lookup dictionary for getting rows when they're not all there
                Dictionary <int, DataRow> lookup = new Dictionary <int, DataRow>();
                foreach (DataRow dr in dt.Rows)
                {
                    int rowid = dr["DateRange"].ToString()[0].ToString().StringToInt();
                    lookup.Add(rowid, dr);
                }

                int rowNum = 11;

                AddDataRow(worksheet, lookup, rowNum++, true, "SAMPLE SIZE", "SampleCount", CellFormat.Number);
                // Overall Stay
                AddDataRow(worksheet, lookup, rowNum++, true, "OVERALL STAY", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Satisfaction score", "Q1Overall");
                // GSEI
                AddDataRow(worksheet, lookup, rowNum++, true, "GUEST SERVICE EXPERIENCE INDEX (GSEI)", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall GSEI", "Q2");
                AddDataRow(worksheet, lookup, rowNum++, false, "Ensuring all of your needs were met", "Q1A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Making you feel welcome", "Q1B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Going above & beyond normal service", "Q1C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Speed of service", "Q1D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Encouraging you to visit again", "Q1E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall staff availability", "Q1F");
                //ROOMS
                AddDataRow(worksheet, lookup, rowNum++, true, "ROOMS", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Rooms Score", "RoomScore");
                //Reservation, Front Desk
                AddDataRow(worksheet, lookup, rowNum++, true, "Reservation, Front Desk", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "ReservationScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness of Reservation Agent", "Q3A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Helpfulness of Reservation Agent", "Q3B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Accuracy of reservation information upon check-in", "Q3C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Employee knowledge of the River Rock Casino Resort & Facilities", "Q3D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Efficiency of check-in", "Q3E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness of Front Desk staff", "Q3F");
                AddDataRow(worksheet, lookup, rowNum++, false, "Helpfulness of Front Desk staff", "Q3G");
                AddDataRow(worksheet, lookup, rowNum++, false, "Employees' 'can-do' attitude", "Q3H");
                AddDataRow(worksheet, lookup, rowNum++, false, "Efficiency of check-out", "Q3I");
                AddDataRow(worksheet, lookup, rowNum++, false, "Accuracy of bill at check-out", "Q3J");
                // Housekeeping
                AddDataRow(worksheet, lookup, rowNum++, true, "Housekeeping", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "HousekeepingScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness of Housekeeping staff", "Q4A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Room cleanliness", "Q4B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Bathroom cleanliness", "Q4C");
                // Hotel Room
                AddDataRow(worksheet, lookup, rowNum++, true, "Hotel Room", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "HotelRoomScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Towels & Linens", "Q5A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Proper functioning of lights, TV, etc.", "Q5B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall condition of the room", "Q5C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Adequate amenities", "Q5D");
                // Fitness Centre
                AddDataRow(worksheet, lookup, rowNum++, true, "Fitness Centre", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6FitnessCenter");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "FitnessScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Cleanliness of Fitness Center", "Q11A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality/ condition of fitness equipment", "Q11B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Availability of Fitness Center equipment", "Q11C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Variety of equipment", "Q11D");
                // Pool / Hot Tub
                AddDataRow(worksheet, lookup, rowNum++, true, "Pool / Hot Tub", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6PoolHotTub");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "PoolScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Cleanliness of pool area", "Q12A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Temperature of pool", "Q12B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Cleanliness of hot tub area", "Q12C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Temperature of hot tub", "Q12D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Cleanliness of changing rooms", "Q12E");
                // Valet Parking
                AddDataRow(worksheet, lookup, rowNum++, true, "Valet Parking", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6ValetParking");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "ValetScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Greeting upon arrival", "Q14A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Car returned in timely manner", "Q14B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Original mirror position", "Q14C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Original radio station", "Q14D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Original seat position", "Q14E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Valet driver drove care in respectful manner", "Q14F");
                AddDataRow(worksheet, lookup, rowNum++, false, "Pleasant departure greeting", "Q14G");
                // Concierge
                AddDataRow(worksheet, lookup, rowNum++, true, "Concierge", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6Concierge");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "ConciergeScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Availability of Concierge", "Q15A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness of Concierge", "Q15B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Employee knowledge of the River Rock Casino Resort & Facilities", "Q15C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Staff member went out of way to provide excellent service", "Q15D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Pleasant departure greeting", "Q15E");
                // Bell /Door Service
                AddDataRow(worksheet, lookup, rowNum++, true, "Bell /Door Service", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6BellDoorService");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "BellDoorScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Greeting upon arrival", "Q16A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Acknowledgement throughout stay", "Q16B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness of bell/ door staff", "Q16C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Employee knowledge of the River Rock Casino Resort & Facilities", "Q16D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Staff member went out of way to provide excellent service", "Q16E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Pleasant departure greeting", "Q16F");
                // FOOD & BEVERAGE, CATERING
                AddDataRow(worksheet, lookup, rowNum++, true, "FOOD & BEVERAGE, CATERING", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall F & B, Catering Score", "RoomScore");
                // Tramonto
                AddDataRow(worksheet, lookup, rowNum++, true, "Tramonto", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6Tramonto");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "TramontoScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Greeting upon arrival", "Q7A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Timeliness of seating", "Q7B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Attentiveness of server", "Q7C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Server's knowledge of menu selections", "Q7D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Timeliness of meal delivery", "Q7E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality and taste of food", "Q7F");
                AddDataRow(worksheet, lookup, rowNum++, false, "Presentation of food", "Q7G");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality of beverage", "Q7H");
                AddDataRow(worksheet, lookup, rowNum++, false, "Accuracy of bill", "Q7I");
                // Buffet
                AddDataRow(worksheet, lookup, rowNum++, true, "Buffet", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6TheBuffet");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "BuffetScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Greeting upon arrival", "Q8A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Attentiveness of server", "Q8B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Server's knowledge of menu selections", "Q8C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality and taste of food", "Q8D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality of beverage", "Q8E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Accuracy of bill", "Q8F");
                // Curve
                AddDataRow(worksheet, lookup, rowNum++, true, "Curve", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6Curve");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "CurveScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Greeting upon arrival", "Q9A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Timeliness of seating", "Q9B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Attentiveness of server", "Q9C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Server's knowledge of menu selections", "Q9D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Timeliness of meal delivery", "Q9E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality and taste of food", "Q9F");
                AddDataRow(worksheet, lookup, rowNum++, false, "Presentation of food", "Q9G");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality of beverage", "Q9H");
                AddDataRow(worksheet, lookup, rowNum++, false, "Accuracy of bill", "Q9I");
                // In-Room Dining
                AddDataRow(worksheet, lookup, rowNum++, true, "In-Room Dining", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6InRoomDining");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "InRoomScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Phone answered promptly", "Q10A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness of order taker", "Q10B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness of server", "Q10C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Order delivered within time period advised", "Q10D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Accuracy of order", "Q10E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Presentation of food", "Q10F");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality of in-room dining food", "Q10G");
                AddDataRow(worksheet, lookup, rowNum++, false, "Delivery staff offered pick-up of empty tray", "Q10H");
                // Meeting & Events
                AddDataRow(worksheet, lookup, rowNum++, true, "Meeting & Events", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "% Used", "Q6Meeting");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Score", "MeetingScore");
                AddDataRow(worksheet, lookup, rowNum++, false, "Condition and cleanliness of meeting/event room", "Q13A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Proper meeting/event room temperature", "Q13B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality of meeting/event food and beverage", "Q13C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Friendliness and efficiency of meeting/event staff", "Q13D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality/condition/support of technical equipment", "Q13E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Meeting/event facilities (size, design, amenities)", "Q13F");
                AddDataRow(worksheet, lookup, rowNum++, false, "Accuracy of meeting/ event signage", "Q13G");
                // SERVICE RECOVERY
                AddDataRow(worksheet, lookup, rowNum++, true, "SERVICE RECOVERY", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Experience problem?", "Q23");
                AddDataRow(worksheet, lookup, rowNum++, false, "Report problem?", "Q24C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Where experienced problem? (% of all problems)", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "  Arrival", "Q24A_Arrival");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Staff", "Q24A_Staff");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Guest Room", "Q24A_GuestRoom");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Food & Beverage", "Q24A_FoodBeverage");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Facilities & Service", "Q24A_FacilitiesService");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Billing/Departure", "Q24A_BillingDeparture");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Meetings & Events", "Q24A_MeetingsEvents");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Other", "Q24A_Other");
                AddDataRow(worksheet, lookup, rowNum++, false, "", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall ability to fix problem (PRS Score)", "Q24D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "  The length of time taken to resolve your problem", "Q24E_1");
                AddDataRow(worksheet, lookup, rowNum++, false, "  The effort of employees in resolving your problem", "Q24E_2");
                AddDataRow(worksheet, lookup, rowNum++, false, "  The courteousness of employees while resolving your problem", "Q24E_3");
                AddDataRow(worksheet, lookup, rowNum++, false, "  The amount of communication with you from employees while resolving your problem", "Q24E_4");
                AddDataRow(worksheet, lookup, rowNum++, false, "  The fairness of the outcome in resolving your problem", "Q24E_5");
                // Satisfaction Attributes
                AddDataRow(worksheet, lookup, rowNum++, true, "Satisfaction Attributes", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Satisfaction with how we made you feel", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "  Welcome", "Q17A");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Comfortable", "Q17B");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Important", "Q17C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Satisfaction with Overall Stay", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "  Overall condition of the River Rock Casino Resort", "Q18A");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Value for Price", "Q18B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Likelihood to Return", "Q19");
                AddDataRow(worksheet, lookup, rowNum++, false, "Likelihood to Recommend", "Q20");
                AddDataRow(worksheet, lookup, rowNum++, false, "Received \"Exceptional\" Service", "Q21");
                AddDataRow(worksheet, lookup, rowNum++, false, "Importance of \"Green\" Initiatives", "Q22");
                AddDataRow(worksheet, lookup, rowNum++, false, "Visited River Rock before?", "Q27");
                AddDataRow(worksheet, lookup, rowNum++, false, "", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Primary Reason for Choosing (% of all Responses)", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "  Articles/Advertisements", "Q25_Articles");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Business meeting/Conference venue", "Q25_Business");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Facilities/Amenities", "Q25_Facilities");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Location", "Q25_Location");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Other, please specify", "Q25_Other");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Personal recommendation", "Q25_Personal");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Previous visit", "Q25_Previous");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Special package/rate", "Q25_Special");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Travel Agent", "Q25_Travel");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Website", "Q25_Website");
                AddDataRow(worksheet, lookup, rowNum++, false, "", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Reason to Visit (% of all Responses)", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "  Business", "Q26Business");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Pleasure", "Q26Pleasure");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Meeting / Event", "Q26MeetingEvent");
                AddDataRow(worksheet, lookup, rowNum++, false, "  Other", "Q26Other");
                AddDataRow(worksheet, lookup, rowNum++, false, "", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Follow-up on comments requested", "Q29");

                // Bottom Line
                worksheet.Cells["A" + rowNum].Value = "";
                using (ExcelRange r = worksheet.Cells["A" + rowNum + ":L" + rowNum])
                {
                    r.Merge = true;
                    r.Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                }
                rowNum++;
                // Bottom Message
                worksheet.Cells["A" + rowNum].Value = "All scores are top-2 box scores on a scale of 5, unless otherwise indicated.";
                using (ExcelRange r = worksheet.Cells["A" + rowNum + ":L" + rowNum])
                {
                    r.Merge                     = true;
                    r.Style.Font.Size           = 10;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                string       fileName = sc.ToString() + "-Hotel-Monthly-" + ReportingTools.AdjustAndDisplayDate(DateTime.Now, "yyyy-MM-dd-hh-mm-ss", User) + ".xlsx";
                const string lPath    = "~/Files/Cache/";

                string lOutput = string.Concat(MapPath(lPath), fileName);

                FileInfo fi = new FileInfo(lOutput);
                p.SaveAs(fi);

                hlDownload.Text        = "Download File - " + fileName;
                hlDownload.NavigateUrl = String.Format("{0}{1}", lPath, fileName);
            }
        }
        protected void btnSaveTier_Click(object sender, EventArgs e)
        {
            //Prevent refresh from re-submitting form data
            if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
            {
                Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
            }
            else
            {
                //Catch refresh and wipe the value again
                Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
                return;
            }
            //Don't do anything if the tier hasn't changed
            if (ddlTier.SelectedValue.Equals(hdnOldTier.Value))
            {
                return;
            }
            //Update the tier
            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            sql.ExecStoredProcedureDataTable("spFeedback_ChangeTier",
                                             new SQLParamList()
                                             .Add("@UID", GUID)
                                             .Add("@Tier", Conversion.StringToInt(ddlTier.SelectedValue, 1))
                                             .Add("@UserID", User.UserID));
            //Send tier 3 notifications
            if (ddlTier.SelectedValue.Equals("3"))
            {
                SQLParamList sqlParams = new SQLParamList();
                sqlParams.Add("@GUID", GUID);
                DataSet ds = sql.ExecStoredProcedureDataSet("[spFeedback_GetItem]", sqlParams);
                if (sql.HasError)
                {
                    TopMessage.ErrorMessage = "Unable to load the feedback item.";
                    return;
                }
                DataRow fr = ds.Tables[0].Rows[0];                 //Feedback row
                DataRow sr = ds.Tables[2].Rows[0];                 //Survey row
                GCCPropertyShortCode sc = (GCCPropertyShortCode)fr["PropertyID"].ToString().StringToInt(1);
                SurveyType           st = (SurveyType)fr["SurveyTypeID"].ToString().StringToInt(1);

                //Get the GAG location
                string gagLocation = String.Empty;
                switch (st)
                {
                case SurveyType.GEI:
                    gagLocation = sr["Q3"].ToString();
                    break;

                case SurveyType.Feedback:
                    gagLocation = sr["GAGProperty"].ToString();
                    break;
                }
                if (gagLocation.Length > 0)
                {
                    gagLocation = " - " + gagLocation;
                }

                //Send the notification
                SurveyTools.SendNotifications(Server, sc, SurveyType.Feedback, NotificationReason.Tier3Alert, string.Empty, new {
                    Date         = DateTime.Now.ToString("MMMM dd, yyyy"),
                    CasinoName   = fr["CasinoName"].ToString() + gagLocation,
                    FeedbackLink = GCCPortalUrl + "Admin/Feedback/" + fr["UID"].ToString(),
                    SurveyLink   = String.Format(GCCPortalUrl + "Display/{0}/{1}", st.ToString(), fr["RecordID"])
                });
            }
            if (sql.HasError)
            {
                TopMessage.ErrorMessage = "Oops! It looks like something went wrong trying to change the tier. Please try again. (EFB120)";
            }
        }
        public static void SendFeedbackNotifications(HttpServerUtility server, string feedbackUID, bool toGuest)
        {
            SQLDatabase  sql          = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams    = new SQLParamList().Add("GUID", feedbackUID);
            DataSet      ds           = sql.ExecStoredProcedureDataSet("spFeedback_GetItem", sqlParams);
            string       GCCPortalUrl = ConfigurationManager.AppSettings["GCCPortalURL"].ToString();

            if (!sql.HasError && ds.Tables[0].Rows.Count > 0)
            {
                DataRow fbkDR = ds.Tables[0].Rows[0];
                GCCPropertyShortCode property   = (GCCPropertyShortCode)fbkDR["PropertyID"].ToString().StringToInt();
                SurveyType           surveyType = (SurveyType)fbkDR["SurveyTypeID"].ToString().StringToInt();
                NotificationReason   reason     = (NotificationReason)fbkDR["ReasonID"].ToString().StringToInt();

                string emailAddress = String.Empty;
                if (toGuest)
                {
                    if (ds.Tables[2].Columns.Contains("ContactEmail"))
                    {
                        emailAddress = ds.Tables[2].Rows[0]["ContactEmail"].ToString();
                    }
                    if (String.IsNullOrWhiteSpace(emailAddress) && ds.Tables[2].Columns.Contains("Email"))
                    {
                        emailAddress = ds.Tables[2].Rows[0]["Email"].ToString();
                    }
                    if (String.IsNullOrWhiteSpace(emailAddress) && ds.Tables[2].Columns.Contains("Q5Email"))
                    {
                        emailAddress = ds.Tables[2].Rows[0]["Q5Email"].ToString();
                    }
                    if (String.IsNullOrWhiteSpace(emailAddress))
                    {
                        //Nothing to do
                        return;
                    }
                }

                string template = String.Empty;
                string title    = String.Empty;
                object replacementModel;

                title = PropertyTools.GetCasinoName((int)property) + " - Feedback Reply Notification";
                if (toGuest)
                {
                    template         = "GuestFeedbackNotification";
                    replacementModel = new {
                        CasinoName  = PropertyTools.GetCasinoName((int)property),
                        Link        = GCCPortalUrl + "F/" + feedbackUID,
                        Attachments = new SurveyTools.SurveyAttachmentDetails[] {
                            new SurveyTools.SurveyAttachmentDetails()
                            {
                                Path = "~/Images/headers/" + PropertyTools.GetCasinoHeaderImage(property), ContentID = "HeaderImage"
                            }
                        }
                    };
                }
                else
                {
                    template         = "StaffFeedbackNotification";
                    replacementModel = new {
                        Date       = DateTime.Now.ToString("yyyy-MM-dd"),
                        CasinoName = PropertyTools.GetCasinoName((int)property),
                        Link       = GCCPortalUrl + "Admin/Feedback/" + feedbackUID
                    };
                }

                MailMessage msg = null;
                try {
                    string path = server.MapPath("~/Content/notifications/");
                    msg = EmailManager.CreateEmailFromTemplate(
                        Path.Combine(path, template + ".htm"),
                        Path.Combine(path, template + ".txt"),
                        replacementModel);
                    PropertyInfo attachmentProp = replacementModel.GetType().GetProperty("Attachments");
                    if (attachmentProp != null)
                    {
                        SurveyAttachmentDetails[] attachments = attachmentProp.GetValue(replacementModel) as SurveyAttachmentDetails[];
                        foreach (SurveyAttachmentDetails att in attachments)
                        {
                            LinkedResource lr = new LinkedResource(server.MapPath(att.Path));
                            lr.ContentId = att.ContentID;
                            msg.AlternateViews[0].LinkedResources.Add(lr);
                        }
                    }
                    msg.From    = new MailAddress("*****@*****.**");
                    msg.Subject = title;
                    bool hasAddress = false;
                    if (!String.IsNullOrWhiteSpace(emailAddress))
                    {
                        msg.To.Add(emailAddress);
                        hasAddress = true;
                    }
                    else
                    {
                        sql = new SQLDatabase();
                        DataTable dt = sql.QueryDataTable(@"
SELECT [SendType], u.[FirstName], u.[LastName],  u.[Email]
FROM [tblNotificationUsers] ne
	INNER JOIN [tblNotificationPropertySurveyReason] psr
		ON ne.[PropertySurveyReasonID] = psr.[PropertySurveyReasonID]
	INNER JOIN [tblCOM_Users] u
		ON ne.UserID = u.UserID
WHERE psr.PropertyID = @PropertyID
	AND psr.SurveyTypeID = @SurveyID
	AND psr.ReasonID = @ReasonID
;",
                                                          new SQLParamList()
                                                          .Add("@PropertyID", (int)property)
                                                          .Add("@SurveyID", (int)surveyType)
                                                          .Add("@ReasonID", (int)reason)
                                                          );
                        if (!sql.HasError && dt.Rows.Count > 0)
                        {
                            StringBuilder addrs = new StringBuilder();
                            foreach (DataRow dr in dt.Rows)
                            {
                                switch (dr["SendType"].ToString())
                                {
                                case "1":
                                    msg.To.Add(dr["Email"].ToString());
                                    addrs.Append(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n");
                                    hasAddress = true;
                                    break;

                                case "2":
                                    msg.CC.Add(dr["Email"].ToString());
                                    //Colin requested that CC addresses not show on the call Aug 10,2015
                                    //addrs.Append( dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n" );
                                    hasAddress = true;
                                    break;

                                case "3":
                                    msg.Bcc.Add(dr["Email"].ToString());
                                    hasAddress = true;
                                    break;
                                }
                            }
                            using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream))
                            {
                                msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html);
                            }
                            using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream))
                            {
                                msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()), null, MediaTypeNames.Text.Plain);
                            }



                            //using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream))
                            //{
                            //    msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")).Replace("{Business}", server.HtmlEncode(reason.ToString()).Replace("\n", "<br />")).Replace("{Comments}", server.HtmlEncode(Comments.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html);
                            //}
                            //using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream))
                            //{
                            //    msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()).Replace("{Business}", reason.ToString()).Replace("{Comments}", Comments.ToString()), null, MediaTypeNames.Text.Plain);
                            //}
                        }
                    }

                    if (hasAddress)
                    {
                        msg.Send();
                    }
                } catch (Exception ex) {
                } finally {
                    if (msg != null)
                    {
                        msg.Dispose();
                        msg = null;
                    }
                }
            }
        }
Beispiel #7
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            if (Data == null || Data.Rows.Count == 0)
            {
                TopMessage.ErrorMessage = "Invalid batch. Please go back and try again.";
                return;
            }

            if (!Data.Rows[0]["PINCount"].Equals(0))
            {
                TopMessage.ErrorMessage = "You cannot upload a file for a batch that has already generated a PIN file.";
                return;
            }

            if (fuEmailFile.HasFile)
            {
                try
                {
                    string fileExt = Path.GetExtension(fuEmailFile.FileName.ToLower());
                    if ((new string[] { ".xls", ".xlsx" }).Contains(fileExt))
                    {
                        if (fuEmailFile.PostedFile.ContentLength <= 5048576)
                        {
                            string tempPath = Path.GetTempFileName();
                            fuEmailFile.SaveAs(tempPath);

                            string connString = String.Format(fileExt.Equals(".xlsx") ? WebConfigurationManager.ConnectionStrings["Excel"].ConnectionString : WebConfigurationManager.ConnectionStrings["OldExcel"].ConnectionString, tempPath);

                            using (OleDbConnection fileConnection = new OleDbConnection(connString))
                            {
                                fileConnection.Open();

                                DataTable dt = GetFirstSheetDataTable(fileConnection);
                                //Make sure we have a worksheet
                                if (dt == null)
                                {
                                    TopMessage.ErrorMessage = "Unable to find the first worksheet. Please ensure the name of the first worksheet contains only letters and numbers. For example, \"Email\".";
                                }

                                //Make sure the columns exist in the sheet
                                if (String.IsNullOrWhiteSpace(TopMessage.ErrorMessage) && (!dt.Columns.Contains("Email") || !dt.Columns.Contains("Location") || !dt.Columns.Contains("Encore")))
                                {
                                    TopMessage.ErrorMessage = "The first sheet of the file must at least contain the columns \"Email\", \"Location\", and \"Encore\".";
                                }

                                //Make sure the columns exist in the sheet
                                if (String.IsNullOrWhiteSpace(TopMessage.ErrorMessage) && (dt.Rows.Count == 0))
                                {
                                    TopMessage.ErrorMessage = "No rows were found in the first sheet of this file.";
                                }

                                //HashSet<Tuple<string, GCCPropertyShortCode>> uniqueEmailProperties = new HashSet<Tuple<string, GCCPropertyShortCode>>();
                                if (String.IsNullOrWhiteSpace(TopMessage.ErrorMessage))
                                {
                                    List <string> errorMessages = new List <string>();

                                    dt.Columns.Add("Link", typeof(String));
                                    int           rowNum      = 2; //Start at row 2 because there's a header row in the Excel file
                                    int           batchRowNum = 2;
                                    bool          errsFound   = false;
                                    StringBuilder query       = new StringBuilder();
                                    SQLParamList  sqlParams   = new SQLParamList();
                                    sqlParams.Add("@BatchID", BatchID);
                                    List <Tuple <string, SQLParamList> > sqlBatches = new List <Tuple <string, SQLParamList> >();
                                    foreach (DataRow dr in dt.Rows)
                                    {
                                        string errs = "";

                                        //Verify the email address
                                        string email = dr["Email"].ToString().Trim();
                                        if (!Validation.RegExCheck(email, ValidationType.Email))
                                        {
                                            errs += String.Format(", invalid email address \"{0}\"", email);
                                        }

                                        //Verify the property
                                        string location         = dr["Location"].ToString();
                                        GCCPropertyShortCode sc = GCCPropertyShortCode.None;
                                        if (!Enum.IsDefined(typeof(GCCPropertyShortCode), location) ||
                                            !Enum.TryParse(dr["Location"].ToString(), out sc) ||
                                            sc == GCCPropertyShortCode.None ||
                                            sc == GCCPropertyShortCode.GCC)
                                        {
                                            errs += String.Format(", invalid property short code \"{0}\"", location);
                                        }

                                        ////Check if this is a valid email / property combo (we can't have duplicate emails at the same property)
                                        //if ( errs.Length == 0 ) {
                                        //    Tuple<string, GCCPropertyShortCode> cur = new Tuple<string, GCCPropertyShortCode>( email, sc );
                                        //    if ( uniqueEmailProperties.Contains( cur ) ) {
                                        //        errs += String.Format( ", duplicate email / property combination found for \"{0}\" and \"{1}\"", email, sc.ToString() );
                                        //    } else {
                                        //        uniqueEmailProperties.Add( cur );
                                        //    }
                                        //}

                                        //Verify the encore number
                                        string encoreString = dr["Encore"].ToString();
                                        int?   encoreNumber = Conversion.StringToInt(encoreString, -1000);
                                        if (encoreNumber == -1000 && !String.IsNullOrWhiteSpace(encoreString))
                                        {
                                            errs += String.Format(", invalid encore number \"{0}\"", encoreString);
                                        }
                                        else if (encoreNumber == -1000)
                                        {
                                            encoreNumber = null;
                                        }

                                        bool   isGSEIList  = false;
                                        string gseiVal     = null;
                                        string gseiURLStud = String.Empty;
                                        if (dt.Columns.Contains("GSEISurvey"))
                                        {
                                            isGSEIList = true;
                                            //If we have the GSEI survey column, validate it
                                            gseiVal = dr["GSEISurvey"].ToString();
                                            if (String.IsNullOrWhiteSpace(gseiVal))
                                            {
                                                errs += ", you must specify the GSEI survey type";
                                            }
                                            else if (!(new string[] { "BC", "HPI", "Hotel", "TicketMaster", "Great American" }).Contains(gseiVal))
                                            {
                                                errs += String.Format(", \"{0}\" is not a valid value for the GSEISurvey column (Note: this value is case sensitive)", gseiVal);
                                                //} else if ( gseiVal == "BC" && PropertyTools.GetCasinoRegion( sc ) != "BC" ) {
                                                //	errs += ", you can only use GSEISurvey value of \"BC\" for locations in BC";
                                                //} else if ( gseiVal == "HPI" && sc != GCCPropertyShortCode.FD && sc != GCCPropertyShortCode.ECS && sc != GCCPropertyShortCode.HA ) {
                                            }
                                            else if (gseiVal == "HPI" && sc != GCCPropertyShortCode.ECS && sc != GCCPropertyShortCode.HA)
                                            {
                                                errs += ", you can only use GSEISurvey value of \"HPI\" for locations FD, EC, or HA";
                                            }
                                            else if (gseiVal == "Hotel" && sc != GCCPropertyShortCode.RR)
                                            {
                                                errs += ", you can only use GSEISurvey value of \"Hotel\" for RR";
                                            }
                                            else if (gseiVal == "TicketMaster" && sc != GCCPropertyShortCode.RR && sc != GCCPropertyShortCode.HRCV)
                                            {
                                                errs += ", you can only use GSEISurvey value of \"TicketMaster\" for locations RR, or HRCV";
                                            }
                                            else if (gseiVal == "Great American" && sc != GCCPropertyShortCode.GAG)
                                            {
                                                errs += ", you can only use GSEISurvey value of \"Great American\" for GAG";
                                            }
                                            else
                                            {
                                                switch (gseiVal)
                                                {
                                                case "BC":
                                                    gseiURLStud = "GSEIBC";
                                                    break;

                                                case "HPI":
                                                    gseiURLStud = "GSEIHP";
                                                    break;

                                                case "Hotel":
                                                    gseiURLStud = "GSEIHO";
                                                    break;

                                                case "TicketMaster":
                                                    gseiURLStud = "GSEITM";
                                                    break;

                                                case "Great American":
                                                    gseiURLStud = "GSEIGA";
                                                    break;
                                                }
                                            }
                                        }

                                        if (errs.Length == 0 && !errsFound)
                                        {
                                            //No errors with row or overall, generate GUID and update query
                                            Guid uid = Guid.NewGuid();
                                            query.AppendFormat("INSERT INTO [tblSurveyGEI_EmailPINs] ( [BatchID], [EmailAddress], [PropertyID], [Encore], [PIN]{2} ) VALUES (@BatchID, @Email{0}, {1}, @Encore{0}, @PIN{0}{3});\n", rowNum, (int)sc, (isGSEIList ? ", [GSEISurvey]" : String.Empty), (isGSEIList ? ", @GSEISurvey" + rowNum : String.Empty));
                                            sqlParams.Add("@Email" + rowNum, email)
                                            .Add("@PIN" + rowNum, uid);
                                            if (encoreNumber != null)
                                            {
                                                sqlParams.Add("@Encore" + rowNum, encoreNumber);
                                            }
                                            else
                                            {
                                                sqlParams.Add("@Encore" + rowNum, DBNull.Value);
                                            }
                                            if (isGSEIList)
                                            {
                                                sqlParams.Add("@GSEISurvey" + rowNum, gseiVal);
                                                //Set the GSEI survey link

                                                dr["Link"] = String.Format(GCCPortalUrl + "{0}/{1}/{2}", gseiURLStud, sc.ToString(), uid.ToString());
                                            }
                                            else
                                            {
                                                //Set the GEI survey link
                                                dr["Link"] = String.Format(GCCPortalUrl + "SE/{0}/{1}", sc.ToString(), uid.ToString());
                                            }

                                            //Only ~2100 parameters are allowed so batch them
                                            if (batchRowNum * (isGSEIList ? 4 : 3) >= 2096)
                                            {
                                                sqlBatches.Add(new Tuple <string, SQLParamList>(query.ToString(), sqlParams));
                                                query       = new StringBuilder();
                                                sqlParams   = new SQLParamList().Add("@BatchID", BatchID);
                                                batchRowNum = 2;
                                            }
                                        }
                                        else if (errs.Length > 0)
                                        {
                                            //Errors found, add to list
                                            errsFound = true;
                                            errs      = errs.Substring(2, errs.Length - 2);
                                            errorMessages.Add(String.Format("Error(s) found on row {0}: {1}", rowNum, errs));
                                        }

                                        rowNum++;
                                        batchRowNum++;
                                    }

                                    //If no errors found, save it all
                                    if (errorMessages.Count == 0)
                                    {
                                        //Add last set to the batch list
                                        if (!String.IsNullOrWhiteSpace(query.ToString()))
                                        {
                                            sqlBatches.Add(new Tuple <string, SQLParamList>(query.ToString(), sqlParams));
                                            query     = new StringBuilder();
                                            sqlParams = new SQLParamList().Add("@BatchID", BatchID);
                                        }

                                        bool errorsFound = false;
                                        bool firstRound  = true;

                                        //Insert everything into the db
                                        SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;
                                        foreach (var sqlBatch in sqlBatches)
                                        {
                                            sql.NonQuery(sqlBatch.Item1, sqlBatch.Item2);
                                            if (sql.HasError)
                                            {
                                                errorsFound = true;
                                                if (!firstRound)
                                                {
                                                    sql.NonQuery("DELETE FROM [tblSurveyGEI_EmailPINs] WHERE [BatchID] = @BatchID", new SqlParameter("@BatchID", BatchID));
                                                }
                                                TopMessage.ErrorMessage = "There was a database level error trying to generate and save the PINs. Please try again and if the problem persists, contact the administrator.";
                                                return;
                                            }
                                            firstRound = false;
                                        }

                                        if (errorsFound)
                                        {
                                            TopMessage.ErrorMessage = "There was an error trying to generate and save the PINs. Please try again and if the problem persists, contact the administrator.";
                                        }
                                        else
                                        {
                                            //Generate a CSV from the data table
                                            string outfile = GetFileName();
                                            outfile = Path.Combine(Server.MapPath(Config.PINFileDirectory), outfile);
                                            if (!Conversion.DataTableToCSV(dt, outfile, true))
                                            {
                                                TopMessage.ErrorMessage = "There was an error generating the output file. If you cannot download the file, please contact the administrator.";
                                            }

                                            //Set the PIN count so the page will update
                                            Data.Rows[0]["PINCount"] = rowNum - 2; //Subtract 2 because we started at 2
                                        }
                                    }
                                    else
                                    {
                                        //If errors were found, show them
                                        TopMessage.ErrorMessage  = "The following errors were found when attempting to submit the file:<ul><li>";
                                        TopMessage.ErrorMessage += String.Join("</li><li>", errorMessages);
                                        TopMessage.ErrorMessage += "</li></ul>";
                                    }
                                }

                                fileConnection.Close();
                            }
                        }
                        else
                        {
                            TopMessage.ErrorMessage = "This file exceeds the maximum file size of 5MB.";
                        }
                    }
                    else
                    {
                        TopMessage.ErrorMessage = "Invalid file type. Only Excel files of type xls or xlsx are accepted.";
                    }
                }
                catch (Exception ex)
                {
                    TopMessage.ErrorMessage = "Something went wrong attempting to upload the file. Please try again.";
                    ErrorHandler.WriteLog("GCC_Web_Portal.Admin.EmailPINGenerator", "Unable to parse PIN file.", ErrorHandler.ErrorEventID.General, ex);
                }
            }
            else
            {
                TopMessage.ErrorMessage = "Please choose a file to upload.";
            }
        }
        //20170116 adding commentws for email notification
        //public static void SendNotifications<T>( HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, T replacementModel, string emailAddress, string subjectPrefix )
        public static void SendNotifications <T>(HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, string Comments, T replacementModel, string emailAddress, string subjectPrefix, int operationsArea)
            where T : class
        {
            string template     = String.Empty;
            string title        = String.Empty;
            string propertyName = PropertyTools.GetCasinoName((int)property);

            if (property == GCCPropertyShortCode.GAG)
            {
                PropertyInfo nameProp = replacementModel.GetType().GetProperty("CasinoName");
                if (nameProp != null)
                {
                    string name = nameProp.GetValue(replacementModel) as string;
                    if (!String.IsNullOrWhiteSpace(name))
                    {
                        propertyName = name;
                    }
                }
            }
            switch (surveyType)
            {
            case SurveyType.GEI:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "GEIThankYou";
                }
                else
                {
                    template = "GEITemplate";
                    title    = String.Format("{0}GEI Feedback Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                }
                break;

            case SurveyType.GEIProblemResolution:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "GEIThankYou";
                }
                else
                {
                    if (replacementModel.ToString().Contains("FeedbackCategory"))
                    {
                        template = "GEIFeedbackCategoryTemplate";
                        title    = String.Format("{0}GEI Feedback Category Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                    }
                    else
                    {
                        template = "GEITemplate";
                        title    = String.Format("{0}GEI Problem Resolution Feedback Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                    }
                }
                break;

            case SurveyType.Hotel:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "HotelThankYou";
                }
                else
                {
                    template = "HotelTemplate";
                    title    = String.Format("{0}Hotel Survey Notification - {1}", subjectPrefix, DateTime.Now.ToString("MMMM dd, yyyy"));
                }
                break;

            case SurveyType.Feedback:
                if (reason == NotificationReason.ThankYou)
                {
                    title    = "Thank You For Your Feedback";
                    template = "FeedbackThankYou";
                }
                else if (reason == NotificationReason.Tier3Alert)
                {
                    title    = String.Format("{0}Tier 3 Alert for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                    template = "Tier3Alert";
                }
                else
                {
                    template = "FeedbackTemplate";
                    title    = String.Format("{0}Feedback Follow-up Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                }
                break;

            case SurveyType.Donation:
                template = "DonationTemplate";
                title    = String.Format("{0}Sponsorship / Donation Request Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy"));
                break;
            }
            if (template.Equals(String.Empty))
            {
                return;
            }
            MailMessage msg = null;

            try {
                string path = server.MapPath("~/Content/notifications/");
                msg = EmailManager.CreateEmailFromTemplate(
                    Path.Combine(path, template + ".htm"),
                    Path.Combine(path, template + ".txt"),
                    replacementModel);
                PropertyInfo attachmentProp = replacementModel.GetType().GetProperty("Attachments");
                if (attachmentProp != null)
                {
                    SurveyAttachmentDetails[] attachments = attachmentProp.GetValue(replacementModel) as SurveyAttachmentDetails[];
                    foreach (SurveyAttachmentDetails att in attachments)
                    {
                        LinkedResource lr = new LinkedResource(server.MapPath(att.Path));
                        lr.ContentId = att.ContentID;
                        msg.AlternateViews[0].LinkedResources.Add(lr);
                    }
                }
                msg.From    = new MailAddress("*****@*****.**");
                msg.Subject = title;
                //Add high priority flag to tier 3 alerts
                if (reason == NotificationReason.Tier3Alert)
                {
                    msg.Priority = MailPriority.High;
                }
                bool hasAddress = false;
                if (!String.IsNullOrEmpty(emailAddress))
                {
                    msg.To.Add(emailAddress);
                    hasAddress = true;
                }
                else
                {
                    SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;
                    DataTable   dt  = sql.QueryDataTable(@"
SELECT [SendType], u.[FirstName], u.[LastName],  u.[Email]
FROM [tblNotificationUsers] ne
	INNER JOIN [tblNotificationPropertySurveyReason] psr
		ON ne.[PropertySurveyReasonID] = psr.[PropertySurveyReasonID]
	INNER JOIN [tblCOM_Users] u
		ON ne.UserID = u.UserID
WHERE psr.PropertyID = @PropertyID
	AND psr.SurveyTypeID = @SurveyID
	AND psr.ReasonID = @ReasonID
	
;",
                                                         //AND ( ( @OperationsAreaID < 0 AND psr.OperationsAreaID IS NULL ) OR psr.OperationsAreaID = @OperationsAreaID )
                                                         new SQLParamList()
                                                         .Add("@PropertyID", (int)property)
                                                         .Add("@SurveyID", (int)surveyType)
                                                         .Add("@ReasonID", (int)reason)
                                                         .Add("@OperationsAreaID", operationsArea)
                                                         );
                    if (!sql.HasError && dt.Rows.Count > 0)
                    {
                        StringBuilder addrs = new StringBuilder();
                        foreach (DataRow dr in dt.Rows)
                        {
                            switch (dr["SendType"].ToString())
                            {
                            case "1":
                                msg.To.Add(dr["Email"].ToString());
                                //201701 Testing Email error
                                //msg.Bcc.Add("*****@*****.**");
                                addrs.Append(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n");
                                hasAddress = true;
                                break;

                            case "2":
                                msg.CC.Add(dr["Email"].ToString());
                                //201701 Testing Email error
                                //msg.Bcc.Add("*****@*****.**");
                                //Colin requested that CC addresses not show on the call Aug 10,2015
                                //addrs.Append( dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n" );
                                hasAddress = true;
                                break;

                            case "3":
                                msg.Bcc.Add(dr["Email"].ToString());
                                //201701 Testing Email error
                                // msg.Bcc.Add("*****@*****.**");
                                hasAddress = true;
                                break;
                            }
                        }
                        using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream)) {
                            msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")).Replace("{Business}", server.HtmlEncode(reason.ToString()).Replace("\n", "<br />")).Replace("{Comments}", server.HtmlEncode(Comments.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html);
                        }
                        using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream)) {
                            msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()).Replace("{Business}", reason.ToString()).Replace("{Comments}", Comments.ToString()), null, MediaTypeNames.Text.Plain);
                        }
                    }
                }

                if (hasAddress)
                {
                    msg.Send();
                }
            } catch (Exception ex) {
            } finally {
                if (msg != null)
                {
                    msg.Dispose();
                    msg = null;
                }
            }
        }
 public static void SendNotifications <T>(HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, string Comments, T replacementModel, string emailAddress, string subjectPrefix)
     where T : class
 {
     SendNotifications(server, property, surveyType, reason, Comments, replacementModel, emailAddress, subjectPrefix, -1);
 }
 public static void SendNotifications <T>(HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, string Comments, T replacementModel)
     where T : class
 {
     SendNotifications(server, property, surveyType, reason, Comments, replacementModel, String.Empty);
 }
        protected void GenerateReport()
        {
            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            sql.CommandTimeout = 90;
            DataSet ds = sql.ExecStoredProcedureDataSet("spReports_FeedbackReport_2",
                                                        new SqlParameter("@MonthStart", ddlMonth.SelectedValue + "-01"),
                                                        new SqlParameter("@PropertyID", ddlProperty.SelectedValue));


            //DataSet ds = sql.ExecStoredProcedureDataSet("spReports_FeedbackReport",
            //                                                   new SqlParameter("@MonthStart", ddlMonth.SelectedValue + "-01"),
            //                                                   new SqlParameter("@PropertyID", ddlProperty.SelectedValue));


            using (ExcelPackage package = new ExcelPackage())
            {
                GCCPropertyShortCode sc = (GCCPropertyShortCode)ddlProperty.SelectedValue.StringToInt(0);
                string fileName         = sc.ToString() + "-FeedbackExport-" + ReportingTools.AdjustAndDisplayDate(DateTime.Now, "yyyy-MM-dd-hh-mm-ss", User);

                package.Workbook.Worksheets.Add("GEI Survey");
                ExcelWorksheet worksheet = package.Workbook.Worksheets[1];

                worksheet.Cells.Style.Font.Size = 10;
                worksheet.Cells.Style.Font.Name = "Calibri";

                //set column widths
                worksheet.Column(1).Width = 23f;

                worksheet.Column(2).Width = 11.3f;
                worksheet.Column(3).Width = 11.3f;
                worksheet.Column(4).Width = 11.3f;
                worksheet.Column(5).Width = 11.3f;

                worksheet.Column(6).Width  = 21.86f;
                worksheet.Column(7).Width  = 21.86f;
                worksheet.Column(8).Width  = 9.2f;
                worksheet.Column(9).Width  = 31.86f;
                worksheet.Column(10).Width = 10.5f;
                worksheet.Column(11).Width = 21.7f;
                worksheet.Column(12).Width = 25f;
                worksheet.Column(13).Width = 10.5f;
                worksheet.Column(14).Width = 30f;
                worksheet.Column(15).Width = 15f;

                DataTable DT     = ds.Tables[0];
                int       colNum = 1;
                int       rowNum = 1;

                foreach (DataColumn col in DT.Columns)
                {
                    worksheet.Cells[rowNum, colNum].Value = col.ColumnName;
                    colNum++;
                }
                rowNum++;

                foreach (DataRow DR in DT.Rows)
                {
                    colNum = 1;
                    foreach (DataColumn col in DT.Columns)
                    {
                        worksheet.Cells[rowNum, colNum].Value = DR[col.ColumnName];
                        colNum++;
                    }
                    rowNum++;
                }

                #region Feedback Survey Tab
                package.Workbook.Worksheets.Add("Feedback Survey");
                worksheet = package.Workbook.Worksheets[2];

                worksheet.Cells.Style.Font.Size = 10;
                worksheet.Cells.Style.Font.Name = "Calibri";

                DT     = ds.Tables[1];
                colNum = 1;
                rowNum = 1;

                foreach (DataColumn col in DT.Columns)
                {
                    worksheet.Cells[rowNum, colNum].Value = col.ColumnName;
                    colNum++;
                }
                rowNum++;

                foreach (DataRow DR in DT.Rows)
                {
                    colNum = 1;
                    foreach (DataColumn col in DT.Columns)
                    {
                        worksheet.Cells[rowNum, colNum].Value = DR[col.ColumnName];
                        colNum++;
                    }
                    rowNum++;
                }
                #endregion Feedback Survey Tab

                #region Hotel Survey Tab
                package.Workbook.Worksheets.Add("Hotel Survey");
                worksheet = package.Workbook.Worksheets[3];

                worksheet.Cells.Style.Font.Size = 10;
                worksheet.Cells.Style.Font.Name = "Calibri";

                DT     = ds.Tables[2];
                colNum = 1;
                rowNum = 1;

                foreach (DataColumn col in DT.Columns)
                {
                    worksheet.Cells[rowNum, colNum].Value = col.ColumnName;
                    colNum++;
                }
                rowNum++;

                foreach (DataRow DR in DT.Rows)
                {
                    colNum = 1;
                    foreach (DataColumn col in DT.Columns)
                    {
                        worksheet.Cells[rowNum, colNum].Value = DR[col.ColumnName];
                        colNum++;
                    }
                    rowNum++;
                }
                #endregion Hotel Survey Tab

                #region Donation Survey Tab
                package.Workbook.Worksheets.Add("Donation Survey");
                worksheet = package.Workbook.Worksheets[4];

                worksheet.Cells.Style.Font.Size = 10;
                worksheet.Cells.Style.Font.Name = "Calibri";

                DT     = ds.Tables[3];
                colNum = 1;
                rowNum = 1;

                foreach (DataColumn col in DT.Columns)
                {
                    worksheet.Cells[rowNum, colNum].Value = col.ColumnName;
                    colNum++;
                }
                rowNum++;

                foreach (DataRow DR in DT.Rows)
                {
                    colNum = 1;
                    foreach (DataColumn col in DT.Columns)
                    {
                        worksheet.Cells[rowNum, colNum].Value = DR[col.ColumnName];
                        colNum++;
                    }
                    rowNum++;
                }
                #endregion Donation Survey Tab

                Response.Clear();
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.AddHeader("content-disposition", String.Format("attachment;    filename={0}.xlsx", fileName));
                package.SaveAs(Response.OutputStream);
                worksheet.Dispose();
                Response.End();
            }
        }
Beispiel #12
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            sql.CommandTimeout = 90;
            DataTable dt = sql.ExecStoredProcedureDataTable("spReports_Monthly",
                                                            new SqlParameter("@MonthStart", ddlMonth.SelectedValue + "-01"),
                                                            new SqlParameter("@PropertyID", ddlProperty.SelectedValue));

            if (sql.HasError)
            {
                TopMessage.ErrorMessage = "Unable to query report data from the database.";
                return;
            }

            using (ExcelPackage p = new ExcelPackage())
            {
                string[] date = ddlMonth.SelectedValue.Split('-');
                DateTime mon  = new DateTime(date[0].StringToInt(2017), date[1].StringToInt(1), 1);

                GCCPropertyShortCode sc = (GCCPropertyShortCode)ddlProperty.SelectedValue.StringToInt(0);

                p.Workbook.Worksheets.Add(PropertyTools.GetCasinoName((int)sc));
                ExcelWorksheet worksheet = p.Workbook.Worksheets[1];
                worksheet.Cells.Style.Font.Size        = 10;        //Default font size for whole sheet
                worksheet.Cells.Style.Font.Name        = "Calibri"; //Default Font name for whole sheet
                worksheet.Cells.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
                worksheet.Cells.Style.Fill.BackgroundColor.SetColor(Color.White);

                worksheet.Column(1).Width = 12.71f;
                worksheet.Column(2).Width = 54.85f;

                worksheet.Column(3).Width  = 10f;
                worksheet.Column(4).Width  = 15.42f;
                worksheet.Column(5).Width  = 14.57f;
                worksheet.Column(6).Width  = 19.28f;
                worksheet.Column(7).Width  = 4.14f;
                worksheet.Column(8).Width  = 10.71f;
                worksheet.Column(9).Width  = 10.71f;
                worksheet.Column(10).Width = 10.71f;
                worksheet.Column(11).Width = 10.71f;;

                //Sheet title
                worksheet.Cells["A1"].Value = PropertyTools.GetCasinoName((int)sc).ToUpper() + " GUEST EXPERIENCE REPORT";
                using (ExcelRange r = worksheet.Cells["A1:B8"])
                {
                    r.Merge                     = true;
                    r.Style.Font.Size           = 14;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.CenterContinuous;
                    r.Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Bottom;
                }
                worksheet.Cells["A9"].Value = String.Format("REPORTING PERIOD: {0}", mon.ToString("MMMM, yyyy"));
                using (ExcelRange r = worksheet.Cells["A9:B14"])
                {
                    r.Merge                     = true;
                    r.Style.Font.Size           = 14;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.CenterContinuous;
                    r.Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Top;
                }

                //Legend
                worksheet.Cells["C1"].Value = "LEGEND";
                using (ExcelRange r = worksheet.Cells["C1:K1"])
                {
                    r.Merge                    = true;
                    r.Style.Font.Size          = 12;
                    r.Style.Font.Bold          = true;
                    r.Style.VerticalAlignment  = OfficeOpenXml.Style.ExcelVerticalAlignment.Top;
                    r.Style.Border.Left.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Medium;
                    r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium;
                }
                AddMergedCell(worksheet, "C2", "K2", "- Net Promoter Score (NPS) = difference in percentage of top two box and bottom two box to the 'likelihood to recommend' question.", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; });
                AddMergedCell(worksheet, "C3", "K3", "- Guest Experience Index (GEI) = weighted average of responses to Guest Loyalty questions converted to a 100 point equal interval scale.", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; });
                AddMergedCell(worksheet, "C4", "K4", "- Problem Resolution Score (PRS) =  of those who had a problem, top two box percentage of \"overall ability to fix problem\" question.", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; });
                AddMergedCell(worksheet, "C5", "K5", "- 5 point scales used:", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; });
                AddMergedCell(worksheet, "C6", "K6", "RATIONAL CONNECTIONS, TOUCHPOINTS, ATTRIBUTES: excellent, very good, good, fair, poor", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Indent = 2; });
                AddMergedCell(worksheet, "C7", "K7", "EMOTIONAL CONNECTIONS, BRAND CONNECTIONS: strongly agree,moderately agree, slightly agree,disagree, strongly disagree", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Indent = 2; });
                AddMergedCell(worksheet, "C8", "K8", "GUEST LOYALTY: definitely would, probably would, possibly would, probably would not, definitely would not", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Indent = 2; });
                AddMergedCell(worksheet, "C9", "K9", "- Performance Score %: Top Two Box % = excellent+very good; strongly agree+moderately agree; definitely would +probably would", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; });
                AddMergedCell(worksheet, "C10", "K10", "- GCGC numbers are total for  all properties ", r => { r.Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; r.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Medium; });

                AddMergedCell(worksheet, "C12", "D12", "Green: +10% change or more", r => r.Style.Font.Bold = true);
                AddMergedCell(worksheet, "E12", "F12", "Red: -10% change or more", r => r.Style.Font.Bold   = true);

                float titleFontSize = 10f;

                AddMergedCell(worksheet, "C14", "C15", "CURRENT PERIOD", r =>
                {
                    r.Style.WrapText            = true;
                    r.Style.Font.Bold           = true;
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.Border.Top.Style    = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                });

                AddMergedCell(worksheet, "D14", "F14", "VARIANCE FROM", r =>
                {
                    r.Style.Font.Bold = true;
                    r.Style.Font.Size = titleFontSize;
                    r.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                });

                AddMergedCell(worksheet, "H14", "K14", "PERFORMANCE " + "2015", r =>
                {
                    r.Style.Font.Bold = true;
                    r.Style.Font.Size = titleFontSize;
                    r.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                });

                AddMergedCell(worksheet, "A15", "B15", "Total Sample:", r =>
                {
                    r.Style.Font.Bold           = true;
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Right;
                });

                using (ExcelRange r = worksheet.Cells["D15"])
                {
                    r.Value                     = "PREVIOUS PERIOD";
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["E15"])
                {
                    r.Value                     = "YEAR AGO";
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["F15"])
                {
                    r.Value                     = "CURRENT PERIOD GCGC";
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["H15"])
                {
                    r.Value                     = "Q1/FY15"; //+mon.ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["I15"])
                {
                    r.Value                     = "Q2/FY15"; //+mon.ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["J15"])
                {
                    r.Value                     = "Q3/FY15"; // + mon.ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                using (ExcelRange r = worksheet.Cells["K15"])
                {
                    r.Value                     = "Q4/FY15"; //+mon.ToString("yy");
                    r.Style.Font.Size           = titleFontSize;
                    r.Style.Font.Bold           = true;
                    r.Style.Border.Left.Style   = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.Border.Right.Style  = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
                    r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                }

                //Set up the lookup dictionary for getting rows when they're not all there
                Dictionary <int, DataRow> lookup = new Dictionary <int, DataRow>();
                foreach (DataRow dr in dt.Rows)
                {
                    int rowid = dr["DateRange"].ToString()[0].ToString().StringToInt();
                    lookup.Add(rowid, dr);
                }

                int rowNum = 16;

                AddDataRow(worksheet, lookup, rowNum++, true, "SAMPLE SIZE", "SampleCount", CellFormat.Number);

                AddDataRow(worksheet, lookup, rowNum++, true, "GUEST EXPERIENCE INDEX", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "GEI", "GEI", CellFormat.Index);

                AddDataRow(worksheet, lookup, rowNum++, true, "GUEST SERVICE EXPERIENCE INDEX", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "GSEI", "GSEI");

                AddDataRow(worksheet, lookup, rowNum++, true, "NET PROMOTER SCORE", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "NPS", "NPS");

                AddDataRow(worksheet, lookup, rowNum++, true, "PROBLEM RESOLUTION SCORE", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "PRS", "PRS");

                AddDataRow(worksheet, lookup, rowNum++, true, "GUEST LOYALTY", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Likely to recommend the casino", "Q6A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Likely to mostly visit this casino", "Q6B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Likely to visit this casino for next gaming entertainment opportunity", "Q6C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Likely to provide personal preferences so casino can serve me better", "Q6D");

                AddDataRow(worksheet, lookup, rowNum++, true, "CASINO STAFF", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Ensuring all of your needs were met", "Q7A");
                AddDataRow(worksheet, lookup, rowNum++, false, "Making you feel welcome", "Q7B");
                AddDataRow(worksheet, lookup, rowNum++, false, "Going above & beyond normal service", "Q7C");
                AddDataRow(worksheet, lookup, rowNum++, false, "Speed of service", "Q7D");
                AddDataRow(worksheet, lookup, rowNum++, false, "Encouraging you to visit again", "Q7E");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall staff availability", "Q7F");

                AddDataRow(worksheet, lookup, rowNum++, false, "Overall staff", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Cashiers", "Q9A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Guest Services", "Q9B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Slot Attendants", "Q9C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Dealers", "Q9D", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Restaurant Servers", "Q9E", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Cocktail Servers", "Q9F", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Coffee Servers", "Q9G", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Security", "Q9H", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Managers/Supervisors", "Q9I", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Hotel Staff", "Q9J", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Encouraging you to take part in events or promotions", "Q10A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Answering questions you had about the property or promotions", "Q10B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Being friendly and welcoming", "Q10C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                AddDataRow(worksheet, lookup, rowNum++, true, "CASINO FACILITIES", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall facilities", "Q12");
                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Ambiance, mood, atmosphere of the environment", "Q13A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Cleanliness of general areas", "Q13B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Clear signage", "Q13C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Washroom cleanliness", "Q13D", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Adequate  lighting - it is bright enough", "Q13E", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Safe environment", "Q13F", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Parking availability", "Q13G", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                AddDataRow(worksheet, lookup, rowNum++, true, "GAMING EXPERIENCE", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Primary gaming:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Playing Slots", "Count_Slots", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Playing Tables", "Count_Tables", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Playing Poker", "Count_Poker", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Enjoying Food or Beverages", "Count_Food", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Watching Live Entertainment at a show lounge or theatre", "Count_Entertainment", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Staying at our Hotel", "Count_Hotel", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Watching Live Racing", "Count_LiveRacing", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Watching Racing at our Racebook", "Count_Racebook", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Playing Bingo", "Count_Bingo", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Lottery / Pull Tabs", "Count_Lottery", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "None", "Count_None", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Primary gaming:", "Q14");

                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Variety of games available", "Q15A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Waiting time to play", "Q15B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Availability of specific game at your desired denomination", "Q15C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Contests & monthly promotions", "Q15D", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Courtesy & respectfulness of staff", "Q15E", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Game Knowledge of Staff", "Q15F", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Rate of earning", "Q16A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Redemption value", "Q16B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Choice of rewards", "Q16C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Slot Free Play", "Q16D", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                AddDataRow(worksheet, lookup, rowNum++, true, "FOOD & BEVERAGE", null);
                rowNum = AddYesNoRow(worksheet, lookup, rowNum++, false, "Purchase food or beverages?", "Q17");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall dining experience", "Q19");

                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Variety of food choices", "Q20A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Cleanliness of outlet", "Q20B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Courtesy of staff", "Q20C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Timely delivery of order", "Q20D", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Value for the money", "Q20E", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Pleasant atmosphere", "Q20F", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Quality of food", "Q20G", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                AddDataRow(worksheet, lookup, rowNum++, true, "LOUNGE ENTERTAINMENT", null);
                rowNum = AddYesNoRow(worksheet, lookup, rowNum++, false, "Attend Lounge entertainment?", "Q21");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall entertainment experience", "Q22");

                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Sound / quality", "Q23A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Seating availability", "Q23B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Dance floor", "Q23C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Fun and enjoyable atmosphere", "Q23D", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                AddDataRow(worksheet, lookup, rowNum++, true, "THEATRE", null);
                rowNum = AddYesNoRow(worksheet, lookup, rowNum++, false, "Attend Theatre?", "Q24");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall Theatre experience", "Q25");

                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "The quality of the show", "Q26A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "The value of the show", "Q26B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Seating choices", "Q26C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Sound quality", "Q26D", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                //AddDataRow( worksheet, lookup, rowNum++, false, "Overall customer service of Theatre staff", "Q26E", CellFormat.Percent, r => { r.Style.Indent = 3; }, null );

                AddDataRow(worksheet, lookup, rowNum++, true, "SERVICE RECOVERY", null);
                rowNum = AddYesNoRow(worksheet, lookup, rowNum++, false, "Experience problem?", "Q27");
                AddDataRow(worksheet, lookup, rowNum++, false, "Where experienced problem?", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Arrival and parking", "Q27A_ArrivalAndParking", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Guest Services", "Q27A_GuestServices", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Cashiers", "Q27A_Cashiers", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Manager/Supervisor", "Q27A_ManagerSupervisor", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Security", "Q27A_Security", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Slots", "Q27A_Slots", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Tables", "Q27A_Tables", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Food & Beverage", "Q27A_FoodAndBeverage", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Hotel", "Q27A_Hotel", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Other", "Q27A_Other", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                rowNum = AddYesNoRow(worksheet, lookup, rowNum++, false, "Resolve problem?", "Q28");
                rowNum = AddYesNoRow(worksheet, lookup, rowNum++, false, "Report problem?", "Q29");
                AddDataRow(worksheet, lookup, rowNum++, false, "Overall ability to fix problem", "Q30");
                AddDataRow(worksheet, lookup, rowNum++, false, "Attribute ratings:", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "The length of time taken to resolve your problem", "Q31A", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "The effort of employees in resolving your problem", "Q31B", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "The courteousness of employees while resolving your problem", "Q31C", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                worksheet.Row(rowNum).Height *= 2;
                AddDataRow(worksheet, lookup, rowNum++, false, "The amount of communication with you from employees while resolving your problem", "Q31D", CellFormat.Percent, r => { r.Style.WrapText = true; r.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center; r.Style.Indent = 3; }, r => { r.Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center; });
                AddDataRow(worksheet, lookup, rowNum++, false, "The fairness of the outcome in resolving your problem", "Q31E", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);

                AddDataRow(worksheet, lookup, rowNum++, true, "DEMOGRAPHICS", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Male", "Q36_Male");
                AddDataRow(worksheet, lookup, rowNum++, false, "Female", "Q36_Female");
                AddDataRow(worksheet, lookup, rowNum++, false, String.Empty, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "19-24", "Q37_19-24");
                AddDataRow(worksheet, lookup, rowNum++, false, "25-34", "Q37_25-34");
                AddDataRow(worksheet, lookup, rowNum++, false, "35-44", "Q37_35-44");
                AddDataRow(worksheet, lookup, rowNum++, false, "45-54", "Q37_45-54");
                AddDataRow(worksheet, lookup, rowNum++, false, "55-64", "Q37_55-64");
                AddDataRow(worksheet, lookup, rowNum++, false, "65 or older", "Q37_65 or older");
                AddDataRow(worksheet, lookup, rowNum++, false, String.Empty, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "First visit", "Q38_This was my first visit");
                AddDataRow(worksheet, lookup, rowNum++, false, "2-7 times per week", "Q38_2-7 times per week");
                AddDataRow(worksheet, lookup, rowNum++, false, "Once per week", "Q38_Once per week");
                AddDataRow(worksheet, lookup, rowNum++, false, "2-3 times per month", "Q38_2-3 times per month");
                AddDataRow(worksheet, lookup, rowNum++, false, "Once per month", "Q38_Once per month");
                AddDataRow(worksheet, lookup, rowNum++, false, "Several times a year", "Q38_Several times a year");

                AddDataRow(worksheet, lookup, rowNum++, false, "Languages spoken at home (other than English)", null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Korean", "Q39_1", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Punjabi", "Q39_2", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Chinese Mandarin", "Q39_3", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Other Western European languages", "Q39_4", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Eastern European languages", "Q39_5", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Spanish", "Q39_6", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "French", "Q39_7", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Hindi", "Q39_8", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Tagalog", "Q39_9", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Vietnamese", "Q39_10", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Pakistani", "Q39_11", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Farsi", "Q39_12", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Japanese", "Q39_13", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Arabic / Middle Eastern", "Q39_14", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Chinese – Cantonese", "Q39_15", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, "Other", "Q39_16", CellFormat.Percent, r => { r.Style.Indent = 3; }, null);
                AddDataRow(worksheet, lookup, rowNum++, false, String.Empty, null);
                rowNum = AddYesNoRow(worksheet, lookup, rowNum++, false, "Players Club?", "Q4");

                string       fileName = sc.ToString() + "-Monthly-" + ReportingTools.AdjustAndDisplayDate(DateTime.Now, "yyyy-MM-dd-hh-mm-ss", User) + ".xlsx";
                const string lPath    = "~/Files/Cache/";

                string lOutput = string.Concat(MapPath(lPath), fileName);

                FileInfo fi = new FileInfo(lOutput);
                p.SaveAs(fi);

                hlDownload.Text        = "Download File - " + fileName;
                hlDownload.NavigateUrl = String.Format("{0}{1}", lPath, fileName);
            }
        }