Esempio n. 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());
        }
        //删除
        /// <summary>
        /// 111
        /// </summary>
        /// <returns></returns>
        public JsonResult ListPhyDel1()
        {
            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_GenuineSoftware();

            if (cBll.PhysicalDelete1(delIds.ToArray()))
            {
                sReturnModel.ErrorType      = 1;
                sReturnModel.MessageContent = "操作成功.";
            }
            else
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "操作失败.";
            }
            return(Json(sReturnModel));
        }
Esempio n. 3
0
        /// <summary>
        /// 正版软件
        /// </summary>
        public JsonResult ZBApi()
        {
            var sReturnModel = new ReturnDetailModel();

            var cBll = new BLL_GenuineSoftware();
            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.czxtlx.Count()
                };
            }
            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_GenuineSoftware();
            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 IPdz    = RequestParameters.Pstring("IPdz");
            string Dept_Id = RequestParameters.Pstring("Dept_Id");
            string czxtlx  = RequestParameters.Pstring("czxtlx");
            string bgrjlx  = RequestParameters.Pstring("bgrjlx");
            string yt      = RequestParameters.Pstring("yt");

            if (IPdz.Length < 1)
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "操作失败:IP地址不能为空.";
                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_GenuineSoftware();
            td_GenuineSoftware model;
            if (id > 0)
            {
                model = cBll.GetObjectById(id);
                if (model == null)
                {
                    sReturnModel.ErrorType      = 0;
                    sReturnModel.MessageContent = "操作失败.";
                    return(Json(sReturnModel));
                }
            }

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

            model.IPdz   = IPdz;
            model.czxtlx = czxtlx;
            model.bgrjlx = bgrjlx;
            model.yt     = yt;

            if (cBll.AddOrUpdate(model))
            {
                sReturnModel.ErrorType      = 1;
                sReturnModel.MessageContent = "操作成功.";
            }
            else
            {
                sReturnModel.ErrorType      = 0;
                sReturnModel.MessageContent = "操作失败.";
            }
            return(Json(sReturnModel));
        }
        /// <summary>
        /// 11
        /// </summary>
        /// <returns></returns>
        public JsonResult LoadPageList1()
        {
            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_GenuineSoftware();
            var list = cBll.GetPageListByCondition1(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.tsj,
                    a.bjb,
                    a.bjrqzwww,
                    a.jrzwwwsl,
                    a.az260tqsl,
                    a.sfdbd,
                    a.czxtlx,
                    a.yzczxt,
                    a.yysqs1
                }
            }
            ;
            return(Json(sReturnModel));
        }
Esempio n. 7
0
        /// <summary>
        /// 正版软件情况
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public JsonResult ImportSoftwareExcelFile(HttpPostedFileBase file)
        {
            // string filePath = RequestParameters.Pstring("filePath");
            if (!Utits.IsLogin)
            {
                return(Json(new { jsonrpc = 2.0, error = new { code = 102, message = "登录状态已失效." } }));
            }
            string filePathName = string.Empty;
            string localPath    = Server.MapPath(string.Format("/{0}/SoftwareData/", Utits.UploadExcelPath));

            if (Request.Files.Count == 0)
            {
                return(Json(new { jsonrpc = 2.0, error = new { code = 100, message = "文件上传失败." } }));
            }

            //  string ex = Path.GetExtension(file.FileName);
            filePathName = DateTime.Now.ToString("yyyyMMddHHssmm") + "_" + file.FileName;
            if (!System.IO.Directory.Exists(localPath))
            {
                System.IO.Directory.CreateDirectory(localPath);
            }
            file.SaveAs(localPath + filePathName);

            #region 信息
            try
            {
                var currentUser = Utits.CurrentUser;
                var OpUserId    = currentUser.user_Id;
                var Opdate      = System.DateTime.Now;

                var cBll = new BLL_GenuineSoftware();
                List <td_GenuineSoftware_1> list = new List <td_GenuineSoftware_1>();

                using (FileStream fsfile = new FileStream(localPath + filePathName, FileMode.Open, FileAccess.Read))
                {
                    XSSFWorkbook             workbook = new XSSFWorkbook(fsfile);
                    NPOI.SS.UserModel.ISheet sheet    = workbook.GetSheetAt(0); //第一个工作表
                    ///Excel 第一行是标题,不需要导入数据库的
                    for (int i = 1; i <= sheet.LastRowNum; i++)
                    {
                        IRow row = sheet.GetRow(i);
                        td_GenuineSoftware_1 network = new td_GenuineSoftware_1();

                        if (row.GetCell(0) == null)
                        {
                            network.Dept_Name = "";
                        }
                        else
                        {
                            network.Dept_Name = row.GetCell(0).StringCellValue;
                        }

                        if (row.GetCell(1) == null)
                        {
                            network.tsj = 0;
                        }
                        else
                        {
                            network.tsj = Convert.ToInt32(row.GetCell(1).NumericCellValue);
                        }

                        if (row.GetCell(2) == null)
                        {
                            network.bjb = 0;
                        }
                        else
                        {
                            network.bjb = Convert.ToInt32(row.GetCell(2).NumericCellValue);
                        }

                        if (row.GetCell(3) == null)
                        {
                            network.bjrqzwww = 0;
                        }
                        else
                        {
                            network.bjrqzwww = Convert.ToInt32(row.GetCell(3).NumericCellValue);
                        }

                        if (row.GetCell(4) == null)
                        {
                            network.jrzwwwsl = 0;
                        }
                        else
                        {
                            network.jrzwwwsl = Convert.ToInt32(row.GetCell(4).NumericCellValue);
                        }

                        if (row.GetCell(5) == null)
                        {
                            network.az260tqsl = 0;
                        }
                        else
                        {
                            network.az260tqsl = Convert.ToInt32(row.GetCell(5).NumericCellValue);
                        }

                        if (row.GetCell(6) == null)
                        {
                            network.sfdbd = "";
                        }
                        else
                        {
                            network.sfdbd = row.GetCell(6).StringCellValue;
                        }

                        if (row.GetCell(7) == null)
                        {
                            network.czxtlx = "";
                        }
                        else
                        {
                            network.czxtlx = row.GetCell(7).StringCellValue;
                        }

                        if (row.GetCell(8) == null)
                        {
                            network.yzczxt = "";
                        }
                        else
                        {
                            network.yzczxt = row.GetCell(8).StringCellValue;
                        }

                        if (row.GetCell(9) == null)
                        {
                            network.yysqs1 = 0;
                        }
                        else
                        {
                            network.yysqs1 = Convert.ToInt32(row.GetCell(9).NumericCellValue);
                        }

                        if (row.GetCell(10) == null)
                        {
                            network.bgrjlx = "";
                        }
                        else
                        {
                            network.bgrjlx = row.GetCell(10).StringCellValue;
                        }

                        if (row.GetCell(11) == null)
                        {
                            network.sftytg1 = "";
                        }
                        else
                        {
                            network.sftytg1 = row.GetCell(11).StringCellValue;
                        }

                        if (row.GetCell(12) == null)
                        {
                            network.yysqs = 0;
                        }
                        else
                        {
                            network.yysqs = Convert.ToInt32(row.GetCell(12).NumericCellValue);
                        }

                        if (row.GetCell(13) == null)
                        {
                            network.sftytg = "";
                        }
                        else
                        {
                            network.sftytg = row.GetCell(13).StringCellValue;
                        }

                        if (row.GetCell(14) == null)
                        {
                            network.tgsl = 0;
                        }
                        else
                        {
                            network.tgsl = Convert.ToInt32(row.GetCell(14).NumericCellValue);
                        }
                        network.OperatTime = Opdate;
                        network.OperatPid  = OpUserId;

                        list.Add(network);
                    }

                    if (cBll.AddImport(list))
                    {
                        return(Json(new { jsonrpc = 2.0, message = "导入成功." }));
                    }
                    else
                    {
                        return(Json(new { jsonrpc = 2.0, error = new { code = 100, message = "导入失败." } }));
                    }
                }
            }
            catch (Exception e)
            {
                MessageLog.AddLog(string.Format("UpDataProcess(数据导入)异常:{0}", e.Message));
            }
            return(Json(new { jsonrpc = 2.0, error = new { code = 100, message = "系统错误.(请确保数据完整)" } }));

            #endregion
        }