216 lines
8.8 KiB
C#
216 lines
8.8 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.ZHGL.Plan
|
|
{
|
|
public partial class MainContractView : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string MainContractId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["MainContractId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["MainContractId"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 项目主键
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 定义会签意见集合
|
|
/// </summary>
|
|
public static List<Model.ActionPlan_MainContractApprove> approves = new List<Model.ActionPlan_MainContractApprove>();
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
this.MainContractId = Request.Params["MainContractId"];
|
|
ProjectService.InitAllProjectDropDownList(this.drpProject, true);
|
|
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();
|
|
Model.ActionPlan_MainContract MainContract = BLL.MainContractService.GetMainContractById(this.MainContractId);
|
|
if (MainContract != null)
|
|
{
|
|
var compileMan = BLL.Person_PersonsService.GetPerson_PersonsById(MainContract.CompileMan);
|
|
if (compileMan != null)
|
|
{
|
|
q.Add(compileMan);
|
|
}
|
|
}
|
|
this.drpCompileMan.DataTextField = "PersonName";
|
|
this.drpCompileMan.DataValueField = "PersonId";
|
|
this.drpCompileMan.DataSource = q;
|
|
this.drpCompileMan.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpCompileMan);
|
|
this.drpPerson.DataTextField = "PersonName";
|
|
this.drpPerson.DataValueField = "PersonId";
|
|
this.drpPerson.DataSource = q;
|
|
this.drpPerson.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpPerson);
|
|
if (!string.IsNullOrEmpty(this.MainContractId))
|
|
{
|
|
if (MainContract != null)
|
|
{
|
|
HFMainContractId.Text = this.MainContractId;
|
|
this.ProjectId = MainContract.ProjectId;
|
|
if (MainContract.Edition != null)
|
|
{
|
|
txtEdition.Text = MainContract.Edition.ToString();
|
|
}
|
|
///读取编号
|
|
this.txtMainContractCode.Text = MainContract.MainContractCode;
|
|
this.txtMainContractName.Text = MainContract.MainContractName;
|
|
this.drpProject.SelectedValue = MainContract.ProjectId;
|
|
this.txtVersionNo.Text = MainContract.VersionNo;
|
|
if (!string.IsNullOrEmpty(MainContract.ProjectType))
|
|
{
|
|
this.drpProjectType.SelectedValue = MainContract.ProjectType;
|
|
}
|
|
else
|
|
{
|
|
this.drpProjectType.Hidden = true;
|
|
}
|
|
if (!string.IsNullOrEmpty(MainContract.CompileMan))
|
|
{
|
|
this.drpCompileMan.SelectedValue = MainContract.CompileMan;
|
|
}
|
|
if (MainContract.CompileDate != null)
|
|
{
|
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", MainContract.CompileDate);
|
|
}
|
|
List<string> list = BLL.MainContractApproveService.GetReviewingPersonIds(this.MainContractId);
|
|
if (list.Count > 0)
|
|
{
|
|
this.drpPerson.SelectedValueArray = list.ToArray();
|
|
}
|
|
bindApprove();
|
|
}
|
|
WindowAtt_Close(null, null);
|
|
}
|
|
else
|
|
{
|
|
this.drpCompileMan.SelectedValue = this.CurrUser.PersonId;
|
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
this.trAtt.Hidden = true;
|
|
txtEdition.Text = "0";
|
|
plApprove2.Hidden = true;
|
|
////自动生成编码
|
|
this.txtMainContractCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.OfficeMainContractMenuId, this.ProjectId, this.CurrUser.UnitId);
|
|
this.txtMainContractName.Text = this.SimpleForm1.Title;
|
|
this.txtVersionNo.Text = "V1.0";
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 审批列表
|
|
/// </summary>
|
|
private void bindApprove()
|
|
{
|
|
var list = MainContractOpinionService.getListData(MainContractId, null);
|
|
gvApprove.DataSource = list;
|
|
gvApprove.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 上传附件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(HFMainContractId.Text)) //新增记录
|
|
{
|
|
HFMainContractId.Text = SQLHelper.GetNewID(typeof(Model.ActionPlan_MainContract));
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/MainContractAttachUrl&menuId={1}&type=-1", HFMainContractId.Text, BLL.Const.OfficeMainContractMenuId)));
|
|
}
|
|
|
|
protected void btnapprove_Click(object sender, EventArgs e)
|
|
{
|
|
//HFConstructSolutionId.Text
|
|
var approve = MainContractApproveService.GetMainContractApproveByApproveMan(HFMainContractId.Text, CurrUser.PersonId);
|
|
if (approve != null)
|
|
{
|
|
var approveId = approve.MainContractApproveId;
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
|
|
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/MainContractAttachUrl&menuId={2}",
|
|
0, approveId, Const.OfficeMainContractMenuId)));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
this.divC.InnerHtml = string.Empty;
|
|
var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == HFMainContractId.Text);
|
|
if (getAtt != null)
|
|
{
|
|
this.divC.InnerHtml = UploadAttachmentService.ShowAttachment("../../", getAtt.AttachUrl);
|
|
}
|
|
else
|
|
{
|
|
this.trAtt.Hidden = true;
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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/MainContractAttachUrl&menuId={2}",
|
|
-1, fileId, Const.OfficeMainContractMenuId)));
|
|
}
|
|
}
|
|
} |