protected void Page_Load(object sender, EventArgs e)
        {
            //string VinID = Request.QueryString["VinID"].ToString();
            //string ProcessDate = Request.QueryString["ProcessDate"].ToString();
            //string ReportPeriod = Request.QueryString["ReportPeriod"].ToString();

            //string ReportType = Request.QueryString["ReportType"].ToString();

            //string WeekNumber = Request.QueryString["WeekNumber"].ToString();
            //string YearNumber = Request.QueryString["YearNumber"].ToString();

            string VinID = Request.QueryString["VinID"].ToString();

            string ProcessDate = String.Empty;
            DateTime dtProcessDate = DateTime.Today;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ProcessDate"]))
            {
                ProcessDate = Request.QueryString["ProcessDate"].ToString();
                dtProcessDate = DateTime.Parse(ProcessDate);
            }

            string ReportType = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportType"]))
            {
                ReportType = Request.QueryString["ReportType"].ToString();
            }

            string WeekNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["WeekNumber"]))
            {
                WeekNumber = Request.QueryString["WeekNumber"].ToString();
            }

            string YearNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["YearNumber"]))
            {
                YearNumber = Request.QueryString["YearNumber"].ToString();
            }

            string ReportPeriod = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportPeriod"]))
            {
                ReportPeriod = Request.QueryString["ReportPeriod"].ToString();
            }

            int intWeekNumber = 0;
            int intYearNumber = 0;

            string DtRangeWeekly = String.Empty;
            if (ReportPeriod == "Weekly")
            {
                bool IsWeekNumeric = int.TryParse(WeekNumber, out intWeekNumber);
                if (IsWeekNumeric)
                {
                    intWeekNumber = int.Parse(WeekNumber);
                }

                bool IsYearNumeric = int.TryParse(YearNumber, out intYearNumber);
                if (IsYearNumeric)
                {
                    intYearNumber = int.Parse(YearNumber);
                }

                GetChartData gd = new GetChartData();
                DataTable DtRange = gd.GetDateRangeFromWeekNumber(intWeekNumber, intYearNumber);

                DtRangeWeekly = Convert.ToDateTime(DtRange.Rows[0]["StartDate"]).ToString("d") + " - " + Convert.ToDateTime(DtRange.Rows[0]["EndDate"]).ToString("d");
            }

            Vehicles Vehicle = new Vehicles();

            if (VinID != "")
            {
                int intVinID;
                bool IsVinNumeric = int.TryParse(VinID, out intVinID);

                if (IsVinNumeric)
                {
                    intVinID = int.Parse(VinID);

                    GetChartData gcd = new GetChartData();
                    Vehicle = gcd.GetVinInfo(intVinID);
                    GetChartData gd = new GetChartData();

                    DataTable dataTable_TempData = new DataTable();

                    if (intWeekNumber > 0)
                    {
                        dataTable_TempData = gd.GetDashBoardDataTabular(intVinID, intWeekNumber, intYearNumber, ReportType);
                    }
                    else
                    {
                        dataTable_TempData = gd.GetDashBoardDataTabular(intVinID, dtProcessDate, ReportType);
                    }

                    if (ReportType == "DailyChargingData")
                    {
                        GV_DailyChargingData.Visible = true;
                        GV_DailyChargingData.DataSource = dataTable_TempData;
                        GV_DailyChargingData.DataBind();
                    }

                    if (ReportType == "DailyTempData")
                    {
                        GV_DailyTempData.Visible = true;
                        GV_DailyTempData.DataSource = dataTable_TempData;
                        GV_DailyTempData.DataBind();
                    }

                    if (ReportType == "DailyBatteryData")
                    {
                        GV_DailyBatteryData.Visible = true;
                        GV_DailyBatteryData.DataSource = dataTable_TempData;
                        GV_DailyBatteryData.DataBind();
                    }

                }
                else
                {
                    Response.Write(" Vehicle does not exists!");
                    Response.End();
                }

            }
            else
            {
                Response.Write(" Vehicle does not exists!");
                Response.End();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string VinID = Request.QueryString["VinID"].ToString();

            string ProcessDate = String.Empty;
            DateTime dtProcessDate = DateTime.Today;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ProcessDate"]))
            {
                ProcessDate = Request.QueryString["ProcessDate"].ToString();
                dtProcessDate = DateTime.Parse(ProcessDate);
            }

            string ReportType = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportType"]))
            {
                ReportType = Request.QueryString["ReportType"].ToString();
            }

            string WeekNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["WeekNumber"]))
            {
                WeekNumber = Request.QueryString["WeekNumber"].ToString();
            }

            string YearNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["YearNumber"]))
            {
                YearNumber = Request.QueryString["YearNumber"].ToString();
            }

            string ReportPeriod = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportPeriod"]))
            {
                ReportPeriod = Request.QueryString["ReportPeriod"].ToString();
            }

            int intWeekNumber = 0;
            int intYearNumber = 0;

            string DtRangeWeekly = String.Empty;
            if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
            {
                bool IsWeekNumeric = int.TryParse(WeekNumber, out intWeekNumber);
                if (IsWeekNumeric)
                {
                    intWeekNumber = int.Parse(WeekNumber);
                }

                bool IsYearNumeric = int.TryParse(YearNumber, out intYearNumber);
                if (IsYearNumeric)
                {
                    intYearNumber = int.Parse(YearNumber);
                }

                GetChartData gd = new GetChartData();
                DataTable DtRange = gd.GetDateRangeFromWeekNumber(intWeekNumber, intYearNumber);

                DtRangeWeekly = Convert.ToDateTime(DtRange.Rows[0]["StartDate"]).ToString("d") + " - " + Convert.ToDateTime(DtRange.Rows[0]["EndDate"]).ToString("d");
            }

            if (ReportPeriod == "Weekly")
            {
                lblHead.InnerText = "Weekly Vehicle Report";
            }
            else     if (ReportPeriod == "NREL")
            {
                lblHead.InnerText = "NREL Weekly Vehicle Report";
            }

            else
            {
                lblHead.InnerText = "Daily Vehicle Report";
            }

            //VinID = "221";
            //  ReportType = "GenVehicleData_VinSpeed";
            //ReportType = "GenVehicleData_CurrentVoltage";
            //ProcessDate = "04/13/2015";

            Vehicles Vehicle = new Vehicles();

            if (VinID != "")
            {
                int intVinID;
                bool IsVinNumeric = int.TryParse(VinID, out intVinID);

                if (IsVinNumeric)
                {
                    intVinID = int.Parse(VinID);

                    GetChartData gcd = new GetChartData();
                    Vehicle = gcd.GetVinInfo(intVinID);
                    GetChartData gd = new GetChartData();
                    ReportType = "OperationalData";

                    DataTable dataTable_OperationalData = new DataTable();

                    if (intWeekNumber > 0)
                    {
                         dataTable_OperationalData = gd.GetDashBoardData(intVinID, intWeekNumber,intYearNumber, ReportType);
                    }
                    else
                    {
                        dataTable_OperationalData = gd.GetDashBoardData(intVinID, dtProcessDate, ReportType);
                    }

                    ReportType = "HVACOperationMode";

                    DataTable dataTable_HVACOperationMode = new DataTable();
                    if (intWeekNumber > 0)
                    {
                         dataTable_HVACOperationMode = gd.GetDashBoardData(intVinID, intWeekNumber, intYearNumber, ReportType);
                    }
                    else
                    {
                         dataTable_HVACOperationMode = gd.GetDashBoardData(intVinID, dtProcessDate, ReportType);
                    }

                    ReportType = "AuxLoadsOnTime";
                    DataTable dataTable_AuxLoadsOnTime = new DataTable();
                    if (intWeekNumber > 0)
                    {
                         dataTable_AuxLoadsOnTime = gd.GetDashBoardData(intVinID, intWeekNumber, intYearNumber, ReportType);
                    }
                    else
                    {
                         dataTable_AuxLoadsOnTime = gd.GetDashBoardData(intVinID, dtProcessDate, ReportType);
                    }

                    ReportType = "PowerTrainData";
                    DataTable dataTable_PowerTrainData = new DataTable();
                    if (intWeekNumber > 0)
                    {
                         dataTable_PowerTrainData = gd.GetDashBoardData(intVinID, intWeekNumber, intYearNumber, ReportType);
                    }
                    else
                    {
                         dataTable_PowerTrainData = gd.GetDashBoardData(intVinID, dtProcessDate, ReportType);
                    }

                        ReportType = "DailyChargingData";
                        DataTable dataTable_DailyChargingData = new DataTable();
                        if (intWeekNumber > 0)
                        {
                            dataTable_DailyChargingData = gd.GetDashBoardDataTabular(intVinID, intWeekNumber, intYearNumber, ReportType);
                        }
                        else
                        {
                            // dataTable_OperationalData = gd.GetDashBoardDataTabular(intVinID, dtProcessDate, ReportType);
                        }

                            GV_DailyChargingData.Visible = true;
                            GV_DailyChargingData.DataSource = dataTable_DailyChargingData;
                            GV_DailyChargingData.DataBind();

                            ReportType = "DailyTempData";
                            DataTable dataTable_DailyTempData = new DataTable();
                            if (intWeekNumber > 0)
                            {
                                dataTable_DailyTempData = gd.GetDashBoardDataTabular(intVinID, intWeekNumber, intYearNumber, ReportType);
                            }
                            else
                            {
                                // dataTable_OperationalData = gd.GetDashBoardDataTabular(intVinID, dtProcessDate, ReportType);
                            }

                            GV_DailyTempData1.Visible = true;
                            GV_DailyTempData1.DataSource = dataTable_DailyTempData;
                           GV_DailyTempData1.DataBind();

                    GridView1.DataSource = dataTable_OperationalData;
                    GridView1.DataBind();

                    GridView3.DataSource = dataTable_HVACOperationMode;
                    GridView3.DataBind();

                    GridView4.DataSource = dataTable_AuxLoadsOnTime;
                    GridView4.DataBind();

                    GridView5.DataSource = dataTable_PowerTrainData;
                    GridView5.DataBind();

                    lblVin.InnerHtml = "<b>" + Vehicle.CustomerName + " - " + Vehicle.Vin;
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                     lblDate.InnerHtml = "<b>" + DtRangeWeekly;
                    }
                    else
                    {
                    lblDate.InnerHtml = "<b>" + dtProcessDate.ToShortDateString();
                     }

                }
                else
                {
                    Response.Write(" Vehicle does not exists!");
                    Response.End();
                }

            }
            else
            {
                Response.Write(" Vehicle does not exists!");
                Response.End();
            }

            //switch (ReportType)
            //{

            //    case "TempData":
            //        ReportServices_DailyGrab_VinDashBoard_OperationalData(Vehicle, dtProcessDate);
            //        break;

            //    default:
            //        Response.Write(" Chart Type does not exists!");
            //        break;
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string VinID = Request.QueryString["VinID"].ToString();

            string ProcessDate = String.Empty;
            DateTime dtProcessDate = DateTime.Today;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ProcessDate"]))
            {
                ProcessDate = Request.QueryString["ProcessDate"].ToString();
                dtProcessDate = DateTime.Parse(ProcessDate);
            }

            string ReportType = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportType"]))
            {
                ReportType = Request.QueryString["ReportType"].ToString();
            }

            string WeekNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["WeekNumber"]))
            {
                WeekNumber = Request.QueryString["WeekNumber"].ToString();
            }

            string YearNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["YearNumber"]))
            {
                YearNumber = Request.QueryString["YearNumber"].ToString();
            }

            string ReportPeriod = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportPeriod"]))
            {
                ReportPeriod = Request.QueryString["ReportPeriod"].ToString();
            }

            int intWeekNumber = 0;
            int intYearNumber = 0;

            string DtRangeWeekly = String.Empty;
            if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
            {
                bool IsWeekNumeric = int.TryParse(WeekNumber, out intWeekNumber);
                if (IsWeekNumeric)
                {
                    intWeekNumber = int.Parse(WeekNumber);
                }

                bool IsYearNumeric = int.TryParse(YearNumber, out intYearNumber);
                if (IsYearNumeric)
                {
                    intYearNumber = int.Parse(YearNumber);
                }

                GetChartData gd = new GetChartData();
                DataTable DtRange = gd.GetDateRangeFromWeekNumber(intWeekNumber, intYearNumber);

                DtRangeWeekly = Convert.ToDateTime(DtRange.Rows[0]["StartDate"]).ToString("d") + " - " + Convert.ToDateTime(DtRange.Rows[0]["EndDate"]).ToString("d");
            }

            if (ReportPeriod == "Weekly")
            {
                lblHead.InnerHtml = "<br/><br/><b>Weekly Vehicle Report";
            }
            else if (ReportPeriod == "NREL")
            {
                lblHead.InnerHtml = "<br/><br/><b>NREL Weekly Vehicle Report";
            }

            else if (ReportPeriod == "DailyBattery")
            {
                lblHead.InnerHtml = "<br/><br/><b>Daily Battery Report";
            }

            else if (ReportPeriod == "DailyBatteryAllCust")
            {
                lblHead.InnerHtml = "<br/><br/><b>Daily Battery Status Report";
            }

            else
            {
                lblHead.InnerHtml = "<br/><br/><b>Daily Vehicle Report";
            }

             Vehicles Vehicle = new Vehicles();

            if (VinID != "")
            {
                int intVinID;
                bool IsVinNumeric = int.TryParse(VinID, out intVinID);

                if (IsVinNumeric)
                {
                    intVinID = int.Parse(VinID);

                    GetChartData gcd = new GetChartData();
                    Vehicle = gcd.GetVinInfo(intVinID);

                    lblVin.InnerHtml = "<br/><br/><b>" + Vehicle.CustomerName + "  -  " + Vehicle.Vin;
                    if (ReportPeriod == "Weekly")
                    {
                     lblDate.InnerHtml = "<br/><br/><b>Report Dates: " + DtRangeWeekly;
                    }
                    else if (ReportPeriod == "NREL")
                    {
                        lblDate.InnerHtml = "<br/><br/><b>Report Dates: " + DtRangeWeekly;
                    }
                    else if (ReportPeriod == "DailyBattery")
                    {
                        lblDate.InnerHtml = "<br/><br/><b>Report Dates: " + dtProcessDate.ToShortDateString();
                    }
                    else if (ReportPeriod == "DailyBatteryAllCust")
                    {
                        lblDate.InnerHtml = "<br/><br/><b>Report Dates: " + dtProcessDate.ToShortDateString();
                        lblVin.Visible = false;
                        splashImg.Visible = false;
                    }

                    else
                    {
                        lblDate.InnerHtml = "<br/><br/><b>Report Date: " + dtProcessDate.ToShortDateString();
                    }

                }
                else
                {
                    lblVin.InnerHtml = "<br/><br/><b>" + " Vehicle does not exists!";
                    Response.End();
                }

            }
            else
            {
                lblVin.InnerHtml = "<b>" + " Vehicle does not exists!";
                Response.End();
            }

            //VinID = "221";
            //  ReportType = "GenVehicleData_VinSpeed";
            //ReportType = "GenVehicleData_CurrentVoltage";
            //ProcessDate = "04/13/2015";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string VinID =string.Empty;

            if (!String.IsNullOrEmpty(Request.QueryString["VinID"]))
            {
                VinID = Request.QueryString["VinID"].ToString();

            }

            string ChargingStationID = string.Empty;

            if (!String.IsNullOrEmpty(Request.QueryString["ChargingStationID"]))
            {
                ChargingStationID = Request.QueryString["ChargingStationID"].ToString();

            }

            string ProcessDate = String.Empty;
            DateTime dtProcessDate = DateTime.Today;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ProcessDate"]))
            {
                ProcessDate = Request.QueryString["ProcessDate"].ToString();
                dtProcessDate = DateTime.Parse(ProcessDate);
            }

            string ReportType = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportType"]))
            {
                ReportType = Request.QueryString["ReportType"].ToString();
            }

            string WeekNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["WeekNumber"]))
            {
                WeekNumber = Request.QueryString["WeekNumber"].ToString();
            }

            string YearNumber = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["YearNumber"]))
            {
                YearNumber = Request.QueryString["YearNumber"].ToString();
            }

            string ReportPeriod = String.Empty;
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ReportPeriod"]))
            {
                ReportPeriod = Request.QueryString["ReportPeriod"].ToString();
            }

            int intWeekNumber = 0;
            int intYearNumber = 0;

            string DtRangeWeekly = String.Empty;
            if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
            {
                bool IsWeekNumeric = int.TryParse(WeekNumber, out intWeekNumber);
                if (IsWeekNumeric)
                {
                    intWeekNumber = int.Parse(WeekNumber);
                }

                bool IsYearNumeric = int.TryParse(YearNumber, out intYearNumber);
                if (IsYearNumeric)
                {
                    intYearNumber = int.Parse(YearNumber);
                }

                GetChartData gd = new GetChartData();
                DataTable DtRange = gd.GetDateRangeFromWeekNumber(intWeekNumber, intYearNumber);

                DtRangeWeekly = Convert.ToDateTime(DtRange.Rows[0]["StartDate"]).ToString("d") + " - " + Convert.ToDateTime(DtRange.Rows[0]["EndDate"]).ToString("d");
            }

            //string ReportType = Request.QueryString["ReportType"].ToString();
            //string ReportPeriod = Request.QueryString["ReportPeriod"].ToString();
            //string WeekNumber = Request.QueryString["WeekNumber"].ToString();
            //string YearNumber = Request.QueryString["YearNumber"].ToString();

            //VinID = "221";
            //  ReportType = "GenVehicleData_VinSpeed";
            //ReportType = "GenVehicleData_CurrentVoltage";
            //ProcessDate = "04/13/2015";
            //DateTime dtProcessDate = DateTime.Parse(ProcessDate);

            Vehicles Vehicle = new Vehicles();

            if (VinID != "")
            {
                int intVinID;
                bool IsVinNumeric = int.TryParse(VinID, out intVinID);

                if (IsVinNumeric)
                {
                    intVinID = int.Parse(VinID);

                    GetChartData gcd = new GetChartData();
                    Vehicle = gcd.GetVinInfo(intVinID);

                }
                else
                {
                    Response.Write(" Vehicle does not exists!");
                    Response.End();
                }

            }
            //else
            //{
            //    Response.Write(" Vehicle does not exists!");
            //    Response.End();
            //}

            Chargers Charger = new Chargers();
            int intChargingStationID = 0;

            if (ChargingStationID != "")
            {

                bool IsChargerNumeric = int.TryParse(ChargingStationID, out intChargingStationID);

                if (IsChargerNumeric)
                {
                    intChargingStationID = int.Parse(ChargingStationID);

                    GetChartData gcd = new GetChartData();
                    Charger = gcd.GetChargerInfo(intChargingStationID);

                }
                else
                {
                    Response.Write(" Charger does not exists!");
                    Response.End();
                }

            }
            //else
            //{
            //    Response.Write(" Charger does not exists!");
            //    Response.End();
            //}

            switch (ReportType)
            {

                case "GenVehicleData_VinSpeedHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinSpeedHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinSpeedHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinEfficiencyHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinEfficiencyHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinEfficiencyHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinAccelPedalHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinAccelPedalHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinAccelPedalHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinBrakePedalHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinBrakePedalHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinBrakePedalHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinChargingHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinChargingHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinChargingHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinVoltageHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinVoltageHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinVoltageHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinSocMinHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinSocMinHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinSocMinHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinBatteryTempMaxHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinBatteryTempMaxHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinBatteryTempMaxHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinPECoolantTempHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinPECoolantTempHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinPECoolantTempHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinDCDCConverterPowerHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinDCDCConverterPowerHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinDCDCConverterPowerHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinTractionMotorRotorTempHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTractionMotorRotorTempHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTractionMotorRotorTempHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinStatorTempHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinStatorTempHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinStatorTempHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinTractionMotorInverterTempHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTractionMotorInverterTempHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTractionMotorInverterTempHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinTractionMotorIGBTTempHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTractionMotorIGBTTempHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTractionMotorIGBTTempHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinRadiatorFanSpeedHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinRadiatorFanSpeedHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinRadiatorFanSpeedHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinBatteryCoolantPumpHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinBatteryCoolantPumpHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinBatteryCoolantPumpHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinMinAirPressureHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinMinAirPressureHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinMinAirPressureHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinTransTempHist":
                     if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTransTempHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinTransTempHist(Vehicle, dtProcessDate);
                    }

                    break;

                case "GenVehicleData_VinChgEnergyHist":
                    if (ReportPeriod == "Weekly" || ReportPeriod == "NREL")
                    {
                        ReportServices_DailyGrab_GenVehicleData_VinChgEnergyHist(Vehicle, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        //do nothing
                    }

                    break;

                    case "GenVehicleData_ChargerStatusHist":
                    if (ReportPeriod == "Weekly")
                    {
                        ReportServices_DailyGrab_GenChargerData_ChargerHist(Charger, intWeekNumber, intYearNumber);
                    }
                    else
                    {
                        //do nothing
                    }

                    break;

                default:
                    Response.Write(" Chart Type does not exists!");
                    break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string VinID = Request.QueryString["VinID"].ToString();
            string ProcessDate = Request.QueryString["ProcessDate"].ToString();
            string ReportType = Request.QueryString["ReportType"].ToString();

            //VinID = "221";
            //  ReportType = "GenVehicleData_VinSpeed";
            //ReportType = "GenVehicleData_CurrentVoltage";
            //ProcessDate = "04/13/2015";
            DateTime dtProcessDate = DateTime.Parse(ProcessDate);

            Vehicles Vehicle = new Vehicles();

            if (VinID != "")
            {
                int intVinID;
                bool IsVinNumeric = int.TryParse(VinID, out intVinID);

                if (IsVinNumeric)
                {
                    intVinID = int.Parse(VinID);

                    GetChartData gcd = new GetChartData();
                    Vehicle = gcd.GetVinInfo(intVinID);

                }
                else
                {
                    Response.Write(" Vehicle does not exists!");
                    Response.End();
                }

            }
            else
            {
                Response.Write(" Vehicle does not exists!");
                Response.End();
            }

            switch (ReportType)
            {
                case "GenVehicleData_SoC":
                    ReportServices_DailyGrab_GenVehicleData_SOC(Vehicle, dtProcessDate);
                    break;
                case "GenVehicleData_SoCByPacks_Min":
                    ReportServices_DailyGrab_GenVehicleData_SOCByPacks(Vehicle, dtProcessDate, "MinSoC");
                    break;
                case "GenVehicleData_SoCByPacks_Max":
                    ReportServices_DailyGrab_GenVehicleData_SOCByPacks(Vehicle, dtProcessDate, "MaxSoC");
                    break;
                case "GenVehicleData_TMaxByPacks":
                    ReportServices_DailyGrab_GenVehicleData_TMaxByPacks(Vehicle, dtProcessDate);
                    break;
                case "GenVehicleData_CurrentByPacks":
                    ReportServices_DailyGrab_GenVehicleData_CurrentByPacks(Vehicle, dtProcessDate);
                    break;
                case "GenVehicleData_VinSpeed":
                    ReportServices_DailyGrab_GenVehicleData_VinSpeed(Vehicle, dtProcessDate);
                    break;
                case "GenVehicleData_CurrentVoltage":
                    ReportServices_DailyGrab_GenVehicleData_CurrentVoltage(Vehicle, dtProcessDate);
                    break;
                case "GenVehicleData_SoCEnergy":
                    ReportServices_DailyGrab_GenVehicleData_SOCEnergy(Vehicle, dtProcessDate);
                    break;
                case "GenVehicleData_VinSpeedHist":
                    ReportServices_DailyGrab_GenVehicleData_VinSpeedHist(Vehicle, dtProcessDate);
                    break;

                default:
                    Response.Write(" Chart Type does not exists!");
                    break;
            }
        }