示例#1
0
        /// <summary>
        /// 获取属性值集合
        /// </summary>
        private List <object> GetPropertyValues <T>(T entity, IEnumerable <string> propertyNames) where T : class
        {
            var type = entity.GetType();

            return(propertyNames.Select(type.GetProperty).Select(property => {
                if (property == null)
                {
                    return "";
                }
                object result = property.GetValue(entity);
                if (property.PropertyType == typeof(bool))
                {
                    result = Convert.ToBool(result).Description();
                }
                return result;
            }).ToList());
        }
示例#2
0
 /// <summary>
 /// 设置总金额
 /// </summary>
 /// <param name="totalFee">总金额,单位:元</param>
 public WechatpayParameterBuilder TotalFee(decimal totalFee)
 {
     _builder.Add(WechatpayConst.TotalFee, Convert.ToInt(totalFee * 100));
     return(this);
 }
示例#3
0
 /// <summary>
 /// 获取当前应用程序标识
 /// </summary>
 /// <param name="session">用户会话</param>
 public static T GetApplicationId <T>(this ISession session)
 {
     return(Convert.To <T>(Web.Identity.GetValue(ClaimTypes.ApplicationId)));
 }
示例#4
0
 /// <summary>
 /// 获取当前操作人角色标识列表
 /// </summary>
 /// <param name="session">用户会话</param>
 public static List <T> GetRoleIds <T>(this ISession session)
 {
     return(Convert.ToList <T>(Web.Identity.GetValue(ClaimTypes.RoleIds)));
 }
示例#5
0
 /// <summary>
 /// 获取当前操作人标识
 /// </summary>
 /// <param name="session">用户会话</param>
 public static T GetUserId <T>(this ISession session)
 {
     return(Convert.To <T>(session.UserId));
 }