public static XmlElement CreateXmlElement(string name, object value) { XmlDocument doc = new XmlDocument(); XmlElement elem = doc.CreateElement(name); elem.InnerText = MyUtils.Coalesce(value, "").ToString(); return(elem); }
public static string GetXmlChildValue(XElement xElement, string childName) { if (xElement != null) { XElement xChildElement = xElement.Element(childName); if (xChildElement != null) { return(MyUtils.Coalesce(xChildElement.Value, "")); } } return(""); }
public static string GetAuthorisedApp() { DataTable dt = new DataTable(); dt.Columns.Add("Application").DefaultValue = Application; DataRow dr = dt.NewRow(); dt.Rows.Add(dr); object sqlResult = MyWebUtils.EvalSQL("select dbo.fnGetAuthorisedApp(@CI_UserEmail, @Application)", dr, 0); return(MyUtils.Coalesce(sqlResult, "").ToString()); }
public static bool IsTrueSQL(string SQL, DataRow drParams, int?appID = null) { if (!MyUtils.IsEmpty(SQL)) { DataTable dt = GetBySQL(SQL, drParams, appID); if (MyWebUtils.GetNumberOfRows(dt) > 0 && MyWebUtils.GetNumberOfColumns(dt) > 0) { return(Convert.ToBoolean(MyUtils.Coalesce(dt.Rows[0][0], false))); } return(false); } return(true); }
public void InsertTable(object table, string view, object parameters, ref string rowKey, ref string script, ref bool isInvalid) { DataRow drParams = parameters as DataRow; CiTable ciTable = table as CiTable; if (ciTable != null) { CiMacro ciMacro = ciTable.InsertMacro; if (ciMacro != null) { ciMacro.Run(drParams); script = ciMacro.ResultScript; isInvalid = !MyUtils.IsEmpty(ciMacro.ErrorMessage); DataTable dt = ciMacro.ResultTable; if (MyWebUtils.GetNumberOfRows(dt) > 0) { DataRow dr = dt.Rows[0]; int i = 0; foreach (string key in ciTable.RowKeyNames) { if (i++ > 0) { rowKey += ","; } if (dt.Columns.Contains(key)) { rowKey += MyUtils.Coalesce(dr[key], "").ToString(); } } } } } }