public XmlDocument GetIncompleteMetadata( out Dictionary <string, XmlElement> classElementsByName, out List <XmlElement> orderedClassElements) { string fileName1 = Path.Combine(this.FolderPath, "Meta\\meta-app.xml"); double num = SysUtils.GetFileVersion(fileName1); XmlDocument document = XmlUtils.CreateDocument("AppMetadata"); XmlElement documentElement = document.DocumentElement; documentElement.SetAttribute("AppRootFolder", this.FolderPath); XmlDocument xmlDocument1 = XmlUtils.LoadDocument(fileName1, Encoding.GetEncoding(1251)); MetadataElementLoader metadataElementLoader = new MetadataElementLoader(documentElement); if (xmlDocument1.DocumentElement != null) { foreach (XmlNode selectNode in xmlDocument1.DocumentElement.SelectNodes("meta-data")) { string fileName2 = Path.Combine(this.FolderPath, "Meta\\" + XmlUtils.NeedAttr(selectNode, "src")); double fileVersion = SysUtils.GetFileVersion(fileName2); if (fileVersion > num) { num = fileVersion; } XmlDocument xmlDocument2 = XmlUtils.LoadDocument(fileName2, Encoding.GetEncoding(1251)); metadataElementLoader.Merge(xmlDocument2.DocumentElement); } } classElementsByName = new Dictionary <string, XmlElement>(); orderedClassElements = new List <XmlElement>(); foreach (XmlElement selectNode in documentElement.SelectNodes("class")) { orderedClassElements.Add(selectNode); classElementsByName[selectNode.GetAttribute("name")] = selectNode; } documentElement.SetAttribute("Version", XStrUtils.ToXStr(num)); XmlUtils.SetChildText((XmlNode)documentElement, "meta-version", XStrUtils.ToXStr(num)); foreach (XmlNode childNode in this.FDbInfo.DocumentElement.ChildNodes) { documentElement.AppendChild(document.ImportNode(childNode, true)); } foreach (XmlElement selectNode in documentElement.SelectNodes("class")) { ApplicationMetadataXml.MakePrimaryClassCompletion(selectNode); } return(document); }
public object ValueFromXStr(DataSession session, string xStr) { if (StrUtils.IsNullOrEmpty(xStr) || xStr == "{{null}}") { return((object)null); } if (this.IsLink) { if (this.Association.Refs.Count > 1) { throw new MetadataException("Невозможно получить связанный объект по идентификатору: для ассоциации определено более одного варианта связи."); } return((object)session[this.Association.Refs[0].RefClass][new DataId(xStr)]); } switch (this.DataType & DataType.BaseMask) { case DataType.Boolean: return((object)XStrUtils.ToBool(xStr, false)); case DataType.Integer: return((object)XStrUtils.ToInt(xStr, 0)); case DataType.Float: return((object)XStrUtils.ToDouble(xStr, 0.0)); case DataType.Currency: return((object)XStrUtils.ToCurrency(xStr, 0M)); case DataType.DateTime: return((object)XStrUtils.ToDateTime(xStr, DateTime.MinValue)); case DataType.Binary: return((object)Convert.FromBase64String(xStr)); default: return((object)XStrUtils.ToString(xStr, string.Empty)); } }
public object XStrToCur(string xStr) => xStr == this.XStrNULL ? (object)DBNull.Value : (object)XStrUtils.ToCurrency(xStr, 0M);
public string CurToXStr(object value) => InMetaXStrUtils.TreatAsNull(value) ? this.XStrNULL : XStrUtils.ToXStr(Convert.ToDecimal(value));
public object XStrToDbl(string xStr) => xStr == this.XStrNULL ? (object)DBNull.Value : (object)XStrUtils.ToDouble(xStr, 0.0);
public string DblToXStr(object value) => InMetaXStrUtils.TreatAsNull(value) ? this.XStrNULL : XStrUtils.ToXStr(Convert.ToDouble(value));
public object XStrToLng(string xStr) => xStr == this.XStrNULL ? (object)DBNull.Value : (object)XStrUtils.ToInt(xStr, 0);
public string LngToXStr(object value) => InMetaXStrUtils.TreatAsNull(value) ? this.XStrNULL : XStrUtils.ToXStr(Convert.ToInt32(value));
public object XStrToDateTime(string xStr) => xStr == this.XStrNULL ? (object)DBNull.Value : (object)XStrUtils.ToDateTime(xStr, DateTime.Now);
public object XStrToBool(string xStr) => xStr == this.XStrNULL ? (object)DBNull.Value : (object)XStrUtils.ToBool(xStr, false);
public string BoolToXStr(object value) => InMetaXStrUtils.TreatAsNull(value) ? this.XStrNULL : XStrUtils.ToXStr(Convert.ToBoolean(value));