// 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); }
public JsonResult BackUpPolicy(tblBackUpPolicy tblbackup) { try { BLCustomer customerBL = new BLCustomer(); tblbackup.CustomerID = SessionHelper.UserSession.CustomerID; customerBL.SaveBackUpPolicy(tblbackup); } catch { ModelState.AddModelError("", "Error occurred durung Customer Information save."); return Json(new { errors = KeyValue.GetErrorsFromModelState(ViewData) }); } return Json(new { success = true, Tab = "BP" }); }
// 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); }
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); } } }
public List<tblBackUpPolicy> GetBPIndex(int CustomerID, int pageNumber, int pageSize, int sortColumnIndex, string sortOrder, string searchText, ref int totalRecords) { int errorNum = 0; string errorDesc = ""; DataAccess.resetParams(); DataAccess.addSqlParam("@CustomerID", 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_BACKUPPOLICIES, ref errorNum, ref errorDesc); tblBackUpPolicy backup = new tblBackUpPolicy(); List<tblBackUpPolicy> backups = new List<tblBackUpPolicy>(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable dtAntiVirus = ds.Tables[0]; totalRecords = Common.ConvertToInt(dtAntiVirus.Rows[0], "TotalRecords"); if (dtAntiVirus != null && dtAntiVirus.Rows.Count > 0) { foreach (DataRow dr in dtAntiVirus.Rows) { backup = new tblBackUpPolicy(); backup.ScheduleTimeZone = new TimeZoneFX(); backup.CustomerID = Common.ConvertToInt(dr, "CustomerID"); backup.BackUpPolicyID = Common.ConvertToInt(dr, "BackUpPolicyID"); backup.ProductName = Common.ConvertToString(dr, "ProductName"); backup.VolumeLocation = Common.ConvertToString(dr, "VolumeLocation"); backup.FolderLocation = Common.ConvertToString(dr, "FolderLocation"); backup.ScheduleTime = Common.ConvertToString(dr, "ScheduleTime"); backup.PolicyName = Common.ConvertToString(dr, "PolicyName"); backup.ProductName = Common.ConvertToString(dr, "ProductName"); backup.ScheduleTimeZone.ID = Common.ConvertToInt(dr, "ScheduleTimeZone"); backup.ScheduleTimeZone.Name = LookUpValue.GetTimeZone(backup.ScheduleTimeZone.ID.Value); backup.BackUpSetDetails = Common.ConvertToString(dr, "BackUpSetDetails"); backup.PreviousBackupSaved = Common.ConvertToInt(dr, "PreviousBackupSaved"); backup.FullBackUpEveryDay = Common.ConvertToInt(dr, "FullBackUpEveryDay"); backup.DomainName = Common.ConvertToString(dr, "DomainName"); backup.DifferentialEveryDay = Common.ConvertToInt(dr, "DifferentialEveryDay"); backup.UserName = Common.ConvertToString(dr, "UserName"); backup.Password = Common.ConvertToString(dr, "Password"); backups.Add(backup); } } } return backups; }
public tblBackUpPolicy GetBackUp(int BackUpPolicyID) { int errorNum = 0; string errorDesc = ""; DataAccess.resetParams(); DataAccess.addSqlParam("@BackUpPolicyID", ParameterDirection.Input, 16, MySqlDbType.Int32, BackUpPolicyID); DataSet ds = DataAccess.ExecuteDataSet(GET_BACKUPPOLICY, ref errorNum, ref errorDesc); tblBackUpPolicy backup = new tblBackUpPolicy(); if (ds != null && ds.Tables.Count > 0) { DataTable dtAntiVirus = ds.Tables[0]; if (dtAntiVirus != null && dtAntiVirus.Rows.Count > 0) { foreach (DataRow dr in dtAntiVirus.Rows) { if (dtAntiVirus != null && dtAntiVirus.Rows.Count > 0) { backup.ScheduleTimeZone = new TimeZoneFX(); backup.CustomerID = Common.ConvertToInt(dr, "CustomerID"); backup.BackUpPolicyID = Common.ConvertToInt(dr, "BackUpPolicyID"); backup.ProductName = Common.ConvertToString(dr, "ProductName"); backup.VolumeLocation = Common.ConvertToString(dr, "VolumeLocation"); backup.FolderLocation = Common.ConvertToString(dr, "FolderLocation"); backup.ScheduleTime = Common.ConvertToString(dr, "ScheduleTime"); backup.PolicyName = Common.ConvertToString(dr, "PolicyName"); backup.ProductName = Common.ConvertToString(dr, "ProductName"); backup.ScheduleTimeZone.ID = Common.ConvertToInt(dr, "ScheduleTimeZone"); backup.ScheduleTimeZone.Name = LookUpValue.GetTimeZone(backup.ScheduleTimeZone.ID.Value); backup.BackUpSetDetails = Common.ConvertToString(dr, "BackUpSetDetails"); backup.PreviousBackupSaved = Common.ConvertToInt(dr, "PreviousBackupSaved"); backup.FullBackUpEveryDay = Common.ConvertToInt(dr, "FullBackUpEveryDay"); backup.DomainName = Common.ConvertToString(dr, "DomainName"); backup.DifferentialEveryDay = Common.ConvertToInt(dr, "DifferentialEveryDay"); backup.UserName = Common.ConvertToString(dr, "UserName"); backup.Password = Common.ConvertToString(dr, "Password"); } } } } return backup; }
public int SaveBackUpPolicy(tblBackUpPolicy BackUpPolicy) { int errorNum = 0; string errorDesc = ""; DataAccess.resetParams(); DataAccess.addSqlParam("@BackUpPolicyID", ParameterDirection.Input, 16, MySqlDbType.Int32, BackUpPolicy.BackUpPolicyID); DataAccess.addSqlParam("@CustomerID", ParameterDirection.Input, 16, MySqlDbType.Int32, BackUpPolicy.CustomerID); DataAccess.addSqlParam("@PolicyName", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.PolicyName); DataAccess.addSqlParam("@ProductName", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.ProductName); DataAccess.addSqlParam("@VolumeLocation", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.VolumeLocation); DataAccess.addSqlParam("@FolderLocation", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.FolderLocation); DataAccess.addSqlParam("@ScheduleTime", ParameterDirection.Input, 10, MySqlDbType.VarChar, BackUpPolicy.ScheduleTime); DataAccess.addSqlParam("@ScheduleTimeZone", ParameterDirection.Input, 16, MySqlDbType.Int32, BackUpPolicy.ScheduleTimeZone.ID); DataAccess.addSqlParam("@BackUpSetDetails", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.BackUpSetDetails); DataAccess.addSqlParam("@DifferentialEveryDay", ParameterDirection.Input, 16, MySqlDbType.Int32, BackUpPolicy.DifferentialEveryDay); DataAccess.addSqlParam("@PreviousBackupSaved", ParameterDirection.Input, 16, MySqlDbType.Int32, BackUpPolicy.PreviousBackupSaved); DataAccess.addSqlParam("@FullBackUpEveryDay", ParameterDirection.Input, 16, MySqlDbType.Int32, BackUpPolicy.FullBackUpEveryDay); DataAccess.addSqlParam("@DomainName", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.DomainName); DataAccess.addSqlParam("@UserName", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.UserName); DataAccess.addSqlParam("@Password", ParameterDirection.Input, 100, MySqlDbType.VarChar, BackUpPolicy.Password); DataAccess.addSqlParam("@Identity", ParameterDirection.InputOutput, 16, MySqlDbType.Int32); DataAccess.ExecuteNonQuery(SET_BackUpPolicy, ref errorNum, ref errorDesc); return Common.ConvertToInt(DataAccess.getSQLParam("@Identity").ToString()); }