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_Security(); 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 AQApi() { var sReturnModel = new ReturnDetailModel(); var cBll = new BLL_Security(); 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.yjsjsb }; } 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_Security(); 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"); string bswz = RequestParameters.Pstring("bswz"); int fhq = RequestParameters.Pint("fhq"); int rqjc = RequestParameters.Pint("rqjc"); int VPNsb = RequestParameters.Pint("VPNsb"); string VPNsbxh = RequestParameters.Pstring("VPNsbxh"); string VPNsbpp = RequestParameters.Pstring("VPNsbpp"); int zmaqfhsb = RequestParameters.Pint("zmaqfhsb"); string zmaqfhsbxh = RequestParameters.Pstring("zmaqfhsbxh"); string zmaqfhsbpp = RequestParameters.Pstring("zmaqfhsbpp"); int mmj = RequestParameters.Pint("mmj"); int jsmb = RequestParameters.Pint("jsmb"); int yjsjsb = RequestParameters.Pint("yjsjsb"); string yjsjsbxh = RequestParameters.Pstring("yjsjsbxh"); string yjsjsbpp = RequestParameters.Pstring("yjsjsbpp"); string sfrzwg = RequestParameters.Pstring("sfrzwg"); int yyfzjh = RequestParameters.Pint("yyfzjh"); int xhgrq = RequestParameters.Pint("xhgrq"); int swxwgl = RequestParameters.Pint("wljk"); int wljk = RequestParameters.Pint("wljk"); int fwqjkpt = RequestParameters.Pint("fwqjkpt"); int ywglpt = RequestParameters.Pint("ywglpt"); int wyfcg = RequestParameters.Pint("wyfcg"); int zdjkASM = RequestParameters.Pint("zdjkASM"); if (bswz.Length < 1) { sReturnModel.ErrorType = 0; sReturnModel.MessageContent = "操作失败:部署位置不能为空."; return(Json(sReturnModel)); } //if (sfrzwg.GetType() != typeof(int)) { // 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_Security(); td_Security model; if (id > 0) { model = cBll.GetObjectById(id); if (model == null) { sReturnModel.ErrorType = 0; sReturnModel.MessageContent = "操作失败."; return(Json(sReturnModel)); } } model = new td_Security(); model.ID = id; model.OperatPid = currentUser.user_Id; model.OperatTime = DateTime.Now; model.Dept_Id = DeptId; model.bswz = bswz; model.fhq = fhq; model.rqjc = rqjc; model.VPNsb = VPNsb; model.VPNsbxh = VPNsbxh; model.VPNsbpp = VPNsbpp; model.zmaqfhsb = zmaqfhsb; model.zmaqfhsbxh = zmaqfhsbxh; model.zmaqfhsbpp = zmaqfhsbpp; model.mmj = mmj; model.jsmb = jsmb; model.yjsjsb = yjsjsb; model.yjsjsbxh = yjsjsbxh; model.yjsjsbpp = yjsjsbpp; model.sfrzwg = sfrzwg; model.yyfzjh = yyfzjh; model.xhgrq = xhgrq; model.swxwgl = swxwgl; model.wljk = wljk; model.fwqjkpt = fwqjkpt; model.ywglpt = ywglpt; model.wyfcg = wyfcg; model.zdjkASM = zdjkASM; if (cBll.AddOrUpdate(model)) { sReturnModel.ErrorType = 1; sReturnModel.MessageContent = "操作成功."; } else { sReturnModel.ErrorType = 0; sReturnModel.MessageContent = "操作失败."; } return(Json(sReturnModel)); }
/// <summary> /// 1 /// </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_Security(); 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.bswz, a.dyxt, a.sfjrzwww, a.sbglryxm, a.lxfs } } ; return(Json(sReturnModel)); }
/// <summary> /// 安全设备 /// </summary> /// <param name="file"></param> /// <returns></returns> public JsonResult ImportSecurityExcelFile(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}/SecurityData/", 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 mdate = DateTime.Parse("1999/09/09"); var cBll = new BLL_Security(); List <td_Security_1> list = new List <td_Security_1>(); List <td_Security_xxsl_1> list_xxsl = new List <td_Security_xxsl_1>(); using (FileStream fsfile = new FileStream(localPath + filePathName, FileMode.Open, FileAccess.Read)) { XSSFWorkbook workbook = new XSSFWorkbook(fsfile); // HSSFWorkbook Hworkbook = new HSSFWorkbook(fsfile); NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0); //第一个工作表 //NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(1); //第二个工作表 ISheet sheet_xxsl = workbook.GetSheet("设备信息"); // string nam = workbook.GetSheetName(1); ///Excel 第一行是标题,不需要导入数据库的 for (int i = 1; i <= sheet.LastRowNum; i++) { IRow row = sheet.GetRow(i); td_Security_1 security = new td_Security_1(); if (row.GetCell(0) == null) { security.Dept_Name = ""; } else { security.Dept_Name = row.GetCell(0).StringCellValue; } if (row.GetCell(1) == null) { security.bswz = ""; } else { security.bswz = row.GetCell(1).StringCellValue; } if (row.GetCell(2) == null) { security.dyxt = ""; } else { security.dyxt = row.GetCell(2).StringCellValue; } if (row.GetCell(3) == null) { security.sfjrzwww = ""; } else { security.sfjrzwww = row.GetCell(3).StringCellValue; } if (row.GetCell(4) == null) { security.sbglryxm = ""; } else { security.sbglryxm = row.GetCell(4).StringCellValue; } if (row.GetCell(5) == null) { security.lxfs = 0; } else { security.lxfs = Convert.ToInt32(row.GetCell(5).NumericCellValue); } security.OperatTime = Opdate; security.OperatPid = OpUserId; list.Add(security); } for (int i = 1; i <= sheet_xxsl.LastRowNum; i++) { IRow row = sheet_xxsl.GetRow(i); td_Security_xxsl_1 security_sl = new td_Security_xxsl_1(); if (row.GetCell(0) == null) { security_sl.Dept_Name = ""; } else { security_sl.Dept_Name = row.GetCell(0).StringCellValue; } if (row.GetCell(1) == null) { security_sl.aqsbhrjmc = ""; } else { security_sl.aqsbhrjmc = row.GetCell(1).StringCellValue; } if (row.GetCell(2) == null) { security_sl.sfbs = ""; } else { security_sl.sfbs = row.GetCell(2).StringCellValue; } if (row.GetCell(3) == null) { security_sl.sl = 0; } else { security_sl.sl = Convert.ToInt32(row.GetCell(3).NumericCellValue); } if (row.GetCell(4) == null) { security_sl.pp = ""; } else { security_sl.pp = row.GetCell(4).StringCellValue; } if (row.GetCell(5) == null) { security_sl.xh = ""; } else { security_sl.xh = row.GetCell(5).StringCellValue; } if (row.GetCell(6) == null) { security_sl.gmrq = mdate; } else { security_sl.gmrq = row.GetCell(6).DateCellValue; } if (row.GetCell(7) == null) { security_sl.gmjq = 0; } else { security_sl.gmjq = Convert.ToInt32(row.GetCell(7).NumericCellValue); } //Room_sl.OperatTime = Opdate; //Room_sl.OperatPid = OpUserId; list_xxsl.Add(security_sl); } if (cBll.AddImport(list) && cBll.AddImport_sl(list_xxsl)) { 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 }