Exemplo n.º 1
0
        /// <summary>
        /// 递归模块信息·补空格模式
        /// </summary>
        /// <param name="id">模块编号</param>
        /// <returns>数据集合</returns>
        public static IList <DawnAuthDepartmentMDL> GetTree(int id)
        {
            IList <DawnAuthDepartmentMDL> treeList = new List <DawnAuthDepartmentMDL>();
            DawnAuthDepartmentMDL         rootInfo = DawnAuthDepartmentBLL.Select(id);

            treeList.Add(rootInfo);
            GetTreeNode(treeList, rootInfo.DptId, " ");
            return(treeList);
        }
Exemplo n.º 2
0
        public string Delete(string id)
        {
            var stateInfo = GeneralHandler.StateSuccess;

            if (!string.IsNullOrEmpty(id))
            {
                DawnAuthDepartmentBLL.Delete(int.Parse(id), true);
            }
            return(stateInfo);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 单位部门数据列表
        /// </summary>
        /// <param name="id">数据表单</param>
        /// <returns>执行结果</returns>
        public ActionResult Search(FormCollection form)
        {
            string strWhere = null;
            var    pgParam  = "Nothing,Nothing";
            //隶属部门
            var sltDepart = TypeHelper.TypeToInt32(form["sltDepart"], -1);

            if (sltDepart > 0)
            {
                pgParam += string.Format(",sltDepart,{0}", sltDepart);
                if (strWhere == null)
                {
                    strWhere = string.Format("charindex(',{0},',dpt_path)>0", sltDepart);
                }
                else
                {
                    strWhere += string.Format(" and charindex(',{0},',dpt_path)>0", sltDepart);
                }
            }
            //部门编码
            var txtCode = form["txtCode"] as string;

            if (!string.IsNullOrEmpty(txtCode) && ValidHelper.EngIsEngAndNums(txtCode))
            {
                pgParam += string.Format(",txtCode,{0}", txtCode);
                if (strWhere == null)
                {
                    strWhere = string.Format("charindex('{0}',dpt_code)>0", txtCode);
                }
                else
                {
                    strWhere += string.Format(" and charindex('{0}',dpt_code)>0", txtCode);
                }
            }
            var dataPager = new PagerHelperCHS();

            dataPager.PageSize = GeneralHandler.PageSize;
            if (form.Count > 1)
            {
                dataPager.PageCurrent = TypeHelper.TypeToInt32(form["pager"], 1);
            }
            else
            {
                dataPager.PageCurrent = TypeHelper.TypeToInt32(form["id"], 1);
            }
            int pageCount, recordCount;
            var dataList = DawnAuthDepartmentBLL.SelectPSPisAllPurposeRowNumber(dataPager.PageSize, dataPager.PageCurrent, "dpt_time desc,dpt_path", strWhere, out pageCount, out recordCount);

            dataPager.PageCount       = pageCount;
            dataPager.RecordCount     = recordCount;
            dataPager.PageRecordCount = dataList.Count;
            ViewBag.Pager             = dataPager;
            ViewBag.PagerParam        = pgParam;
            return(View("List", dataList));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 递归模块信息·补空格模式
        /// </summary>
        /// <returns>数据集合</returns>
        public static IList <DawnAuthDepartmentMDL> GetTree()
        {
            IList <DawnAuthDepartmentMDL> treeList = new List <DawnAuthDepartmentMDL>();
            IList <DawnAuthDepartmentMDL> rootList = DawnAuthDepartmentBLL.ISelectFather();

            foreach (var item in rootList)
            {
                treeList.Add(item);
                GetTreeNode(treeList, item.DptId, " ");
            }
            return(treeList);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 单位部门数据列表
        /// </summary>
        /// <param name="id">页码</param>
        /// <returns>执行结果</returns>
        public ActionResult List(string id)
        {
            var pager = new PagerHelperCHS();

            pager.PageSize    = GeneralHandler.PageSize;
            pager.PageCurrent = TypeHelper.TypeToInt32(id, 1);
            int pageCount, recordCount;
            var dataList = DawnAuthDepartmentBLL.SelectPSPisAllPurposeRowNumber(pager.PageSize, pager.PageCurrent, null, out pageCount, out recordCount);

            pager.PageCount       = pageCount;
            pager.RecordCount     = recordCount;
            pager.PageRecordCount = dataList.Count;
            ViewBag.Pager         = pager;
            ViewBag.PagerParam    = null;
            return(View(dataList));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 递归模块信息·子
        /// </summary>
        /// <param name="treeList">树存储器</param>
        /// <param name="fId">父编号</param>
        /// <param name="tbMarker">符号标识</param>
        private static void GetTreeNode(IList <DawnAuthDepartmentMDL> treeList, int fId, string tbMarker)
        {
            IList <DawnAuthDepartmentMDL> nodeList = DawnAuthDepartmentBLL.ISelect(string.Format("dpt_father='{0}'", fId));

            if (nodeList == null || nodeList.Count <= 0)
            {
                return;
            }
            foreach (DawnAuthDepartmentMDL nodeInfo in nodeList)
            {
                nodeInfo.DptName = tbMarker + nodeInfo.DptName;
                treeList.Add(nodeInfo);
                string strMarker = tbMarker + " ";
                GetTreeNode(treeList, nodeInfo.DptId, strMarker);
            }
        }
Exemplo n.º 7
0
        public string Added(FormCollection form)
        {
            var stateInfo = GeneralHandler.StateSuccess;

            if (AddedByCheck(form, out stateInfo))
            {
                DawnAuthDepartmentMDL dataInfo = new DawnAuthDepartmentMDL();
                int father = TypeHelper.TypeToInt32(form["ddlFather"], -1);
                dataInfo.DptFather = father;
                dataInfo.DptName   = form["txtName"];
                dataInfo.DptCode   = form["txtCode"];
                dataInfo.DptIdent  = TypeHelper.TypeToInt32(form["txtIdent"], 0);
                dataInfo.DptRank   = TypeHelper.TypeToInt32(form["txtRank"], 255);
                dataInfo.DptClick  = 0;
                dataInfo.DptCounts = 0;
                dataInfo.DptDesc   = form["txtDesc"];
                dataInfo.DptTime   = DateTime.Now;
                bool added = false;
                if (father == -1)
                {
                    added = DawnAuthDepartmentBLL.ExistsOfWhere(string.Format("(dpt_name='{0}' or dpt_code='{1}') and dpt_ident='{2}'", dataInfo.DptName, dataInfo.DptCode, dataInfo.DptIdent));
                }
                else
                {
                    added = DawnAuthDepartmentBLL.ExistsOfWhere(string.Format("((dpt_name='{0}' and dpt_father='{1}') or dpt_code='{2}') and dpt_ident='{3}'", dataInfo.DptName, father, dataInfo.DptCode, dataInfo.DptIdent));
                }
                if (added)
                {
                    stateInfo = GeneralHandler.StateAdded;
                }
                else
                {
                    DawnAuthDepartmentBLL.Insert(dataInfo, father == -1 ? false : true);
                }
            }
            return(stateInfo);
        }