//法律、新闻、消费知识 文档类型(2:消防知识 3:新闻管理 4:法律法规) //[HttpGet] public JsonResult GetDynamic(string GroupId) { try { LogErrorRecord.InfoFormat("参数请求url:{0}", Request.Url); LogErrorRecord.InfoFormat("参数参数:GroupId={0}", GroupId); CheckParams(GroupId, "文档类型不能为空!"); BllEDynamic bllEDynamic = new BllEDynamic(); if (jsonResult.success) { Search search = GetSearch(); search.AddCondition("GroupId='" + GroupId + "'"); Page <ModEDynamic> r = bllEDynamic.GetDynamic(search); jsonResult.data = r.Items; jsonResult.msg = "获取成功!"; } } catch (Exception ex) { LogErrorRecord.ErrorFormat("错误日志:{0},请求url:{1}", ex.Message, Request.Url); jsonResult.success = false; jsonResult.errorCode = -1; jsonResult.msg = "常异:" + ex.Message; } return(Json(jsonResult, "application/json", JsonRequestBehavior.AllowGet)); }
//广告、幻灯片 //[HttpGet] public JsonResult GetAdActive(int top = 8) { try { LogErrorRecord.InfoFormat("参数请求url:{0}", Request.Url); LogErrorRecord.InfoFormat("参数参数:top={0}", top); BllAdActive bllAdActive = new BllAdActive(); if (jsonResult.success) { List <ModAdActive> list = bllAdActive.QueryAll(top); jsonResult.data = list; jsonResult.msg = "获取成功!"; } } catch (Exception ex) { LogErrorRecord.ErrorFormat("错误日志:{0},请求url:{1}", ex.Message, Request.Url); jsonResult.success = false; jsonResult.errorCode = -1; jsonResult.msg = "常异:" + ex.Message; } return(Json(jsonResult, "application/json", JsonRequestBehavior.AllowGet)); }
//上传语音 //[HttpGet] public JsonResult Upvoice() { try { LogErrorRecord.InfoFormat("参数请求url:{0}", Request.Url); if (jsonResult.success) { HttpFileCollectionBase files = Request.Files; //获取文件 string seavPath = ConfigurationManager.AppSettings["UpVoice"]; //文件保存路劲 string tmpPath = Server.MapPath("~" + seavPath); //小图片 FileHelper fh = new FileHelper(); fh.CreateDirectory(tmpPath); //创建文件夹 if (files != null && files.Count > 0) { for (int i = 0; i < files.Count; i++) { HttpPostedFileBase file = files[i]; string geshi = Path.GetExtension(file.FileName);//文件格式 string guidName = DateTime.Now.ToString("yyyyMMdd-" + Guid.NewGuid().ToString()) + geshi; string str = ""; if (UploadFile.Upload(file, tmpPath + guidName, 5120, out str)) { jsonResult.data = seavPath + guidName;//"\"" + seavPath + guidName + "\""; jsonResult.success = true; jsonResult.msg = "上传成功!"; } else { jsonResult.success = false; jsonResult.msg = str; } } } else { jsonResult.success = false; jsonResult.msg = "未获取到客户端文件!"; } } } catch (Exception ex) { LogErrorRecord.ErrorFormat("错误日志:{0},请求url:{1}", ex.Message, Request.Url); jsonResult.success = false; jsonResult.errorCode = -1; jsonResult.msg = "常异:" + ex.Message; } return(Json(jsonResult, "application/json", JsonRequestBehavior.AllowGet)); }
/// <summary> /// 查询市区管理 /// </summary> public void SearchData() { try { Search search = this.GetSearch(); string ProvinceCode = (Request["ProvinceCode"] == null ? "" : Request["ProvinceCode"]); if (!string.IsNullOrEmpty(ProvinceCode) && ProvinceCode != "-1") { search.AddCondition("ProvinceCode='" + ProvinceCode + "'"); } WriteJsonToPage(new BllSysHatcity().SearchData(search)); } catch (Exception ex) { LogErrorRecord.Info("查询列表:" + ex); } }
/// <summary> /// 查询上级单位 /// </summary> public void SearchParentIndex() { try { Search search = this.GetSearch(); search.AddCondition("CId='" + CurrentMaster.Cid + "'"); search.AddCondition("SelectType=2");//上级单位管理的 LogInsert(OperationTypeEnum.访问, "关联单位模块", "访问页面成功."); WriteJsonToPage(Bll.SearchData(search)); } catch (Exception ex) { LogErrorRecord.Info("查询列表:" + ex); LogInsert(OperationTypeEnum.异常, "关联单位模块", "查询列表错误消息:" + ex.Message.ToString()); } }
/// <summary> /// 根据id 加载数据 /// </summary> public void SearchData() { try { Search search = this.GetSearch(); search.AddCondition("ResponsibleId='" + CurrentMaster.Id + "'");//自己查看自己的 LogInsert(OperationTypeEnum.访问, "设备巡检模块", "访问页面成功."); WriteJsonToPage(new BllSysQRCode().SearchData(search)); } catch (Exception ex) { LogErrorRecord.Info("查询列表:" + ex); LogInsert(OperationTypeEnum.异常, "设备巡检模块", "查询列表错误消息:" + ex.Message.ToString()); } }
//意见反馈 //[HttpGet] public JsonResult Feedback(string userid, string backinfo, string phonetype) { try { LogErrorRecord.InfoFormat("参数请求url:{0}", Request.Url); LogErrorRecord.InfoFormat("参数参数:userid={0}&backinfo={1}&phonetype={2}", userid, backinfo, phonetype); CheckParams(userid, "用户不能为空!"); CheckParams(backinfo, "反馈不能为空!"); CheckParams(phonetype, "手机类型不能为空!"); if (jsonResult.success) { BllSysFeedback bllSysFeedback = new BllSysFeedback(); ModSysFeedback mod = new ModSysFeedback(); mod.Id = Guid.NewGuid().ToString(); mod.CreateTime = DateTime.Now; mod.BackInfo = backinfo; mod.PhoneType = phonetype; mod.Status = (int)StatusEnum.正常; mod.UserId = userid; mod.IsAccept = false;//默认没接受 mod.CreaterId = ""; if (bllSysFeedback.Insert(mod) > 0) { jsonResult.msg = "我们已经收到了您的反馈信息!谢谢您"; jsonResult.success = true; } else { jsonResult.msg = "系统繁忙,请稍后再试!"; jsonResult.success = false; } } } catch (Exception ex) { LogErrorRecord.ErrorFormat("错误日志:{0},请求url:{1}", ex.Message, Request.Url); jsonResult.success = false; jsonResult.errorCode = -1; jsonResult.msg = "常异:" + ex.Message; } return(Json(jsonResult, "application/json", JsonRequestBehavior.AllowGet)); }
//version //[HttpGet] public JsonResult CheckVersion(string phonetype, string version) { try { LogErrorRecord.InfoFormat("参数请求url:{0}", Request.Url); LogErrorRecord.InfoFormat("参数参数:version={0}&phonetype={1}", version, phonetype); CheckParams(version, "手机版本不能为空!"); CheckParams(phonetype, "手机类型不能为空!"); string tempversion = ConfigurationManager.AppSettings[phonetype + "V"]; string managerdomain = ConfigurationManager.AppSettings["managerdomain"]; if (!string.IsNullOrEmpty(tempversion) && tempversion != version) { if (phonetype == "ios") { //jsonResult.data = managerdomain + "/file/" + phonetype + ".ipa"; jsonResult.data = managerdomain + "/file/ios.ipa"; } else { //jsonResult.data = managerdomain + "/file/" + phonetype + ".apk"; jsonResult.data = managerdomain + "/file/android.apk"; } jsonResult.success = true; jsonResult.msg = "有新版本,快去更新吧!"; } else { jsonResult.success = false; jsonResult.msg = "暂无更新"; } } catch (Exception ex) { LogErrorRecord.ErrorFormat("错误日志:{0},请求url:{1}", ex.Message, Request.Url); jsonResult.success = false; jsonResult.errorCode = -1; jsonResult.msg = "常异:" + ex.Message; } return(Json(jsonResult, "application/json", JsonRequestBehavior.AllowGet)); }
/// <summary> /// 查询岗位管理 /// </summary> public void SearchData() { try { Search search = this.GetSearch(); search.AddCondition("Attribute=" + (int)CompanyType.消防部门); if (!CurrentMaster.IsMain) { if (CurrentMaster.LookPower == (int)LookPowerEnum.查看自建) { search.AddCondition("CreaterUserId='" + CurrentMaster.Id + "'");//自己查看自己的 } } WriteJsonToPage(bll.SearchData(search)); } catch (Exception ex) { LogErrorRecord.Info("查询列表:" + ex); } }
/// <summary> /// 超期未巡检列表统计 /// </summary> public void SuperParentData() { try { BllSysAppointed Bll = new BllSysAppointed(); Search search = this.GetSearch(); if (Request["Id"].ToString() != "-1") { search.AddCondition("Cid='" + Request["Id"].ToString() + "'"); } else { search.AddCondition("Cid in (select EmployerId from Sys_CompanyCognate where Cid='" + CurrentMaster.Cid + "' and Status=1 and SelectType=2)"); } string searchType = Request["searchType"].ToString(); switch (int.Parse(searchType)) { case 1: //全部 break; case 2: //本月 search.AddCondition("datediff(month,MaintenanceDate,getdate())=0"); break; case 3: //上月 search.AddCondition("datediff(month,MaintenanceDate,getdate())=1"); break; } search.AddCondition("MaintenanceDate<getDate()"); LogInsert(OperationTypeEnum.访问, "超期未巡检列表统计模块", "访问页面成功."); WriteJsonToPage(Bll.SearchData(search)); } catch (Exception ex) { LogErrorRecord.Info("查询列表:" + ex); LogInsert(OperationTypeEnum.异常, "超期未巡检列表统计模块", "查询列表错误消息:" + ex.Message.ToString()); } }
/// <summary> /// 弹框根据加载数据 /// </summary> public void SearchViewData() { try { Search search = this.GetSearch(); search.AddCondition("Status=" + (int)StatusEnum.禁用); string CompanyId = Request["CompanyId"].ToString().Trim();// if (CompanyId != "") { search.AddCondition("SysId='" + CompanyId + "'"); } else { search.AddCondition("SysId='" + CurrentMaster.Cid + "'"); } WriteJsonToPage(new BllSysQRCode().SearchData(search)); } catch (Exception ex) { LogErrorRecord.Info("查询列表:" + ex); } }
/// <summary> /// 二维码生成 /// </summary> public string QrCode(string PrimaryKey) { try { //QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); //int scale = Convert.ToInt16(4); //qrCodeEncoder.QRCodeScale = scale; //qrCodeEncoder.QRCodeVersion = 5; //qrCodeEncoder.QRCodeForegroundColor = System.Drawing.Color.Black; //System.Drawing.Image myimg = qrCodeEncoder.Encode("XF" + PrimaryKey, System.Text.Encoding.UTF8); //string rootQROrderPath = ConfigurationManager.AppSettings["QROrder"] ?? "~/UploadFile/QRCode/"; //string path = rootQROrderPath + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/"; //if (!string.IsNullOrEmpty(Server.MapPath(path))) //{ // if (!System.IO.File.Exists(Server.MapPath(path))) // { // System.IO.Directory.CreateDirectory(Server.MapPath(path)); // } //} //path = path + PrimaryKey + ".png";//组成图片名称 //using (Bitmap bitmap = new Bitmap(250, 250)) //{ // using (Graphics g = Graphics.FromImage(bitmap)) // { // g.FillRectangle(new SolidBrush(System.Drawing.Color.White), new Rectangle(0, 0, 250, 250)); // g.DrawImage(myimg, new Rectangle(10, 10, 230, 230)); // bitmap.Save(Server.MapPath(path), System.Drawing.Imaging.ImageFormat.Png); // } //} //path = path.Substring(1, path.Length - 1); //return path; return(""); } catch (Exception ex) { LogErrorRecord.Debug("二维码生成错误" + ex.Message); return(""); } }