Ejemplo n.º 1
0
        /// <summary>
        /// 获取当前登陆的
        /// </summary>
        /// <returns></returns>
        public static Model.TcAdmin GetCurrentAdmin()
        {
            //开发方便,默认写上一个登陆用户
#if DEBUG
            return(BLL.TcAdmin.Instance.GetModelList("name='admin'")[0]);
#else
            try
            {
                if (HttpContext.Current.Session[Session_admin] == null)
                {
                    HttpContext.Current.Response.Redirect("~/admin/login.aspx");
                }
                Model.TcAdmin admin = HttpContext.Current.Session[Session_admin] as Model.TcAdmin;
                if (admin == null)
                {
                    HttpContext.Current.Response.Redirect("~/admin/login.aspx");
                }
                return(admin);
            }
            catch
            {
                HttpContext.Current.Response.Redirect("~/admin/login.aspx");
                return(null);
            }
#endif
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取当前登陆的
 /// </summary>
 /// <returns></returns>
 public static Model.TcAdmin GetCurrentAdmin()
 {
     try
     {
         if (HttpContext.Current.Session[Session_admin] == null)
         {
             HttpContext.Current.Response.Redirect("~/admin/login.aspx");
         }
         Model.TcAdmin admin = HttpContext.Current.Session[Session_admin] as Model.TcAdmin;
         if (admin == null)
         {
             HttpContext.Current.Response.Redirect("~/admin/login.aspx");
         }
         return(admin);
     }
     catch
     {
         HttpContext.Current.Response.Redirect("~/admin/login.aspx");
         return(null);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Tc.Model.TcAdmin model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tc.Model.TcAdmin model)
 {
     return(dal.Add(model));
 }