예제 #1
0
        /// <summary>
        /// 获取扩展字典值
        /// </summary>
        /// <param name="comData">通用数据</param>
        /// <param name="key">键</param>
        /// <returns>扩展字典值</returns>
        public static object GetExtendValue(this CommonUseData comData, string key)
        {
            if (comData == null || string.IsNullOrWhiteSpace(key) || comData.Extend.IsNullOrCount0())
            {
                return(null);
            }

            return(comData.Extend.ContainsKey(key) ? comData.Extend[key] : null);
        }
예제 #2
0
 /// <summary>
 /// 获取Token,如果里面的为空,则会执行App.GetTokenFunc()
 /// </summary>
 /// <param name="comData">通用数据</param>
 /// <returns>Token</returns>
 public static string GetToken(this CommonUseData comData)
 {
     if (comData == null || string.IsNullOrWhiteSpace(comData.Token))
     {
         return(App.GetTokenFunc != null?App.GetTokenFunc() : null);
     }
     else
     {
         return(comData.Token);
     }
 }
예제 #3
0
        /// <summary>
        /// 获取事件ID,如果里面的为空,则会执行theOperation.EventId,如果传入的theOperation为null,则会执行 App.TheOperation.EventId
        /// </summary>
        /// <param name="comData">通用数据</param>
        /// <param name="theOperation">本次操作</param>
        /// <returns>事件ID</returns>
        public static string GetEventId(this CommonUseData comData, ITheOperation theOperation = null)
        {
            if (comData == null || string.IsNullOrWhiteSpace(comData.EventId))
            {
                theOperation = theOperation == null ? App.TheOperation : theOperation;
                if (theOperation == null)
                {
                    return(null);
                }

                return(theOperation.EventId);
            }
            else
            {
                return(comData.EventId);
            }
        }
예제 #4
0
 /// <summary>
 /// 获取标签
 /// </summary>
 /// <param name="comData">通用数据</param>
 /// <returns>扩展字典值</returns>
 public static object GetTag(this CommonUseData comData)
 {
     return(comData == null ? null : comData.Tag);
 }
예제 #5
0
 /// <summary>
 /// 获取当前用户
 /// </summary>
 /// <param name="comData">通用数据</param>
 /// <returns>当前用户</returns>
 public static object GetCurrUser(this CommonUseData comData)
 {
     return(comData != null ? comData.CurrUser : null);
 }