/// <summary>
 /// ��������б�
 /// </summary>
 public List<WebProject.Model.SysManage.ZT_SYS_RoleInfo> DataTableToList(DataTable dt)
 {
     List<WebProject.Model.SysManage.ZT_SYS_RoleInfo> modelList = new List<WebProject.Model.SysManage.ZT_SYS_RoleInfo>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         WebProject.Model.SysManage.ZT_SYS_RoleInfo model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new WebProject.Model.SysManage.ZT_SYS_RoleInfo();
             if(dt.Rows[n]["RoleID"].ToString()!="")
             {
                 model.RoleID=int.Parse(dt.Rows[n]["RoleID"].ToString());
             }
             model.RoleNo=dt.Rows[n]["RoleNo"].ToString();
             model.RoleName=dt.Rows[n]["RoleName"].ToString();
             model.RoleDesc=dt.Rows[n]["RoleDesc"].ToString();
             model.RoleElements=dt.Rows[n]["RoleElements"].ToString();
             model.CreateBy=dt.Rows[n]["CreateBy"].ToString();
             if(dt.Rows[n]["CreateDate"].ToString()!="")
             {
                 model.CreateDate=DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
             }
             model.LastUpdateBy=dt.Rows[n]["LastUpdateBy"].ToString();
             if(dt.Rows[n]["LastUpdateDate"].ToString()!="")
             {
                 model.LastUpdateDate=DateTime.Parse(dt.Rows[n]["LastUpdateDate"].ToString());
             }
             model.Status=dt.Rows[n]["Status"].ToString();
             model.Remark=dt.Rows[n]["Remark"].ToString();
             modelList.Add(model);
         }
     }
     return modelList;
 }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Session["ZT_ADMIN"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            if (this.txtRoleNo.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入角色编号!");
                return;
            }
            if (this.txtRoleName.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入角色名称!");
                return;
            }
            WebProject.BLL.SysManage.ZT_SYS_RoleInfo bll_RoleInfo = new WebProject.BLL.SysManage.ZT_SYS_RoleInfo();
            if (bll_RoleInfo.GetModelList(" RoleNo='" + this.txtRoleNo.Text.Trim() + "'").Count > 0)
            {
                MessageBox.Show(this, "角色编号不能重复!");
                return;
            }

            this.mElemStr = "";
            string elems = this.GetAllNodeText(this.TreeView1.Nodes);
            if (elems.Split(',').Length <= 1)
            {
                MessageBox.Show(this, "至少选择一个权限!");
                return;
            }
            elems = elems.Substring(1);
            WebProject.Model.SysManage.ZT_SYS_RoleInfo model_RoleInfo = new WebProject.Model.SysManage.ZT_SYS_RoleInfo();
            model_RoleInfo.RoleNo = this.txtRoleNo.Text.Trim();
            model_RoleInfo.RoleName = this.txtRoleName.Text.Trim();
            model_RoleInfo.RoleElements = elems;
            model_RoleInfo.CreateBy = SessionUtil.GetAdminSession().AdminNo;
            model_RoleInfo.CreateDate = DateTime.Now;
            bll_RoleInfo.Add(model_RoleInfo);
            LogManage.WriteLog(Request.UserHostAddress, "角色管理", "添加角色", "成功", "角色编号:" + model_RoleInfo.RoleNo + " 角色名称:" + model_RoleInfo.RoleName + "操作人:" + SessionUtil.GetAdminSession().AdminNo);
            MessageBox.ShowAndRedirect(this, "添加角色成功!", "RoleList.aspx");
        }
    }