Exemple #1
0
        public ActionResult Details(int id)
        {
            var model  = DaoRole.GetEntity("ROLE_ID", id);
            var orgall = DaoOrg.FindList();

            model.RoleORG = orgall.FirstOrDefault(obj => obj.ORG_ID == model.ORG_ID);
            return(View(model));
        }
Exemple #2
0
        public ActionResult RoleOrgTree(int?roleid)
        {
            var      orgall = DaoOrg.FindList();
            SYS_ROLE role   = null;

            if (roleid != null)
            {
                role = DaoRole.GetEntity("ROLE_ID", roleid);
            }
            return(Json(GenRoleOrgTree(orgall, role, string.Empty), JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public ActionResult Create()
        {
            var selectlist = EnumHelper.GetCategorySelectList(typeof(SYS_ORGANIZE.ORG_LEVEL_ENUM));

            if (Request["orglev"] != null && selectlist != null)
            {
                selectlist.FirstOrDefault(obj => obj.Value == Request["orglev"]).Selected = true;
            }
            ViewBag.ORG_LEVELLIST = selectlist;
            TempData["ORGALL"]    = DaoOrg.FindList();
            return(View());
        }
Exemple #4
0
        public ActionResult Create(SYS_ORGANIZE org)
        {
            try
            {
                CreateValid(org);
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("", "新增出错!");
                    return(JsonResult(false, "新增出错!", "SYS", "/", false));
                }

                string rst = null;
                if (org.ORG_LEVEL == 4)
                {
                    SYS_HALL hal = new SYS_HALL()
                    {
                        HALL_NO      = org.ORG_ID,
                        HALL_NAM     = org.ORG_NAM,
                        ADDRESS      = "",
                        LONGITUDE    = org.LONGITUDE,
                        DIMENSION    = org.DIMENSION,
                        CREATE_DTIME = DateTime.Now,
                        CREATE_ID    = UserState.UserID,
                        HEAD         = org.HEAD,
                        HEAD_TEL     = org.HEAD_TEL,
                        ORG_ID       = org.ORG_ID
                    };
                    rst = new SYS_ORGANIZE_DAL().Add(org, hal);
                }
                else
                {
                    DaoOrg.AddObject(org);
                    rst = org.ORG_ID;
                }

                if (!string.IsNullOrEmpty(rst))
                {
                    return(JsonResult(true, "新增成功!", "SYS", "/", false));
                }
                else
                {
                    ModelState.AddModelError("", "新增出错!");
                    return(JsonResult(false, "新增出错!", "SYS", "/", false));
                }
            }
            catch (Exception ex)
            {
                LogHelper.ErrorLog("新增出错", ex);
                ModelState.AddModelError("", "新增出错!");
                return(JsonResult(false, "新增出错!", "SYS", "/", false));
            }
        }
Exemple #5
0
 public ActionResult Edit(string id)
 {
     try
     {
         ViewBag.ORG_LEVELLIST = EnumHelper.GetCategorySelectList(typeof(SYS_ORGANIZE.ORG_LEVEL_ENUM));
         TempData["ORGALL"]    = DaoOrg.FindList();
         var role = DaoOrg.GetEntity("ORG_ID", id);
         return(View(role));
     }
     catch (Exception ex)
     {
         LogHelper.ErrorLog("修改组织架构出错", ex);
         return(Json(new { result = false, desc = "系统错误,请重试" }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #6
0
 public ActionResult Details(string id)
 {
     try
     {
         var orgall = DaoOrg.FindList();
         var org    = DaoOrg.GetEntity("ORG_ID", id);
         if (null != org)
         {
             org.Par_OrgList = orgall.Where(obj => obj.ORG_ID == org.PAR_ORG_ID).ToList();
         }
         return(View(org));
     }
     catch (Exception ex)
     {
         LogHelper.ErrorLog("查看组织架构出错", ex);
         return(Json(new { Result = false, Text = "系统出错!" + ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #7
0
 private void CreateValid(SYS_ORGANIZE org, bool isEdit = false)
 {
     if (string.IsNullOrEmpty(org.ORG_ID))
     {
         ModelState.AddModelError("ORG_ID", "组织机构编码不能为空!");
     }
     if (!isEdit && !string.IsNullOrEmpty(org.ORG_ID) && DaoOrg.GetEntity("ORG_ID", org.ORG_ID) != null)
     {
         ModelState.AddModelError("ORG_ID", "组织机构编码已经存在!");
     }
     if (string.IsNullOrEmpty(org.ORG_NAM))
     {
         ModelState.AddModelError("ORG_NAM", "组织机构名称不能为空!");
     }
     if (string.IsNullOrEmpty(org.HEAD))
     {
         ModelState.AddModelError("HEAD", "负责人不能为空!");
     }
     if (string.IsNullOrEmpty(org.HEAD_TEL))
     {
         ModelState.AddModelError("HEAD_TEL", "负责人电话不能为空!");
     }
     if (string.IsNullOrEmpty(org.LONGITUDE))
     {
         ModelState.AddModelError("LONGITUDE", "经度不能为空!");
     }
     if (string.IsNullOrEmpty(org.DIMENSION))
     {
         ModelState.AddModelError("DIMENSION", "纬度不能为空!");
     }
     if (string.IsNullOrEmpty(org.DUTY_TEL))
     {
         ModelState.AddModelError("DUTY_TEL", "值班领导手机不能为空!");
     }
     if (org.ORG_LEVEL == 0)
     {
         ModelState.AddModelError("ORG_LEVEL", "组织机构级别不能为空!");
     }
     if (org.PAR_ORG_ID == null)
     {
         org.PAR_ORG_ID = "";
     }
 }
Exemple #8
0
        public ActionResult Index(string rolenam, string orgid, string orgnam, int pageIndex = 1, int pageSize = 20)
        {
            ViewBag.ORGID   = orgid;
            ViewBag.ORGNAM  = orgnam;
            ViewBag.ROLENAM = rolenam;

            var orgall      = DaoOrg.FindList();
            var organdchild = new SYS_HALL_DAL().GetOrgAndChild(orgid);

            if (organdchild != null && organdchild.Count == 0)
            {
                organdchild = null;
            }

            Page <SYS_ROLE> data = dao.GetList(pageIndex, pageSize, "", "ROLE_NAM like", rolenam, "ORG_ID in", organdchild);

            foreach (var role in data.Items)
            {
                role.RoleORG = orgall.FirstOrDefault(obj => obj.ORG_ID == role.ORG_ID);
            }
            return(View(data));
        }
Exemple #9
0
 public ActionResult Create()
 {
     TempData["ORGALL"] = DaoOrg.FindList();
     return(View());
 }