protected void init_form(string ctrID)
        {
            if (!string.IsNullOrEmpty(ctrID))
            {
                _GroupsEntity = DataProvider.GetInstance().GetGroupsEntity(int.Parse(ctrID));

                TextBox_GroupName.Text = _GroupsEntity.GroupName.ToString();
                TextBox_DisplayIndex.Text = _GroupsEntity.DisplayIndex.ToString();
            }
        }
        protected void GroupsAdd()
        {
            #region 判断是否可空


            var _GroupName = Request.Form["TextBox_GroupName"];
            if (string.IsNullOrEmpty(_GroupName))
            {
                Alert("[ 分组名称 ]不能为空");
                return;
            }

            var _DisplayIndex = Request.Form["TextBox_DisplayIndex"];
            if (string.IsNullOrEmpty(_DisplayIndex))
            {
                Alert("[ 显示顺序 ]不能为空");
                return;
            }

            #endregion

            #region 获取数据

            GroupsEntity _GroupsEntity = new GroupsEntity();



            _GroupsEntity.GroupName = Convert.ToString(_GroupName.ToString());

            _GroupsEntity.DisplayIndex = Convert.ToInt32(_DisplayIndex.ToString());
            _GroupsEntity.CreateDate = DateTime.Now;
            _GroupsEntity.UpdateDate = DateTime.Now;
            try
            {
                DataProvider.GetInstance().AddGroups(_GroupsEntity);
            }
            catch
            {
                WriteLog("GroupsAdd", "添加Groups", "插入数据库时出错", Common.DailyUtility.MideSmsType.LogType.SystemLog);
                Alert("添加数据时出错,请重试");
                return;
            }
            Alert("添加Groups成功");
        }
        protected void init_form(string ctrID)
        {
            //取得menu表
            IList<MenuEntity> menuList = DataProvider.GetInstance().GetMenuList(" 1 = 1 ");

            //获取权限表
            IList<GroupsEntity> groupList = DataProvider.GetInstance().GetGroupsList(" 1 = 1 ");

            if (!string.IsNullOrEmpty(ctrID))
            {
                _MenuEntity = DataProvider.GetInstance().GetMenuEntity(int.Parse(ctrID));

                _MenuEntity_parent = DataProvider.GetInstance().GetMenuEntity(_MenuEntity.ParentID);

                _GroupEnty = DataProvider.GetInstance().GetGroupsEntity(_MenuEntity.GroupID);
            }
            if (!IsPostBack)
            {
                //初始化父菜单
                var parentIdDataSource = from parentIdTabels in menuList where parentIdTabels.ParentID == 0 select parentIdTabels;
                DropDownList_parentId.DataSource = parentIdDataSource;
                DropDownList_parentId.DataTextField = "DisplayName";
                DropDownList_parentId.DataValueField = "ID";
                DropDownList_parentId.DataBind();
                DropDownList_parentId.Items.Insert(0, new ListItem("顶级菜单", "0"));


                DropDownList_Group.DataSource = groupList;
                DropDownList_Group.DataTextField = "GroupName";
                DropDownList_Group.DataValueField = "ID";
                DropDownList_Group.DataBind();
                DropDownList_Group.Items.Insert(0, new ListItem("选择分组", "0"));

                DropDownList_Status.DataSource = new List<Status> { new Status(0, "正常"), new Status(1, "暂停"), new Status(2, "已删除") };
                DropDownList_Status.DataTextField = "Text";
                DropDownList_Status.DataValueField = "ID";
                DropDownList_Status.DataBind();
                DropDownList_Status.Items.Insert(0, new ListItem("选择状体", "-1"));

                #region 编辑
                if (!string.IsNullOrEmpty(ctrID))
                {
                    if (_MenuEntity_parent != null)
                    {
                        DropDownList_parentId.ClearSelection();
                        DropDownList_parentId.Items.FindByText(_MenuEntity_parent.DisplayName).Selected = true;
                    }
                    TextBox_DisplayName.Text = _MenuEntity.DisplayName.ToString();
                    TextBox_DisplayIndex.Text = _MenuEntity.DisplayIndex.ToString();
                    if (_GroupEnty != null)
                    {
                        DropDownList_Group.ClearSelection();
                        DropDownList_Group.Items.FindByText(_GroupEnty.GroupName).Selected = true;
                    }
                    TextBox_LinkUrl.Text = _MenuEntity.LinkUrl.ToString();
                    TextBox_ImageUrl.Text = _MenuEntity.ImageUrl.ToString();
                    if (_MenuEntity != null)
                    {
                        DropDownList_Status.ClearSelection();
                        DropDownList_Status.Items.FindByValue(_MenuEntity.Status.ToString()).Selected = true;
                    }
                }
                #endregion
            }
        }
        private MideFrameWork.Data.Entity.GroupsEntity GetGroups(DataRow dr)
        {
            MideFrameWork.Data.Entity.GroupsEntity info = new MideFrameWork.Data.Entity.GroupsEntity();
										if(DBNull.Value==dr["ID"])
					info.ID=0;
				else
					info.ID=int.Parse(dr["ID"].ToString());
									
																								
						if(DBNull.Value==dr["GroupName"])
				info.GroupName= string.Empty;
			else	
				info.GroupName= dr["GroupName"].ToString();
																						if(DBNull.Value==dr["DisplayIndex"])
					info.DisplayIndex=0;
				else
					info.DisplayIndex=int.Parse(dr["DisplayIndex"].ToString());
									
																									if(DBNull.Value==dr["CreateDate"])
					info.CreateDate=DateTime.Now;
				else
					info.CreateDate=DateTime.Parse(dr["CreateDate"].ToString());
						
																									if(DBNull.Value==dr["UpdateDate"])
					info.UpdateDate=DateTime.Now;
				else
					info.UpdateDate=DateTime.Parse(dr["UpdateDate"].ToString());
						
															            return info;
        }