Exemple #1
0
        public ActionResult GetAllMetadata(string id)
        {
            SysDepartmentBLL           m_BLL = new SysDepartmentBLL();
            IQueryable <SysDepartment> rows  = m_BLL.GetAllMetadata(id);

            if (rows.Any())
            {//是否可以省
                return(Json(new treegrid
                {
                    rows = rows.Select(s =>
                                       new
                    {
                        Id = s.Id
                        , Name = s.Name
                        , _parentId = s.ParentId
                        , state = s.SysDepartment1.Any(a => a.ParentId == s.Id) ? "closed" : null
                        , Address = s.Address
                        , Sort = s.Sort
                        , Remark = s.Remark
                        , CreateTime = s.CreateTime
                        , CreatePerson = s.CreatePerson
                        , UpdateTime = s.UpdateTime
                        , UpdatePerson = s.UpdatePerson
                    }
                                       ).OrderBy(o => o.Id)
                }));
            }
            return(Content("[]"));
        }
        /// <summary>
        /// 修改
        /// </summary>
        private void updateDepartment()
        {
            try
            {
                SysDepartment department = new SysDepartment();

                department.D_Code   = D_Code.Text;
                department.D_Name   = D_Name.Text;
                department.C_Code   = C_Code.SelectedValue.ToString();
                department.D_Remark = D_Remark.Text;

                department.D_CreateBy   = D_CreateBy.Text;
                department.D_CreateDate = D_CreateDate.Value;

                department.D_UpdateBy   = D_UpdateBy.Text;
                department.D_UpdateDate = D_UpdateDate.Value;

                SysDepartmentBLL departmentbll = new SysDepartmentBLL();
                if (departmentbll.Edit(department) > 0)
                {
                    untCommon.InfoMsg("修改成功!");
                    frmParent.loadData();
                }
                else
                {
                    untCommon.InfoMsg("修改失败!");
                }
            }
            catch (Exception ex)
            {
                untCommon.ErrorMsg("部门管理更新数据异常:" + ex);
            }
        }
        private void deleteDepartment()
        {
            try
            {
                if (dataGridView.SelectedRows.Count < 1)
                {
                    return;
                }

                string D_Code = dataGridView.SelectedRows[0].Cells["D_Code"].Value.ToString();

                if (untCommon.QuestionMsg("您确定删除[" + D_Code + "]该项吗?"))
                {
                    SysDepartmentBLL companybll = new SysDepartmentBLL();
                    if (companybll.Delete(D_Code) > 0)
                    {
                        untCommon.InfoMsg("删除成功!");
                        loadData();
                    }
                    else
                    {
                        untCommon.InfoMsg("删除失败!");
                    }
                }
            }
            catch (Exception ex)
            {
                untCommon.ErrorMsg("部门管理删除数据异常:" + ex);
            }
        }
Exemple #4
0
        public ActionResult GetAllMetadata(string id)
        {
            SysDepartmentBLL        m_BLL      = new SysDepartmentBLL();
            List <SysDepartmentSef> collection = m_BLL.GetAllMetadata(id);

            if (collection != null && collection.Count > 0)
            {
                Metadata metadata = new Metadata();
                metadata.rows = collection;
                return(Json(metadata));
            }
            return(Json(""));
        }
        /// <summary>
        /// 获取树形页面的数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTree()
        {
            List <SystemTree> listSystemTree = new List <SystemTree>();
            string            parentId       = Request["parentid"];//父节点编号;

            using (SysDepartmentBLL db = new SysDepartmentBLL())
            {
                SysDepartmentTreeNodeCollection tree = new SysDepartmentTreeNodeCollection();
                var trees = db.GetAll().OrderBy(o => o.Sort);
                if (trees != null)
                {
                    tree.Bind(trees, parentId, ref listSystemTree);
                }
            }
            return(Json(listSystemTree, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create(string id)
        {
            if (!string.IsNullOrWhiteSpace(id))
            {
                using (SysDepartmentBLL bll = new SysDepartmentBLL())
                {
                    SysDepartment entityId = bll.GetById(id);
                    if (entityId != null)
                    {
                        SysDocument entity = new SysDocument();
                        entity.SysDepartmentId = id + '&' + entityId.Name;
                        return(View(entity));
                    }
                }
            }

            return(View());
        }
        /// <summary>
        /// 添加
        /// </summary>
        private void addDepartment()
        {
            try
            {
                if (checkInput())
                {
                    SysDepartment department = new SysDepartment();

                    department.D_Code   = D_Code.Text;
                    department.D_Name   = D_Name.Text;
                    department.C_Code   = C_Code.SelectedValue.ToString();
                    department.D_Remark = D_Remark.Text;

                    department.D_CreateBy   = D_CreateBy.Text;
                    department.D_CreateDate = D_CreateDate.Value;
                    department.D_UpdateBy   = null;
                    department.D_UpdateDate = null;

                    SysDepartmentBLL departmentbll = new SysDepartmentBLL();

                    if (departmentbll.Exists(department.D_Code))
                    {
                        untCommon.InfoMsg("部门编号已存在!");
                    }
                    else
                    {
                        if (departmentbll.Add(department) > 0)
                        {
                            untCommon.InfoMsg("添加成功!");
                            frmParent.loadData();
                        }
                        else
                        {
                            untCommon.InfoMsg("添加失败!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                untCommon.ErrorMsg("部门管理添加数据异常:" + ex);
            }
        }
        public void loadData(string key = "")
        {
            try
            {
                SysDepartmentBLL companybll = new SysDepartmentBLL();
                var rows = companybll.loadData(key);

                if (rows == null || rows.Count < 1)
                {
                    untCommon.InfoMsg("没有任何数据!");
                    return;
                }

                dataGridView.DataSource = rows;
            }
            catch (Exception ex)
            {
                untCommon.ErrorMsg("部门管理加载数据异常:" + ex.Message);
            }
        }
        private void getDetail()
        {
            try
            {
                SysDepartmentBLL departmentbll = new SysDepartmentBLL();
                SysDepartment    department    = departmentbll.getDetail(PrimaryKey);

                D_Code.Text   = department.D_Code;
                D_Name.Text   = department.D_Name;
                company       = department.C_Code;
                D_Remark.Text = department.D_Remark;

                D_CreateBy.Text = department.D_CreateBy;
                D_UpdateBy.Text = department.D_UpdateBy;

                if (department.D_CreateDate.HasValue)
                {
                    D_CreateDate.Value = department.D_CreateDate.Value;
                }
                else
                {
                    D_CreateDate.Value = DateTime.Now;
                }

                if (department.D_UpdateDate.HasValue)
                {
                    D_UpdateDate.Value = department.D_UpdateDate.Value;
                }
                else
                {
                    D_UpdateDate.Value = DateTime.Now;
                    ;
                }
            }
            catch (Exception ex)
            {
                untCommon.ErrorMsg("部门管理加载数据异常:" + ex.Message);
            }
        }
        /// <summary>
        /// 获取树形页面的数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTree()
        {
            List<SystemTree> listSystemTree = new List<SystemTree>();

            IBLL.ISysDepartmentBLL db = new SysDepartmentBLL();

            SysDepartmentTreeNodeCollection tree = new SysDepartmentTreeNodeCollection();

            var trees = db.GetAll().OrderBy(o => o.Id);
            if (trees != null)
            {
                string parentId = Request["parentid"];//父节点编号
                if (string.IsNullOrWhiteSpace(parentId))
                {
                    tree.Bind(trees, null, ref listSystemTree);
                }
                else
                {
                    tree.Bind(trees, parentId, ref listSystemTree);
                }
            }
            return Json(listSystemTree, JsonRequestBehavior.AllowGet);
        }
Exemple #11
0
        /// <summary>
        /// 获取树形页面的数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTree()
        {
            List <DataList> listSystemTree = new List <DataList>();

            IBLL.ISysDepartmentBLL db = new SysDepartmentBLL();

            SysDepartmentTreeNodeCollection tree = new SysDepartmentTreeNodeCollection();

            var trees = db.GetAll().OrderBy(o => o.Id);

            if (trees != null)
            {
                string parentId = Request["parentid"];//父节点编号
                if (string.IsNullOrWhiteSpace(parentId))
                {
                    tree.Bind(trees, null, ref listSystemTree);
                }
                else
                {
                    tree.Bind(trees, parentId, ref listSystemTree);
                }
            }
            return(Json(listSystemTree, JsonRequestBehavior.AllowGet));
        }
Exemple #12
0
 public SysDepartmentController(SysDepartmentBLL bll)
 {
     m_BLL = bll;
 }
 public SysDepartmentController(SysDepartmentBLL bll)
 {
     m_BLL = bll;
 }
        public ActionResult GetAllMetadata(string id)
        {
            SysDepartmentBLL m_BLL = new SysDepartmentBLL();
            IQueryable<SysDepartment> rows = m_BLL.GetAllMetadata(id);
            if (rows.Any())
            {//是否可以省
                return Json(new treegrid
                {
                    rows = rows.Select(s =>
                        new
                        {
                          Id = s.Id
                    ,Name = s.Name
                    ,_parentId =   s.ParentId
                    ,state = s.SysDepartment1.Any(a => a.ParentId == s.Id) ? "closed" : null
                    ,Address = s.Address
                    ,Sort = s.Sort
                    ,Remark = s.Remark
                    ,CreateTime = s.CreateTime
                    ,CreatePerson = s.CreatePerson
                    ,UpdateTime = s.UpdateTime
                    ,UpdatePerson = s.UpdatePerson

                        }
                        ).OrderBy(o => o.Id)
                });
            }
            return Content("[]");
        }