// 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);
        }
 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;

            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);
        }
        internal void FillDropDownList(ref List<tblMaintenancePolicy> Manitenancepoly, ref List<tblAccessPolicy> Accesspoly, ref List<tblAntiVirusPolicy> Antiviruspoly, ref List<tblBackUpPolicy> Backuppoly, ref List<tblPatchingPolicy> PatchingPoly, ref List<tbltoolInfomation> ToolInfoPoly)
        {
            int errorNum = 0;
            string errorDesc = "";

            DataAccess.resetParams();
            DataAccess.addSqlParam("@ClientSiteDeviceID", ParameterDirection.Input, 16, MySqlDbType.Int32);
            DataAccess.addSqlParam("@CustomerID", ParameterDirection.Input, 16, MySqlDbType.Int32, SessionHelper.UserSession.CustomerID);
            DataSet ds = DataAccess.ExecuteDataSet(GET_CLIENT_SITE_DEVICE, ref errorNum, ref errorDesc);
            Manitenancepoly = new List<tblMaintenancePolicy>();
            Manitenancepoly.Add(new tblMaintenancePolicy() { MaintenancePolicyID = 0, ActivityName = "-- Select --" });
            DataTable dttblmaintinance = ds.Tables[3];
            if (dttblmaintinance != null && dttblmaintinance.Rows.Count > 0)
            {
                foreach (DataRow dPP in dttblmaintinance.Rows)
                {
                    tblMaintenancePolicy tblmaintinance = new tblMaintenancePolicy();
                    tblmaintinance.MaintenancePolicyID = Common.ConvertToInt(dPP, "MaintenancePolicyID");
                    tblmaintinance.ActivityName = Common.ConvertToString(dPP, "ActivityName");
                    Manitenancepoly.Add(tblmaintinance);

                }

            }
            ToolInfoPoly = new List<tbltoolInfomation>();
            ToolInfoPoly.Add(new tbltoolInfomation() { ToolIDRT = 0, RMMTool ="-- Select --"});
            DataTable dttbltoolinfomation = ds.Tables[1];
            if (dttbltoolinfomation != null && dttbltoolinfomation.Rows.Count > 0)
            {
                //  DataRow dTI = dttbltoolinfomation.Rows[1];
                foreach (DataRow dTI in dttbltoolinfomation.Rows)
                {
                    tbltoolInfomation toolInfo = new tbltoolInfomation();
                    toolInfo.ToolIDRT = Common.ConvertToInt(dTI, "ToolID");
                    toolInfo.RMMTool = Common.ConvertToString(dTI, "ToolInfomationName");
                    ToolInfoPoly.Add(toolInfo);
                }
            }
            Accesspoly = new List<tblAccessPolicy>();
            Accesspoly.Add(new tblAccessPolicy() { AccessPolicyID = 0, productname = "-- Select --" });
            DataTable dttblAccpolicy = ds.Tables[4];
            if (dttblAccpolicy != null && dttblAccpolicy.Rows.Count > 0)
            {
                foreach (DataRow dAP in dttblAccpolicy.Rows)
                {
                    tblAccessPolicy tblaccess = new tblAccessPolicy();
                    tblaccess.AccessPolicyID = Common.ConvertToInt(dAP, "AccessPolicyID");
                    tblaccess.productname = Common.ConvertToString(dAP, "productname");
                    Accesspoly.Add(tblaccess);
                }
            }
            PatchingPoly = new List<tblPatchingPolicy>();
            PatchingPoly.Add(new tblPatchingPolicy() { PatchingPolicyIDWR = 0, PolicyNameND ="-- Select --"});
            DataTable dttblPatchingpolicy = ds.Tables[2];
            if (dttblPatchingpolicy != null && dttblPatchingpolicy.Rows.Count > 0)
            {
                //  DataRow dTI = dttbltoolinfomation.Rows[1];
                foreach (DataRow dPP in dttblPatchingpolicy.Rows)
                {
                    tblPatchingPolicy tblpatch = new tblPatchingPolicy();
                    tblpatch.PatchingPolicyIDWR = Common.ConvertToInt(dPP, "PatchingPolicyID");
                    tblpatch.PolicyNameND = Common.ConvertToString(dPP, "PolicyNameND");
                    PatchingPoly.Add(tblpatch);
                }
            }

            Antiviruspoly = new List<tblAntiVirusPolicy>();
            Antiviruspoly.Add(new tblAntiVirusPolicy() { AntiVirusID = 0, PolicyName = "-- Select --" });
            DataTable dttblAantivspolicy = ds.Tables[5];
            if (dttblAantivspolicy != null && dttblAantivspolicy.Rows.Count > 0)
            {
                foreach (DataRow dAP in dttblAantivspolicy.Rows)
                {
                    tblAntiVirusPolicy tblantivirus = new tblAntiVirusPolicy();
                    tblantivirus.AntiVirusID = Common.ConvertToInt(dAP, "AntiVirusID");
                    tblantivirus.PolicyName = Common.ConvertToString(dAP, "PolicyName");
                    Antiviruspoly.Add(tblantivirus);
                }
            }
            Backuppoly = new List<tblBackUpPolicy>();
            Backuppoly.Add(new tblBackUpPolicy() { BackUpPolicyID = 0, PolicyName = "-- Select --" });
            DataTable dttblBackupspolicy = ds.Tables[6];
            if (dttblBackupspolicy != null && dttblBackupspolicy.Rows.Count > 0)
            {
                foreach (DataRow dAP in dttblBackupspolicy.Rows)
                {
                    tblBackUpPolicy tblbackup = new tblBackUpPolicy();
                    tblbackup.BackUpPolicyID = Common.ConvertToInt(dAP, "BackUpPolicyID");
                    tblbackup.PolicyName = Common.ConvertToString(dAP, "PolicyName");
                    Backuppoly.Add(tblbackup);
                }
            }
        }
Exemplo n.º 5
0
        public List<tblMaintenancePolicy> GetMPIndex(int CustomerID, int pageNumber, int pageSize, int sortColumnIndex, string sortOrder, string searchText, ref int totalRecords)
        {
            int errorNum = 0;
            string errorDesc = "";
            DataAccess.resetParams();
            DataAccess.addSqlParam("@oCustomerID", ParameterDirection.Input, 16, MySqlDbType.Int32, CustomerID);
            DataAccess.addSqlParam("@pageNumber", ParameterDirection.Input, 16, MySqlDbType.Int32, pageNumber);
            DataAccess.addSqlParam("@pageRecord", ParameterDirection.Input, 16, MySqlDbType.Int32, pageSize);
            DataAccess.addSqlParam("@sortColumnIndex", ParameterDirection.Input, 16, MySqlDbType.Int32, sortColumnIndex);
            DataAccess.addSqlParam("@searchOrder", ParameterDirection.Input, 4, MySqlDbType.VarChar, sortOrder);
            DataAccess.addSqlParam("@searchText", ParameterDirection.Input, 100, MySqlDbType.VarChar, searchText);

            DataSet ds = DataAccess.ExecuteDataSet(GET_MAINTENANCE, ref errorNum, ref errorDesc);
            tblMaintenancePolicy maintenance = new tblMaintenancePolicy();
            List<tblMaintenancePolicy> maintenances = new List<tblMaintenancePolicy>();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataTable dtMaintenance = ds.Tables[0];
                DataTable dtTotalRecords = ds.Tables[1];
                totalRecords = Common.ConvertToInt(dtTotalRecords.Rows[0], "TotalRecords");
                if (dtMaintenance != null && dtMaintenance.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtMaintenance.Rows)
                    {
                        maintenance = new tblMaintenancePolicy();
                        maintenance.WeekOfDays = new WeekOfDay();
                        maintenance.MonthOfDays = new MonthOfDay();
                        maintenance.TimeZone = new TimeZoneFX();
                        //  maintenance.ScheduledEndTime = new FXTime();
                        // maintenance.ScheduledStartTime = new FXTime();
                        maintenance.ScheduleType = new ScheduleTypeMaintenancePolicy();
                        maintenance.CustomerID = Common.ConvertToInt(dr, "CustomerID");
                        maintenance.MaintenancePolicyID = Common.ConvertToInt(dr, "MaintenancePolicyID");
                        maintenance.ActivityName = Common.ConvertToString(dr, "ActivityName");
                        maintenance.ScheduleType.ID = Common.ConvertToInt(dr, "ScheduleType");
                        maintenance.ScheduleType.Name = LookUpValue.GetScheduleType(maintenance.ScheduleType.ID.Value);
                        maintenance.WeekOfDays.ID = Common.ConvertToInt(dr, "WeekOfDay");
                        maintenance.WeekOfDays.Name = LookUpValue.GetWeekOfDay(maintenance.WeekOfDays.ID.Value);
                        maintenance.MonthOfDays.ID = Common.ConvertToInt(dr, "MonthOfDay");
                        maintenance.MonthOfDays.Name = LookUpValue.GetMonthOfDays(maintenance.MonthOfDays.ID.Value);
                        maintenance.ScheduledStartTime = Common.ConvertToString(dr, "ScheduledStartTime");
                        //  maintenance.ScheduledStartTime.Name = LookUpValue.GetFXTime(maintenance.ScheduledStartTime.ID.Value);
                        maintenance.ScheduledEndTime = Common.ConvertToString(dr, "ScheduledEndTime");
                        // maintenance.ScheduledEndTime.Name = LookUpValue.GetFXTime(maintenance.ScheduledEndTime.ID.Value);
                        maintenance.ScheduledStartDate = Common.ConvertToDateTime(dr, "ScheduledStartDate");
                        maintenance.TimeZone.ID = Common.ConvertToInt(dr, "TimeZone");
                        maintenance.WeekOfMonth = Common.ConvertToInt(dr, "WeekOfMonth");
                        maintenance.TimeZone.Name = LookUpValue.GetTimeZone(maintenance.TimeZone.ID.Value);
                        maintenances.Add(maintenance);
                    }
                }
            }
            return maintenances;
        }
Exemplo n.º 6
0
        public tblMaintenancePolicy GetMaintenance(int MaintenancePolicyID)
        {
            int errorNum = 0;
            string errorDesc = "";
            DataAccess.resetParams();
            DataAccess.addSqlParam("@oMaintenancePolicyID", ParameterDirection.Input, 16, MySqlDbType.Int32, MaintenancePolicyID);
            DataSet ds = DataAccess.ExecuteDataSet(GET_MAINTENANCEEDIT, ref errorNum, ref errorDesc);
            tblMaintenancePolicy maintenance = new tblMaintenancePolicy();

            if (ds != null && ds.Tables.Count > 0)
            {

                DataTable dtmaintenance = ds.Tables[0];
                if (dtmaintenance != null && dtmaintenance.Rows.Count > 0)
                {
                    DataRow dr = dtmaintenance.Rows[0];
                    maintenance.ScheduleType = new ScheduleTypeMaintenancePolicy();
                    maintenance.WeekOfDays = new WeekOfDay();
                    maintenance.MonthOfDays = new MonthOfDay();
                    maintenance.TimeZone = new TimeZoneFX();

                    maintenance.CustomerID = Common.ConvertToInt(dr, "CustomerID");
                    maintenance.MaintenancePolicyID = Common.ConvertToInt(dr, "MaintenancePolicyID");
                    maintenance.ActivityName = Common.ConvertToString(dr, "ActivityName");
                    maintenance.ScheduleType.ID = Common.ConvertToInt(dr, "ScheduleType");
                    maintenance.ScheduleType.Name = LookUpValue.GetScheduleType(maintenance.ScheduleType.ID.Value);
                    maintenance.WeekOfDays.ID = Common.ConvertToInt(dr, "WeekOfDay");
                    maintenance.WeekOfDays.Name = LookUpValue.GetWeekOfDay(maintenance.WeekOfDays.ID.Value);
                 //   maintenance.MonthOfDays.ID = Common.ConvertToInt(dr, "MonthOfDay");
                    maintenance.ScheduledStartTime = Common.ConvertToString(dr, "ScheduledStartTime");
                    maintenance.ScheduledEndTime = Common.ConvertToString(dr, "ScheduledEndTime");
                    maintenance.ScheduledStartDate = Common.ConvertToDateTime(dr, "ScheduledStartDate");
                    maintenance.TimeZone.ID = Common.ConvertToInt(dr, "TimeZone");
                    maintenance.WeekOfMonth = Common.ConvertToInt(dr, "WeekOfMonth");
                    maintenance.TimeZone.Name = LookUpValue.GetTimeZone(maintenance.TimeZone.ID.Value);
                 //   antiVirus.PatchingTimeZone.Name = LookUpValue.GetTimeZone(antiVirus.PatchingTimeZone.ID.Value);
                }
            }
            return maintenance;
        }
Exemplo n.º 7
0
 public int SaveMaintenancePolicy(tblMaintenancePolicy maintenancePolicy)
 {
     int errorNum = 0;
     string errorDesc = "";
     DataAccess.resetParams();
     DataAccess.addSqlParam("@MaintenancePolicyID", ParameterDirection.Input, 16, MySqlDbType.Int32, maintenancePolicy.MaintenancePolicyID);
     DataAccess.addSqlParam("@CustomerID", ParameterDirection.Input, 16, MySqlDbType.Int32, maintenancePolicy.CustomerID);
     DataAccess.addSqlParam("@ActivityName", ParameterDirection.Input, 100, MySqlDbType.VarChar, maintenancePolicy.ActivityName);
     DataAccess.addSqlParam("@ScheduleType", ParameterDirection.Input, 16, MySqlDbType.Int32, maintenancePolicy.ScheduleType.ID);
     DataAccess.addSqlParam("@WeekOfDay", ParameterDirection.Input, 16, MySqlDbType.Int32, maintenancePolicy.WeekOfDays == null ? 0: maintenancePolicy.WeekOfDays.ID);
       //  DataAccess.addSqlParam("@MonthOfDay", ParameterDirection.Input, 16, MySqlDbType.Int32, maintenancePolicy.MonthOfDays.ID);
     DataAccess.addSqlParam("@ScheduledStartTime", ParameterDirection.Input, 10, MySqlDbType.VarChar, maintenancePolicy.ScheduledStartTime);
     DataAccess.addSqlParam("@ScheduledEndTime", ParameterDirection.Input, 10, MySqlDbType.VarChar, maintenancePolicy.ScheduledEndTime);
     DataAccess.addSqlParam("@ScheduledStartDate", ParameterDirection.Input, 20, MySqlDbType.DateTime, maintenancePolicy.ScheduledStartDate);
     DataAccess.addSqlParam("@WeekOfMonth", ParameterDirection.Input, 16, MySqlDbType.Int32, maintenancePolicy.WeekOfMonth);
     DataAccess.addSqlParam("@TimeZone", ParameterDirection.Input, 16, MySqlDbType.Int32, maintenancePolicy.TimeZone.ID);
     DataAccess.addSqlParam("@Identity", ParameterDirection.InputOutput, 16, MySqlDbType.Int32);
     DataAccess.ExecuteNonQuery(SET_MaintenancePolicy, ref errorNum, ref errorDesc);
     return Common.ConvertToInt(DataAccess.getSQLParam("@Identity").ToString());
 }