//
        // GET: /DeploymentPeriod/

        public ActionResult DeploymentPeriodDashboard()
        {
            List <ACM.Model.DeploymentPeriod> deploymentperiod = new List <ACM.Model.DeploymentPeriod>();
            DeploymentPeriodBO deploymentPeriodbo = new DeploymentPeriodBO();

            deploymentperiod = deploymentPeriodbo.GetAllDeploymentPeriods();
            return(View(deploymentperiod));
        }
        public JsonResult GetDeploymentPeriodDashboard(string sidx, string sord, int page, int rows)
        {
            List <ACM.Model.DeploymentPeriod> deploymentperiod = new List <ACM.Model.DeploymentPeriod>();
            //string loginId = Utility.LoginId(User.Identity.Name);

            DeploymentPeriodBO deploymentPeriodbo = new DeploymentPeriodBO();

            deploymentperiod = deploymentPeriodbo.GetAllDeploymentPeriods();
            switch (sidx.Trim())
            {
            case "DeploymentStartDate":
                deploymentperiod = (sord == "asc") ? deploymentperiod.OrderBy(i => i.DeploymentStartDate).ToList() : deploymentperiod.OrderByDescending(i => i.DeploymentStartDate).ToList();
                break;

            case "DeploymentEndEndDate":
                deploymentperiod = (sord == "asc") ? deploymentperiod.OrderBy(i => i.DeploymentEndEndDate).ToList() : deploymentperiod.OrderByDescending(i => i.DeploymentEndEndDate).ToList();
                break;

            case "DeploymentName":
                deploymentperiod = (sord == "asc") ? deploymentperiod.OrderBy(i => i.DeploymentName).ToList() : deploymentperiod.OrderByDescending(i => i.DeploymentName).ToList();
                break;

            case "Status":
                deploymentperiod = (sord == "asc") ? deploymentperiod.OrderBy(i => i.Status).ToList() : deploymentperiod.OrderByDescending(i => i.Status).ToList();
                break;
                //case "CampaignName":
                //    deploymentperiod = (sord == "asc") ? deploymentperiod.OrderBy(i => i.CampaignName).ToList() : deploymentperiod.OrderByDescending(i => i.CampaignName).ToList();
                //    break;
            }

            var totalRecords = deploymentperiod.Count();
            var assets       = from a in deploymentperiod
                               select new
            {
                DeploymentPeriodId   = a.DeploymentPeriodId,
                DeploymentName       = a.DeploymentName,
                DeploymentStartDate  = a.DeploymentStartDate.ToShortDateString(),
                DeploymentEndEndDate = a.DeploymentEndEndDate.ToShortDateString(),
                Status = a.Status,
                Action = "Edit"
            };
            var result = new
            {
                total   = (totalRecords + rows - 1) / rows, //number of pages
                page    = page,                             //current page
                records = totalRecords,                     //total items
                rows    = assets.AsEnumerable().Skip((page - 1) * rows).Take(rows)
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }