public static Dictionary <string, object> GetChangedValues(this DataPO po) { bool refreshflow = (po.flows != null && po.flows.Count(f => f.IsChanges()) > 0); System.Data.DataRow row = po.GetRow(refreshflow); return(DataSetTools.GetChangedValues(row)); }
/// <summary> /// Obtientir les données du DataPO /// </summary> /// <returns></returns> public static Dictionary <string, object> GetValues(this DataPO po, bool returnKeys, bool returnValues) { System.Data.DataRow row = po.GetRow(returnValues);// Si les valeurs sont demandé on refresh les flow if (returnKeys && !IsDefinedSchema(po)) { DefineSchemaPO(po); // Si l'objet est pas définis il faut le daire } return(DataSetTools.GetValues(row, returnKeys, returnValues)); }
/// <summary> /// Savoir si le datapo à été correctement défini pour des actions SQL /// </summary> /// <param name="po"></param> /// <returns></returns> public static bool IsDefinedSchema(this DataPO po) { if (po == null) { return(false); } if (po.GetRow() == null) { return(false); } if (!po._isDefined) { return(false); } return(true); }
/// <summary> /// Obtientir les données du DataPO /// </summary> /// <returns></returns> public static Dictionary <string, object> GetValues(this DataPO po, params string[] ColNames) { if (ColNames == null || ColNames.Length == 0) { return(new Dictionary <string, object>()); } bool refreshflow = false; if (po.flows != null && po.flows.Count > 0) { refreshflow = po.flows.Select(f => f.GetFieldName()).Where(fn => !string.IsNullOrWhiteSpace(fn)).Any(fn => ColNames.Any(eq => fn.Equals(eq, StringComparison.OrdinalIgnoreCase))); } System.Data.DataRow row = po.GetRow(refreshflow); return(DataSetTools.GetValues(row, ColNames)); }
/// <summary> /// Sérialiser le Datapo /// </summary> /// <param name="po">Objet racine à sérialiser</param> /// <param name="includeInternalPO">Inclure les sous objets</param> /// <param name="fromProperty">Pour les sérialisations en boucles</param> /// <returns>string sérialiser custom</returns> public static string SerializeDatas(DataPO po, bool includeInternalPO = true, PropertyInfo fromProperty = null) { try { StringBuilder retour = new StringBuilder(); retour.Append("[[$"); System.Data.DataRow rowd = po.GetRow(); string strd = MANIPULATE.DATASET.DataTableTools.SerializeDataRow(rowd); if (!string.IsNullOrEmpty(strd)) { retour.Append("[[!dataxml!]]"); retour.Append(strd); retour.AppendLine(); } if (!includeInternalPO) { return(retour.ToString()); } Type typepo = po.GetType(); PropertyInfo[] properties = typepo.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo propertie in properties) { string strproper = ToDatasXMLProperty(propertie, po); if (string.IsNullOrWhiteSpace(strproper)) { continue; } retour.AppendFormat("[[!{0}!]]", propertie.Name); retour.Append(strproper); retour.AppendLine(); } retour.Append("$]]"); return(retour.ToString()); } catch (Exception ex) { throw new Exception("GetDatasXML" + ex.Message, ex); } }