public JsonResult WriteScriptSettings(CustomElements Detalle_de_Hechos_Audiencia_InicialModuleAttributeList) { for (int i = 0; i < Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.CustomModuleAttributeList.Count - 1; i++) { if (string.IsNullOrEmpty(Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.CustomModuleAttributeList[i].DefaultValue)) { Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.CustomModuleAttributeList[i].DefaultValue = string.Empty; } if (string.IsNullOrEmpty(Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.CustomModuleAttributeList[i].HelpText)) { Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.CustomModuleAttributeList[i].HelpText = string.Empty; } } if (Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList != null) { for (int i = 0; i < Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList.Count - 1; i++) { if (string.IsNullOrEmpty(Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList[i].DefaultValue)) { Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList[i].DefaultValue = string.Empty; } if (string.IsNullOrEmpty(Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList[i].HelpText)) { Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList[i].HelpText = string.Empty; } } } string strDetalle_de_Hechos_Audiencia_InicialScript = string.Empty; using (StreamReader r = new StreamReader(Server.MapPath("~/Uploads/Scripts/Detalle_de_Hechos_Audiencia_Inicial.js"))) { strDetalle_de_Hechos_Audiencia_InicialScript = r.ReadToEnd(); } JavaScriptSerializer jsSerialize = new JavaScriptSerializer(); // get json string of change Detalle_de_Hechos_Audiencia_Inicial element attributes string userChangeJson = jsSerialize.Serialize(Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.CustomModuleAttributeList); int indexOfArray = strDetalle_de_Hechos_Audiencia_InicialScript.IndexOf("inpuElementArray"); string splittedString = strDetalle_de_Hechos_Audiencia_InicialScript.Substring(indexOfArray, strDetalle_de_Hechos_Audiencia_InicialScript.Length - indexOfArray); int indexOfMainElement = splittedString.IndexOf('['); int endIndexOfMainElement = splittedString.IndexOf(']') + 1; // get json string of change job history element attributes string childUserChangeJson = jsSerialize.Serialize(Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList); int indexOfArrayHistory = 0; string splittedStringHistory = ""; int indexOfMainElementHistory = 0; int endIndexOfMainElementHistory = 0; if (Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList != null) { indexOfArrayHistory = strDetalle_de_Hechos_Audiencia_InicialScript.IndexOf("inpuElementChildArray"); splittedStringHistory = strDetalle_de_Hechos_Audiencia_InicialScript.Substring(indexOfArrayHistory, strDetalle_de_Hechos_Audiencia_InicialScript.Length - indexOfArrayHistory); indexOfMainElementHistory = splittedStringHistory.IndexOf('['); endIndexOfMainElementHistory = splittedStringHistory.IndexOf(']') + 1; } string finalResponse = strDetalle_de_Hechos_Audiencia_InicialScript.Substring(0, indexOfArray + indexOfMainElement) + userChangeJson + strDetalle_de_Hechos_Audiencia_InicialScript.Substring(endIndexOfMainElement + indexOfArray, strDetalle_de_Hechos_Audiencia_InicialScript.Length - (endIndexOfMainElement + indexOfArray)); if (Detalle_de_Hechos_Audiencia_InicialModuleAttributeList.ChildModuleAttributeList != null) { finalResponse = strDetalle_de_Hechos_Audiencia_InicialScript.Substring(0, indexOfArray + indexOfMainElement) + userChangeJson + strDetalle_de_Hechos_Audiencia_InicialScript.Substring(endIndexOfMainElement + indexOfArray, (indexOfMainElementHistory + indexOfArrayHistory) - (endIndexOfMainElement + indexOfArray)) + childUserChangeJson + strDetalle_de_Hechos_Audiencia_InicialScript.Substring(endIndexOfMainElementHistory + indexOfArrayHistory, strDetalle_de_Hechos_Audiencia_InicialScript.Length - (endIndexOfMainElementHistory + indexOfArrayHistory)); } using (StreamWriter w = new StreamWriter(Server.MapPath("~/Uploads/Scripts/Detalle_de_Hechos_Audiencia_Inicial.js"))) { w.WriteLine(finalResponse); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult WriteScriptSettings(CustomElements Spartan_BR_Presentation_Control_TypeModuleAttributeList) { for (int i = 0; i < Spartan_BR_Presentation_Control_TypeModuleAttributeList.CustomModuleAttributeList.Count - 1; i++) { if (string.IsNullOrEmpty(Spartan_BR_Presentation_Control_TypeModuleAttributeList.CustomModuleAttributeList[i].DefaultValue)) { Spartan_BR_Presentation_Control_TypeModuleAttributeList.CustomModuleAttributeList[i].DefaultValue = string.Empty; } if (string.IsNullOrEmpty(Spartan_BR_Presentation_Control_TypeModuleAttributeList.CustomModuleAttributeList[i].HelpText)) { Spartan_BR_Presentation_Control_TypeModuleAttributeList.CustomModuleAttributeList[i].HelpText = string.Empty; } } for (int i = 0; i < Spartan_BR_Presentation_Control_TypeModuleAttributeList.ChildModuleAttributeList.Count - 1; i++) { if (string.IsNullOrEmpty(Spartan_BR_Presentation_Control_TypeModuleAttributeList.ChildModuleAttributeList[i].DefaultValue)) { Spartan_BR_Presentation_Control_TypeModuleAttributeList.ChildModuleAttributeList[i].DefaultValue = string.Empty; } if (string.IsNullOrEmpty(Spartan_BR_Presentation_Control_TypeModuleAttributeList.ChildModuleAttributeList[i].HelpText)) { Spartan_BR_Presentation_Control_TypeModuleAttributeList.ChildModuleAttributeList[i].HelpText = string.Empty; } } string strSpartan_BR_Presentation_Control_TypeScript = string.Empty; using (StreamReader r = new StreamReader(Server.MapPath("~/Uploads/Scripts/Spartan_BR_Presentation_Control_Type.js"))) { strSpartan_BR_Presentation_Control_TypeScript = r.ReadToEnd(); } JavaScriptSerializer jsSerialize = new JavaScriptSerializer(); // get json string of change Spartan_BR_Presentation_Control_Type element attributes string userChangeJson = jsSerialize.Serialize(Spartan_BR_Presentation_Control_TypeModuleAttributeList.CustomModuleAttributeList); int indexOfArray = strSpartan_BR_Presentation_Control_TypeScript.IndexOf("inpuElementArray"); string splittedString = strSpartan_BR_Presentation_Control_TypeScript.Substring(indexOfArray, strSpartan_BR_Presentation_Control_TypeScript.Length - indexOfArray); int indexOfMainElement = splittedString.IndexOf('['); int endIndexOfMainElement = splittedString.IndexOf(']') + 1; // get json string of change job history element attributes string childUserChangeJson = jsSerialize.Serialize(Spartan_BR_Presentation_Control_TypeModuleAttributeList.ChildModuleAttributeList); int indexOfArrayHistory = strSpartan_BR_Presentation_Control_TypeScript.IndexOf("inpuElementChildArray"); string splittedStringHistory = strSpartan_BR_Presentation_Control_TypeScript.Substring(indexOfArrayHistory, strSpartan_BR_Presentation_Control_TypeScript.Length - indexOfArrayHistory); int indexOfMainElementHistory = splittedStringHistory.IndexOf('['); int endIndexOfMainElementHistory = splittedStringHistory.IndexOf(']') + 1; //string finalResponse = strSpartan_BR_Presentation_Control_TypeScript.Substring(0, indexOfArray + indexOfMainElement) + userChangeJson + strSpartan_BR_Presentation_Control_TypeScript.Substring(endIndexOfMainElement + indexOfArray, strSpartan_BR_Presentation_Control_TypeScript.Length - (endIndexOfMainElement + indexOfArray)); string finalResponse = strSpartan_BR_Presentation_Control_TypeScript.Substring(0, indexOfArray + indexOfMainElement) + userChangeJson + strSpartan_BR_Presentation_Control_TypeScript.Substring(endIndexOfMainElement + indexOfArray, (indexOfMainElementHistory + indexOfArrayHistory) - (endIndexOfMainElement + indexOfArray)) + childUserChangeJson + strSpartan_BR_Presentation_Control_TypeScript.Substring(endIndexOfMainElementHistory + indexOfArrayHistory, strSpartan_BR_Presentation_Control_TypeScript.Length - (endIndexOfMainElementHistory + indexOfArrayHistory)); using (StreamWriter w = new StreamWriter(Server.MapPath("~/Uploads/Scripts/Spartan_BR_Presentation_Control_Type.js"))) { w.WriteLine(finalResponse); } return(Json(true, JsonRequestBehavior.AllowGet)); }