public object DeleteFileType(string content,string userid) { IDbTransaction tran = Utility.Database.BeginDbTransaction(); try { B_OA_FileType fileType = JsonConvert.DeserializeObject<B_OA_FileType>(content); B_OA_SendDoc_ZhiDui sendDoc = new B_OA_SendDoc_ZhiDui(); sendDoc.Condition.Add("fwlxId=" + fileType.FileTypeId); List<B_OA_SendDoc_ZhiDui> listSend = Utility.Database.QueryList<B_OA_SendDoc_ZhiDui>(sendDoc, tran); if (listSend.Count > 0) { throw (new Exception("删除失败!此文件类别下还包含有其它发文,无法删除!")); } else { fileType.Condition.Add("FileTypeId =" + fileType.FileTypeId); Utility.Database.Delete(fileType, tran); } Utility.Database.Commit(tran); return Utility.JsonMsg(true, "删除成功!"); } catch (Exception ex) { ComBase.Logger(ex); throw (new Exception("获取数据失败!", ex)); } }
public object GetData(string userid, string caseId, string baid) { try { //只有待办箱才有设置为已读 if (!String.IsNullOrEmpty(baid)) engineAPI.SetIsReaded(caseId, baid, userid); B_OA_SendDoc_ZhiDui en = new B_OA_SendDoc_ZhiDui(); en.Condition.Add("caseid=" + caseId); B_OA_SendDoc_ZhiDui sendDocBaseInfo = Utility.Database.QueryObject<B_OA_SendDoc_ZhiDui>(en); if (sendDocBaseInfo == null) { var baseInfo = new B_OA_SendDoc_ZhiDui(); baseInfo.fwrq = DateTime.Now; baseInfo.dzy = ComClass.GetUserInfo(userid).CnName; //baseInfo.gklx = "1";//公开类型默认为主动公开 sendDocBaseInfo = baseInfo; } return new { sendDocBaseInfo = sendDocBaseInfo }; } catch (Exception ex) { ComBase.Logger(ex); throw (new Exception("获取数据失败!", ex)); } }
/// <summary> /// 创建一个Word数据 /// </summary> /// <param name="caseid"></param> /// <returns></returns> private Dictionary<string, Object> CreateWordSendDocData(string caseid, IDbTransaction tran, string fwzh) { B_OA_SendDoc_ZhiDui boacd = new B_OA_SendDoc_ZhiDui(); boacd.Condition.Add("caseid = " + caseid);//设置查询条件 boacd = Utility.Database.QueryObject<B_OA_SendDoc_ZhiDui>(boacd); FX_WorkFlowBusAct wfba = new FX_WorkFlowBusAct(); wfba.Condition.Add("CaseID = " + caseid);//设置查询条件 List<FX_WorkFlowBusAct> wfbaList = Utility.Database.QueryList(wfba); var boacdmjsql = @"select a.csz as id, a.mc as mc from Para_BizTypeItem a , Para_BizTypeDictionary b where a.flid = b.id and b.lx = 'mjTypeDic' and a.csz =" + boacd.mj; DataSet boacdmjds = Utility.Database.ExcuteDataSet(boacdmjsql); // 发文 Dictionary<string, Object> dict = new Dictionary<string, Object>(); dict.Add("fwzh", fwzh); dict.Add("fwlx", boacd.fwlx == "" ? "" : boacd.fwlx);//发文类型 dict.Add("mj", boacdmjds.Tables.Count > 0 ? (boacdmjds.Tables[0].Rows.Count > 0 ? boacdmjds.Tables[0].Rows[0]["mc"] : "") : ""); //密级 //处理显示名称 dict.Add("ys", boacd.ys == "" ? "" : boacd.ys);//印数 DataSet gkcdgkcdds = new DataSet(); var gkcdgkcdsql = ""; if (boacd.gkcd != null) { gkcdgkcdsql = @"select a.csz as id, a.mc as mc from Para_BizTypeItem a , Para_BizTypeDictionary b where a.flid = b.id and b.lx = 'gkcdTypeDic' and a.csz =" + boacd.gkcd; gkcdgkcdds = Utility.Database.ExcuteDataSet(gkcdgkcdsql); dict.Add("gkcd", gkcdgkcdds.Tables.Count > 0 ? (gkcdgkcdds.Tables[0].Rows.Count > 0 ? gkcdgkcdds.Tables[0].Rows[0]["mc"] : "") : ""); //公开程度 } else { dict.Add("gkcd", ""); //公开程度 } dict.Add("wjbt", boacd.wjbt == "" ? "" : boacd.wjbt);//文件标题 dict.Add("zs", boacd.zs == "" ? "" : boacd.zs);//主送 dict.Add("cb", boacd.cb == "" ? "" : boacd.cb);//抄报 dict.Add("cs", boacd.cs == "" ? "" : boacd.cs);//抄送 dict.Add("ztc", boacd.ztc == "" ? "" : boacd.ztc);// 主题词 dict.Add("zbbm", boacd.zbbm == "" ? "" : boacd.zbbm);//主办部门 dict.Add("jd", boacd.jd == "" ? "" : boacd.jd);//校对 dict.Add("dzy", boacd.dzy == "" ? "" : boacd.dzy);// 打字员 dict.Add("bz", boacd.bz == "" ? "" : boacd.bz);//备注 dict.Add("yx", boacd.yx == "" ? "" : boacd.yx);//一校 dict.Add("ex", boacd.ex == "" ? "" : boacd.ex);//二校 string gklx = boacd.gklx;//公开类型 switch (gklx) { case "1": dict.Add("gklx1", "√"); break; case "2": dict.Add("gklx2", "√"); break; case "3": dict.Add("gklx3", "√"); break; } dict.Add("printTime", DateTime.Now.ToLongDateString());// 打印日期 DataTable dataTable = CommonFunctional.GetUserNameAndDepartNameByActId(caseid, "A002", tran); if (dataTable.Rows.Count > 0) { string name = dataTable.Rows[0][1] + " " + dataTable.Rows[0][0]; dict.Add("ngr", name);// 拟稿人 } #region //获取所有评阅意见 FX_WorkFlowBusAct work = new FX_WorkFlowBusAct(); work.Condition.Add("CaseID = " + caseid); work.OrderInfo = "ReceDate asc"; List<FX_WorkFlowBusAct> listWork = Utility.Database.QueryList<FX_WorkFlowBusAct>(work, tran); //将所有工作流信息格式化 List<B_OA_PrintParagragh> listPara = CommonFunctional.ChangeListToMatch(listWork); List<B_OA_PrintParagragh> ngbmfzrhgList = new List<B_OA_PrintParagragh>(); List<B_OA_PrintParagragh> bgshgList = new List<B_OA_PrintParagragh>(); List<B_OA_PrintParagragh> fgldshList = new List<B_OA_PrintParagragh>(); List<B_OA_PrintParagragh> qfList = new List<B_OA_PrintParagragh>(); for (int i = 0; i < listPara.Count; i++) { // 拟稿部门负责人核稿 if (listPara[i].ActID == "A002") { ngbmfzrhgList.Add(listPara[i]); } //分管领导审核意见 else if (listPara[i].ActID == "A003") { fgldshList.Add(listPara[i]); } //办公室核稿 else if (listPara[i].ActID == "A004") { bgshgList.Add(listPara[i]); }//签发 else if (listPara[i].ActID == "A005") { qfList.Add(listPara[i]); } } int k = 0; //拟稿部门负责人 var imgNgbmfzrhgList = new OpenXmlHelper.ImageTextArray[ngbmfzrhgList.Count]; for (k = 0; k < ngbmfzrhgList.Count; k++) { imgNgbmfzrhgList[k] = new OpenXmlHelper.ImageTextArray(); imgNgbmfzrhgList[k].Images = ngbmfzrhgList[k].Image; imgNgbmfzrhgList[k].Text = ngbmfzrhgList[k].Text; imgNgbmfzrhgList[k].Foots = ngbmfzrhgList[k].Foots; imgNgbmfzrhgList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("ngbmfzrhg", imgNgbmfzrhgList); //分管领导审核意见 var imgFgldshList = new OpenXmlHelper.ImageTextArray[fgldshList.Count]; for (k = 0; k < fgldshList.Count; k++) { imgFgldshList[k] = new OpenXmlHelper.ImageTextArray(); imgFgldshList[k].Images = fgldshList[k].Image; imgFgldshList[k].Text = fgldshList[k].Text; imgFgldshList[k].Foots = fgldshList[k].Foots; imgFgldshList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("fgldsh", imgFgldshList); //办公室核稿 var imgBgshgList = new OpenXmlHelper.ImageTextArray[bgshgList.Count]; for (k = 0; k < fgldshList.Count; k++) { imgBgshgList[k] = new OpenXmlHelper.ImageTextArray(); imgBgshgList[k].Images = bgshgList[k].Image; imgBgshgList[k].Text = bgshgList[k].Text; imgBgshgList[k].Foots = bgshgList[k].Foots; imgBgshgList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("bgshg", imgBgshgList); //签发 var imgQfList = new OpenXmlHelper.ImageTextArray[qfList.Count]; for (k = 0; k < fgldshList.Count; k++) { imgQfList[k] = new OpenXmlHelper.ImageTextArray(); imgQfList[k].Images = qfList[k].Image; imgQfList[k].Text = qfList[k].Text; imgQfList[k].Foots = qfList[k].Foots; imgQfList[k].FootAlign = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Right; } dict.Add("qf", imgQfList); #endregion return dict; }
public string PrintSendDocContent(string content, string userid) { IDbTransaction tran = Utility.Database.BeginDbTransaction(); SkyLandDeveloper developer = new SkyLandDeveloper("{}", userid, tran); try { string rootPath = HttpContext.Current.Server.MapPath("/"); rootPath = rootPath.Replace("\\", "/"); dynamic jdata = JValue.Parse(content); string fwrqString = jdata["fwrqString"];//fwrqString string printType = jdata["printType"];//printType string caseid = jdata["caseid"]; string fwzh = jdata["fwzh"]; string strFileName = "发文正文_"; strFileName += DateTime.Now.ToString("yyyyMMddHHmmss") + "_temporary"; strFileName += ".docx"; string targetpath = rootPath + "officeFile/SendDocContent/" + strFileName; string savePath = "officeFile/SendDocContent/" + strFileName; string realFileName = ""; switch (printType) { case "1": realFileName = "officeFileModel/SendZhiDui/南宁市环境监察支队文件中红头.docx"; break; case "2": realFileName = "officeFileModel/SendZhiDui/南宁市环境监察支队小红头.docx"; break; } //选择模版,将模版复制出一份 //通过caseid查找发文,并将字号贴上 B_OA_SendDoc_ZhiDui sendDoc = new B_OA_SendDoc_ZhiDui(); sendDoc.Condition.Add("caseid=" + caseid); sendDoc = Utility.Database.QueryObject(sendDoc, tran); Dictionary<string, Object> dict = new Dictionary<string, Object>(); dict.Add("fwzh", fwzh == "" ? "" : fwzh);//发文字号 realFileName = rootPath + realFileName; //将字号赋到文档的相应位置 IWorkFlow.OfficeService.IWorkFlowOfficeHandler.ProduceWord2007UP(realFileName, targetpath, dict); //获取正文的路径 B_Common_CreateDoc createDoc = new B_Common_CreateDoc(); createDoc.Condition.Add("caseid=" + caseid); createDoc.Condition.Add("docType=" + "mainBody"); createDoc = Utility.Database.QueryObject(createDoc, tran); if (createDoc == null) { return Utility.JsonMsg(false, "选择模版失败:此发文未生成过正文,请编辑正文后再选择模版!"); } string fileName = createDoc.filename.Replace("#", "/"); string filePath = rootPath + fileName; if (!File.Exists(filePath)) { developer.RollBack(); return Utility.JsonMsg(false, "此模版路径不存在,无法套红"); } //删除旧的套红过的源数据 B_Common_CreateDoc delDoc = new B_Common_CreateDoc(); delDoc.Condition.Add("caseid = " + caseid); delDoc.Condition.Add("type = " + "SendDocZhiDui"); delDoc.Condition.Add("docType = " + "redCover"); delDoc = Utility.Database.QueryObject<B_Common_CreateDoc>(delDoc); if (delDoc != null) { delDoc.Condition.Add("id =" + delDoc.id); Utility.Database.Delete(delDoc, tran); } //存入新的套红模版路径 B_Common_CreateDoc redCover = new B_Common_CreateDoc(); redCover.caseid = caseid; redCover.type = "SendDocZhiDui"; redCover.filename = savePath.Replace("/", "#"); redCover.createdate = DateTime.Now; redCover.createman = userid; redCover.docType = "redCover"; Utility.Database.Insert(redCover, tran); //将发文的正文路径 GetDataModel dataModel = new GetDataModel(); dataModel.mainBodyPath = rootPath + createDoc.filename.Replace("#", "/"); dataModel.redCoverPath = rootPath + redCover.filename.Replace("#", "/"); Utility.Database.Commit(tran); return JsonConvert.SerializeObject( dataModel); } catch (Exception ex) { developer.RollBack(); ComBase.Logger(ex); return Utility.JsonMsg(false, "选择模版失败:" + ex.Message.Replace(":", " ")); } }