//============操作方法===========
        #region 数据保存

        /// <summary>
        /// 数据保存按钮事件
        /// 创建 林以恒
        /// 2015年4月14日
        /// </summary>
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            ////设置页面权限
            //Power.SetViewPower("mod_menu");
            ////验证权限
            //if (Power.VerifyPower() == false)
            //{
            //    return;
            //}
            string str;

            if (Request.QueryString["id"].IsNum())
            {
                string id = Request.QueryString["id"].ToString();
                //修改
                T_ADMIN_MENUS T_ADMIN_MENUS = new T_ADMIN_MENUS();
                var           q             = new DapperExQuery <T_ADMIN_MENUS>().AndWhere(n => n.ID, OperationMethod.Equal, id);
                T_ADMIN_MENUS = _adminMenusBll.GetEntity(q);
                T_ADMIN_MENUS = GetnewModel(T_ADMIN_MENUS);
                str           = _adminMenusBll.Update(T_ADMIN_MENUS) ? "修改成功!" : "修改失败!";
            }
            else
            {
                //添加
                T_ADMIN_MENUS adminMenus = new T_ADMIN_MENUS();
                adminMenus           = GetnewModel(adminMenus);
                adminMenus.PARENT_ID = Int32.Parse(Request.QueryString["fatherId"].ToString());
                str = _adminMenusBll.Add(adminMenus) ? "添加成功!" : "添加失败!";
            }
            // 2. 关闭本窗体,然后刷新父窗体
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
            Alert.ShowInTop(str);
        }
        //=========数据绑定

        #region 数据绑定

        /// <summary>
        /// 修改数据绑定
        /// 创建 林以恒 
        /// 2015年4月14日
        /// </summary>
        private void LoadData()
        {
            if (!Request.QueryString["id"].IsNum()) return;
            string id = Request.QueryString["id"].ToString();
            var query = new DapperExQuery<T_ADMIN_MENUS>().AndWhere(n => n.ID, OperationMethod.Equal, id);
            _adminMenus = _adminMenusBll.GetEntity(query);
            tbxAM_NAME.Text = (_adminMenus.AM_NAME != null ? _adminMenus.AM_NAME.ToString() : "");
            tbxAM_NAVIGATE_URL.Text = (_adminMenus.AM_NAVIGATE_URL != null ? _adminMenus.AM_NAVIGATE_URL.ToString() : "");
            tbxAM_REMARK.Text = (_adminMenus.AM_REMARK != null ? _adminMenus.AM_REMARK.ToString() : "");
            tbxAM_SORTINDEX.Text = _adminMenus.AM_SORTINDEX.ToString();
            if (_adminMenus.P_CODE != null && _adminMenus.P_CODE != "")
            {
                tbxVIEWPOWER_ID.Text = _powersBll.GetEntity(new DapperExQuery<T_POWERS>().AndWhere(n => n.P_CODE, OperationMethod.Equal, _adminMenus.P_CODE)).P_NAME;
            }
        }
        //=========数据绑定

        #region 数据绑定

        /// <summary>
        /// 修改数据绑定
        /// 创建 林以恒
        /// 2015年4月14日
        /// </summary>
        private void LoadData()
        {
            if (!Request.QueryString["id"].IsNum())
            {
                return;
            }
            string id    = Request.QueryString["id"].ToString();
            var    query = new DapperExQuery <T_ADMIN_MENUS>().AndWhere(n => n.ID, OperationMethod.Equal, id);

            _adminMenus             = _adminMenusBll.GetEntity(query);
            tbxAM_NAME.Text         = (_adminMenus.AM_NAME != null ? _adminMenus.AM_NAME.ToString() : "");
            tbxAM_NAVIGATE_URL.Text = (_adminMenus.AM_NAVIGATE_URL != null ? _adminMenus.AM_NAVIGATE_URL.ToString() : "");
            tbxAM_REMARK.Text       = (_adminMenus.AM_REMARK != null ? _adminMenus.AM_REMARK.ToString() : "");
            tbxAM_SORTINDEX.Text    = _adminMenus.AM_SORTINDEX.ToString();
            if (_adminMenus.P_CODE != null && _adminMenus.P_CODE != "")
            {
                tbxVIEWPOWER_ID.Text = _powersBll.GetEntity(new DapperExQuery <T_POWERS>().AndWhere(n => n.P_CODE, OperationMethod.Equal, _adminMenus.P_CODE)).P_NAME;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///  根据用户权限,获取菜单列表
        /// </summary>
        /// <returns></returns>
        public List <T_ADMIN_MENUS> Get_PowerMenu()
        {
            List <T_ADMIN_MENUS> T_ADMIN_MENUS_LIST = new List <T_ADMIN_MENUS>();
            List <T_POWERS>      T_POWERS_LIST      = new List <T_POWERS>();

            T_POWERS_LIST = T_POWERS_BLL.GetAllList();
            int count = T_POWERS_LIST.Count;
            int j     = 0;

            for (int i = 0; i < count; i++)
            {
                if (AdminwebUserManager.CompareRole(T_POWERS_LIST[i].P_NAME))
                {
                    string        p_code        = T_POWERS_LIST[i].P_CODE;
                    var           query         = new DapperExQuery <T_ADMIN_MENUS>().AndWhere(n => n.P_CODE, OperationMethod.Equal, p_code);
                    T_ADMIN_MENUS T_ADMIN_MENUS = new T_ADMIN_MENUS();
                    T_ADMIN_MENUS = T_ADMIN_MENUS_BLL.GetEntity(query);
                    if (T_ADMIN_MENUS != null)
                    {
                        T_ADMIN_MENUS_LIST.Add(T_ADMIN_MENUS);
                    }
                }
            }
            //排序
            T_ADMIN_MENUS q = new T_ADMIN_MENUS();

            for (int i = 0; i < T_ADMIN_MENUS_LIST.Count - 1; i++)
            {
                for (j = 0; j < T_ADMIN_MENUS_LIST.Count - 1 - i; j++)
                {
                    if (T_ADMIN_MENUS_LIST[j].AM_SORTINDEX > T_ADMIN_MENUS_LIST[j + 1].AM_SORTINDEX)
                    {
                        q = T_ADMIN_MENUS_LIST[j];
                        T_ADMIN_MENUS_LIST[j]     = T_ADMIN_MENUS_LIST[j + 1];
                        T_ADMIN_MENUS_LIST[j + 1] = q;
                    }
                }
            }
            //T_ADMIN_MENUS_LIST = T_ADMIN_MENUS_LIST.OrderBy(n => n.AM_SORTINDEX) as List<T_ADMIN_MENUS>;
            return(T_ADMIN_MENUS_LIST);
        }
        /// <summary>
        /// 更新实体
        /// 创建人:林以恒
        /// 2015年7月6日18:16:18
        /// </summary>
        /// <param name="adminMenus"></param>
        /// <returns></returns>
        private T_ADMIN_MENUS GetnewModel(T_ADMIN_MENUS adminMenus)
        {
            adminMenus.AM_NAME         = tbxAM_NAME.Text.Trim();
            adminMenus.AM_NAVIGATE_URL = tbxAM_NAVIGATE_URL.Text.Trim();
            adminMenus.AM_REMARK       = tbxAM_REMARK.Text.Trim();
            adminMenus.AM_SORTINDEX    = int.Parse(tbxAM_SORTINDEX.Text.Trim());
            var queryPower = new DapperExQuery <T_POWERS>().AndWhere(n => n.P_NAME, OperationMethod.Equal, tbxVIEWPOWER_ID.Text.ToString());
            var powerid    = _powersBll.GetEntity(queryPower);

            adminMenus.P_CODE        = powerid != null ? powerid.P_CODE : "";
            adminMenus.AM_ISTREELEAF = tbxAM_NAVIGATE_URL.Text.Trim() == "" ? 0 : 1;
            if (adminMenus.ID == 0)
            {
                //获取登入用户信息
                var AdminUserModel = AdminwebUserManager.GetCurrentAdminUser();
                if (AdminUserModel != null)
                {
                    adminMenus.CREATE_USER      = AdminUserModel.A_NAME;
                    adminMenus.CREATE_USER_NAME = AdminUserModel.A_CHINESE_NAME;
                }
                adminMenus.CREATE_TIME = DateTime.Now;
            }
            return(adminMenus);
        }
        //============操作方法===========
        #region 数据保存

        /// <summary>
        /// 数据保存按钮事件
        /// 创建 林以恒 
        /// 2015年4月14日
        /// </summary>
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            ////设置页面权限
            //Power.SetViewPower("mod_menu");
            ////验证权限
            //if (Power.VerifyPower() == false)
            //{
            //    return;
            //}
            string str;
            if (Request.QueryString["id"].IsNum())
            {
                string id = Request.QueryString["id"].ToString();
                //修改
                T_ADMIN_MENUS T_ADMIN_MENUS = new T_ADMIN_MENUS();
                var q = new DapperExQuery<T_ADMIN_MENUS>().AndWhere(n => n.ID, OperationMethod.Equal, id);
                T_ADMIN_MENUS = _adminMenusBll.GetEntity(q);
                T_ADMIN_MENUS = GetnewModel(T_ADMIN_MENUS);
                str = _adminMenusBll.Update(T_ADMIN_MENUS) ? "修改成功!" : "修改失败!";
            }
            else
            {
                //添加
                T_ADMIN_MENUS adminMenus = new T_ADMIN_MENUS();
                adminMenus = GetnewModel(adminMenus);
                adminMenus.PARENT_ID = Int32.Parse(Request.QueryString["fatherId"].ToString());
                str = _adminMenusBll.Add(adminMenus) ? "添加成功!" : "添加失败!";
            }
            // 2. 关闭本窗体,然后刷新父窗体
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
            Alert.ShowInTop(str);
        }
 /// <summary>
 /// 更新实体
 /// 创建人:林以恒
 /// 2015年7月6日18:16:18
 /// </summary>
 /// <param name="adminMenus"></param>
 /// <returns></returns>
 private T_ADMIN_MENUS GetnewModel(T_ADMIN_MENUS adminMenus)
 {
     adminMenus.AM_NAME = tbxAM_NAME.Text.Trim();
     adminMenus.AM_NAVIGATE_URL = tbxAM_NAVIGATE_URL.Text.Trim();
     adminMenus.AM_REMARK = tbxAM_REMARK.Text.Trim();
     adminMenus.AM_SORTINDEX = int.Parse(tbxAM_SORTINDEX.Text.Trim());
     var queryPower = new DapperExQuery<T_POWERS>().AndWhere(n => n.P_NAME, OperationMethod.Equal, tbxVIEWPOWER_ID.Text.ToString());
     var powerid = _powersBll.GetEntity(queryPower);
     adminMenus.P_CODE= powerid != null ? powerid.P_CODE : "";
     adminMenus.AM_ISTREELEAF = tbxAM_NAVIGATE_URL.Text.Trim() == "" ? 0 : 1;
     if (adminMenus.ID == 0)
     {
         //获取登入用户信息
         var AdminUserModel = AdminwebUserManager.GetCurrentAdminUser();
         if (AdminUserModel != null)
         {
             adminMenus.CREATE_USER = AdminUserModel.A_NAME;
             adminMenus.CREATE_USER_NAME = AdminUserModel.A_CHINESE_NAME;
         }
         adminMenus.CREATE_TIME = DateTime.Now;
     }
     return adminMenus;
 }
Exemplo n.º 8
0
        /// <summary>
        ///  根据用户权限,获取菜单列表 
        /// </summary>
        /// <returns></returns>
        public List<T_ADMIN_MENUS> Get_PowerMenu()
        {
            List<T_ADMIN_MENUS> T_ADMIN_MENUS_LIST = new List<T_ADMIN_MENUS>();
            List<T_POWERS> T_POWERS_LIST = new List<T_POWERS>();
            T_POWERS_LIST = T_POWERS_BLL.GetAllList();
            int count = T_POWERS_LIST.Count;
            int j = 0;
            for (int i = 0; i < count; i++)
            {
                if (AdminwebUserManager.CompareRole(T_POWERS_LIST[i].P_NAME))
                {
                    string p_code = T_POWERS_LIST[i].P_CODE;
                    var query = new DapperExQuery<T_ADMIN_MENUS>().AndWhere(n => n.P_CODE, OperationMethod.Equal, p_code);
                    T_ADMIN_MENUS T_ADMIN_MENUS = new T_ADMIN_MENUS();
                    T_ADMIN_MENUS = T_ADMIN_MENUS_BLL.GetEntity(query);
                    if (T_ADMIN_MENUS != null)
                    {
                        T_ADMIN_MENUS_LIST.Add(T_ADMIN_MENUS);
                    }
                }
            }
            //排序
            T_ADMIN_MENUS q = new T_ADMIN_MENUS();
            for (int i = 0; i < T_ADMIN_MENUS_LIST.Count - 1; i++)
            {

                for (j = 0; j < T_ADMIN_MENUS_LIST.Count - 1 - i; j++)
                {
                    if (T_ADMIN_MENUS_LIST[j].AM_SORTINDEX > T_ADMIN_MENUS_LIST[j + 1].AM_SORTINDEX)
                    {
                        q = T_ADMIN_MENUS_LIST[j];
                        T_ADMIN_MENUS_LIST[j] = T_ADMIN_MENUS_LIST[j + 1];
                        T_ADMIN_MENUS_LIST[j + 1] = q;
                    }
                }
            }
            //T_ADMIN_MENUS_LIST = T_ADMIN_MENUS_LIST.OrderBy(n => n.AM_SORTINDEX) as List<T_ADMIN_MENUS>;
            return T_ADMIN_MENUS_LIST;
        }