public CsiService(ICsiDocument doc, string serviceName, ICsiXmlElement parent) : base(doc, "__service", parent) { this.SetAttribute("__serviceType", serviceName); CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__txnGUID", CsiXmlHelper.GenerateGuid()); CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__utcOffset", CsiXmlDataFormat.GetUTCOffset()); }
public void SetFormattedValue(string val, DataFormats format) { string str = null; string str2; try { switch (format) { case DataFormats.FormatDateAndTime: str = CsiXmlDataFormat.Locale2LexicalDateTime(val); goto Label_00DE; case DataFormats.FormatDate: str = CsiXmlDataFormat.Locale2LexicalDate(val); goto Label_00DE; case DataFormats.FormatTime: str = CsiXmlDataFormat.Locale2LexicalTime(val); goto Label_00DE; case DataFormats.FormatDecimal: str = CsiXmlDataFormat.Locale2LexicalDecimal(val); goto Label_00DE; case DataFormats.FormatFloat: str = CsiXmlDataFormat.Locale2LexicalFloat(val); goto Label_00DE; } str2 = base.GetType().FullName + ".setFormattedValue()"; throw new CsiClientException(-1L, "格式化错误", str2); } catch (Exception exception) { str2 = base.GetType().FullName + "#setFormattedValue()"; string desc = string.Concat(new object[] { "不能转换'", val, "' 为 '", format, "'. ", exception.Message }); throw new CsiClientException(-1L, desc, str2); } Label_00DE: if (str != null) { this.SetValue(str); } }
public string GetFormattedValue(DataFormats format) { string str3; string val = this.GetValue(); if ((val == null) || (val.Length == 0)) { return(val); } try { switch (format) { case DataFormats.FormatDateAndTime: return(CsiXmlDataFormat.Lexical2LocaleDateTime(val)); case DataFormats.FormatDate: return(CsiXmlDataFormat.Lexical2LocaleDate(val)); case DataFormats.FormatTime: return(CsiXmlDataFormat.Lexical2LocaleTime(val)); case DataFormats.FormatDecimal: return(CsiXmlDataFormat.Lexical2LocaleDecimal(val)); case DataFormats.FormatFloat: return(CsiXmlDataFormat.Lexical2LocaleFloat(val)); } str3 = base.GetType().FullName + ".getFormattedValue()"; throw new CsiClientException(-1L, "格式化错误", str3); } catch (Exception exception) { str3 = base.GetType().FullName + ".getFormattedValue()"; string desc = "不能转换 '" + val + "' 为 '" + format.GetType().Name + "'. " + exception.Message; throw new CsiClientException(-1L, desc, str3); } return(null); }