Exemple #1
0
        public ActionResult Home()
        {
            //if (!Utits.IsLogin)
            //{
            //    return RedirectPermanent("/Login/Index");
            //}
            //var currentUser = Utits.CurrentUser;
            //ViewBag.LogPerson = currentUser.user_TrueName;
            ViewBag.LogPerson = "管理员";// currentUser.user_TrueName;

            var cNetBll  = new BLL_Network();
            var cRoomBll = new BLL_ComputerRoom();
            var cTerBll  = new BLL_Terminal();
            var cSecuBll = new BLL_Security();
            var cCproBll = new BLL_ConstructionProject();
            var cResBll  = new BLL_ResourceCatalog();
            var cGSoft   = new BLL_GenuineSoftware();


            var Netlist   = cNetBll.GetObjectAll();
            var Roomlist  = cNetBll.GetObjectAll();
            var Terlist   = cTerBll.GetObjectAll();
            var Seculist  = cSecuBll.GetObjectAll();
            var Cprolist  = cCproBll.GetObjectAll();
            var Reslist   = cResBll.GetObjectAll();
            var GSoftlist = cGSoft.GetObjectAll();

            ViewBag.jhj   = Netlist.Sum(c => c.scjhj);
            ViewBag.gx    = Netlist.Sum(c => c.gx);
            ViewBag.wxjrd = Netlist.Sum(c => c.wxjrd);

            ViewBag.jfsl = Roomlist.Count();

            ViewBag.zd    = Terlist.Sum(c => c.zdsl);
            ViewBag.jrww  = Terlist.Sum(c => c.jrzwwwsl);
            ViewBag.az360 = Terlist.Sum(c => c.az360tysl);

            ViewBag.fwq = Seculist.Sum(c => c.fhq);
            ViewBag.VPN = Seculist.Sum(c => c.VPNsb);

            ViewBag.xxm = Cprolist.Count();

            ViewBag.zyml = Reslist.Sum(c => c.zymlsl);
            ViewBag.ysj  = Reslist.Sum(c => c.ysjzyl);
            ViewBag.gxzy = Reslist.Sum(c => c.gxcs);
            ViewBag.fwzy = Reslist.Sum(c => c.fwl);

            ViewBag.czxt = GSoftlist.Count();

            return(View());
        }
        //删除
        public JsonResult ListPhyDel()
        {
            var sReturnModel = new ReturnMessageModel();

            #region 登录验证
            if (!Utits.IsLogin)
            {
                sReturnModel.ErrorType      = 3;
                sReturnModel.MessageContent = "登录状态已失效.";
                return(Json(sReturnModel));
            }
            #endregion
            var ids = RequestParameters.Pstring("ids");
            if (ids.Length < 1)
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "参数错误.";
                return(Json(sReturnModel));
            }
            var        tempArry = ids.Split(',');
            List <int> delIds   = new List <int>();
            foreach (var s in tempArry)
            {
                if (RegexValidate.IsInt(s))
                {
                    delIds.Add(int.Parse(s));
                }
            }
            if (!delIds.Any())
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "参数格式错误.";
                return(Json(sReturnModel));
            }
            var cBll = new BLL_ResourceCatalog();

            if (cBll.PhysicalDelete(delIds.ToArray()))
            {
                sReturnModel.ErrorType      = 1;
                sReturnModel.MessageContent = "操作成功.";
            }
            else
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "操作失败.";
            }
            return(Json(sReturnModel));
        }
Exemple #3
0
        /// <summary>
        /// 资源编码——资源编码数量
        /// </summary>
        /// <returns></returns>
        public JsonResult ZYApi()
        {
            var sReturnModel = new ReturnDetailModel();

            var cBll = new BLL_ResourceCatalog();
            var list = cBll.GetObjectAll();

            list = list.OrderByDescending(o => o.ID).Distinct().ToList();

            sReturnModel.ErrorType = 1;
            if (list != null)
            {
                sReturnModel.Entity = from a in list
                                      select new
                {
                    name  = a.Dept_Name,
                    value = a.zymlsl
                };
            }
            return(Json(sReturnModel));
        }
        //单一信息
        public JsonResult InitSingle()
        {
            var sReturnModel = new ReturnDetailModel();

            #region 登录验证
            if (!Utits.IsLogin)
            {
                sReturnModel.ErrorType      = 3;
                sReturnModel.MessageContent = "登录状态已失效.";
                return(Json(sReturnModel));
            }
            #endregion
            int id = RequestParameters.Pint("ID");
            if (id < 1)
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "参数错误.";
                return(Json(sReturnModel));
            }
            var cBll = new BLL_ResourceCatalog();
            sReturnModel.ErrorType = 1;
            sReturnModel.Entity    = cBll.GetObjectDeptById(id);
            return(Json(sReturnModel));
        }
        //添加或修改
        public JsonResult AddOrUpdate()
        {
            var sReturnModel = new ReturnMessageModel();

            #region 登录验证
            if (!Utits.IsLogin)
            {
                sReturnModel.ErrorType      = 3;
                sReturnModel.MessageContent = "登录状态已失效.";
                return(Json(sReturnModel));
            }
            #endregion
            int    id     = RequestParameters.Pint("ID");
            string DeptId = RequestParameters.Pstring("Dept_Id");
            int    zymlsl = RequestParameters.Pint("zymlsl");
            int    ysjzyl = RequestParameters.Pint("ysjzyl");
            int    dysjxl = RequestParameters.Pint("dysjxl");
            int    gxcs   = RequestParameters.Pint("gxcs");
            int    fwl    = RequestParameters.Pint("fwl");

            if (DeptId.Length < 1)
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "操作失败:资源提供部门不能为空.";
                return(Json(sReturnModel));
            }

            var currentUser = Utits.CurrentUser;

            #region 检查参数(暂不做处理)
            //if (ECode.Length < 1)
            //{
            //    sReturnModel.ErrorType = 0;
            //    sReturnModel.MessageContent = "操作失败:员工号不能为空.";
            //    return Json(sReturnModel);
            //}
            //if (WCode.Length < 1)
            //{
            //    sReturnModel.ErrorType = 0;
            //    sReturnModel.MessageContent = "操作失败:考勤号不能为空.";
            //    return Json(sReturnModel);
            //}
            //if (Name.Length < 1)
            //{
            //    sReturnModel.ErrorType = 0;
            //    sReturnModel.MessageContent = "操作失败:姓名不能为空.";
            //    return Json(sReturnModel);
            //}
            //if (Dept.Length < 1)
            //{
            //    sReturnModel.ErrorType = 0;
            //    sReturnModel.MessageContent = "操作失败:部门不能为空.";
            //    return Json(sReturnModel);
            //}
            //if (Login.Length < 1)
            //{
            //    sReturnModel.ErrorType = 0;
            //    sReturnModel.MessageContent = "操作失败:登录名不能为空.";
            //    return Json(sReturnModel);
            //}
            //if (Role == Guid.Empty)
            //{
            //    sReturnModel.ErrorType = 0;
            //    sReturnModel.MessageContent = "操作失败:角色不能为空.";
            //    return Json(sReturnModel);
            //}
            //if (id < 1 && Password.Length < 1)
            //{
            //    sReturnModel.ErrorType = 0;
            //    sReturnModel.MessageContent = "操作失败:密码不能为空.";
            //    return Json(sReturnModel);
            //}
            #endregion

            var cBll = new BLL_ResourceCatalog();
            td_ResourceCatalog model;
            if (id > 0)
            {
                model = cBll.GetObjectById(id);
                if (model == null)
                {
                    sReturnModel.ErrorType      = 0;
                    sReturnModel.MessageContent = "操作失败.";
                    return(Json(sReturnModel));
                }
            }

            model            = new td_ResourceCatalog();
            model.ID         = id;
            model.OperatPid  = currentUser.user_Id;
            model.OperatTime = DateTime.Now;

            model.Dept_Id = DeptId;
            model.dysjxl  = dysjxl;
            model.zymlsl  = zymlsl;
            model.ysjzyl  = ysjzyl;
            model.gxcs    = gxcs;
            model.fwl     = fwl;

            if (cBll.AddOrUpdate(model))
            {
                sReturnModel.ErrorType      = 1;
                sReturnModel.MessageContent = "操作成功.";
            }
            else
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "操作失败.";
            }
            return(Json(sReturnModel));
        }
        //加载数据集
        public JsonResult LoadPageList()
        {
            var sReturnModel = new ReturnListModel();

            #region 登录验证
            var currentUser = Utits.CurrentUser;
            if (currentUser == null)
            {
                sReturnModel.ErrorType      = 3;
                sReturnModel.MessageContent = "登录状态已失效.";
                return(Json(sReturnModel));
            }
            #endregion
            #region 参数处理
            #region 分页参数
            int page = RequestParameters.Pint("page");
            int size = RequestParameters.Pint("size");
            if (page < 1 || size < 1)
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "参数错误.";
                return(Json(sReturnModel));
            }
            #endregion
            var condition = new ConditionModel();
            #region 查询参数
            var whereList = new List <WhereCondition>();
            //部门名称
            string Search = RequestParameters.Pstring("SearchDept");
            if (Search.Length > 0)
            {
                var where1Condition = new WhereCondition();
                where1Condition.FieldName     = "Dept_Name";
                where1Condition.FieldOperator = EnumOper.Contains;
                where1Condition.FieldValue    = Search;
                whereList.Add(where1Condition);
            }
            condition.WhereList = whereList;
            #endregion
            #region 排序参数
            var orderList      = new List <OrderCondition>();
            var orderCondition = new OrderCondition();
            orderCondition.Ascending  = true;
            orderCondition.FiledOrder = "OperatTime";
            orderList.Add(orderCondition);
            condition.OrderList = orderList;
            #endregion
            #endregion
            int iTotalRecord = 0, iPageIndex = page - 1, iPageSize = size;
            var cBll = new BLL_ResourceCatalog();
            var list = cBll.GetPageListByCondition(iPageIndex, iPageSize, ref iTotalRecord, condition);
            iPageSize = iPageSize == 0 ? iTotalRecord : iPageSize;
            int pageCount = iTotalRecord % iPageSize == 0 ? iTotalRecord / iPageSize : iTotalRecord / iPageSize + 1;

            sReturnModel.ErrorType   = 1;
            sReturnModel.CurrentPage = page;
            sReturnModel.PageSize    = iPageSize;
            sReturnModel.TotalRecord = iTotalRecord;
            sReturnModel.PageCount   = pageCount;
            if (list != null)
            {
                sReturnModel.Data = from a in list
                                    select new
                {
                    a.ID,
                    a.Dept_Name,
                    a.zymlsl,
                    a.ysjzyl,
                    a.dysjxl,
                    a.gxcs,
                    a.fwl,
                }
            }
            ;
            return(Json(sReturnModel));
        }