Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ViewState["surrentPage"] = 0;
         divide mdv = new divide();
         this.AdminList.DataSource = mdv.AdminShow(Convert.ToInt32(ViewState["surrentPage"]));
         this.AdminList.DataBind();
         SA  mSA         = new SA();
         int PageSum     = mSA.GetPage();
         int CurrentPage = Convert.ToInt32(ViewState["surrentPage"]);
         ShowPages.Text = "第" + (CurrentPage + 1).ToString() + "页/共" + PageSum + "页";
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 上一页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void last_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(ViewState["surrentPage"]) > 0)
            {
                ViewState["surrentPage"] = Convert.ToInt32(ViewState["surrentPage"]) - 1;
                divide mdv = new divide();
                this.AdminList.DataSource = mdv.AdminShow(Convert.ToInt32(ViewState["surrentPage"]));
                this.AdminList.DataBind();
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "已经是第一页!!" + "');</script> ");
            }
            SA  mSA         = new SA();
            int PageSum     = mSA.GetPage();
            int CurrentPage = Convert.ToInt32(ViewState["surrentPage"]);

            ShowPages.Text = "第" + (CurrentPage + 1).ToString() + "页/共" + PageSum + "页";
        }
Ejemplo n.º 3
0
 AdminController mAdminController = new AdminController();     //管理员方法对象
 /// <summary>
 /// 激活管理员
 /// </summary>
 protected void btnActive_Click(object sender, EventArgs e)
 {
     mSa.UserName  = this.tbxUserName.Text;
     mSa.StaffType = (this.dplStaffType.SelectedValue).ToCharArray()[0];
     //判断此用户名是否存在
     if (mSaController.AdminRegistText(mSa) == true)
     {
         this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "此用户名不存在!" + "');</script> ");
     }
     else
     {
         //判断此用户名是否被激活过
         if (mSaController.AdminStaffType(mSa) != "9")
         {
             this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "此用户名已被激活!" + "');</script> ");
         }
         else
         {
             if (Session["hUserName"] != null)
             {
                 mSaLogin.UserName = Session["hUserName"].ToString();
                 mSaController.ActiveAdmin(mSa);
                 this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('" + "激活成功!" + "');</script> ");
                 divide mdv = new divide();
                 //数据重新绑定更新页面数据
                 this.AdminList.DataSource = mdv.AdminShow(Convert.ToInt32(ViewState["surrentPage"]));
                 this.AdminList.DataBind();
                 //在日志表中记录此次操作
                 mDayBook.StaffID        = mAdminController.GetStaffID(mSaLogin, mSaLogin.UserName);
                 mDayBook.UserName       = mSaLogin.UserName;
                 mDayBook.HandleTime     = DateTime.Now.ToString();
                 mDayBook.HandleObjects  = "普通管理员:" + mSa.UserName;
                 mDayBook.DayBookVersion = "1";
                 mDayBookController.AddDayBook(mDayBook);
             }
         }
     }
 }