222 lines
9.9 KiB
C#
222 lines
9.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Specialized;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.Design
|
|
{
|
|
public partial class DesignInputPlan : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
BLL.Sys_UserService.InitUserDropDownList(this.drpIssuedMan, true);//提出人
|
|
BLL.Sys_UserService.InitUserDropDownList(this.drpReceivedMan, true);// 接收人
|
|
|
|
string designInputId = Request.Params["designInputId"];
|
|
if (!string.IsNullOrEmpty(designInputId))
|
|
{
|
|
|
|
var input = BLL.DesignInputService.GetDesignInputById(designInputId);
|
|
var project = BLL.EProjectService.GeteProjectById(input.EProjectId);
|
|
|
|
txtDesignInputName.Text = input.DesignInputChName + " " + input.DesignInputEnName;
|
|
txtDesignInputNo.Text = input.DesignInputNo;
|
|
txtIssuedDiscipline.Text = input.IssuedDiscipline;
|
|
txtReceivedDiscipline.Text = input.ReceivedDiscipline;
|
|
if (!string.IsNullOrEmpty(input.IssuedMan))
|
|
{
|
|
drpIssuedMan.SelectedValue = input.IssuedMan;
|
|
|
|
}
|
|
else
|
|
{
|
|
if (project != null)
|
|
{
|
|
if (input.IssuedDiscipline.Contains("Process") || input.IssuedDiscipline.Contains("Piping")) //工艺及配管
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Process))
|
|
{
|
|
drpIssuedMan.SelectedValue = project.ProjectControl_CI_Process;
|
|
}
|
|
}
|
|
if (input.IssuedDiscipline.Contains("Equipment")) //设备
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Equipment))
|
|
{
|
|
drpIssuedMan.SelectedValue = project.ProjectControl_CI_Equipment;
|
|
}
|
|
}
|
|
if (input.IssuedDiscipline.Contains("Instrument")) //仪表
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Instrument))
|
|
{
|
|
drpIssuedMan.SelectedValue = project.ProjectControl_CI_Instrument;
|
|
}
|
|
}
|
|
if (input.IssuedDiscipline.Contains("Electrical")) //电力
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Electrical))
|
|
{
|
|
drpIssuedMan.SelectedValue = project.ProjectControl_CI_Electrical;
|
|
}
|
|
}
|
|
if (input.IssuedDiscipline.Contains("PM")) //项目经理
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_ProjectManager))
|
|
{
|
|
drpIssuedMan.SelectedValue = project.ProjectControl_ProjectManager;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(input.ReceivedMan))
|
|
{
|
|
drpReceivedMan.SelectedValue = input.ReceivedMan;
|
|
}
|
|
else
|
|
{
|
|
if (project != null)
|
|
{
|
|
if (input.ReceivedDiscipline.Contains("Process") || input.ReceivedDiscipline.Contains("Piping")) //工艺及配管
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Process))
|
|
{
|
|
drpReceivedMan.SelectedValue = project.ProjectControl_CI_Process;
|
|
}
|
|
}
|
|
if (input.ReceivedDiscipline.Contains("Equipment")) //设备
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Equipment))
|
|
{
|
|
drpReceivedMan.SelectedValue = project.ProjectControl_CI_Equipment;
|
|
}
|
|
}
|
|
if (input.ReceivedDiscipline.Contains("Instrument")) //仪表
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Instrument))
|
|
{
|
|
drpReceivedMan.SelectedValue = project.ProjectControl_CI_Instrument;
|
|
}
|
|
}
|
|
if (input.ReceivedDiscipline.Contains("Electrical")) //电力
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_CI_Electrical))
|
|
{
|
|
drpReceivedMan.SelectedValue = project.ProjectControl_CI_Electrical;
|
|
}
|
|
}
|
|
if (input.ReceivedDiscipline.Contains("PM")) //项目经理
|
|
{
|
|
if (!string.IsNullOrEmpty(project.ProjectControl_ProjectManager))
|
|
{
|
|
drpReceivedMan.SelectedValue = project.ProjectControl_ProjectManager;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (input.PlanStartDate.HasValue)
|
|
{
|
|
this.txtPlanStartDate.Text = string.Format("{0:yyyy-MM-dd}", (input.PlanStartDate));
|
|
}
|
|
if (input.PlanEndDate.HasValue)
|
|
{
|
|
this.txtPlanEndDate.Text = string.Format("{0:yyyy-MM-dd}", (input.PlanEndDate));
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
string designInputId = Request.Params["designInputId"];
|
|
string issuedMan = null;
|
|
string receivedMan = null;
|
|
DateTime? planStartDate = null;
|
|
DateTime? planEndDate = null;
|
|
var notice = from x in BLL.Funs.DB.Design_Notice where x.DesignInputId == designInputId select x;
|
|
|
|
if (notice.Count() > 0)
|
|
{
|
|
Alert.ShowInTop("已创建了通知单不能修改!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
if (drpIssuedMan.SelectedValue != BLL.Const._Null)
|
|
{
|
|
issuedMan = drpIssuedMan.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择提出人!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
if (drpReceivedMan.SelectedValue != BLL.Const._Null)
|
|
{
|
|
receivedMan = drpReceivedMan.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择接收人!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(txtPlanStartDate.Text))
|
|
{
|
|
planStartDate = Convert.ToDateTime(txtPlanStartDate.Text);
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择计划开始日期!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(txtPlanEndDate.Text))
|
|
{
|
|
planEndDate = Convert.ToDateTime(txtPlanEndDate.Text);
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择计划结束日期!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
BLL.DesignInputService.UpdateDesignInputPlan(designInputId, issuedMan, receivedMan, planStartDate, planEndDate);
|
|
|
|
#region 邮件发送提出人
|
|
|
|
var input = BLL.DesignInputService.GetDesignInputById(designInputId);
|
|
var project = BLL.EProjectService.GeteProjectById(input.EProjectId);
|
|
if (input != null)
|
|
{
|
|
NameValueCollection nameValue = new NameValueCollection();
|
|
nameValue.Add("projectNo", project.ProjectControl_JobNo);
|
|
nameValue.Add("IssuedDiscOrNo", project.ProjectControl_JobNo + "-" + project.ProjectControl_JobTitle + "," + input.DesignInputChName + " " + input.DesignInputEnName + " " + input.DesignInputNo);
|
|
nameValue.Add("Person_Ch", CurrUser.ChineseName);
|
|
nameValue.Add("Person_En", CurrUser.UserName);
|
|
if (!string.IsNullOrEmpty(issuedMan))
|
|
{
|
|
Model.Sys_User sys_User = new Model.Sys_User();
|
|
sys_User = BLL.Sys_UserService.GetUsersByUserId(issuedMan);
|
|
nameValue.Add("UserName", sys_User.UserName);
|
|
List<Model.Sys_User> list = new List<Model.Sys_User>();
|
|
|
|
list.Add(sys_User);
|
|
EmailSendMessage(BLL.Const.DesignInputString, nameValue, BLL.Const.CustomString, list, "");
|
|
}
|
|
}
|
|
#endregion
|
|
ShowNotify("Save Successfully!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
}
|
|
} |