Exemplo n.º 1
0
 /// <summary>
 /// 添加管理员
 /// </summary>
 /// <param name="aname"></param>
 /// <param name="apwd"></param>
 /// <param name="anickname"></param>
 /// <param name="email"></param>
 /// <param name="gid"></param>
 /// <returns></returns>
 public int Add(string aname, string apwd, string anickname, string email, int gid)
 {
     MR_Admin model = new MR_Admin();
     model.AName = aname;
     model.APwd = apwd.MD5();
     model.ANickName = anickname;
     model.Email = email;
     model.GID = gid;
     return new DR_Admin().Add(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 增加管理员信息
        /// 返回新增加的标识列,如果增加失败返回0
        /// </summary>
        public int Add(MR_Admin model)
        {
            string pname = "p_AddAdmin";
            SqlParameter[] parameters = new SqlParameter[]{
                    new SqlParameter("@AName", model.AName),
                    new SqlParameter("@APwd", model.APwd),
                    new SqlParameter("@ANickName", model.ANickName),
                    new SqlParameter("@Email", model.Email),
                    new SqlParameter("@GID",model.GID)
            };

            object obj = SQLHelpers.TcAdmin().ExecuteNonQuery(pname, CommandType.StoredProcedure, parameters);
            if (obj == null) {
                return 0;
            } else {
                return Convert.ToInt32(obj);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 管理员登录后台
 /// </summary>
 /// <param name="userName">登录名</param>
 /// <param name="userPwdMD5">密码密文</param>
 /// <param name="userIp">用户IP</param>
 /// <param name="model">输出值,当前登录用户的基本信息</param>
 /// <returns></returns>
 public bool Login(string userName, string userPwdMD5, string userIp, out MR_Admin model)
 {
     model = new DR_Admin().GetModel(userName, userPwdMD5, userIp);
     if (model == null || model.AID < 0)
         return false;
     return true;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 登录成功后,设置COOKIE
 /// </summary>
 /// <param name="model"></param>
 public static void SaveUserFormsCookie(MR_Admin model)
 {
     ZAuthentication.AuthHelper.SetUser(new ZAuthentication.UserTickModel(
         model.AName, model.GetJSON(), DateTime.Now, DateTime.Now.AddHours(3), StaticFunctions.GetUserIp()));
 }