using System; using System.Collections.Generic; using System.Web; using BLL; using System.Linq; namespace FineUIPro.Web.ZHGL.Plan { public partial class ActionPlanListView : PageBase { #region 定义项 /// /// 主键 /// public string ActionPlanListId { get { return (string)ViewState["ActionPlanListId"]; } set { ViewState["ActionPlanListId"] = value; } } #endregion #region 加载 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); var q = (from x in Funs.DB.Person_Persons where x.UnitId == Const.UnitId_SEDIN && x.DepartId == Const.Depart_constructionId && x.RoleIds != null && x.RoleIds != Const.NoOfficeRole && x.RoleIds != string.Empty && (!x.IsPost.HasValue || x.IsPost == true) orderby x.PersonName select x).ToList(); this.drpReviewMan.DataTextField = "PersonName"; this.drpReviewMan.DataValueField = "PersonId"; this.drpReviewMan.DataSource = q; this.drpReviewMan.DataBind(); Funs.FineUIPleaseSelect(this.drpReviewMan); this.drpPerson.DataTextField = "PersonName"; this.drpPerson.DataValueField = "PersonId"; this.drpPerson.DataSource = q; this.drpPerson.DataBind(); Funs.FineUIPleaseSelect(this.drpPerson); BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); this.ActionPlanListId = Request.Params["ActionPlanListId"]; if (!string.IsNullOrEmpty(this.ActionPlanListId)) { Model.ActionPlan_ActionPlanList actionPlanList = BLL.ActionPlanListService.GetActionPlanListById(this.ActionPlanListId); if (actionPlanList != null) { ///读取编号 this.txtActionPlanListCode.Text = actionPlanList.ActionPlanListCode; this.txtActionPlanListName.Text = actionPlanList.ActionPlanListName; this.txtVersionNo.Text = actionPlanList.VersionNo; if (!string.IsNullOrEmpty(actionPlanList.ProjectType)) { this.drpProjectType.SelectedValue = actionPlanList.ProjectType; } else { this.drpProjectType.Hidden = true; } this.drpCompileMan.Text = BLL.Person_PersonsService.GetPersonsNameById(actionPlanList.CompileMan); this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", actionPlanList.CompileDate); if (actionPlanList.IsReview == true) { this.rblIsReview.SelectedValue = "True"; this.drpReviewMan.Hidden = false; this.drpReviewMan.SelectedValue = actionPlanList.ReviewMan; } else { this.rblIsReview.SelectedValue = "False"; this.drpPerson.Hidden = true; } if (!string.IsNullOrEmpty(actionPlanList.ProjectId)) { this.drpProject.SelectedValue = actionPlanList.ProjectId; } List list2 = BLL.ActionPlanListApproveService.GetReviewingPersonIds(this.ActionPlanListId); if (list2.Count > 0) { this.drpPerson.SelectedValueArray = list2.ToArray(); } if (actionPlanList.IsCompanyReview != null) { rblIsCompanyReview.Hidden = false; if (actionPlanList.IsCompanyReview == true) { rblIsCompanyReview.SelectedValue = "True"; } else { rblIsCompanyReview.SelectedValue = "False"; } } var list = ActionPlanListApproveService.getListData(ActionPlanListId); gvApprove.DataSource = list; gvApprove.DataBind(); WindowAtt_Close(null, null); } } } } public string man(Object man) { string appman = string.Empty; if (Person_PersonsService.GetPerson_PersonsById(man.ToString()) != null) { appman = Person_PersonsService.GetPerson_PersonsById(man.ToString()).PersonName; } return appman; } /// /// 设置树的节点选择 /// /// /// private void SetCheck(Tree tree, List userIds) { foreach (TreeNode tn in tree.Nodes[0].Nodes) { if (userIds.Contains(tn.NodeID)) { tn.Checked = true; } } } #endregion #region 附件上传 /// /// 上传附件 /// /// /// protected void btnAttachUrl_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.ActionPlanListId)) { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ActionPlanListAttachUrl&menuId={1}&type=-1", this.ActionPlanListId, BLL.Const.ProjectActionPlanListMenuId))); } } #endregion protected void gvApprove_RowCommand(object sender, GridCommandEventArgs e) { object[] keys = gvApprove.DataKeys[e.RowIndex]; string fileId = string.Empty; if (keys == null) { return; } else { fileId = keys[0].ToString(); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference( String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/ActionPlanListAttachUrl&menuId={2}", -1, fileId, Const.ProjectActionPlanListMenuId))); } protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) { this.divC.InnerHtml = string.Empty; var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.ActionPlanListId); if (getAtt != null) { this.divC.InnerHtml = UploadAttachmentService.ShowAttachment("../../", getAtt.AttachUrl); } else { this.trAtt.Hidden = true; } } } }