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" }); }
public int SaveToolInfo(tbltoolInfomation toolinfo) { int errorNum = 0; string errorDesc = ""; DataAccess.resetParams(); DataAccess.addSqlParam("@ToolId", ParameterDirection.Input, 16, MySqlDbType.Int32, toolinfo.ToolIDRT); DataAccess.addSqlParam("@CustomerID", ParameterDirection.Input, 16, MySqlDbType.Int32, toolinfo.CustomerID); DataAccess.addSqlParam("@ToolName", ParameterDirection.Input, 50, MySqlDbType.VarChar, toolinfo.RMMTool); DataAccess.addSqlParam("@Tool_URL", ParameterDirection.Input, 200, MySqlDbType.VarChar, toolinfo.RMMUrl); DataAccess.addSqlParam("@UserName", ParameterDirection.Input, 50, MySqlDbType.VarChar, toolinfo.RMMToolUserName); DataAccess.addSqlParam("@oPassword", ParameterDirection.Input, 50, MySqlDbType.VarChar, toolinfo.RMMToolPassword); DataAccess.addSqlParam("@ToolType", ParameterDirection.Input, 16, MySqlDbType.Int32, toolinfo.ToolTypeRT = 1); DataAccess.addSqlParam("@Identity", ParameterDirection.InputOutput, 16, MySqlDbType.Int32); DataAccess.ExecuteNonQuery(SET_ToolInfo, ref errorNum, ref errorDesc); DataAccess.resetParams(); DataAccess.addSqlParam("@ToolId", ParameterDirection.Input, 16, MySqlDbType.Int32, toolinfo.ToolIDPT); DataAccess.addSqlParam("@CustomerID", ParameterDirection.Input, 16, MySqlDbType.Int32, toolinfo.CustomerID); DataAccess.addSqlParam("@ToolName", ParameterDirection.Input, 50, MySqlDbType.VarChar, toolinfo.PSATool); DataAccess.addSqlParam("@Tool_URL", ParameterDirection.Input, 200, MySqlDbType.VarChar, toolinfo.PSAUrl); DataAccess.addSqlParam("@UserName", ParameterDirection.Input, 50, MySqlDbType.VarChar, toolinfo.PSAToolUserName); DataAccess.addSqlParam("@oPassword", ParameterDirection.Input, 50, MySqlDbType.VarChar, toolinfo.PSAToolPassword); DataAccess.addSqlParam("@ToolType", ParameterDirection.Input, 16, MySqlDbType.Int32, toolinfo.ToolTypePT = 2); DataAccess.addSqlParam("@Identity", ParameterDirection.InputOutput, 16, MySqlDbType.Int32); DataAccess.ExecuteNonQuery(SET_ToolInfo, ref errorNum, ref errorDesc); return Common.ConvertToInt(DataAccess.getSQLParam("@Identity").ToString()); }
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 tbltoolInfomation GetToolInfoByID(int ToolID) { int errorNum = 0; string errorDesc = ""; DataAccess.resetParams(); DataAccess.addSqlParam("@CustomerID", ParameterDirection.Input, 16, MySqlDbType.Int32, 0); DataAccess.addSqlParam("@ToolID", ParameterDirection.Input, 16, MySqlDbType.Int32, ToolID); DataSet ds = DataAccess.ExecuteDataSet(GET_TOOLINFO, ref errorNum, ref errorDesc); tbltoolInfomation toolinformation = new tbltoolInfomation(); if (ds != null && ds.Tables.Count > 0) { DataTable dtContact = ds.Tables[0]; if (dtContact != null && dtContact.Rows.Count > 0) { DataRow dr = dtContact.Rows[0]; switch (Common.ConvertToInt(dr, "ToolType")) { case 1: toolinformation.ToolIDRT = Common.ConvertToInt(dr, "ToolId"); toolinformation.RMMTool = Common.ConvertToString(dr, "ToolName"); toolinformation.RMMUrl = Common.ConvertToString(dr, "Tool_URL"); toolinformation.RMMToolUserName = Common.ConvertToString(dr, "UserName"); toolinformation.RMMToolPassword = Common.ConvertToString(dr, "Password"); toolinformation.ToolTypeRT = Common.ConvertToInt(dr, "ToolType"); break; case 2: toolinformation.ToolIDPT = Common.ConvertToInt(dr, "ToolId"); toolinformation.PSATool = Common.ConvertToString(dr, "ToolName"); toolinformation.PSAUrl = Common.ConvertToString(dr, "Tool_URL"); toolinformation.PSAToolUserName = Common.ConvertToString(dr, "UserName"); toolinformation.PSAToolPassword = Common.ConvertToString(dr, "Password"); toolinformation.ToolTypePT = Common.ConvertToInt(dr, "ToolType"); break; } } } return toolinformation; }