Exemple #1
0
 public Result Delete(Model.DB.User model)
 {
     UserRA.Delete(model.id.ToString());
     MessageBiz.Send(model.id.ToString(), MessageTypeEnum.User_Forbidden);
     model.created_by = user_id;
     return(Result(UserDA.Delete(model)));
 }
Exemple #2
0
        public ResultLogin Login(Model.DB.User model)
        {
            ApiResultEnum result = UserDA.Login(ref model, platform);

            if (result == ApiResultEnum.Success)
            {
                string user_token = UserRA.Get(model.id.ToString(), "platform_" + platform);
                if (string.IsNullOrWhiteSpace(user_token))
                {
                    user_token = FuncHelper.GetUniqueString();
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("platform_" + platform, user_token);
                    dic.Add("name", model.name);
                    dic.Add("status_order", model.status_order.ToString());
                    dic.Add("role", model.role.ToString());
                    dic.Add("login_time_" + platform, DateTime.Now.Format());
                    UserRA.Set(model.id.ToString(), dic);
                    UserRA.SetExpire(model.id.ToString());
                }
                return(new ResultLogin(result, model, model.id + "-" + user_token));
            }
            else
            {
                return(new ResultLogin(result, null, null));
            }
        }
Exemple #3
0
        public Result <int> Add(Model.DB.User model)
        {
            int id = 0;

            model.created_by = user_id;
            ApiResultEnum result = UserDA.Add(model, ref id);

            return(Result(result, id));
        }
Exemple #4
0
 public Result Authority(Model.DB.User model)
 {
     MessageBiz.Send(model.id.ToString(), MessageTypeEnum.Authorization_Changed);
     return(Result(UserDA.Authority(model)));
 }
Exemple #5
0
 public Result Update(Model.DB.User model)
 {
     return(Result(UserDA.Update(model)));
 }