public ActionResult Table(string table_name, string db_name = null, string order = null) { if (table_name.Contains(";") || table_name.Contains("--") || table_name.Contains(" ")) { return(null); } DersaSqlManager M = new DersaSqlManager(); if (db_name != null) { M.SetDatabaseName(db_name); } string query = string.Format("select top 1000 * from {0}(nolock)", table_name); if (!string.IsNullOrEmpty(order)) { order = order.Replace(" desc", "____desc"); if (order.Contains(";") || order.Contains("--") || order.Contains(" ")) { return(null); } order = order.Replace("____desc", " desc"); query += (" order by " + order); } System.Data.DataTable T = M.ExecSql(query, null, true);//.GetSqlObject(table_name, "", 1000);//ObjectMethods.ExecProc("REPORT$WorkplaceList"); return(View(T)); }
public string DownloadIcon(int id, bool from_stereotype) { try { DersaSqlManager M = new DersaSqlManager(); string sql = from_stereotype ? "select icon, name from STEREOTYPE (nolock) where stereotype = " + id.ToString() : "select s.icon, s.name from STEREOTYPE s(nolock) join ENTITY e(nolock) on e.stereotype = s.stereotype where e.entity = " + id.ToString(); System.Data.DataTable T = M.ExecSql(sql); Response.ContentType = "APPLICATION/OCTET-STREAM"; string Header = "Attachment; Filename=" + T.Rows[0][1].ToString() + ".gif"; Response.AppendHeader("Content-Disposition", Header); byte[] bts = (byte[])T.Rows[0][0]; Response.OutputStream.Write(bts, 0, bts.Length); Response.End(); return("OK"); } catch (System.Exception exc) { Response.OutputStream.Flush(); Response.OutputStream.Close(); Response.ContentType = "TEXT/HTML"; Response.ClearHeaders(); Response.Write(exc.Message); return(exc.Message); } }
public static void SetAttribute(DersaSqlManager DM, AttributeOwnerType ownerType, string entityId, string paramName, string paramValue, int attrType) { string userName = HttpContext.Current.User.Identity.Name; Util.SetAttributeValue(DM, userName, ownerType, entityId, paramName, attrType, paramValue); //DM.ExecuteSPWithParams(procName, new object[] { entityId, paramName, paramValue, userName, Util.GetPassword(userName) }); }
public string SetUserSettings(string json_params) { try { IParameterCollection Params = Util.DeserializeParams(json_params); DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; foreach (IParameter Param in Params) { try { System.Data.DataTable T = DM.ExecuteSPWithParams("USER_SETTING$SetValue", new object[] { Param.Name, Param.Value, userName, Util.GetPassword(userName) }); if (T.Rows.Count > 0) { return(T.Rows[0][0].ToString()); } } catch { throw; } } return(""); } catch { throw; } }
public static StereotypeBaseE GetSimpleInstance(int id) { DersaSqlManager M = new DersaSqlManager(); DataTable ET = M.GetEntity(id.ToString()); if (ET == null || ET.Rows.Count < 1) { return(null); } Stereotype S = M.GetStereotype(ET.Rows[0]["stereotype"].ToString()); if (S == null) { return(null); } string typeName = "DersaStereotypes." + S.Name; Type dType = Util.GetDynamicType(typeName); if (dType == null) { return(null); } StereotypeBaseE res = Activator.CreateInstance(dType, new object[] { }) as StereotypeBaseE; res._id = id; if (ET.Rows[0]["parent"] != DBNull.Value) { dynamic parentId = ET.Rows[0]["parent"]; res._parent = GetSimpleInstance(parentId); } return(res); }
public string List(string id) { try { DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; object parent = null; if (!id.Contains("#")) { parent = id; } string result = "[]"; if (id == "STEREOTYPES") { result = Util.GetUserSetting(userName, "root stereotypes"); Regex removeDigitsEx = new Regex("[0-9]"); result = removeDigitsEx.Replace(result, "*"); } else { result = JsonConvert.SerializeObject(DM.ExecuteSPWithParams("ENTITY$JTreeList", new object[] { parent, userName, Util.GetPassword(userName) })); } return(result); } catch (Exception exc) { return(""); } }
public string PropertiesForm(int id) { try { DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; System.Data.DataTable T = DM.ExecuteSPWithParams("ENTITY$GetAttributes", new object[] { id, userName, Util.GetPassword(userName) }); var query = from System.Data.DataRow R in T.Rows select new { Name = R["Name"], Value = R["Value"], ReadOnly = R["ReadOnly"], WriteUnchanged = R["WriteUnchanged"], Type = R["Type"], ControlType = (int)R["Type"] == 1 ? "text" : "button", ChildFormAttrs = (int)R["Type"] == 1 ? null : new { Height = 900, Width = 600, DisplayValue = (int)R["Type"] == 1 ? R["Value"] : "...", InfoLink = (int)R["Type"] == 1 ? "" : "Node/PropertyForm?id=" + id.ToString() + "&prop_name=" + R["Name"].ToString() + "&prop_type=" + R["Type"].ToString() } }; string result = JsonConvert.SerializeObject(query); return(result); } catch { return(""); } }
public ActionResult Index() { if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { if (!Dersa.Models.User.Exists(System.Web.HttpContext.Current.User.Identity.Name)) { return(RedirectToAction("Login", "Account")); } string userName = System.Web.HttpContext.Current.User.Identity.Name; ViewBag.Login = userName; DersaSqlManager DM = new DersaSqlManager(); System.Data.DataTable T = DM.ExecuteSPWithParams("DERSA_USER$GetTextUserSetting", new object[] { userName, Util.GetPassword(userName), "toolbox JSON" }); if (T != null && T.Rows.Count > 0) { ViewBag.ToolBoxData = T.Rows[0][0]; } else { ViewBag.ToolBoxData = "[]"; } return(View()); } else { return(RedirectToAction("Login", "Account")); } }
public string Info(string login) { DersaSqlManager DM = new DersaSqlManager(); System.Data.DataTable T = DM.ExecuteSPWithParams("DERSA_USER$GetInfo", new object[] { login }); T.Rows[0]["email"] = Cryptor.Decrypt(T.Rows[0]["email"].ToString(), Util.GetDefaultPassword()); return(JsonConvert.SerializeObject(T)); }
public string JsSettings(string settingName = null) { try { DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; if (settingName == null) { System.Data.DataTable T = DM.ExecuteSPWithParams("USER_SETTING$List", new object[] { userName, Util.GetPassword(userName) }); var query = from System.Data.DataRow R in T.Rows select new { Name = R["name"], Value = R["value"], ReadOnly = R["ReadOnly"], Type = R["value_type"], ControlType = (int)R["value_type"] == 1 ? "text" : "button", ChildFormAttrs = (int)R["value_type"] == 1 ? null : new { Height = 500, Width = 400, DisplayValue = (int)R["value_type"] == 1 ? R["value"] : "...", InfoLink = (int)R["value_type"] == 1 ? "" : "Account/JsSettings?settingName=" + R["name"].ToString() } }; string result = JsonConvert.SerializeObject(query); return(result); } else { System.Data.DataTable T = DM.ExecuteSPWithParams("DERSA_USER$GetTextUserSetting", new object[] { userName, Util.GetPassword(userName), settingName }); var query = from System.Data.DataRow R in T.Rows select new { Name = settingName, Value = R[0], ReadOnly = false, Type = 2, ControlType = "textarea", Height = 200, Width = 300, InfoLink = "" }; string result = JsonConvert.SerializeObject(query); return(result); } } catch { return(""); } }
public string MethodsForm(int id) { try { string SqlExecAction = "alert"; DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; IParameterCollection UserParams = new ParameterCollection(); UserParams.Add("@login", userName); UserParams.Add("@password", Util.GetPassword(userName)); int userPermissions = DM.ExecuteSPWithResult("DERSA_USER$GetPermissions", false, UserParams); int canExecSql = userPermissions & 1; if (canExecSql != 0) { UserParams.Add("@user_setting_name", "Выполнять SQL локально"); int execSqlLocal = DM.ExecuteSPWithResult("DERSA_USER$GetBoolUserSetting", false, UserParams); int canExecLocalSql = userPermissions & 2; if (execSqlLocal > 0 && canExecLocalSql != 0) { SqlExecAction = "exec"; } } System.Data.DataTable T = DM.ExecuteSPWithParams("ENTITY$GetMethods", new object[] { id, userName, Util.GetPassword(userName) }); int i = 1; var query = from System.Data.DataRow R in T.Rows select new { Name = R["name"], Value = "", ReadOnly = false, Type = -1, ControlType = "button", ChildFormAttrs = new { Height = 800, Width = 600, DisplayValue = "...", InfoLink = (int)R["get_result_type"] == 1 ? "Node/ExecMethodForm?id=" + id.ToString() + "&method_name=" + R["name"].ToString() : "", SaveLink = "Query/ExecSql",//GetSaveLink((int)R["get_result_type"], R["name"].ToString(), id), OnClick = GetOnClick((int)R["get_result_type"], R["name"].ToString(), id), ActionAfterExec = SqlExecAction } }; string result = JsonConvert.SerializeObject(query); return(result); } catch { return(""); } }
public string Create(int parent) { IParameterCollection Params = new ParameterCollection(); Params.Add("@parent", parent); string currentUser = System.Web.HttpContext.Current.User.Identity.Name; Params.Add("@login", currentUser); Params.Add("@password", Util.GetPassword(currentUser)); DersaSqlManager M = new DersaSqlManager(); int res = M.ExecuteSPWithResult("DIAGRAM$Create", false, Params); return(res.ToString()); }
public string Rename(string id, string name) { int intId = -1; try { intId = int.Parse(id); } catch { } if (intId < 0)//диаграммы и проч. { try { DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; string result = JsonConvert.SerializeObject(DM.ExecuteSPWithParams("ENTITY$Rename", new object[] { id, name, userName, Util.GetPassword(userName) })); return(result); } catch { return(""); } } //для нормальных объектов используем объектные методы try { string userName = HttpContext.Current.User.Identity.Name; StereotypeBaseE objToRename = StereotypeBaseE.GetSimpleInstance(intId); if (objToRename != null) { return(objToRename.Rename(userName, name)); } return(""); } catch { return(""); } //try //{ // DersaSqlManager DM = new DersaSqlManager(); // string userName = HttpContext.Current.User.Identity.Name; // string result = JsonConvert.SerializeObject(DM.ExecuteSPWithParams("ENTITY$Rename", new object[] { id, name, userName, Util.GetPassword(userName) })); // return result; //} //catch //{ // return ""; //} }
public string Restore(int id) { try { DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; string result = JsonConvert.SerializeObject(DM.ExecuteSPWithParams("ENTITY$Restore", new object[] { id, userName, Util.GetPassword(userName) })); return(result); } catch { return(""); } }
public string SetProperties(string json_params) { Dersa.Common.CachedObjects.ClearCache(); IParameterCollection Params = Util.DeserializeParams(json_params); string key = "-1"; //string procName = ""; AttributeOwnerType ownerType = AttributeOwnerType.Entity; if (Params.Contains("entity")) { key = Params["entity"].Value.ToString(); //procName = "ENTITY$SetAttribute"; ownerType = AttributeOwnerType.Entity; Params.Remove("entity"); if (Params.Count < 1) { return("no data"); } } if (Params.Contains("relation")) { key = Params["relation"].Value.ToString(); //procName = "RELATION$SetAttribute"; ownerType = AttributeOwnerType.Relation; Params.Remove("relation"); if (Params.Count < 1) { return("no data"); } } DersaSqlManager DM = new DersaSqlManager(); foreach (IParameter Param in Params) { try { if (Param.Value != null) { string strVal = Param.Value.ToString().Replace("$lt$", "<").Replace("$gt$", ">"); Param.Value = strVal; } SetAttribute(DM, ownerType, key, Param.Name, Param.Value?.ToString(), 0); } catch { throw; } } return(""); }
public object ExecMethodResult(int id, string method_name) { CachedObjects.CachedEntities[id] = null; DersaSqlManager M = new DersaSqlManager(); System.Data.DataTable t = M.GetEntity(id.ToString()); if (t == null) { throw new Exception(string.Format("Table is null for entity {0}", id)); } if (t.Rows.Count < 1) { throw new Exception(string.Format("Table is empty for entity {0}", id)); } Entity ent = new Entity(t, M); CachedObjects.CachedCompiledInstances[ent.StereotypeName + id.ToString()] = null; foreach (Entity child in ent.Children) { CachedObjects.CachedCompiledInstances[child.StereotypeName + child.Id.ToString()] = null; } Logger.LogStatic("ExecMethodResult clear cache Entity" + ent.Id.ToString()); //Type nType = Type.GetType("DersaStereotypes." + ent.Stereotype.Name); ICompiled cInst = ent.GetCompiledInstance(); MethodInfo mi = cInst.GetType().GetMethod(method_name); if (mi == null) { string excMessage = "Method " + method_name + " not found "; Logger.LogStatic(excMessage); throw new Exception(excMessage); } //string userName = HttpContext.Current.User.Identity.Name; //System.Data.DataTable T = M.ExecuteSPWithParams("dbo.ENTITY$GetMethodParams", new object[] { id, method_name, userName, Util.GetPassword(userName) }); //string Params = ""; //if (T.Rows.Count > 0) // Params = T.Rows[0][0].ToString(); //object[] ParamValues = Util.GetMethodCallParameterValues(Params); //return mi.Invoke(cInst, ParamValues); return(mi.Invoke(cInst, new object[] {})); //object res = mi.Invoke(cInst, ParamValues); //string resultText = ""; //if (res != null) // resultText = res.ToString(); //return resultText; }
public string Save(string id, string xml) { XmlDocument doc = new XmlDocument(); string decodedXml = xml.Replace("{lt;", "<").Replace("{gt;", ">"); IParameterCollection Params = new ParameterCollection(); Params.Add("@diagram", id.Replace("D_", "")); Params.Add("@xml", decodedXml); string currentUser = System.Web.HttpContext.Current.User.Identity.Name; Params.Add("@login", currentUser); Params.Add("@password", Util.GetPassword(currentUser)); DersaSqlManager M = new DersaSqlManager(); int res = M.ExecuteSPWithResult("DIAGRAM$SaveFromXml", false, Params); return(res.ToString()); }
public virtual string Rename(string userName, string objectName) { try { if (this.Parent != null && !(this.Parent as StereotypeBaseE).AllowModifyChildren()) { return(""); } DersaSqlManager DM = new DersaSqlManager(); string result = JsonConvert.SerializeObject(DM.ExecuteSPWithParams("ENTITY$Rename", new object[] { this.Id, objectName, userName, Util.GetPassword(userName) })); return(result); } catch { return(""); } }
public int CanDnD(string src, int dst) { try { DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; IParameterCollection Params = new ParameterCollection(); Params.Add("dnd_source", src); Params.Add("dnd_target", dst); Params.Add("login", userName); Params.Add("password", Util.GetPassword(userName)); int result = DM.ExecuteSPWithResult("ENTITY$CanDnD", false, Params); return(result); } catch { return(0); } }
public ActionResult Report(string proc_name, string parameters) { DersaSqlManager M = new DersaSqlManager(); IParameterCollection Params = Util.DeserializeParams(parameters); if (Params.Contains("proc_name") || !string.IsNullOrEmpty(proc_name)) { if (Params.Contains("proc_name")) { proc_name = Params["proc_name"].Value.ToString(); Params.Remove("proc_name"); } System.Data.DataTable T = M.ExecuteSPWithParams(proc_name, Params); return(View(T)); } else { throw new System.Exception("procedure for report is not defined!"); } }
public static void SetImagePath(int id, string fileName) { string userName = HttpContext.Current.User.Identity.Name; string path = "/user_resources/" + userName + "/" + fileName; StereotypeBaseE target = StereotypeBaseE.GetSimpleInstance(id); CachedObjects.CachedEntities[id] = null; DersaSqlManager M = new DersaSqlManager(); System.Data.DataTable t = M.GetEntity(id.ToString()); if (t == null) { throw new Exception(string.Format("Table is null for entity {0}", id)); } if (t.Rows.Count < 1) { throw new Exception(string.Format("Table is empty for entity {0}", id)); } Entity ent = new Entity(t, M); CachedObjects.CachedCompiledInstances[ent.StereotypeName + id.ToString()] = null; foreach (Entity child in ent.Children) { CachedObjects.CachedCompiledInstances[child.StereotypeName + child.Id.ToString()] = null; } ICompiled cInst = ent.GetCompiledInstance(); MethodInfo mi = cInst.GetType().GetMethod("SetPath"); if (mi == null) { string excMessage = "Method SetPath not found "; Logger.LogStatic(excMessage); throw new Exception(excMessage); } object[] callParams = new object[2]; callParams[0] = userName; callParams[1] = path; mi.Invoke(cInst, callParams); }
public static string SetTextProperty(int entity, string prop_name, string prop_value, string userName = null) { DersaSqlManager DM = userName == null? new DersaSqlManager(): new DersaAnonimousSqlManager(); if (userName == null) { userName = HttpContext.Current.User.Identity.Name; } try { System.Data.DataTable T = DM.ExecuteSPWithParams("ENTITY$SetAttribute", new object[] { entity, prop_name, prop_value, userName, Util.GetPassword(userName) }); if (T != null && T.Rows.Count > 0) { return(T.Rows[0][0].ToString()); } } catch { throw; } return(""); }
public virtual void Drop(string userName, int options) { try { if (!this.AllowDrop()) { return; } if (this.Parent == null) { return; } if (!(this.Parent as StereotypeBaseE).AllowModifyChildren()) { return; } DersaSqlManager DM = new DersaSqlManager(); DM.ExecuteSPWithParams("ENTITY$Remove", new object[] { this.Id, userName, Util.GetPassword(userName), options }); } catch { } }
public string Description(string id, string attr_name) { try { DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; System.Data.DataTable T = DM.ExecuteSPWithParams("ENTITY$GetDescription", new object[] { id, attr_name, userName, Util.GetPassword(userName) }); string result = ""; if (T.Rows.Count > 0) { result = T.Rows[0][0].ToString(); } if (attr_name == "DiagramXmlAdditional") { XmlDocument addXml = new XmlDocument(); addXml.LoadXml(result); } return(result); } catch (Exception exc) { return(""); } }
public static void DropRelation(int id, string userName) { DersaSqlManager DM = new DersaSqlManager(); DM.ExecuteSPWithParams("ENTITY$Remove", new object[] { id, userName, Util.GetPassword(userName), 0 }); }
public string ExecSql(string json_params) { IParameterCollection Params = Util.DeserializeParams(json_params); if (!Params.Contains("SQL")) { return(json_params); } else { DersaSqlManager M = new DersaSqlManager(); string sql = Params["SQL"].Value.ToString().Replace("$gt$", ">").Replace("$lt$", "<"); IParameterCollection UserParams = new ParameterCollection(); string userName = HttpContext.Current.User.Identity.Name; UserParams.Add("@login", userName); UserParams.Add("@password", Util.GetPassword(userName)); int userPermissions = M.ExecuteSPWithResult("DERSA_USER$GetPermissions", false, UserParams); int canExecSql = userPermissions & 1; if (canExecSql == 0) { return("You have no permissions to exec SQL in database."); } UserParams.Add("@user_setting_name", "Выполнять SQL локально"); int execSqlLocal = M.ExecuteSPWithResult("DERSA_USER$GetBoolUserSetting", false, UserParams); int canExecLocalSql = userPermissions & 2; if (execSqlLocal > 0) { if (canExecLocalSql == 0) { return("You have no permissions to exec SQL locally."); } else { string queryId = GetQueryId(sql); (UserParams["@user_setting_name"] as IParameter).Value = "Функция вызова локального клиента SQL"; System.Data.DataTable VT = M.ExecuteSPWithParams("DERSA_USER$GetTextUserSetting", UserParams); if (VT == null || VT.Rows.Count < 1) { throw new Exception("Функция вызова локального клиента SQL не определена"); } string functionBody = VT.Rows[0][0].ToString(); var result = new { action = functionBody, arg_name = "queryId", arg = queryId }; return(JsonConvert.SerializeObject(result)); } } try { string result = "Unknown error"; if (Params.Contains("Server") && Params["Server"].Value != null) { string connectionString = string.Format("Server={0};Database={1};user={2};password={3}", Params["Server"].Value, Params["Database"].Value, Params["Login"].Value, Params["Password"].Value); SqlManager ExecM = new SqlManager(connectionString); result = ExecM.ExecMultiPartSql(sql); } else { DersaUserSqlManager UM = new DersaUserSqlManager(); result = UM.ExecMultiPartSql(sql); } if (result != "") { return(result); } return("Запрос успешно выполнен:\n\n" + sql); } catch (Exception exc) { return(exc.Message); } } }
public string GetInsertSubmenu(int id) { DataTable menuLevels = JsonConvert.DeserializeObject <DataTable>(JsonConvert.SerializeObject( new object[] { new { name = "Package", icon = "/icons/Package.gif", level = 1, is_submenu = false }, new { name = "Entity", icon = "/icons/Entity.gif", level = 1, is_submenu = false }, new { name = "Attribute", icon = "/icons/Attribute.gif", level = 1, is_submenu = false }, new { name = "Script", icon = "/icons/Script.gif", level = 1, is_submenu = false }, new { name = "Procedure", icon = "/icons/Procedure.gif", level = 1, is_submenu = false }, new { name = "Method", icon = "/icons/Method.gif", level = 1, is_submenu = false }, new { name = "прочие", icon = "", level = 1, is_submenu = true } })); DersaSqlManager DM = new DersaSqlManager(); string userName = HttpContext.Current.User.Identity.Name; DataTable childStereotypes = DM.ExecuteSPWithParams("ENTITY$GetChildStereotypes", new object[] { id, userName, Util.GetPassword(userName) }); var result = from DataRow RL in menuLevels.Rows where RL["level"].ToString() == "1" && (childStereotypes.Select("name = '" + RL["name"].ToString() + "'").Length > 0 || (bool)RL["is_submenu"])//аналог exists select new { label = RL["name"], icon = RL["icon"], children = from DataRow RS in childStereotypes.Rows where menuLevels.Select("name = '" + RS["name"].ToString() + "'").Length == 0 && (bool)RL["is_submenu"] select new { label = RS["name"], icon = RS["icon_path"] } }; return(JsonConvert.SerializeObject(result)); }
public string GetAction(string MethodName, int id, string paramString = null) {//AllowExecuteJSMethod string userName = HttpContext.Current.User.Identity.Name; StereotypeBaseE target = StereotypeBaseE.GetSimpleInstance(id); if (!target.AllowExecuteMethod(userName, MethodName)) { return(string.Format("You are not allowed to execute method {0}", MethodName)); } CachedObjects.CachedEntities[id] = null; DersaSqlManager M = new DersaSqlManager(); System.Data.DataTable t = M.GetEntity(id.ToString()); if (t == null) { throw new Exception(string.Format("Table is null for entity {0}", id)); } if (t.Rows.Count < 1) { throw new Exception(string.Format("Table is empty for entity {0}", id)); } Entity ent = new Entity(t, M); CachedObjects.CachedCompiledInstances[ent.StereotypeName + id.ToString()] = null; foreach (Entity child in ent.Children) { CachedObjects.CachedCompiledInstances[child.StereotypeName + child.Id.ToString()] = null; } ICompiled cInst = ent.GetCompiledInstance(); MethodInfo mi = cInst.GetType().GetMethod(MethodName); if (mi == null) { string excMessage = "Method " + MethodName + " not found "; Logger.LogStatic(excMessage); throw new Exception(excMessage); } object[] externalParams = new object[0]; if (paramString != null) { externalParams = JsonConvert.DeserializeObject <object[]>(paramString); } object[] callParams = new object[externalParams.Length + 1]; callParams[0] = userName; for (int i = 0; i < externalParams.Length; i++) { callParams[i + 1] = externalParams[i]; } //Logger.LogStatic(string.Format("method {0}, params count {1}", MethodName, callParams.Length)); object result = mi.Invoke(cInst, new object[] { callParams }); if (result == null) { return(null); } if (result is string) { return(result.ToString()); } return(JsonConvert.SerializeObject(result)); }