Пример #1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, SafestandardEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
 public ActionResult SaveStandardForm(string keyValue, SafestandardEntity entity)
 {
     safestandardbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }
Пример #3
0
        /// <summary>
        /// 获取机构部门组织树菜单
        /// </summary>
        /// <returns></returns>
        //[HttpGet]
        public ActionResult GetStandardTreeJson(string isCheck, string ids = "", string selIds = "", string tid = "")
        {
            //暂时取所有,后期用户权限开发完成,数据将通过权限下来进行展示
            Operator user = OperatorProvider.Provider.Current();

            selIds = "," + selIds.Trim(',') + ",";
            var treeList = new List <TreeEntity>();

            var where = string.Format(" and (CreateUserOrgCode='{0}' or Id='0')", user.OrganizeCode);
            var data = safestandardbll.GetList(where).OrderBy(t => t.ENCODE).ToList();

            //var data = safestandardbll.GetList(where).ToList();
            try
            {
                StringBuilder sb = new StringBuilder();
                if (!string.IsNullOrEmpty(tid))
                {
                    SafestandardEntity hs = safestandardbll.GetEntity(tid);
                    if (hs != null)
                    {
                        DataTable dt = new ERCHTMS.Busines.BaseManage.DepartmentBLL().GetDataTable(string.Format("select id from EPG_SAFESTANDARD t where instr('{0}',encode)=1", hs.ENCODE));
                        foreach (DataRow dr in dt.Rows)
                        {
                            sb.AppendFormat("{0},", dr[0].ToString());
                        }
                    }
                }
                if (!string.IsNullOrWhiteSpace(ids))
                {
                    ids = ids.Trim(',');
                    ids = "," + ids + ",";
                }
                foreach (SafestandardEntity item in data)
                {
                    if (!selIds.Contains("," + item.ID + ","))
                    {
                        string     hasChild = safestandardbll.IsHasChild(item.ID) ? "1" : "0";
                        TreeEntity tree     = new TreeEntity();
                        tree.id       = item.ID;
                        tree.text     = item.NAME.Replace("\n", "").Replace("\\", "╲");
                        tree.value    = item.ID;
                        tree.parentId = item.PARENTID;
                        tree.isexpand = (item.PARENTID == "-1") ? true : false;
                        tree.complete = true;
                        if (!string.IsNullOrWhiteSpace(ids))
                        {
                            tree.checkstate = ids.Contains("," + item.ID + ",") ? 1 : 0;
                        }
                        tree.hasChildren = hasChild == "1" ? true : false;
                        tree.Attribute   = "Code";
                        tree.showcheck   = string.IsNullOrEmpty(isCheck) ? false : true;
                        if (!string.IsNullOrEmpty(tid))
                        {
                            if (sb.ToString().Contains(item.ID))
                            {
                                tree.isexpand = true;
                            }
                        }
                        tree.AttributeValue = item.ENCODE + "|" + hasChild;
                        treeList.Add(tree);
                    }
                }
                return(Content(treeList.TreeToJson("-1")));
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }