protected void btnSave_Click(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(txtRoleName.Text.ToString().Trim()))
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('角色名称不能为空!');", true);
            return;
        }

        _roleEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _roleEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _roleEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _roleEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _roleEntity.RoleDBEntity = new List<RoleDBEntity>();
        RoleDBEntity roleDBEntity = new RoleDBEntity();
        roleDBEntity.RoleName = txtRoleName.Text.Trim();
        roleDBEntity.RoleCreator = UserSession.Current.UserAccount;
        roleDBEntity.UpdateTime = DateTime.Now.ToString();
        roleDBEntity.CreateTime = DateTime.Now.ToString();

        _roleEntity.RoleDBEntity.Add(roleDBEntity);
        int iResult = RoleBP.Insert(_roleEntity);

        _commonEntity.LogMessages = _roleEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "";
        commonDBEntity.Event_ID = "";

        //string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        //conTent = string.Format(conTent,txtRoleName.Text.Trim());
        //commonDBEntity.Event_Content = conTent;

        if (iResult == 1)//插入成功
        {
            commonDBEntity.Event_Result = Resources.MyGlobal.InsertSuccessText;
            messageContent.InnerHtml = Resources.MyGlobal.InsertSuccessText;
        }
        else if (iResult == 2)//表示该名称已经存在
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("PromptRoleExist").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("PromptRoleExist").ToString();
        }
        else//表示失败
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("PromptAddRoleFaild").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("PromptAddRoleFaild").ToString();
        }

        //_commonEntity.CommonDBEntity.Add(commonDBEntity);
        //CommonBP.InsertEventHistory(_commonEntity);
    }
    /// <summary>
    /// 新增角色页面中的保持按钮
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(txtRoleName.Text.ToString().Trim()))
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + STR_RoleNameEmpty + "');", true);
            return;
        }

        //_roleEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        //_commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        //_roleEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        //_roleEntity.LogMessages.Username = UserSession.Current.UserDspName;

        //_commonEntity.LogMessages = _roleEntity.LogMessages;
        //_commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        //CommonDBEntity commonDBEntity = new CommonDBEntity();

        //commonDBEntity.Event_Type = "";
        //commonDBEntity.Event_ID = "";

        string updateRoleID = this.txtRoleID.Text.Trim();
        if (string.IsNullOrEmpty(updateRoleID))
        {
            //增加一条到数据库中
            _roleEntity.RoleDBEntity = new List<RoleDBEntity>();
            RoleDBEntity roleDBEntity = new RoleDBEntity();
            roleDBEntity.RoleName = txtRoleName.Text.Trim();
            roleDBEntity.RoleCreator = UserSession.Current.UserAccount;
            roleDBEntity.UpdateTime = DateTime.Now.ToString();
            roleDBEntity.CreateTime = DateTime.Now.ToString();
            roleDBEntity.IsAD = (chkIsAD.Checked) ? "1" : "0";
            _roleEntity.RoleDBEntity.Add(roleDBEntity);
            int iResult = RoleBP.Insert(_roleEntity);

            if (iResult == 1)//插入成功
            {
                string successText = Resources.MyGlobal.InsertSuccessText;
                //commonDBEntity.Event_Result = successText;
                //messageContent.InnerHtml = Resources.MyGlobal.InsertSuccessText;
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + successText + "');", true);

                clearPopupText();

                BindGridView();//重新绑定显示的页面
            }
            else if (iResult == 2)//表示该名称已经存在
            {
                string strRoleExistText = GetLocalResourceObject("PromptRoleExist").ToString();
                //commonDBEntity.Event_Result = strRoleExistText;
                //messageContent.InnerHtml = GetLocalResourceObject("PromptRoleExist").ToString();
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + strRoleExistText + "')", true);
            }
            else//表示失败
            {
                string strRoleFaild = GetLocalResourceObject("PromptAddRoleFaild").ToString();
                //commonDBEntity.Event_Result = strRoleFaild;
                //messageContent.InnerHtml = GetLocalResourceObject("PromptAddRoleFaild").ToString();
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "alert('" + strRoleFaild + "')", true);
            }
        }
        else
        {
            //修改数据库中该条信息
            _roleEntity.RoleDBEntity = new List<RoleDBEntity>();
            RoleDBEntity roleDBEntity = new RoleDBEntity();

            roleDBEntity.RoleName = txtRoleName.Text.Trim();
            roleDBEntity.RoleID = txtRoleID.Text.Trim();
            roleDBEntity.UpdateTime = DateTime.Now.ToString();
            roleDBEntity.IsAD = (chkIsAD.Checked) ? "1" : "0";
            _roleEntity.RoleDBEntity.Add(roleDBEntity);
            int iResult = RoleBP.Update(_roleEntity);

            if (iResult == 1)//修改成功
            {
                string successText = Resources.MyGlobal.UpdateSuccessText;
                //commonDBEntity.Event_Result = successText;
                //messageContent.InnerHtml = Resources.MyGlobal.InsertSuccessText;
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + successText + "');", true);
                clearPopupText();

                BindGridView();//重新绑定显示的页面
            }
            else if (iResult == 2)//表示该名称已经存在
            {
                string strRoleExistText = GetLocalResourceObject("PromptRoleExist").ToString();
                //commonDBEntity.Event_Result = strRoleExistText;
                //messageContent.InnerHtml = GetLocalResourceObject("PromptRoleExist").ToString();
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + strRoleExistText + "')", true);
            }
            else//表示失败
            {
                string strRoleFaild = GetLocalResourceObject("PromptUpdateRoleFaild").ToString();
                //commonDBEntity.Event_Result = strRoleFaild;
                //messageContent.InnerHtml = GetLocalResourceObject("PromptAddRoleFaild").ToString();
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "alert('" + strRoleFaild + "')", true);
            }

        }

        //string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        //conTent = string.Format(conTent,txtRoleName.Text.Trim());
        //commonDBEntity.Event_Content = conTent;
    }
    protected void RoleGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string roleid = RoleGridView.DataKeys[e.RowIndex].Value.ToString();

        //LogMessage Insert
        //_roleEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        //_commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        //_roleEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        //_roleEntity.LogMessages.Username = UserSession.Current.UserDspName;

        //_commonEntity.LogMessages = _roleEntity.LogMessages;
        //_commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        //CommonDBEntity commonDBEntity = new CommonDBEntity();

        //增加一条到数据库中
        _roleEntity.RoleDBEntity = new List<RoleDBEntity>();
        RoleDBEntity roleDBEntity = new RoleDBEntity();
        roleDBEntity.RoleID = roleid;
        _roleEntity.RoleDBEntity.Add(roleDBEntity);
        int iResult = RoleBP.Delete(_roleEntity);

        if (iResult == 1)//删除成功
        {
            string successText = Resources.MyGlobal.DeleteSuccessText;
            //commonDBEntity.Event_Result = successText;
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + successText + "');", true);

            BindGridView();//重新绑定显示的页面
        }
        else//表示失败
        {
            string strRoleFaild = GetLocalResourceObject("DeleteSuccessText").ToString();
            //commonDBEntity.Event_Result = strRoleFaild;
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "failed", "alert('" + strRoleFaild + "')", true);
        }
    }