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 { /// /// 主键 /// public string DocId { get { return (string)ViewState["DocId"]; } set { ViewState["DocId"] = value; } } /// /// 办理类型 /// public string State { get { return (string)ViewState["State"]; } set { ViewState["State"] = value; } } 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); } txtDocContent.Text = HttpUtility.HtmlDecode(doc.DocContent); if (!string.IsNullOrEmpty(doc.State)) { State = doc.State; } else { State = Const.Doc_State_0; } 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))); } } */ } }