示例#1
0
        protected override void OnPreInit(EventArgs e)
        {
            if (listPrivillagePage.Count == 0)
            {
                listPrivillagePage.Add("/UserManagement/ManagerAdd.aspx");
                //listPrivillagePage.Add("/UserManagement/ManagerEdit.aspx");
                listPrivillagePage.Add("/UserManagement/ManagerList.aspx");
                listPrivillagePage.Add("/Log/LogList.aspx");
                listPrivillagePage.Add("/Module/ModuleList.aspx");
            }
            if (Session["Manager"] != null)
            {
                this.manager = Session["Manager"] as CY.HotelBooking.Core.Business.Manager;
            }
            else
            {
                string strURL = ResolveUrl("~") + "Login.aspx";
                Response.Write("<html><head><script type=\"text/javascript\">top.document.location='" + strURL + "';</script></head><body></body></html>");
            }

            if (Session["Settings"] == null)
            {
                this.settings = CY.HotelBooking.Core.Business.Settings.Load(0);
                Session["Settings"] = this.settings;
            }
            else
            {
                this.settings = Session["Settings"] as CY.HotelBooking.Core.Business.Settings;
            }

            base.OnPreInit(e);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                try
                {
                    lb_err.Text = "";
                    CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager();
                    List<CY.HotelBooking.Core.Business.Manager> listManager = manager.GetAllList() as List<CY.HotelBooking.Core.Business.Manager>;
                    ddl_Manager.DataSource = listManager;
                    ddl_Manager.DataTextField = "RealName";
                    ddl_Manager.DataValueField = "Code";

                    ddl_Manager.DataBind();
                    ddl_Manager.Items.Insert(0, new ListItem("全部", ""));
                    ddl_Manager.Items.Insert(ddl_Manager.Items.Count, new ListItem("已删除", "已删除"));
                    Bind();
                }
                catch (Exception ex)
                {
                    lb_err.Text = ex.Message;
                }

            }
        }
示例#3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string code = textmanagerID.Text.Trim();
            string pass = textpass.Text.Trim();
            pass = CY.HotelBooking.Core.Business.PasswordEncrypt.DESEncryptMethod(pass);
            CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager();
            IList<CY.HotelBooking.Core.Business.Manager> list = manager.GetListByName(code);
            if (list.Count == 0 || list == null)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('该管理员信息不存在!');</script>");
                textmanagerID.Text = string.Empty;
                textmanagerID.Focus();
            }
            else if (pass == list[0].Pass)
            {
                Session["ManagerId"] = list[0].Id;//自增标识符:ID
                Session["ManagerCode"] = list[0].Code;//用户名
                Session["Manager"] = list[0];
                CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();

                log.Manager = list[0].Code;
                log.Message = list[0].RealName + "登录了系统";
                log.Save();
                Response.Redirect("/Struct/Mine.aspx");//成功,页面跳转
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('密码输入不正确!');</script>");
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            //if (TextManage_Pass.Text.Trim() != TextManage_Pass2.Text.Trim())
            //{
            //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('两次密码不相同');</script>");
            //    TextManage_Pass.Focus();
            //}
            CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager();
            if (!manager.IsExistCode(TextManager_Code.Text.Trim()))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('此管理员编号已经存在');</script>");
                TextManager_Code.Text = string.Empty;
                TextManager_Code.Focus();
            }
            else
            {
                manager.Code = TextManager_Code.Text.Trim();//管理员编号
                manager.Pass = "******"; //默认密码888888       // TextManage_Pass.Text.Trim();//密码
                manager.Pass = CY.HotelBooking.Core.Business.PasswordEncrypt.DESEncryptMethod(manager.Pass);//加密
                manager.RealName = TextManage_RealName.Text.Trim();//真实姓名
                manager.AddDate = DateTime.Now;//添加日期
                manager.Role = ddlRole.SelectedValue;//角色类型
                try
                {
                    manager.Save();

                    CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
                    log.Manager = Manager.Code;
                    log.Message = Manager.RealName +"添加了管理员:" + manager.Code;
                    log.Save();

                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('增加管理员信息成功!');</script>");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
 private void Bind()
 {
     CY.HotelBooking.Core.Business.Manager manager;
     IList<CY.HotelBooking.Core.Business.Manager> list;
     if (textSearch.Text.Trim() == string.Empty)
     {
         manager = new CY.HotelBooking.Core.Business.Manager();
         list = manager.GetAllList();
     }
     else
     {
         manager=new CY.HotelBooking.Core.Business.Manager();
         string name = textSearch.Text.Trim();
         list =manager.GetSearchByName(name);
     }
     gvManager.DataSource = list;
     gvManager.DataBind();
 }