private void SaveSelect() { string SelectIDList = Common.Session.GetSession("SelectIDList"); if (!String.IsNullOrEmpty(SelectIDList)) { BLL.T_CellTmp_BLL bll1 = new DigiPower.Onlinecol.Standard.BLL.T_CellTmp_BLL(); //BLL.T_FileListTmp_CellRptTmp_BLL bll2 = new DigiPower.Onlinecol.Standard.BLL.T_FileListTmp_CellRptTmp_BLL(); BLL.T_EFile_BLL bll2 = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL(); foreach (string CellReportID in SelectIDList.Split(',')) { //if (CellReportID != "" && !bll2.Exists("FileListID=" + ID + " AND CellFilePath='" + CellReportID + "'")) //{ Model.T_CellTmp_MDL mdl = bll1.GetModel(Common.ConvertEx.ToInt(CellReportID)); if (mdl != null) { Model.T_EFile_MDL mdl2 = new DigiPower.Onlinecol.Standard.Model.T_EFile_MDL(); mdl2.FileType = 1; mdl2.Title = mdl.Title; mdl2.FilePath = Common.ConvertEx.ToString(mdl.CellID); mdl2.Status = 0; mdl2.OrderIndex = Common.ConvertEx.ToInt(mdl.OrderIndex); mdl2.FileListID = Common.ConvertEx.ToInt(ID); mdl2.RootPath = Common.Common.EFileStartPath; bll2.Add(mdl2); } //} } Session["SelectIDList"] = null; } }
/// <summary> /// 合并PDF /// </summary> private void MergerPdf() { ArrayList list = new ArrayList(); BLL.T_EFile_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL(); DataSet ds = bll.GetList("FileListID = " + ID + " and FileType = 1 order by OrderIndex"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { list.Add(PdfPath + ds.Tables[0].Rows[i]["PDFFilePath"].ToString()); } } DataSet ds1 = bll.GetList("FileListID = " + ID + " and FileType = 0 order by OrderIndex"); if (ds1 != null && ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { list.Add(PdfPath + ds1.Tables[0].Rows[i]["PDFFilePath"].ToString()); } } string[] newMPDF = new string[list.Count]; if (newMPDF != null && newMPDF.Length > 0) { for (int i = 0; i < newMPDF.Length; i++) { newMPDF[i] = list[i].ToString(); } } if (newMPDF != null && newMPDF.Length > 0) { //if (System.IO.Directory.Exists(MPdfPath)) //{ // System.IO.Directory.Delete(MPdfPath, true); // System.IO.Directory.CreateDirectory(MPdfPath); //} ////更新目录合并PDF信息 //DigiPower.Onlinecol.Standard.BLL.T_FileList_BLL tbll = new DigiPower.Onlinecol.Standard.BLL.T_FileList_BLL(); //DigiPower.Onlinecol.Standard.Model.T_FileList_MDL tmodel = tbll.GetModel(Common.ConvertEx.ToInt(ID)); //tmodel.PDFFilePath = NewGUID + ".pdf"; //Common.PrintToPDF pdfTool = new DigiPower.Onlinecol.Standard.Common.PrintToPDF(ProNo); //tmodel.PagesCount = pdfTool.GetPDFCount(MPdfPath + "\\" + NewGUID + ".pdf"); //tbll.Update(tmodel); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //protected void btnAdd_Click(object sender, EventArgs e) //{ // if (ctrlGridEx2.GetSelects().Count > 0) // { // List<string> liSel = ctrlGridEx2.GetSelects(); // if (liSel != null && liSel.Count > 0) // { // for (int i = 0; i < liSel.Count; i++) // { // string newGuid = Guid.NewGuid().ToString(); // DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL(); // DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model = new DigiPower.Onlinecol.Standard.Model.T_EFile_MDL(); // model = bll.GetModel(Common.ConvertEx.ToInt(liSel[i])); // //复制数据 // //新原始文件路径 // string NewFilePath = model.FilePath.Substring(0, model.FilePath.LastIndexOf('\\') + 1); // NewFilePath = NewFilePath + newGuid + ".cll"; // //新PDF文件路径 // string NewPDFFilePath = model.PDFFilePath.Substring(0, model.PDFFilePath.LastIndexOf('\\') + 1); // NewPDFFilePath = NewPDFFilePath + newGuid + ".pdf"; // model.OrderIndex = GetMaxOrder(); // //model.OrderIndex + 1; // //复制表格 // if (System.IO.File.Exists(OPath + model.FilePath)) // { // System.IO.File.Copy(OPath + model.FilePath, OPath + NewFilePath); // } // //复制PDF // if (System.IO.File.Exists(PdfPath + model.PDFFilePath)) // { // System.IO.File.Copy(PdfPath + model.PDFFilePath, PdfPath + NewPDFFilePath); // } // model.FilePath = newGuid + ".cll"; // model.PDFFilePath = newGuid + ".pdf"; // bll.Add(model); // } // MergerPdf(); // BindGridView(); // } // } //} /// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL(); //if (ctrlGridEx1.GetSelects().Count > 0) //{ // for (int i = 0; i < ctrlGridEx1.GetSelects().Count; i++) // { // DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model = new DigiPower.Onlinecol.Standard.Model.T_EFile_MDL(); // model = bll.GetModel(Convert.ToInt32(ctrlGridEx1.GetSelects()[0])); // //删除电子文件记录 // bll.Delete(Convert.ToInt32(ctrlGridEx1.GetSelects()[0])); // try // { // //删除电子文件 // System.IO.File.Delete(PdfPath + model.PDFFilePath); // } // catch { } // //重新合并 // MergerPdf(); // } // this.BindGridView(); //} //if (ctrlGridEx2.GetSelects().Count > 0) //{ // for (int i = 0; i < ctrlGridEx2.GetSelects().Count; i++) // { // DigiPower.Onlinecol.Standard.Model.T_EFile_MDL model = new DigiPower.Onlinecol.Standard.Model.T_EFile_MDL(); // model = bll.GetModel(Convert.ToInt32(ctrlGridEx2.GetSelects()[i])); // //删除电子文件记录 // bll.Delete(Convert.ToInt32(ctrlGridEx2.GetSelects()[i])); // if (System.IO.File.Exists(PdfPath + model.PDFFilePath)) // { // //删除电子文件 // System.IO.File.Delete(PdfPath + model.PDFFilePath); // //重新合并 // MergerPdf(); // } // } // this.BindGridView(); //} }
private int GetMaxOrder() { int MaxOrderIndex = 1; BLL.T_EFile_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL(); DataSet ds = new DataSet(); ds = bll.GetList("1=1" + " and FileListID = " + ID + " and FileType = 1 order by OrderIndex desc"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { MaxOrderIndex = Common.ConvertEx.ToInt(ds.Tables[0].Rows[0]["OrderIndex"].ToString()) + 1; } return(MaxOrderIndex); }
//string EFileStartPath = Common.Common.EFileStartPath; protected void Page_Load(object sender, EventArgs e) { StartPath = Common.Common.EFileStartPath.Remove(0, 2).Replace('\\', '/'); if (!this.IsPostBack) { MyAddInit(); SingleProjectID = Request.QueryString["ProNo"]; BLL.T_EFile_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_EFile_BLL(); Model.T_EFile_MDL efileMDL = new DigiPower.Onlinecol.Standard.Model.T_EFile_MDL(); efileMDL = bll.GetModel(Common.ConvertEx.ToInt(ID)); if (efileMDL != null) { FileListID = efileMDL.FileListID; ArchiveListCellRptID = efileMDL.ArchiveListCellRptID;//给前面用的 //T_SingleProject_MDL SingProMdl = new T_SingleProject_BLL().GetModel(Common.ConvertEx.ToInt(SingleProjectID)); //T_Construction_Project_MDL ConProMdl = new T_Construction_Project_BLL().GetModel(Common.ConvertEx.ToInt(SingProMdl.ConstructionProjectID)); //if (ConProMdl != null) //{ // CompanyID = Common.ConvertEx.ToString(ConProMdl.CompanyID); // ConstructionProjectID = Common.ConvertEx.ToString(ConProMdl.ConstructionProjectID); //} //判断,如果华表是第一次则根据华表模板的路径读取华表 //否则直接读取电子文件的FilePath if (Common.ConvertEx.ToInt(efileMDL.Status) == 0) { T_CellTmp_MDL ctMdl = new T_CellTmp_BLL().GetModel(Common.ConvertEx.ToInt(efileMDL.FilePath)); cellFilePath = "http://" + Request.ServerVariables["HTTP_HOST"] + "/" + ctMdl.FilePath.Substring(1).Replace(@"\", @"/"); //华表模板路径 string tempFileID = Guid.NewGuid().ToString() + ".cll"; //string cellPath = Server.MapPath(string.Concat(StartPath,"CellEFile/" //CreateDirectory(StartPath + "CellEFile/" + + "/", true); CreateDirectory(string.Concat(StartPath, "/", SingleProjectID, "/CellEFile/"), true); NewCellFilePath = string.Concat("/CellEFile/", tempFileID); //新华表存储路径 NewCellFullFilePath = string.Concat(StartPath, SingleProjectID, "/CellEFile/", tempFileID); //新华表存储路径 } else if (Common.ConvertEx.ToInt(efileMDL.Status) == 1) { if (System.IO.File.Exists(Server.MapPath(string.Concat(StartPath, SingleProjectID, "/", efileMDL.FilePath)))) { //Leo 存了绝对路径。等easyPDF好了,再回来来决定 cellFilePath = "http://" + Request.ServerVariables["HTTP_HOST"] + string.Concat(StartPath, SingleProjectID, "/", efileMDL.FilePath); NewCellFilePath = efileMDL.FilePath; NewCellFullFilePath = string.Concat(StartPath, SingleProjectID, "/", efileMDL.FilePath); } } try { string Action = Request.QueryString["Action"]; if (Action == "Show") { T_CellTmp_MDL ctMdl = new T_CellTmp_BLL().GetModel(Common.ConvertEx.ToInt(ID)); cellFilePath = "http://" + Request.ServerVariables["HTTP_HOST"] + "/" + ctMdl.FilePath.Substring(1).Replace(@"\", @"/"); CompanyID = "10"; ConstructionProjectID = "10"; return; } } catch { } T_SingleProject_MDL SingProMdl = new T_SingleProject_BLL().GetModel(Common.ConvertEx.ToInt(SingleProjectID)); T_Construction_Project_MDL ConProMdl = new T_Construction_Project_BLL().GetModel(Common.ConvertEx.ToInt(SingProMdl.ConstructionProjectID)); if (ConProMdl != null) { CompanyID = Common.ConvertEx.ToString(ConProMdl.CompanyID); ConstructionProjectID = Common.ConvertEx.ToString(ConProMdl.ConstructionProjectID); } } } }