Esempio n. 1
0
        public static User Save_UserData(int UserID, string LoginName, string RealName, UserTypeDefine UserType, int RelationID, string NickName = "", bool IsAllowAPPCustomerLogin = false)
        {
            User data = null;

            if (UserID > 0)
            {
                data = User.GetUser(UserID);
            }
            if (data == null)
            {
                data = User.GetAPPUserByLoginName(LoginName);
            }
            if (data == null)
            {
                NickName        = string.IsNullOrEmpty(NickName) ? RealName : NickName;
                data            = new User();
                data.CreateTime = DateTime.Now;
                data.IsLocked   = false;
                data.Type       = UserType.ToString();
                data.LoginName  = LoginName;
                data.RealName   = RealName;
                data.NickName   = NickName;
                data.RelationID = RelationID;
                data.IsAllowAPPCustomerLogin = IsAllowAPPCustomerLogin;
                data.Save();
            }
            return(data);
        }
Esempio n. 2
0
        public static Mall_UserLevel GetMall_UserLevelByUserID(int UserID, out User user)
        {
            user = User.GetUser(UserID);
            if (user == null)
            {
                return(null);
            }
            decimal             amount_balance = Mall_UserBalance.GetMall_UserBalanceALLIncomingAmount(UserID);
            List <string>       conditions     = new List <string>();
            List <SqlParameter> parameters     = new List <SqlParameter>();

            conditions.Add("[StartAmount]<=@Amount and [EndAmount]>@Amount");
            parameters.Add(new SqlParameter("@Amount", amount_balance));
            var data = GetOne <Mall_UserLevel>("select top 1 * from [Mall_UserLevel] where " + string.Join(" and ", conditions.ToArray()) + " order by [StartAmount] desc", parameters);

            return(data);
        }