| 
									
										
										
										
											2023-05-22 18:45:58 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.IO; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Web; | 
					
						
							|  |  |  |  | using System.Web.UI; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls; | 
					
						
							|  |  |  |  | using Aspose.Words; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Web.Security; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.DocManage | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class DocManageView : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 主键 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public string DocId | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["DocId"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["DocId"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 办理类型 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public string State | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["State"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["State"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-15 10:06:34 +08:00
										 |  |  |  |         private string GetUserNames(string Ids) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string[] arr = Ids.Split(','); | 
					
						
							|  |  |  |  |             var data = Funs.DB.Sys_User.Where(t => arr.Contains(t.UserId)).Select(t => t.UserName).ToList(); | 
					
						
							|  |  |  |  |             if (data.Count > 0) | 
					
						
							|  |  |  |  |                 return string.Join(",", data); | 
					
						
							|  |  |  |  |             return null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-22 18:45:58 +08:00
										 |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 string Type = Request.Params["Type"]; | 
					
						
							|  |  |  |  |                 DocId = Request.Params["DocId"]; | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(DocId)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     hdDocId.Text = DocId; | 
					
						
							|  |  |  |  |                     Model.Doc_DocManage doc = DocManageService.GetDocByDocId(DocId); | 
					
						
							|  |  |  |  |                     txtDocCode.Text = doc.DocCode; | 
					
						
							|  |  |  |  |                     txtDocName.Text = doc.DocName; | 
					
						
							|  |  |  |  |                     txtSendUnit.Text = BLL.UnitService.GetUnitNameByUnitId(doc.SendUnitId); | 
					
						
							|  |  |  |  |                     txtReceivUnit.Text = BLL.UnitService.getUnitNamesUnitIds(doc.ReceivUnitIds); | 
					
						
							|  |  |  |  |                     txtDocType.Text = BLL.DocTypeService.GetDocTypeNameById(doc.DocTypeId); | 
					
						
							|  |  |  |  |                     txtCompileMan.Text = BLL.UserService.GetUserNameByUserId(doc.CompileMan); | 
					
						
							|  |  |  |  |                     txtProSubject.Text = UnitWorkService.GetNameById(doc.ProjectSubjectId); | 
					
						
							|  |  |  |  |                     // txtCNProfessional.Text = BLL.CNProfessionalService.GetCNProfessionalNameById(doc.CNProfessionalId); | 
					
						
							|  |  |  |  |                     //txtDepart.Text=DepartService.getDepartNameById(doc.DepartId); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (doc.CompileDate != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", doc.CompileDate); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     if (doc.FinishTime != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.txtFinishTime.Text = string.Format("{0:yyyy-MM-dd}", doc.FinishTime); | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-09-12 14:39:54 +08:00
										 |  |  |  |                     txtDocContent.Text = HttpUtility.HtmlDecode(doc.DocContent); | 
					
						
							| 
									
										
										
										
											2023-05-22 18:45:58 +08:00
										 |  |  |  |                     if (!string.IsNullOrEmpty(doc.State)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         State = doc.State; | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         State = Const.Doc_State_0; | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2024-10-15 10:06:34 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(doc.CopyMan)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         txtCopyMan.Text = GetUserNames(doc.CopyMan); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-22 18:45:58 +08:00
										 |  |  |  |                     BindGrid(); | 
					
						
							|  |  |  |  |                     if (!string.IsNullOrEmpty(Type) && Type == "notice") | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         var q = DocManageApproveService.GetNoticeDocManageApproveByDocId(DocId, this.CurrUser.UserId); | 
					
						
							|  |  |  |  |                         if (q != null && q.ApproveMan == this.CurrUser.UserId) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             q.ApproveDate = DateTime.Now; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                             DocManageApproveService.UpdateDocManageApprove(q); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var data = DocManageApproveService.GetListData(DocId); | 
					
						
							|  |  |  |  |             gvApprove.DataSource = data; | 
					
						
							|  |  |  |  |             gvApprove.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         protected void imgfile_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(hdDocId.Text))   //新增记录 | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 hdDocId.Text = SQLHelper.GetNewID(typeof(Model.Doc_DocManage)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/DocManage&menuId={1}&type=-1", hdDocId.Text, Const.DocManageMenuId))); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |          //   PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/Fileuploader.aspx?toKeyId={0}&path=FileUpload/DocManage&menuId={1}&type=-1", hdDocId.Text, Const.DocManageMenuId))); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /*        protected void btnPrint_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var model = DocManageService.GetDocByDocId(DocId); | 
					
						
							|  |  |  |  |             if (model.State != Const.Doc_State_2) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ShowNotify("当前状态未闭环无法打印", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             DataTable dt = new DataTable(); | 
					
						
							|  |  |  |  |             dt = DocManageApproveService.GetListData(DocId); | 
					
						
							|  |  |  |  |             if (dt.Columns.Count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 dt.Columns.Add("RoleName", typeof(String)); | 
					
						
							|  |  |  |  |                 dt.Columns.Add("ApproveMan", typeof(String)); | 
					
						
							|  |  |  |  |                 dt.Columns.Add("ApproveDate", typeof(String)); | 
					
						
							|  |  |  |  |                 dt.Columns.Add("ApproveIdea", typeof(String)); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             var keyValuePairs = BLL.DocManageService.GetPairs(DocId); | 
					
						
							|  |  |  |  |             dt.TableName = "Table1"; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             BLL.Common.FastReport.ResetData(); | 
					
						
							|  |  |  |  |             BLL.Common.FastReport.AddFastreportTable(dt); | 
					
						
							|  |  |  |  |             BLL.Common.FastReport.AddFastreportParameter(keyValuePairs); | 
					
						
							|  |  |  |  |             string initTemplatePath = "File/Fastreport/新疆文件管理流转表.frx"; | 
					
						
							|  |  |  |  |             string rootPath = Server.MapPath("~/"); | 
					
						
							|  |  |  |  |             if (File.Exists(rootPath + initTemplatePath)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | */    } | 
					
						
							|  |  |  |  | } |