// GET
        public ActionResult AntiVirusPolicy(int? AntiVirusID)
        {
            BLCustomer AntiVirusBL = new BLCustomer();
            tblAntiVirusPolicy tblantivirus = new tblAntiVirusPolicy();
            tblantivirus = AntiVirusBL.GetAntiVirus(AntiVirusID.Value);

            List<KeyValue> lstKeyVal = new List<KeyValue>();
            lstKeyVal.Add(new KeyValue() { Key = "Anti-Virus Policy Name", Value = tblantivirus.PolicyName });
            lstKeyVal.Add(new KeyValue() { Key = "Av Product Name", Value = tblantivirus.ProductName });
            lstKeyVal.Add(new KeyValue()
            {
                Key = "Patching Time",
                Value = tblantivirus.PatchingTime + " " + tblantivirus.PatchingTimeZone.ID
            });
            lstKeyVal.Add(new KeyValue() { Key = "Define Week Day (for weekly schedule)", Value = tblantivirus.WeekOfDay.Name });
            lstKeyVal.Add(new KeyValue() { Key = "Define Month of Day (for Monthly Schedule) ", Value = tblantivirus.MonthOfDay.Name });
            lstKeyVal.Add(new KeyValue() { Key = "Anti-Virus Scan Exclusion", Value = tblantivirus.PolicyName });
            lstKeyVal.Add(new KeyValue() { Key = "Exclude files with an extension", Value = tblantivirus.ExcludedFilesExtension });
            lstKeyVal.Add(new KeyValue() { Key = "Exclude File Types", Value = tblantivirus.ExcludedFileTypes });
            lstKeyVal.Add(new KeyValue() { Key = "Exclude File Paths", Value = tblantivirus.ExcludedFilePaths });

            if (Request.IsAjaxRequest())
                return PartialView("Detail", lstKeyVal);
            else
                return View("Detail", lstKeyVal);
        }
 // GET
 public ActionResult AccessPolicy(int? AccessPolicyID)
 {
     BLCustomer customerBL = new BLCustomer();
     tblAccessPolicy Accesspoly = customerBL.GetAccessPolicyByID(AccessPolicyID.Value);
     List<KeyValue> lstKeyVal = new List<KeyValue>();
     //AccessPolicyIDWR
     if (Accesspoly.AccessPolicyIDWR > 0)
     {
         lstKeyVal.Add(new KeyValue() { Key = "Remote control permission allowed?", Value = Accesspoly.RemoteControlPermissionWR.Name });
         lstKeyVal.Add(new KeyValue()
         {
             Key = "Allowed Remote Access Start Time",
             Value = Accesspoly.RemoteAccessStartTimeWR + " - " + Accesspoly.RemoteAccessEndTimeWR + " " + Accesspoly.RemoteAccessTimeZoneWR.Name
         });
         lstKeyVal.Add(new KeyValue() { Key = "Reboot Permission", Value = Accesspoly.RebootPermissionWR.Name });
         lstKeyVal.Add(new KeyValue()
         {
             Key = "Allowed Reboot Window",
             Value = Accesspoly.RebootWindowStartTimeWR + " - " + Accesspoly.RebootWindowEndTimeWR + " " + Accesspoly.RebootTimeZoneWR.Name
         });
     }
     //AccessPolicyIDSR
     else if (Accesspoly.AccessPolicyIDSR > 0)
     {
         lstKeyVal.Add(new KeyValue() { Key = "Remote control permission allowed?", Value = Accesspoly.RemoteControlPermissionSR.Name });
         lstKeyVal.Add(new KeyValue()
         {
             Key = "Allowed Remote Access Start Time",
             Value = Accesspoly.RemoteAccessStartTimeSR + " - " + Accesspoly.RemoteAccessEndTimeSR + " " + Accesspoly.RemoteAccessTimeZoneSR.Name
         });
         lstKeyVal.Add(new KeyValue() { Key = "Reboot Permission", Value = Accesspoly.RebootPermissionSR.Name });
         lstKeyVal.Add(new KeyValue()
         {
             Key = "Allowed Reboot Window",
             Value = Accesspoly.RebootWindowStartTimeSR + " - " + Accesspoly.RebootWindowEndTimeSR + " " + Accesspoly.RebootTimeZoneSR.Name
         });
     }
     //AccessPolicyIDND
     else if (Accesspoly.AccessPolicyIDND > 0)
     {
         lstKeyVal.Add(new KeyValue() { Key = "Remote control permission allowed?", Value = Accesspoly.RemoteControlPermissionND.Name });
         lstKeyVal.Add(new KeyValue()
         {
             Key = "Allowed Remote Access Start Time",
             Value = Accesspoly.RemoteAccessStartTimeND + " - " + Accesspoly.RemoteAccessEndTimeND + " " + Accesspoly.RemoteAccessTimeZoneND.Name
         });
         lstKeyVal.Add(new KeyValue() { Key = "Reboot Permission", Value = Accesspoly.RebootPermissionND.Name });
         lstKeyVal.Add(new KeyValue()
         {
             Key = "Allowed Reboot Window",
             Value = Accesspoly.RebootWindowStartTimeND + " - " + Accesspoly.RebootWindowEndTimeND + " " + Accesspoly.RebootTimeZoneND.Name
         });
     }
     if (Request.IsAjaxRequest())
         return PartialView("Detail", lstKeyVal);
     else
         return View("Detail", lstKeyVal);
 }
 //Get
 public ActionResult DeleteUser(int? CustomerID)
 {
     BLCustomer customerBL = new BLCustomer();
     StringBuilder str = customerBL.GetDeleteCustomer(CustomerID.Value);
     if (str.Length > 0)
         return Json(new { success = false, resultmsg = str.ToString() }, JsonRequestBehavior.AllowGet);
     else
         return Json(new { success = true, resultmsg = "User deleted successfully" }, JsonRequestBehavior.AllowGet);
 }
        //Get
        public ActionResult User()
        {
            BLCustomer customerBL = new BLCustomer();
            tblCustomerDetails customer = customerBL.GetCustomer(SessionHelper.UserSession.CustomerID);

            ViewBag.TimeZones = LookUpData.GetTimeZoneCI();
            ViewBag.NOCCommunicationBy = LookUpData.GetNOCCommunicationBy();

            if (Request.IsAjaxRequest())
                return PartialView( customer);
            else
                return View(customer);
        }
 public JsonResult AccessPolicy(tblAccessPolicy AccessPolicy)
 {
     try
     {
         BLCustomer customerBL = new BLCustomer();
         AccessPolicy.CustomerID = SessionHelper.UserSession.CustomerID;
         customerBL.SaveAccessPolicy(AccessPolicy);
     }
     catch
     {
         ModelState.AddModelError("", "Error occurred durung Customer Information save.");
         return Json(new { errors = KeyValue.GetErrorsFromModelState(ViewData) });
     }
     return Json(new { success = true, Tab = "AP" });
 }
        //Get
        public ActionResult Email(int CustomerID)
        {
            try
            {
                BLCustomer customerBL = new BLCustomer();
                tblCustomerDetails customer = customerBL.GetCustomer(CustomerID);
                Common.SendMail(customer.EmailAddress, "Please login in flexis system with these credentials !", "User Name: " + customer.EmailAddress + "<br>" + "Password: "******"", "Error occurred durung Customer Information save.");
                return Json(new { errors = KeyValue.GetErrorsFromModelState(ViewData) });
            }

            return Json(new { success = true, MessageDetail = "User's credentials successfully sent to his/her mail address." }, JsonRequestBehavior.AllowGet);
        }
        // GET
        public ActionResult AccessPolicy(int? CustomerID)
        {
            BLCustomer customerBL = new BLCustomer();

            tblAccessPolicy Accesspoly = customerBL.GetAccessPolicy(CustomerID.Value);

            ViewBag.SearchTypes = LookUpData.GetPolicyType();
            ViewBag.TimeZones = LookUpData.GetTimeZone();
            ViewBag.OptionTypeBag = LookUpData.GetOptionType();
            ViewBag.time = LookUpData.GetFXTime();
            ViewBag.ReadOnly = false;

            if (Request.IsAjaxRequest())
                return PartialView(Accesspoly);
            else
                return View(Accesspoly);
        }
        // GET
        public ActionResult AntiVirusPolicy(int? AntiVirusID)
        {
            BLCustomer AntiVirusBL = new BLCustomer();
            tblAntiVirusPolicy tblantivirus = new tblAntiVirusPolicy();
            tblantivirus = AntiVirusBL.GetAntiVirus(AntiVirusID.Value);

            ViewBag.staus = LookUpData.GetSetUpStatus();
            ViewBag.ScheduleAV = LookUpData.GetScheduleType();
            ViewBag.SearchTypes = LookUpData.GetPolicyType();

            ViewBag.WeekOfDayAV = LookUpData.GetWeekOfDay();
            ViewBag.time = LookUpData.GetFXTime();
            ViewBag.MonthOfDayAV = LookUpData.GetMonthOfDay();
            ViewBag.TimeZones = LookUpData.GetTimeZone();
            ViewBag.ScheduleType = LookUpData.GetScheduleType();

            if (Request.IsAjaxRequest())
                return PartialView(tblantivirus);
            else
                return View(tblantivirus);
        }
        // GET
        public ActionResult AntiVirusPolicies(jQueryDataTableParamModel param)
        {
            int totalRecords = 0;

            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            var sortDirection = Request["sSortDir_0"]; // asc or desc

            BLCustomer MaintenanceBL = new BLCustomer();
            List<tblAntiVirusPolicy> lstAntiVirusPolicy = MaintenanceBL.GetAVPIndex(SessionHelper.UserSession.CustomerID, param.iDisplayStart, param.iDisplayLength, sortColumnIndex, sortDirection, param.sSearch, ref totalRecords);

            var result = from a in lstAntiVirusPolicy
                         let PatchingTime = a.PatchingTime + " - " + a.PatchingTimeZone.Name
                         let WeekOfDaysName = a.WeekOfDay.Name
                         let MonthOfDaysName = a.MonthOfDay.Name
                         select new[] { a.PolicyName, a.ProductName, PatchingTime, WeekOfDaysName, MonthOfDaysName, a.ExcludedFilesExtension, a.ExcludedFileTypes, a.ExcludedFilePaths, a.AntiVirusID.ToString() };

            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = totalRecords,
                iTotalDisplayRecords = totalRecords,
                aaData = result
            }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult ToolInformation(tbltoolInfomation toolInfo)
        {
            try
            {
                BLCustomer customerBL = new BLCustomer();
                toolInfo.CustomerID = SessionHelper.UserSession.CustomerID;
                customerBL.SaveToolInfo(toolInfo);
            }
            catch
            {
                ModelState.AddModelError("", "Error occurred durung Tool Information save.");
                return Json(new { errors = KeyValue.GetErrorsFromModelState(ViewData) });
            }

            return Json(new { success = true, Tab = "TI" });
        }
 // GET
 public ActionResult ToolInformation(int? CustomerID)
 {
     BLCustomer customerBL = new BLCustomer();
     tbltoolInfomation tbltoolinfo = customerBL.GetToolInfo(CustomerID.Value);
     if (Request.IsAjaxRequest())
         return PartialView(tbltoolinfo);
     else
         return View(tbltoolinfo);
 }
        //Get
        public ActionResult User(int? CustomerID, int? RoleID)
        {
            BLCustomer customerBL = new BLCustomer();
            tblCustomerDetails customer = customerBL.GetCustomer(CustomerID.Value);
            if (CustomerID.HasValue && CustomerID.Value > 0)
                customer.RoleID = RoleID.HasValue ? RoleID.Value : 0;
            ViewBag.TimeZones = LookUpData.GetTimeZoneCI();
            ViewBag.NOCCommunicationBy = LookUpData.GetNOCCommunicationBy();

            if (Request.IsAjaxRequest())
                return PartialView(customer);
            else
                return View(customer);
        }
        // GET
        public ActionResult PatchingPolicy(int? CustomerID)
        {
            BLCustomer customerBL = new BLCustomer();
            tblPatchingPolicy Patchpoly = customerBL.GetPatchingPolicy(CustomerID.Value);
            ViewBag.SearchTypes = LookUpData.GetPolicyType();
            ViewBag.WeekOfMonth = LookUpData.GetWeekOfMonth();
            ViewBag.time = LookUpData.GetFXTime();
            ViewBag.MonthOfDay = LookUpData.GetMonthOfDay();
            ViewBag.TimeZones = LookUpData.GetTimeZone();
            ViewBag.Schedule = LookUpData.GetScheduleType();
            ViewBag.OptionTypeBag = LookUpData.GetOptionType();

            tblPatchingPolicy patchingPolicy = new tblPatchingPolicy();

            if (Request.IsAjaxRequest())
                return PartialView(Patchpoly);
            else
                return View(Patchpoly);
        }
 public JsonResult MaintenancePolicy(tblMaintenancePolicy Manintenance)
 {
     try
     {
         BLCustomer customerBL = new BLCustomer();
         Manintenance.CustomerID = SessionHelper.UserSession.CustomerID;
         customerBL.SaveMaintenancePolicy(Manintenance);
     }
     catch
     {
         ModelState.AddModelError("", "Error occurred durung Customer Information save.");
         return Json(new { errors = KeyValue.GetErrorsFromModelState(ViewData) });
     }
     return Json(new { success = true, Tab = "MP" });
 }
        // GET
        public ActionResult MaintenancePolicy(int? MaintenancePolicyID)
        {
            BLCustomer MaintenanceBL = new BLCustomer();
            tblMaintenancePolicy tblmaintenance = new tblMaintenancePolicy();
            tblmaintenance = MaintenanceBL.GetMaintenance(MaintenancePolicyID.Value);
            if (MaintenancePolicyID.Value == 0)
                tblmaintenance.ScheduledStartDate = DateTime.Now;
            ViewBag.WeekOfMonths = LookUpData.GetWeekOfMonth();
            ViewBag.WeekOfDay = LookUpData.GetWeekOfDay();
            ViewBag.time = LookUpData.GetFXTime();
            ViewBag.MonthOfDay = LookUpData.GetMonthOfDay();
            ViewBag.TimeZones = LookUpData.GetTimeZone();
            ViewBag.ScheduleTypeM = LookUpData.GetScheduleType();

            if (Request.IsAjaxRequest())
                return PartialView("MaintenancePolicy", tblmaintenance);
            else
                return View("MaintenancePolicy", tblmaintenance);
        }
        // GET
        public ActionResult PatchingPolicy(int? PatchingPolicyID)
        {
            BLCustomer customerBL = new BLCustomer();
            tblPatchingPolicy Patchpoly = customerBL.GetPatchingPolicyByID(PatchingPolicyID.Value);

            List<KeyValue> lstKeyVal = new List<KeyValue>();
            //PatchingPolicyIDWR
            if (Patchpoly.PatchingPolicyIDWR > 0)
            {
                lstKeyVal.Add(new KeyValue() { Key = "Patching Policy Name", Value = Patchpoly.PolicyNameWR });
                lstKeyVal.Add(new KeyValue()
                {
                    Key = "Patching Window ",
                    Value = Patchpoly.WindowStartTimeWR + " - " + Patchpoly.WindowEndTimeWR + " " + Patchpoly.WindowTimeZoneWR.Name
                });
              //  lstKeyVal.Add(new KeyValue() { Key = "Define Patching Schedule", Value = Patchpoly.DefineScheduleTypeWR.Name });
                lstKeyVal.Add(new KeyValue() { Key = "Define Week Day (for weekly schedule) ", Value = Patchpoly.WeekOfDayWR.Name });
             //   lstKeyVal.Add(new KeyValue() { Key = "Define Month of Day (for Monthly Schedule)", Value = Patchpoly.MonthOfDayWR.Name });
                lstKeyVal.Add(new KeyValue() { Key = "BReboot Permission ", Value = Patchpoly.RebootPermissionWR.Name });
                lstKeyVal.Add(new KeyValue()
                {
                    Key = "Allowed Reboot Window",
                    Value = Patchpoly.RebootWindowStartTimeWR + " - " + Patchpoly.RebootWindowEndTimeWR + "  " + Patchpoly.RebootWindowTimeZoneWR.Name
                });
            }
            //PatchingPolicyIDSR
            else if (Patchpoly.PatchingPolicyIDSR > 0)
            {
                lstKeyVal.Add(new KeyValue() { Key = "Patching Policy Name", Value = Patchpoly.PolicyNameSR });
                lstKeyVal.Add(new KeyValue()
                {
                    Key = "Patching Window  ",
                    Value = Patchpoly.WindowStartTimeSR + " - " + Patchpoly.WindowEndTimeSR + "  " + Patchpoly.WindowTimeZoneSR.Name
                });
               // lstKeyVal.Add(new KeyValue() { Key = "Define Patching Schedule ", Value = Patchpoly.DefineScheduleTypeSR.Name });
                lstKeyVal.Add(new KeyValue() { Key = "Define Week Day (for weekly schedule) ", Value = Patchpoly.WeekOfDaySR.Name });
                //lstKeyVal.Add(new KeyValue() { Key = "Define Month of Day (for Monthly Schedule) ", Value = Patchpoly.MonthOfDaySR.Name });
                lstKeyVal.Add(new KeyValue() { Key = "Reboot Permission ", Value = Patchpoly.RebootPermissionSR.Name });
                lstKeyVal.Add(new KeyValue()
                {
                    Key = "Allowed Reboot Window",
                    Value = Patchpoly.RebootWindowStartTimeSR.ToString() + " - " + Patchpoly.RebootWindowEndTimeSR.ToString() + "  " +Patchpoly.RebootWindowTimeZoneSR.Name
                });
            }
            //PatchingPolicyIDDND
            else if (Patchpoly.PatchingPolicyIDDND > 0)
            {
                lstKeyVal.Add(new KeyValue() { Key = "Patching Policy Name ", Value = Patchpoly.PolicyNameND });
                lstKeyVal.Add(new KeyValue()
                {
                    Key = "Patching Window ",
                    Value = Patchpoly.WindowStartTimeND + " - " + Patchpoly.WindowEndTimeND + "  " + Patchpoly.WindowTimeZoneND.Name
                });
               // lstKeyVal.Add(new KeyValue() { Key = "Define Patching Schedule   ", Value = Patchpoly.DefineScheduleTypeND.Name });
                lstKeyVal.Add(new KeyValue() { Key = "Define Week Day (for weekly schedule) ", Value = Patchpoly.WeekOfDayND.Name });
                //lstKeyVal.Add(new KeyValue() { Key = "Define Month of Day (for Monthly Schedule) ", Value = Patchpoly.MonthOfDayND.Name });
                lstKeyVal.Add(new KeyValue() { Key = "Reboot Permission ", Value = Patchpoly.RebootPermissionND.Name });
                lstKeyVal.Add(new KeyValue()
                {
                    Key = "Allowed Reboot Window ",
                    Value = Patchpoly.RebootWindowStartTimeND + " - " + Patchpoly.RebootWindowEndTimeND + "  " + Patchpoly.RebootWindowTimeZoneND.Name
                });
            }

            if (Request.IsAjaxRequest())
                return PartialView("Detail", lstKeyVal);
            else
                return View("Detail", lstKeyVal);
        }
 //Get
 public ActionResult DeletePolicy(int? PolicyID, string PolicyType)
 {
     BLCustomer customerBL = new BLCustomer();
     StringBuilder str = customerBL.DeletePolicy(PolicyID.Value, PolicyType);
     if (str.Length > 0)
         return Json(new { success = false, resultmsg = str.ToString() }, JsonRequestBehavior.AllowGet);
     else
         return Json(new { success = true, resultmsg = "Policy deleted successfully" }, JsonRequestBehavior.AllowGet);
 }
        public JsonResult CustomerInformation(tblCustomerDetails customerDetails)
        {
            try
            {
                BLCustomer customerBL = new BLCustomer();
                customerDetails.CustomerID = SessionHelper.UserSession.CustomerID;
                customerBL.SaveCustomer(customerDetails);
            }
            catch
            {
                ModelState.AddModelError("", "Error occurred durung Customer Information save.");
                return Json(new { errors = KeyValue.GetErrorsFromModelState(ViewData) });
            }

            return Json(new { success = true, CustomerID = SessionHelper.UserSession.CustomerID, Tab = "CI" });
        }
        // GET
        public ActionResult CustomerInformation(int? CustomerID)
        {
            BLCustomer customerBL = new BLCustomer();
            tblCustomerDetails customer = customerBL.GetCustomer(CustomerID.Value);

            ViewBag.TimeZones = LookUpData.GetTimeZoneCI();
            ViewBag.NOCCommunicationBy = LookUpData.GetNOCCommunicationBy();

            if (Request.IsAjaxRequest())
                return PartialView(customer);
            else
                return View(customer);
        }
        // GET
        public ActionResult BackUpPolicy(int? BackUpPolicyID)
        {
            BLCustomer BackupBL = new BLCustomer();

            tblBackUpPolicy tblbackup = new tblBackUpPolicy();
            tblbackup = BackupBL.GetBackUp(BackUpPolicyID.Value);

            List<KeyValue> lstKeyVal = new List<KeyValue>();
            lstKeyVal.Add(new KeyValue() { Key = "Back Up Policy Name", Value = tblbackup.PolicyName });
            lstKeyVal.Add(new KeyValue() { Key = "Back Up Product Name", Value = tblbackup.ProductName });
            lstKeyVal.Add(new KeyValue() { Key = "Volume Back Up Image Location", Value = tblbackup.VolumeLocation });
            lstKeyVal.Add(new KeyValue() { Key = "Folder Back Up Image Location ", Value = tblbackup.FolderLocation });
            lstKeyVal.Add(new KeyValue()
            {
                Key = "BackUp Schedule",
                Value = tblbackup.ScheduleTime + " " + tblbackup.ScheduleTimeZone.Name
            });
            lstKeyVal.Add(new KeyValue() { Key = "BackUp Set Details", Value = tblbackup.BackUpSetDetails });
            lstKeyVal.Add(new KeyValue() { Key = "Differentials Every-Days", Value = tblbackup.DifferentialEveryDay.ToString() });
            lstKeyVal.Add(new KeyValue() { Key = "Number of BackUp Sets", Value = tblbackup.PreviousBackupSaved.ToString() });
            lstKeyVal.Add(new KeyValue() { Key = "Full BackUp Every-Day", Value = tblbackup.FullBackUpEveryDay.ToString() });
            lstKeyVal.Add(new KeyValue() { Key = "Domain Name", Value = tblbackup.DomainName });
            lstKeyVal.Add(new KeyValue() { Key = "User Name", Value = tblbackup.UserName });
            lstKeyVal.Add(new KeyValue() { Key = "Password", Value = tblbackup.Password });

            if (Request.IsAjaxRequest())
                return PartialView("Detail", lstKeyVal);
            else
                return View("Detail", lstKeyVal);
        }
        // GET
        public ActionResult BackUpPolicy(int? BackUpPolicyID)
        {
            BLCustomer BackupBL = new BLCustomer();

            tblBackUpPolicy tblbackup = new tblBackUpPolicy();
            tblbackup = BackupBL.GetBackUp(BackUpPolicyID.Value);

            ViewBag.Schedule = LookUpData.GetScheduleType();
            ViewBag.time = LookUpData.GetFXTime();
            ViewBag.TimeZones = LookUpData.GetTimeZone();

            if (Request.IsAjaxRequest())
                return PartialView(tblbackup);
            else
                return View(tblbackup);
        }
        // GET
        public ActionResult BackUpPolicies(jQueryDataTableParamModel param)
        {
            int totalRecords = 0;

            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            var sortDirection = Request["sSortDir_0"]; // asc or desc

            BLCustomer BackupBL = new BLCustomer();
            List<tblBackUpPolicy> lstBackUpPolicies = BackupBL.GetBPIndex(SessionHelper.UserSession.CustomerID, param.iDisplayStart, param.iDisplayLength, sortColumnIndex, sortDirection, param.sSearch, ref totalRecords);

            var result = from a in lstBackUpPolicies
                         let BackUpSchedule = a.ScheduleTime + " - " + a.ScheduleTimeZone.Name
                         select new[] { a.PolicyName, a.ProductName, a.VolumeLocation, a.FolderLocation, BackUpSchedule, a.BackUpSetDetails,
                             a.DifferentialEveryDay.ToString(), a.PreviousBackupSaved.ToString(), a.FullBackUpEveryDay.ToString(),
                             a.BackUpPolicyID.ToString() };

            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = totalRecords,
                iTotalDisplayRecords = totalRecords,
                aaData = result
            }, JsonRequestBehavior.AllowGet);
        }
        // GET
        public ActionResult MaintenancePolicy(int? MaintenancePolicyID)
        {
            BLCustomer MaintenanceBL = new BLCustomer();
            tblMaintenancePolicy tblmaintenance = new tblMaintenancePolicy();
            tblmaintenance = MaintenanceBL.GetMaintenance(MaintenancePolicyID.Value);

            if (MaintenancePolicyID.Value == 0)
                tblmaintenance.ScheduledStartDate = DateTime.Now;

            List<KeyValue> lstKeyVal = new List<KeyValue>();
            lstKeyVal.Add(new KeyValue() { Key = "Activity Name", Value = tblmaintenance.ActivityName });
            lstKeyVal.Add(new KeyValue() { Key = "Define Regular Schedule", Value = tblmaintenance.ScheduleType.Name});
            lstKeyVal.Add(new KeyValue() { Key = "Define Week Day (for weekly schedule)", Value = tblmaintenance.WeekOfDays.Name });
            //  lstKeyVal.Add(new KeyValue() { Key = "Define Month of Day (for Monthly Schedule)", Value = tblmaintenance.MonthOfDays.Name });
            lstKeyVal.Add(new KeyValue()
            {
                Key = "Scheduled Time",
                Value = tblmaintenance.ScheduledStartTime + " - " +
                        tblmaintenance.ScheduledEndTime + " " +
                        tblmaintenance.TimeZone.Name
            });
            lstKeyVal.Add(new KeyValue() { Key = "Start Date", Value = tblmaintenance.ScheduledStartDate.ToString("MM/dd/yyyy") });

            if (Request.IsAjaxRequest())
                return PartialView("Detail", lstKeyVal);
            else
                return View("Detail", lstKeyVal);
        }
        // GET
        public ActionResult MaintenancePolicies(jQueryDataTableParamModel param)
        {
            int totalRecords = 0;

            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            var sortDirection = Request["sSortDir_0"]; // asc or desc

            BLCustomer MaintenanceBL = new BLCustomer();
            List<tblMaintenancePolicy> lstMaintenancePolity = MaintenanceBL.GetMPIndex(SessionHelper.UserSession.CustomerID, param.iDisplayStart, param.iDisplayLength, sortColumnIndex, sortDirection, param.sSearch, ref totalRecords);

            var result = from m in lstMaintenancePolity
                         let ScheduleTypeName = m.ScheduleType.Name
                         let WeekOfDaysName = m.WeekOfDays.Name
                       //  let MonthOfDaysName = m.MonthOfDays.Name
                         let ScheduleDetail = m.ScheduledStartTime + " - " + m.ScheduledEndTime + " " + m.TimeZone.Name
                         select new[] { m.ActivityName, ScheduleTypeName, WeekOfDaysName, ScheduleDetail, m.ScheduledStartDate.ToShortDateString(), m.MaintenancePolicyID.ToString() };

            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = totalRecords,
                iTotalDisplayRecords = totalRecords,
                aaData = result
            }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult ToolInformation(int? ToolID)
        {
            BLCustomer customerBL = new BLCustomer();
            tbltoolInfomation tbltoolinfo = customerBL.GetToolInfoByID(ToolID.Value);

            List<KeyValue> lstKeyVal = new List<KeyValue>();
            //ToolTypeRT
            if (tbltoolinfo.ToolTypeRT > 0)
            {
                lstKeyVal.Add(new KeyValue() { Key = "RMM Tool Name", Value = tbltoolinfo.RMMTool });
                lstKeyVal.Add(new KeyValue() { Key = "RMM Tool UserID", Value = tbltoolinfo.RMMToolUserName });
                lstKeyVal.Add(new KeyValue() { Key = "RMM Tool URL", Value = tbltoolinfo.RMMUrl });
                lstKeyVal.Add(new KeyValue() { Key = "RMM Tool Password", Value = tbltoolinfo.RMMToolPassword });
            }
            //ToolTypePT
            else if (tbltoolinfo.ToolTypePT > 0)
            {
                lstKeyVal.Add(new KeyValue() { Key = "Ticketing/PSA Tool", Value = tbltoolinfo.PSATool });
                lstKeyVal.Add(new KeyValue() { Key = "PSA Tool UserID", Value = tbltoolinfo.PSAToolUserName });
                lstKeyVal.Add(new KeyValue() { Key = "PSA Tool URL", Value = tbltoolinfo.PSAUrl });
                lstKeyVal.Add(new KeyValue() { Key = "PSA Tool Password", Value = tbltoolinfo.PSAToolPassword });
            }
            if (Request.IsAjaxRequest())
                return PartialView("Detail", lstKeyVal);
            else
                return View("Detail", lstKeyVal);
        }