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> /// 1 /// </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_Network(); if (cBll.PhysicalDelete1(delIds.ToArray())) { sReturnModel.ErrorType = 1; sReturnModel.MessageContent = "操作成功."; } else { sReturnModel.ErrorType = 0; sReturnModel.MessageContent = "操作失败."; } return(Json(sReturnModel)); }
/// <summary> /// 网络情况(光纤) /// </summary> /// <returns></returns> public JsonResult WlApi() { var sReturnModel = new ReturnDetailModel(); var cBll = new BLL_Network(); var list = cBll.GetObjectAll(); list = list.OrderByDescending(o => o.gx).Take(5).ToList(); sReturnModel.ErrorType = 1; if (list != null) { sReturnModel.Entity = from a in list select new { wlAxisData = a.Dept_Name, wlseriesData = a.gx }; } 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_Network(); sReturnModel.ErrorType = 1; sReturnModel.Entity = cBll.GetObjectDeptById(id); 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_Network(); 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.scjhj, a.ecjhj, a.lyq, a.gdj, a.llfzjh, a.gx, a.wxjrd, a.wxzj, a.flwck } } ; return(Json(sReturnModel)); }
/// <summary> /// 保存信息 /// </summary> 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 scjhj = RequestParameters.Pint("scjhj"); string scjhjxh = RequestParameters.Pstring("scjhjxh"); string scjhjpp = RequestParameters.Pstring("scjhjpp"); int ecjhj = RequestParameters.Pint("ecjhj"); string ecjhjxh = RequestParameters.Pstring("ecjhjxh"); string ecjhjpp = RequestParameters.Pstring("ecjhjpp"); int lyq = RequestParameters.Pint("lyq"); string lyqxh = RequestParameters.Pstring("lyqxh"); string lyqpp = RequestParameters.Pstring("lyqpp"); int gdj = RequestParameters.Pint("gdj"); string gdjxh = RequestParameters.Pstring("gdjxh"); string gdjpp = RequestParameters.Pstring("gdjpp"); int llfzjh = RequestParameters.Pint("llfzjh"); string llfzjhxh = RequestParameters.Pstring("llfzjhxh"); string llfzjhpp = RequestParameters.Pstring("llfzjhpp"); int wxzj = RequestParameters.Pint("wxzj"); string wxzjxh = RequestParameters.Pstring("wxzjxh"); string wxzjpp = RequestParameters.Pstring("wxzjpp"); int gx = RequestParameters.Pint("gx"); int wxjrd = RequestParameters.Pint("wxjrd"); string flwck = RequestParameters.Pstring("flwck"); string jrcwwwIPdzd = RequestParameters.Pstring("jrcwwwIPdzd"); if (jrcwwwIPdzd.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_Network(); td_Network model; if (id > 0) { model = cBll.GetObjectById(id); if (model == null) { sReturnModel.ErrorType = 0; sReturnModel.MessageContent = "操作失败."; return(Json(sReturnModel)); } } model = new td_Network(); model.ID = id; model.OperatPid = currentUser.user_Id; model.OperatTime = DateTime.Now; model.Dept_Id = DeptId; model.scjhj = scjhj; model.scjhjxh = scjhjxh; model.scjhjpp = scjhjpp; model.ecjhj = ecjhj; model.ecjhjxh = ecjhjxh; model.ecjhjpp = ecjhjpp; model.lyq = lyq; model.lyqxh = lyqxh; model.lyqpp = lyqpp; model.gdj = gdj; model.gdjxh = gdjxh; model.gdjpp = gdjpp; model.llfzjh = llfzjh; model.llfzjhxh = llfzjhxh; model.llfzjhpp = llfzjhpp; model.wxzj = wxzj; model.wxzjxh = wxzjxh; model.wxzjpp = wxzjpp; model.gx = gx; model.wxjrd = wxjrd; model.flwck = flwck; model.jrcwwwIpdzd = jrcwwwIPdzd; if (cBll.AddOrUpdate(model)) { sReturnModel.ErrorType = 1; sReturnModel.MessageContent = "操作成功."; } else { sReturnModel.ErrorType = 0; sReturnModel.MessageContent = "操作失败."; } return(Json(sReturnModel)); }
// GET: Import //public ActionResult Index() //{ // return View(); //} /// <summary> /// 网络情况 /// </summary> /// <param name="filePath"></param> /// <returns></returns> public JsonResult ImportNetExcelFile(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}/NetWorkData/", 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_Network(); List <td_Network_1> list = new List <td_Network_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_Network_1 network = new td_Network_1(); if (row.GetCell(0) == null) { network.Dept_Name = ""; } else { network.Dept_Name = row.GetCell(0).StringCellValue; } if (row.GetCell(1) == null) { network.bgdd = ""; } else { network.bgdd = row.GetCell(1).StringCellValue; } if (row.GetCell(2) == null) { network.lxdh = ""; } else { network.lxdh = row.GetCell(2).StringCellValue; } if (row.GetCell(3) == null) { network.jrzwwwzdsl = 0; } else { network.jrzwwwzdsl = Convert.ToInt32(row.GetCell(3).NumericCellValue); } if (row.GetCell(4) == null) { network.jrgwwzdsl = 0; } else { network.jrgwwzdsl = Convert.ToInt32(row.GetCell(4).NumericCellValue); } if (row.GetCell(5) == null) { network.jrzwwwIPdzd = ""; } else { network.jrzwwwIPdzd = row.GetCell(5).StringCellValue; } if (row.GetCell(6) == null) { network.scjhj = 0; } else { network.scjhj = Convert.ToInt32(row.GetCell(6).NumericCellValue); } if (row.GetCell(7) == null) { network.ecjhj = 0; } else { network.ecjhj = Convert.ToInt32(row.GetCell(7).NumericCellValue); } if (row.GetCell(8) == null) { network.lyq = 0; } else { network.lyq = Convert.ToInt32(row.GetCell(8).NumericCellValue); } if (row.GetCell(9) == null) { network.gdj = 0; } else { network.gdj = Convert.ToInt32(row.GetCell(9).NumericCellValue); } if (row.GetCell(10) == null) { network.llfzjh = 0; } else { network.llfzjh = Convert.ToInt32(row.GetCell(10).NumericCellValue); } if (row.GetCell(11) == null) { network.gx = 0; } else { network.gx = Convert.ToInt32(row.GetCell(11).NumericCellValue); } if (row.GetCell(12) == null) { network.wxjrd = 0; } else { network.wxjrd = Convert.ToInt32(row.GetCell(12).NumericCellValue); } if (row.GetCell(13) == null) { network.wxzj = 0; } else { network.wxzj = Convert.ToInt32(row.GetCell(13).NumericCellValue); } if (row.GetCell(14) == null) { network.flwck = ""; } else { network.flwck = row.GetCell(14).StringCellValue; } network.OperatTime = Opdate; network.OperatPid = OpUserId; list.Add(network); } if (cBll.AddImportNet(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 }