public MajorActivityDetails ComputeTonnageByType(string sortBy, string sortKey, List <TonnageByActivity> activityList)
        {
            MajorActivityDetails     finalValues       = new MajorActivityDetails();
            List <TonnageByActivity> tempActivityList  = new List <TonnageByActivity>();
            List <TonnageByActivity> finalActivityList = new List <TonnageByActivity>();

            if (sortBy.ToUpper() == "ACTIVITY")
            {
                tempActivityList = activityList.Where(s => s.GeneralActivity.Trim().ToUpper() == sortKey).ToList();
            }
            else if (sortBy.ToUpper() == "EQUIPMENT")
            {
                tempActivityList = activityList.Where(s => s.EquipmentID == Convert.ToInt32(sortKey)).ToList();
            }

            finalValues.TotalWMT        = 0;
            finalValues.TotalHours      = 0;
            finalValues.TotalWMTPerHour = 0;
            finalValues.SaproWMT        = 0;
            finalValues.SaproHours      = 0;
            finalValues.LimoWMT         = 0;
            finalValues.LimoHours       = 0;
            finalValues.WasteWMT        = 0;
            finalValues.WasteHours      = 0;

            if (tempActivityList.Count <= 0)
            {
                return(finalValues);
            }

            finalValues.TotalWMT        = tempActivityList.Select(s => s.TonnageAmount).Sum();
            finalValues.TotalHours      = Convert.ToDecimal(tempActivityList.Select(s => s.TotalMinutes).Sum() / 60);
            finalValues.TotalWMTPerHour = finalValues.TotalWMT / finalValues.TotalHours;

            finalActivityList = tempActivityList.Where(s => s.MaterialName.Trim().ToUpper() == "SAPROLITE" || s.MaterialName.Trim().ToUpper() == "SAPRO" || s.MaterialName.Trim().ToUpper() == "SHIPPABLE SAPRO").ToList();
            if (finalActivityList.Count > 0)
            {
                finalValues.SaproWMT   = finalActivityList.Select(s => s.TonnageAmount).Sum();
                finalValues.SaproHours = Convert.ToDecimal(finalActivityList.Select(s => s.TotalMinutes).Sum() / 60);
            }

            finalActivityList = tempActivityList.Where(s => s.MaterialName.Trim().ToUpper() == "LIMONITE" || s.MaterialName.Trim().ToUpper() == "LIMO" || s.MaterialName.Trim().ToUpper() == "SHIPPABLE LIMO").ToList();
            if (finalActivityList.Count > 0)
            {
                finalValues.LimoWMT   = finalActivityList.Select(s => s.TonnageAmount).Sum();
                finalValues.LimoHours = Convert.ToDecimal(finalActivityList.Select(s => s.TotalMinutes).Sum() / 60);
            }

            finalActivityList = tempActivityList.Where(s => s.MaterialName.Trim().ToUpper() == "BOULDERS" || s.MaterialName.Trim().ToUpper() == "CRUSHED BOULDERS" || s.MaterialName.Trim().ToUpper() == "LIMO WASTE" || s.MaterialName.Trim().ToUpper() == "SAPRO WASTE" || s.MaterialName.Trim().ToUpper() == "TOPSOIL").ToList();
            if (finalActivityList.Count > 0)
            {
                finalValues.WasteWMT   = finalActivityList.Select(s => s.TonnageAmount).Sum();
                finalValues.WasteHours = Convert.ToDecimal(finalActivityList.Select(s => s.TotalMinutes).Sum() / 60);
            }

            return(finalValues);
        }
        public JsonResult GetTonnageByActivity(string majorActivity)
        {
            MajorActivityDetails   majorActivityDetails      = new MajorActivityDetails();
            TonnageByMajorActivity curTonnageByMajorActivity = (TonnageByMajorActivity)Session["tonnageByActivitySession"];

            if (majorActivity.Trim() == "Bargeloading/Shiploading")
            {
                majorActivityDetails = curTonnageByMajorActivity.BargeShipLoading;
            }
            else if (majorActivity.Trim() == "Crushing")
            {
                majorActivityDetails = curTonnageByMajorActivity.Crushing;
            }
            else if (majorActivity.Trim() == "Direct Mining")
            {
                majorActivityDetails = curTonnageByMajorActivity.DirectMining;
            }
            else if (majorActivity.Trim() == "Employee Servicing")
            {
                majorActivityDetails = curTonnageByMajorActivity.EmployeeServicing;
            }
            else if (majorActivity.Trim() == "Envi Major")
            {
                majorActivityDetails = curTonnageByMajorActivity.EnviMajor;
            }
            else if (majorActivity.Trim() == "EPEP")
            {
                majorActivityDetails = curTonnageByMajorActivity.EPEP;
            }
            else if (majorActivity.Trim() == "Mining")
            {
                majorActivityDetails = curTonnageByMajorActivity.Mining;
            }
            else if (majorActivity.Trim() == "Mining Area Management and Maintenance")
            {
                majorActivityDetails = curTonnageByMajorActivity.MiningAreaMngmtMntnce;
            }
            else if (majorActivity.Trim() == "Pit Prep and Miscellaneous Activities")
            {
                majorActivityDetails = curTonnageByMajorActivity.PitPrepMiscellaneousAct;
            }
            else if (majorActivity.Trim() == "Project")
            {
                majorActivityDetails = curTonnageByMajorActivity.Project;
            }
            else if (majorActivity.Trim() == "Rehandling")
            {
                majorActivityDetails = curTonnageByMajorActivity.Rehandling;
            }

            System.Diagnostics.Debug.WriteLine("Total WMT: " + majorActivityDetails.TotalWMT);
            ViewBag.MajorActivity = majorActivity.ToUpper();
            return(Json(majorActivityDetails, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetTonnageByEquipment(string equipmentType)
        {
            TonnageByEquipment   curTonnageByEquipment = (TonnageByEquipment)Session["tonnageByEquipmentSession"];
            MajorActivityDetails majorActivityDetails  = new MajorActivityDetails();

            if (equipmentType.Trim() == "Dump Truck")
            {
                majorActivityDetails = curTonnageByEquipment.DumpTruckData;
            }
            else if (equipmentType.Trim() == "Excavator")
            {
                majorActivityDetails = curTonnageByEquipment.ExcavatorData;
            }
            else if (equipmentType.Trim() == "Auxiliary")
            {
                majorActivityDetails = curTonnageByEquipment.AuxiliaryData;
            }
            else if (equipmentType.Trim() == "Stationary")
            {
                majorActivityDetails = curTonnageByEquipment.StationaryData;
            }
            else if (equipmentType.Trim() == "Envi")
            {
                majorActivityDetails = curTonnageByEquipment.EnviData;
            }
            else if (equipmentType.Trim() == "SVST")
            {
                majorActivityDetails = curTonnageByEquipment.SVSTData;
            }
            else if (equipmentType.Trim() == "Non Equipment")
            {
                majorActivityDetails = curTonnageByEquipment.NonEquipmentData;
            }
            else if (equipmentType.Trim() == "Rainfall")
            {
                majorActivityDetails = curTonnageByEquipment.RainfallData;
            }

            ViewBag.MajorActivity = equipmentType.ToUpper();
            return(Json(majorActivityDetails, JsonRequestBehavior.AllowGet));
        }