public ActionResult Edit(string contactId) { IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll(); //事项分类 Global.Common.Models.ParamModel caseType = paramList.SingleOrDefault(m => m.ParamCode.Equals(Constants.SysParamType.ContactCaseType)); ViewBag.CaseType = new SelectList(caseType.itemsList, "ParamItemValue", "ParamItemName"); //公司名称 Global.Common.Models.ParamModel company = paramList.SingleOrDefault(t => t.ParamCode == Constants.SysParamType.CompanyInfo); if (null == company) { company = new Global.Common.Models.ParamModel(); } Global.Common.Models.ParamItemModel companyInfo = company.itemsList.SingleOrDefault(s => s.ParamItemName.Equals("公司名称")); ContactModel model = null; if (contactId == "0") { model = new ContactModel(); model.CompanyName = companyInfo == null ? "" : companyInfo.ParamItemValue; } else { model = ServiceProvider.ContactService.GetById(UtilsHelper.Decrypt2Int(contactId)); IList <BusinessAttachmentModel> businessAttachList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(Constants.AttachmentBusinessType.联络单.GetHashCode(), model.ContactId); if (businessAttachList.Count > 0 && businessAttachList.First() != null) { ViewBag.FileId = UtilsHelper.Encrypt(businessAttachList.First().FileId.ToString()); ViewBag.FileName = businessAttachList.First().FileName; } } return(View(model)); }
/// <summary> /// 获取知识库 /// </summary> /// <returns></returns> public JsonResult GetAllKnowledgeListJsonData() { //提取DataTable参数 DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams(); //构造输入参数 PagingModel paging = new PagingModel(); paging.PageSize = dtm.PageSize; paging.PageCurrent = dtm.PageIndex; paging.Where = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? "1=1" : dtm.FieldCondition; IList <Hashtable> knowledgeList = ServiceProvider.KnowledgesService.GetAllKnowledgesListForPaging(paging); //系统参数 IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll(); ParamModel pState = paramList.SingleOrDefault(p => p.ParamCode.Equals(UtilConstants.SysParamType.KnowledgeState)); ParamModel pType = paramList.SingleOrDefault(p => p.ParamCode.Equals(UtilConstants.SysParamType.KnowledgeType)); //Json数据格式组装 dtm.iTotalRecords = paging.RecordCount; dtm.iTotalDisplayRecords = dtm.iTotalRecords; dtm.aaData = new List <List <string> >(); StringBuilder operate = new StringBuilder(); foreach (var item in knowledgeList) { dtm.aaData.Add(new List <string>()); string knowledgeId = UtilsHelper.Encrypt(item["KnowledgeId"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("<input type='checkbox' name='chk' value='{0}'>", knowledgeId)); operate.AppendFormat("<div knowledgeId='{0}'>", knowledgeId); if (LoginHelper.LoginUserAuthorize.Contains("/CustKnowledge/Edit".ToLower())) { operate.AppendFormat("<a href='#' onclick='fnEdit(this)'>编辑</a> | "); } if (LoginHelper.LoginUserAuthorize.Contains("/CustKnowledge/Details".ToLower())) { operate.AppendFormat("<a href='#' onclick='fnDetail(this)'>查看</a>"); } operate.Append("</div>"); dtm.aaData[dtm.aaData.Count - 1].Add(operate.ToString()); operate.Clear(); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Title"])); ParamItemModel itemModel = pType.itemsList.SingleOrDefault(p => p.ParamItemValue.Equals(item["KType"].ToString())); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", itemModel == null ? "" : itemModel.ParamItemName)); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Abstract"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Creator"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:yyyy-MM-dd}", item["CreatDate"])); } JsonResult jr = Json(new { sEcho = dtm.sEcho, iTotalRecords = dtm.iTotalRecords, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData }, JsonRequestBehavior.AllowGet); return(jr); }
/// <summary> /// 上传文件列表数据 /// </summary> /// <returns></returns> public JsonResult GetAttachmentListJsonData() { //提取DataTable参数 DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams(); //构造输入参数 PagingModel paging = new PagingModel(); paging.PageSize = dtm.PageSize; paging.PageCurrent = dtm.PageIndex; paging.Where = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? "1=1" : dtm.FieldCondition; if (!string.IsNullOrWhiteSpace(dtm.KeyWord)) { paging.Where = string.Format("{0} and (FileName like '{1}%' or UserName like '{1}%')", paging.Where, dtm.KeyWord); } IList <Hashtable> attachmentList = ServiceProvider.AttachmentService.GetAttachmentListForPaging(paging); //Json数据格式组装 dtm.iTotalRecords = paging.RecordCount; dtm.iTotalDisplayRecords = dtm.iTotalRecords; dtm.aaData = new List <List <string> >(); //列表项:文件显示名称、文件大小、文件类型、上传人、上传时间、文件路径 StringBuilder operate = new StringBuilder(); foreach (var item in attachmentList) { string fileSite = item["FileAccessPrefix"].ToString() + item["FileVirtualPath"].ToString(); string fileId = UtilsHelper.Encrypt(item["FileId"].ToString()); int fileServerType = int.Parse(item["FileServerType"].ToString()); int fileSize = int.Parse(item["FileSize"].ToString()) / 1024; dtm.aaData.Add(new List <string>()); if (LoginHelper.LoginUserAuthorize.ContainsKey("/SysManage/Attachment/List".ToLower())) { operate.AppendFormat("<a href='/SysManage/Attachment/DownLoad?fileId={0}' target='_blank'>下载</a> | <a href='#' fileId='{0}' fileName='{1}' onclick='fnDeleteAttachment(this);return false;' >删除</a>", fileId, item["FileName"].ToString()); } dtm.aaData[dtm.aaData.Count - 1].Add(operate.ToString()); operate.Clear(); dtm.aaData[dtm.aaData.Count - 1].Add(item["FileName"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(fileSize.ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(((UtilConstants.AttachmentType)Convert.ToInt16(item["FileType"])).ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(item["UserName"] == null ?string.Empty:item["UserName"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(DateTime.Parse(item["CreateDate"].ToString()).ToString("yyyy-MM-dd")); dtm.aaData[dtm.aaData.Count - 1].Add(item["FileAccessPrefix"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(item["FileVirtualPath"].ToString()); } JsonResult jr = Json(new { sEcho = dtm.sEcho, iTotalRecords = dtm.iTotalRecords, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData }, JsonRequestBehavior.AllowGet); return(jr); }
/// <summary> /// 获取周检明细 /// </summary> /// <param name="logId"></param> /// <param name="instrumentId"></param> /// <returns></returns> public ActionResult GetInstrumentCertificationDetail(int logId) { InstrumentCertificationModel model = null; model = ServiceProvider.InstrumentCertificationService.GetById(logId); ViewBag.RecordState = (Constants.InstrumentCertificationState)model.RecordState; ViewBag.AttachmentBusinessType = Constants.AttachmentBusinessType.周期校准记录.GetHashCode(); ViewBag.BusinessId = UtilsHelper.Encrypt(model.LogId.ToString()); return(View("InstrumentCertificationDetail", model)); }
public ActionResult GetServerJsonData(int orgId) { //提取DataTable参数 DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams(); string code = ServiceProvider.OrgService.GetCodeById(orgId); //构造输入参数 PagingModel paging = new PagingModel(); paging.PageSize = dtm.PageSize; paging.PageCurrent = dtm.PageIndex; paging.Where = "1=1"; if (!string.IsNullOrWhiteSpace(dtm.FieldCondition)) { paging.Where = dtm.FieldCondition; } paging.Where = string.Format(" {0} and BelongDepart like '{1}%'", paging.Where, code); if (!string.IsNullOrEmpty(dtm.KeyWord)) { paging.Where = string.Format("{0} and (UserName like '{1}%' or LoginName like '{1}%')", paging.Where, dtm.KeyWord); } //数据库查询数据 IList <Hashtable> userList = ServiceProvider.UserService.GetListForPaging(paging); //Json数据格式组装 dtm.iTotalRecords = paging.RecordCount; dtm.iTotalDisplayRecords = dtm.iTotalRecords; dtm.aaData = new List <List <string> >(); foreach (var row in userList) { string userId = UtilsHelper.Encrypt(row["UserId"].ToString()); dtm.aaData.Add(new List <string>()); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("<a href='/Employee/PersonInfo?userId={0}' target=\"_blank\">{1}</a>", userId, row["UserName"])); dtm.aaData[dtm.aaData.Count - 1].Add(row["Sex"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(row["LoginName"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(row["OrgName"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(row["Duty"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(row["IsEnabled"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(row["EmployeeState"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("<a href='#' onclick=\"fnNewWindow({0});return false;\">角色设置</a> <a href='#' onclick=\"fnConfirmWithoutF5('确定重置账户【{1}】密码?','/SysManage/User/ResetPassword?userId={0}');return false;\">重置密码</a> <a href='#' onclick=\"fnConfirmWithF5('确定要禁用账户:{1}','/SysManage/User/DisableAccout?userId={0}');return false;\">禁用</a> <a href='#' onclick=\"fnConfirmWithF5('确定要启用账户:{1}','/SysManage/User/EnableAccout?userId={0}');return false;\">启用</a> <a href='#' onclick=\"fnConfirmWithF5('确定要删除用户:{1}','/SysManage/User/DeleteUser?userId={0}');return false;\">删除</a>", row["UserId"], row["UserName"])); } JsonResult jr = Json(new { sEcho = dtm.sEcho, iTotalRecords = dtm.iTotalRecords, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData }, JsonRequestBehavior.AllowGet); return(jr); }
private void RecursiveDump(IList <ParamItemModel> list, string parentCode, int level, StringBuilder sb) { IEnumerable <ParamItemModel> tempItem = list.Where <ParamItemModel>(m => m.ParentCode == parentCode); string msg = ""; foreach (ParamItemModel m in tempItem) { msg = "<item text='{0}' id='{1}' open='1'>{2}"; sb.AppendFormat(msg, m.ParamItemName, UtilsHelper.Encrypt(m.ParamItemValue), Environment.NewLine); RecursiveDump(list, m.ParamItemValue, level + 1, sb); sb.Append("</item>"); } }
public ActionResult Detail(string contactId) { IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll(); ContactModel model = ServiceProvider.ContactService.GetById(UtilsHelper.Decrypt2Int(contactId)); //事项分类 Global.Common.Models.ParamModel caseType = paramList.SingleOrDefault(m => m.ParamCode.Equals(Constants.SysParamType.ContactCaseType)); ParamItemModel item = caseType.itemsList.SingleOrDefault(p => p.ParamItemValue.Equals(model.CaseType.ToString())); ViewBag.CaseType = item.ParamItemName; IList <BusinessAttachmentModel> businessAttachList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(Constants.AttachmentBusinessType.联络单.GetHashCode(), model.ContactId); if (businessAttachList.Count > 0 && businessAttachList.First() != null) { ViewBag.FileId = UtilsHelper.Encrypt(businessAttachList.First().FileId.ToString()); ViewBag.FileName = businessAttachList.First().FileName; } return(View(model)); }
public ActionResult DocumentList() { //文件分类 IList <ParamModel> list = Global.Business.ServiceProvider.ParamService.GetAll(); ParamModel paramModel = list.SingleOrDefault(p => p.ParamCode == Constants.SysParamType.DocumentType); IList <DocumentModel> documentList = ServiceProvider.DocumentService.GetAll(); StringBuilder sb = new StringBuilder(); StringBuilder operate = new StringBuilder(); sb.Append("["); foreach (var document in documentList) { sb.Append("["); if (LoginHelper.LoginUserAuthorize.Contains("/Document/Details".ToLower())) { operate.Append("<a href='#' onclick='fnUpdateDocument({0});return false;'>编 辑</a> "); } if (LoginHelper.LoginUserAuthorize.Contains("/Document/Delete".ToLower())) { operate.Append("<a href='#' onclick='fnDeleteDocument({0},{1});return false;'>删 除</a> "); } if (LoginHelper.LoginUserAuthorize.Contains("作业指导书-关联仪器".ToLower())) { operate.Append("<a href='#' onclick='fnRelateDocument({0});return false;'>关联仪器</a> "); } sb.AppendFormat("\"" + operate + "\"", document.DocumentId, UtilsHelper.Encrypt(document.FileId.ToString())); operate.Clear(); sb.AppendFormat(",\"<a href='#' id='{0}' onclick='fnDownFile(this);return false;'>{1}</a>\"", UtilsHelper.Encrypt(document.FileId.ToString()), document.FileName); sb.AppendFormat(",\"{0}\"", paramModel.itemsList.SingleOrDefault(p => p.ParamItemValue == document.DocCategory.ToString()).ParamItemName); sb.AppendFormat(",\"{0:d}\"", document.CreateDate); sb.AppendFormat(",\"{0}\"", document.Remark); sb.Append("],"); } if (documentList.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); ViewBag.documentData = sb.ToString(); return(View(new DocumentModel())); }
public ActionResult LoadOrgJavascript(string userId) { //userId = UtilsHelper.Decrypt(userId); StringBuilder js = new StringBuilder(); IList <OrgModel> checkedOrg = ServiceProvider.SalesService.GetSaleManageDepartByUserId(int.Parse(userId)); if (checkedOrg != null) { foreach (OrgModel item in checkedOrg) { IEnumerable <OrgModel> parentOrg = checkedOrg.Where(org => org.OrgCode.IndexOf(item.OrgCode) == 0 && org.OrgCode != item.OrgCode); //当前组织仅仅为叶节点时 if (parentOrg.Count() == 0) { js.AppendFormat("tree.setCheck('{0}',1);{1}", UtilsHelper.Encrypt(item.OrgId.ToString()), Environment.NewLine); } } } return(JavaScript(js.ToString())); }
/// <summary> /// 工艺列表 /// </summary> /// <returns></returns> public string GetCraftJsonData() { IList <CraftModel> craftList = ServiceProvider.CraftService.GetAll(); StringBuilder sbData = new StringBuilder(); sbData.Append("{\"data\":["); StringBuilder sbOperate = new StringBuilder(); foreach (var craft in craftList) { sbData.Append("["); sbOperate.Clear(); //操作 sbOperate.AppendFormat("<a href='#' id='{0}' onclick='fnChooseCraft(this)'>选择</a> ", UtilsHelper.Encrypt(craft.CraftId.ToString())); sbData.AppendFormat("\"{0}\"", sbOperate); sbData.AppendFormat(",\"{0}\"", craft.CraftCode); sbData.AppendFormat(",\"{0}\"", craft.CraftName); sbData.AppendFormat(",\"{0}\"", craft.InstrumentNo); sbData.AppendFormat(",\"{0}\"", craft.UsePlace); sbData.AppendFormat(",\"{0}\"", craft.CreateUser); sbData.AppendFormat(",\"{0:yyyy-MM-dd}\"", craft.CreateDate); sbData.Append("],"); } if (craftList.Count > 0) { sbData.Remove(sbData.Length - 1, 1); } sbData.Append("]}"); return(sbData.ToString()); }
public string GetBusinessAttachmentList(int attachmentType, string bkId) { IList <BusinessAttachmentModel> attachmentList = new List <BusinessAttachmentModel>(); if (bkId != "0") { attachmentList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(attachmentType, UtilsHelper.Decrypt2Int(bkId)); } StringBuilder sb = new StringBuilder(); sb.Insert(0, "{\"data\":["); int count = 0; foreach (var item in attachmentList) { count++; sb.AppendFormat("[\"<input type='checkbox' name='chk{0}' value='{1}|{2}|{3}' />\"", item.BusinessType, item.Id, item.FileId, 0); sb.AppendFormat(",\"{0}\"", count); sb.AppendFormat(",\"<a href='/SysManage/Attachment/DownLoad?fileId={0}'> {1}</a>\"", UtilsHelper.Encrypt(item.FileId.ToString()), item.FileName); sb.AppendFormat(",\" <input class='long_width' id='Remark{0}' type='text' value='{1}' /> <a href='#' onclick='fnUpdateAttachmentRemark({0})'>更新</a>\"", item.Id, string.IsNullOrWhiteSpace(item.Remark) ? string.Empty : item.Remark.Replace("\r", "").Replace("\n", "")); sb.Append("],"); } if (attachmentList.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]}"); return(sb.ToString()); }
public JsonResult GetAllContactJsonData() { //查询标准器具 DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams(); PagingModel paging = new PagingModel(); paging.PageSize = dtm.PageSize; paging.PageCurrent = dtm.PageIndex; paging.FieldShow = @"ContactId,CompanyName,CaseType,Abstract,State,ContactContent,FeedbackContent,FeedbackDate,Creator,CreatId,CreatDate,ItemCode"; paging.Where = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? dtm.FieldCondition = "1=1" : dtm.FieldCondition; IList <Hashtable> contractList = Instrument.Business.ServiceProvider.ContactService.GetAllContactListForPaging(paging); ////系统参数 IList <ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll(); ParamModel pCaseType = paramList.SingleOrDefault(p => p.ParamCode.Equals(Common.Constants.SysParamType.ContactCaseType)); if (pCaseType == null) { pCaseType = new ParamModel(); } ParamItemModel itemCaseType = null; //Json数据格式组装 dtm.iTotalRecords = paging.RecordCount; dtm.iTotalDisplayRecords = dtm.iTotalRecords; dtm.aaData = new List <List <string> >(); StringBuilder sbOperate = new StringBuilder(); foreach (var item in contractList) { dtm.aaData.Add(new List <string>()); sbOperate.Clear(); //操作 sbOperate.AppendFormat("<div contactId='{0}' >", UtilsHelper.Encrypt(item["ContactId"].ToString())); int state = Convert.ToInt32(item["State"]); if (state.Equals(Common.Constants.ContactState.草稿.GetHashCode())) { if (LoginHelper.LoginUserAuthorize.ContainsKey("新增联络单-修改")) { sbOperate.Append("<a href='#' onclick='fnEditContact(this);'>编辑</a> "); } if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Delete".ToLower())) { sbOperate.Append("<a href='#' onclick='fnDeleteContact(this);'>删除</a> "); } if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Send".ToLower())) { sbOperate.Append("<a href='#' onclick='fnSendContact(this);'>提交</a> "); } } if (!state.Equals(Common.Constants.ContactState.草稿.GetHashCode())) { if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Detail".ToLower())) { sbOperate.Append("<a href='#' onclick='fnViewContact(this);'>查看</a> "); } } if (state.Equals(Common.Constants.ContactState.已提交.GetHashCode())) { if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/SynContact".ToLower())) { sbOperate.Append("<a href='#' onclick='fnSynContact(this);'>更新同步</a> "); } } if (state.Equals(Common.Constants.ContactState.已反馈.GetHashCode())) { if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Solve".ToLower())) { sbOperate.Append("<a href='#' onclick='fnSolveContact(this);'>解决</a> "); } } sbOperate.Append("</div>"); dtm.aaData[dtm.aaData.Count - 1].Add(sbOperate.ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["CompanyName"])); //事项分类 itemCaseType = pCaseType.itemsList.SingleOrDefault(p => p.ParamItemValue.Equals(item["CaseType"].ToString())); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", itemCaseType == null ? "" : itemCaseType.ParamItemName)); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Abstract"])); dtm.aaData[dtm.aaData.Count - 1].Add(((Constants.ContactState)Convert.ToInt32(item["State"])).ToString()); //状态 dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:yyyy-MM-dd}", item["FeedbackDate"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Creator"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:yyyy-MM-dd}", item["CreatDate"])); } JsonResult jr = Json(new { sEcho = dtm.sEcho, iTotalRecords = dtm.iTotalRecords, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData }, JsonRequestBehavior.AllowGet); return(jr); }
public JsonResult GetAllCertificationJsonData() { DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams(); //string where = GetCertificationSearchCondition(dtm); PagingModel paging = new PagingModel(); paging.PageSize = dtm.PageSize; paging.PageCurrent = dtm.PageIndex; dtm.iTotalDisplayRecords = dtm.iTotalRecords; paging.FieldShow = @"LogId,InstrumentId,CertificationCode,FileId,CheckDate,EndDate,SendInstrumentDate,CheckResult,ErrorValue,RecordState,IsUseding,CertMoney,CreateDate,CreateUser"; paging.Where = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? dtm.FieldCondition = "1=1" : dtm.FieldCondition; //是否超期 string overTime = Request["searchIsOverTime"]; if (!string.IsNullOrEmpty(overTime)) { if (overTime == "0") { paging.Where = string.Format("{0} and {1}", paging.Where, "GetDate()<=EndDate");//未超期 } else { paging.Where = string.Format("{0} and {1}", paging.Where, "GetDate()>EndDate");//已超期 } } //是否上传报告 string UpdateReport = Request["searchIsUpdateReport"]; if (!string.IsNullOrEmpty(UpdateReport)) { paging.Where = string.Format("{0} and {1}", paging.Where, UpdateReport == "0" ? "(FileId IS null or FileId=0)" : "FileId>0"); } //添加委托单查询条件. string orderParam = Request["InstrumentParam"]; if (!string.IsNullOrWhiteSpace(orderParam)) { orderParam = string.Format(" and {0}", orderParam); } paging.Where = string.Format("{0} and (InstrumentId In (Select InstrumentId From Instrument_BaseInfo Where {2}{1}))", paging.Where, orderParam, GetManageCondition("InstrumentForm=0 ")); DateTime dueEndDate; bool isOverTime = false; IList <Hashtable> instrumentCertificationList = ServiceProvider.InstrumentCertificationService.GetInstrumentCertificationListForPaging(paging); IList <int> instrumentIds = instrumentCertificationList.Select(s => Convert.ToInt32(s["InstrumentId"])).Distinct().ToList(); IList <InstrumentModel> instrumentList = ServiceProvider.InstrumentService.GetByIds(instrumentIds); dtm.iTotalRecords = paging.RecordCount; dtm.iTotalDisplayRecords = dtm.iTotalRecords; ////系统参数 IList <ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll(); Global.Common.Models.OrgModel belongDeptModel = new Global.Common.Models.OrgModel(); Global.Common.Models.ParamItemModel mInstrumentCate = null; IList <Global.Common.Models.ParamItemModel> paramItemList = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCate).itemsList; ///周检状态 IList <ParamItemModel> CertificationState = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCertificationState).itemsList; ParamItemModel mParamItem = new ParamItemModel(); StringBuilder sbData = new StringBuilder(); dtm.aaData = new List <List <string> >(); foreach (var item in instrumentCertificationList) { InstrumentModel instrumentModel = instrumentList.SingleOrDefault(p => p.InstrumentId == Convert.ToInt32(item["InstrumentId"])); if (instrumentModel == null) { instrumentModel = new InstrumentModel(); } if (item["EndDate"] == null) { isOverTime = true; } else { dueEndDate = Convert.ToDateTime(string.Format("{0:d}", item["EndDate"])); //是否过期 isOverTime = DateTime.Now.CompareTo(dueEndDate) > 0 ? true : false; } dtm.aaData.Add(new List <string>()); sbData.Clear(); sbData.AppendFormat("<a href='#' onclick='fnDetails({0})'>详细</a> ", item["LogId"]); if (item["FileId"] != null) { sbData.Append("<a href='#' onclick='fnDownFile(\"" + UtilsHelper.Encrypt(item["FileId"].ToString()) + "\");'>下 载</a> "); //sbData.Append(string.Format("<a href='/Certification/ReadCert?Id={1}' target='_blank' >{0}</a>","浏 览", UtilsHelper.Encrypt(item["FileId"].ToString()))); } dtm.aaData[dtm.aaData.Count - 1].Add(sbData.ToString()); mParamItem = CertificationState.SingleOrDefault(c => c.ParamItemValue == string.Format("{0}", item["RecordState"])); dtm.aaData[dtm.aaData.Count - 1].Add(mParamItem == null ? "" : mParamItem.ParamItemName); //状态 dtm.aaData[dtm.aaData.Count - 1].Add(isOverTime ? "已超期" : "未超期"); //证书超期 dtm.aaData[dtm.aaData.Count - 1].Add(item["FileId"] == null || item["FileId"].ToString() == "" ? "否" : "是"); //是否上传证书 dtm.aaData[dtm.aaData.Count - 1].Add(item["EndDate"] == null ? null : string.Format("{0:yyyy-MM-dd}", item["EndDate"])); dtm.aaData[dtm.aaData.Count - 1].Add(item["CertificationCode"] == null ? "" : item["CertificationCode"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:F2}", item["CertMoney"])); dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.InstrumentName); mInstrumentCate = paramItemList.SingleOrDefault(t => t.ParamItemValue == Convert.ToString(instrumentModel.InstrumentCate)); dtm.aaData[dtm.aaData.Count - 1].Add(mInstrumentCate == null ? "" : mInstrumentCate.ParamItemName); dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.ManageNo); dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.Specification); dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.SerialNo); dtm.aaData[dtm.aaData.Count - 1].Add(item["CheckDate"] == null ? null : string.Format("{0:yyyy-MM-dd}", item["CheckDate"])); dtm.aaData[dtm.aaData.Count - 1].Add(item["CheckResult"] == null ? null : item["CheckResult"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(item["ErrorValue"] == null ? null : item["ErrorValue"].ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(item["CreateDate"] == null ? null : string.Format("{0:yyyy-MM-dd}", item["CreateDate"])); dtm.aaData[dtm.aaData.Count - 1].Add(item["CreateUser"] == null ? null : item["CreateUser"].ToString()); } JsonResult jr = Json(new { sEcho = dtm.sEcho, iTotalRecords = dtm.iTotalRecords, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData, }, JsonRequestBehavior.AllowGet); return(jr); }
public ActionResult Save(string barCode, InstrumentFlowModel model) { Instrument.Common.Models.InstrumentModel instrument = ServiceProvider.InstrumentService.GetByBarCode(barCode); if (instrument == null) { return(Json(new { Msg = "Not Found" })); } string InstrumentInfo = "<b>仪器名称:</b>" + instrument.InstrumentName + " | <b>仪器型号:</b>" + instrument.Specification + " | <b>出厂编号:</b>" + instrument.SerialNo + " | <b>管理编号:</b>" + instrument.ManageNo; model.InstrumentId = instrument.InstrumentId; model.Creator = LoginHelper.LoginUser.UserName; model.Place = ""; ServiceProvider.InstrumentFlowService.Save(model); return(Json(new { Msg = "OK", InstrumentInfo = InstrumentInfo, InstrumentId = UtilsHelper.Encrypt(instrument.InstrumentId.ToString()) }, JsonRequestBehavior.AllowGet)); }
// // GET: /SysManage/User/ public ActionResult Index() { ViewBag.OrgId = UtilsHelper.Encrypt("1"); return(View()); }
public ActionResult GetCertListForJsonData() { //提取DataTable参数 ToolsLib.Utility.Jquery.DataTableUtils.DataTableModel dtm = ToolsLib.Utility.Jquery.DataTableUtils.GetJquerydataTableParams(); //构造输入参数 PagingModel paging = new PagingModel(); paging.FieldOrder = "CertificateId desc"; paging.PageSize = dtm.PageSize; paging.PageCurrent = dtm.PageIndex; //数据库查询数据 object ob = new object(); string[] fieldCondition = new string[8]; fieldCondition[0] = Request["searchOrderNumber"]; fieldCondition[1] = Request["searchCertificateNumber"]; fieldCondition[2] = Request["searchMadeNumber"]; fieldCondition[3] = Request["searchInstrumentName"]; fieldCondition[4] = Request["searchSpecification"]; fieldCondition[5] = Request["searchManageNumber"]; fieldCondition[6] = Request["searchIsComplete"]; fieldCondition[7] = Request["searchIsCertComplete"]; string StrResult = WSProvider.MeasureLabProvider.GetCertListForPage(paging, fieldCondition, Global.Business.ServiceProvider.ParamService.GetCompanyCode(Instrument.Common.Constants.SysParamType.CompanyInfo), Global.Business.ServiceProvider.ParamService.GetaccessToken(Instrument.Common.Constants.SysParamType.CompanyInfo)); Dictionary <string, object> dic = ToolsLib.Utility.CommonUtils.JsonDeserialize(StrResult, typeof(Dictionary <string, object>)) as Dictionary <string, object>; dtm.aaData = new List <List <string> >(); if (dic["Msg"].ToString() != "OK") { JsonResult jrNull = Json(new { sEcho = dtm.sEcho, iTotalRecords = 0, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData }, JsonRequestBehavior.AllowGet); return(jrNull); } IList <Hashtable> orderList = ToolsLib.Utility.CommonUtils.JsonDeserialize(dic["Data"].ToString(), typeof(IList <Hashtable>)) as IList <Hashtable>; //Json数据格式组装 dtm.iTotalRecords = paging.RecordCount; dtm.iTotalDisplayRecords = Convert.ToInt32(dic["RecordCount"].ToString()); if (orderList != null) { foreach (Hashtable row in orderList) { dtm.aaData.Add(new List <string>()); //下载条件:仪器完工,证书完工,仪器有报价,证书文件有上传,客户端允许下载 if (Convert.ToBoolean(row["IsDownLoad"]) && LoginHelper.LoginUserAuthorize.ContainsKey("/Order/Download".ToLower())) { dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("<a href='#' onclick=fnDownloadPDF(this) CertificateNumber='{1}' id='{0}'>下载证书</a>", UtilsHelper.Encrypt(row["CertificatePDFFileId"].ToString()), row["CertificateNumber"].ToString())); } else { dtm.aaData[dtm.aaData.Count - 1].Add(""); } dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["OrderNumber"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["CertificateNumber"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["MadeNumber"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["InstrumentName"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["Specification"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["ManageNumber"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", Convert.ToBoolean(row["IsComplete"]) ? "已完工" : "未完工")); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", Convert.ToBoolean(row["IsCertComplete"]) ? "已完工" : "未完工")); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["SaleName"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:d}", row["CreateDate"])); } } JsonResult jr = Json(new { sEcho = dtm.sEcho, iTotalRecords = dtm.iTotalRecords, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData }, JsonRequestBehavior.AllowGet); return(jr); }
public JsonResult GetAllInstrumentJsonData() { //查询标准器具 DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams(); PagingModel paging = new PagingModel(); paging.PageSize = dtm.PageSize; paging.PageCurrent = dtm.PageIndex; paging.FieldShow = @"InstrumentId,RecordState,InstrumentName,ManageNo,CertificateNo,Specification,InstrumentCate,Manufacturer,SerialNo,DueStartDate,DueEndDate,LeaderName,BelongDepart,StorePalce,CreateDate,CreateUser"; paging.Where = GetSearchCondition(dtm); IList <Hashtable> instrumentList = ServiceProvider.InstrumentService.GetAllInstrumentListForPaging(paging); //系统参数 IList <ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll(); IList <OrgModel> orgList = Global.Business.ServiceProvider.OrgService.GetAll(); OrgModel belongDeptModel = new OrgModel(); ParamItemModel mInstrumentCate = null; //分类 ParamModel InstrumentCate = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCate); //设备分类 IList <ParamItemModel> paramItemList = InstrumentCate.itemsList; //Json数据格式组装 dtm.iTotalRecords = paging.RecordCount; dtm.iTotalDisplayRecords = dtm.iTotalRecords; dtm.aaData = new List <List <string> >(); StringBuilder sbOperate = new StringBuilder(); foreach (var item in instrumentList) { dtm.aaData.Add(new List <string>()); sbOperate.Clear(); //操作 sbOperate.AppendFormat("<div instrumentId='{0}' instrumentName='{1}'>", UtilsHelper.Encrypt(item["InstrumentId"].ToString()), item["InstrumentName"]); if (LoginHelper.LoginUserAuthorize.ContainsKey("/InstrumentFlow/FlowDetails".ToLower())) { //详细 sbOperate.Append("<a href='#' onclick='fnInstrumentFlowDetail(this);'>流转明细</a> "); } sbOperate.Append("</div>"); dtm.aaData[dtm.aaData.Count - 1].Add(sbOperate.ToString()); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["InstrumentName"])); //仪器名称 dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Specification"])); //型号 dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["SerialNo"])); //出厂编号 dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["ManageNo"])); //管理编号 dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["CertificateNo"])); //证书编号 mInstrumentCate = paramItemList.SingleOrDefault(t => t.ParamItemValue == Convert.ToString(item["InstrumentCate"])); dtm.aaData[dtm.aaData.Count - 1].Add(mInstrumentCate == null ? "" : mInstrumentCate.ParamItemName); //分公司 belongDeptModel = orgList.SingleOrDefault(o => o.OrgCode == string.Format("{0}", item["BelongDepart"])); dtm.aaData[dtm.aaData.Count - 1].Add(belongDeptModel == null ? "" : belongDeptModel.OrgName); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:d}", item["DueStartDate"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["LeaderName"])); dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:d}", item["CreateUser"])); } JsonResult jr = Json(new { sEcho = dtm.sEcho, iTotalRecords = dtm.iTotalRecords, iTotalDisplayRecords = dtm.iTotalDisplayRecords, aaData = dtm.aaData }, JsonRequestBehavior.AllowGet); return(jr); }
private void RecursiveDump(IList <OrgModel> orgList, int parentId, int level, StringBuilder sb) { if (orgList == null) { return; } IEnumerable <OrgModel> tempOrg = orgList.Where <OrgModel>(m => m.ParentOrgId == parentId); string msg = ""; foreach (OrgModel m in tempOrg) { msg = "<item text='{0}' id='{1}'>{2}"; if (level == 1) { msg = "<item text='{0}' id='{1}' open='1' select='1'>{2}"; } else if (level < 3) { msg = "<item text='{0}' id='{1}' open='1'>{2}"; } sb.AppendFormat(msg, GRGTCommonUtils.UtilsHelper.XmlSpecialCharValidate(m.OrgName), UtilsHelper.Encrypt(m.OrgId.ToString()), Environment.NewLine); RecursiveDump(orgList, m.OrgId, level + 1, sb); sb.Append("</item>"); } }
public string GetOrderBusinessLog(string FKValue, int FKType) { //解密 int FKvalueInt = 0; if (!string.IsNullOrEmpty(FKValue)) { FKvalueInt = UtilsHelper.Decrypt2Int(FKValue); } //获取日志记录列表 IList <Sys_BusinessLogModel> businessLogList = Global.Business.ServiceProvider.Sys_BusinessLogService.GetByFKValue(FKvalueInt, FKType); businessLogList = businessLogList.OrderByDescending(o => o.CreateDate).ToList(); //姓名、时间、备注、附件(点击即下载) StringBuilder sb = new StringBuilder(); sb.Append("{\"data\":["); foreach (var business in businessLogList) { int index = businessLogList.IndexOf(business); sb.AppendFormat("[\"{0}\"", index + 1); sb.AppendFormat(",\"<input type='checkbox' name='chk' LogId='{0}'></input> \"", business.LogId); sb.AppendFormat(",\"{0}\"", business.CreateUser); sb.AppendFormat(",\"{0}\"", business.CreateDate); sb.AppendFormat(",\"{0}\"", UtilsHelper.SpecialCharValidate(business.LogConent)); sb.AppendFormat(",\"{0}\"", business.FileName == "" ? "" : string.Format("<a onclick='fnDownload(this)' FileId='{1}' >{0}</a>", business.FileName, UtilsHelper.Encrypt(business.FileId.ToString()))); //附件 sb.Append("],"); } sb.Append("]}"); if (businessLogList.Count > 0) { sb.Remove(sb.Length - 3, 1); } return(sb.ToString()); }
public string GetBusinessAttachmentList4Detail(int attachmentType, string bkId) { IList <BusinessAttachmentModel> attachmentList = new List <BusinessAttachmentModel>(); if (bkId != "0") { attachmentList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(attachmentType, UtilsHelper.Decrypt2Int(bkId)); } StringBuilder sb = new StringBuilder(); sb.Insert(0, "{\"data\":["); int count = 0; foreach (var item in attachmentList) { sb.AppendFormat("[\"{0}\"", ++count); sb.AppendFormat(",\"<a href='/SysManage/Attachment/DownLoad?fileId={0}'>{1}</a>\"", UtilsHelper.Encrypt(item.FileId.ToString()), item.FileName); sb.AppendFormat(",\"{0}\"", string.IsNullOrWhiteSpace(item.Remark) ? string.Empty : item.Remark.Replace("\r", "").Replace("\n", "")); sb.Append("],"); } if (attachmentList.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]}"); return(sb.ToString()); }
/// <summary> /// 保存 /// </summary> /// <param name="model"></param> /// <param name="collection"></param> /// <returns></returns> public ActionResult Save(KnowledgesModel model, FormCollection collection) { ServiceProvider.KnowledgesService.Save(model, Request.Files); return(Json(new { Msg = "OK", KnowledgeId = model.KnowledgeId, bkId = UtilsHelper.Encrypt(model.KnowledgeId.ToString()) })); }
/// <summary> /// 知识库明细 /// </summary> /// <param name="knowledgeId"></param> /// <returns></returns> public ActionResult Details(string knowledgeId) { KnowledgesModel model = ServiceProvider.KnowledgesService.GetKnowledgeDetailInfo(UtilsHelper.Decrypt2Int(knowledgeId)); //内容类型 IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll(); Global.Common.Models.ParamModel kType = paramList.SingleOrDefault(m => m.ParamCode.Equals(UtilConstants.SysParamType.KnowledgeType)); ViewBag.KType = kType.itemsList.FirstOrDefault(s => s.ParamItemValue == String.Format("{0}", model.KType)).ParamItemName; //业务附件 StringBuilder sb = new StringBuilder(); sb.Append("["); if (model.swfFileByte != null && model.swfFileByte.Length > 0) { string swfFilePath = "/tempFile/" + Guid.NewGuid().ToString() + ".swf"; ToolsLib.FileService.NormalFile.SaveInfoToFile(model.swfFileByte, swfFilePath); ViewBag.FilePath = swfFilePath; } else { ViewBag.FilePath = ""; } int i = 1; if (model.businessAttachList != null) { foreach (Hashtable item in model.businessAttachList) { sb.Append("["); sb.AppendFormat("\"{0}\"", i++); sb.AppendFormat(",\"<a href='#' onclick='fnDownLoad(this);' data-id='{0}'>{1}</a>\"", UtilsHelper.Encrypt(String.Format("{0}", item["FileId"])), item["FileName"]); sb.Append("],"); } if (model.businessAttachList.Count > 0) { sb.Remove(sb.Length - 1, 1); } } sb.Append("]"); ViewBag.Data = sb.ToString(); return(View(model)); }