SGGL_SHJ/SGGL/FineUIPro.Web/CQMS/WBS/SelectUnit.aspx.cs

64 lines
2.6 KiB
C#

using BLL;
using System;
namespace FineUIPro.Web.CQMS.WBS
{
public partial class SelectUnit : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
string UnitWorkId = Request.Params["UnitWorkId"];
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(UnitWorkId);
if (unitWork != null)
{
BLL.UnitService.InitUnitDropDownListByUnitIds(this.drpUnit, unitWork.UnitId, true);//单位
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData(true);
}
private void SaveData(bool b)
{
if (this.drpUnit.SelectedValue == BLL.Const._Null)
{
ShowNotify("请选择单位名称!", MessageBoxIcon.Warning);
return;
}
Model.Technical_TechnicalDisclose technicalDisclose = new Model.Technical_TechnicalDisclose();
technicalDisclose.TechnicalDiscloseId = SQLHelper.GetNewID();
technicalDisclose.ProjectId = this.CurrUser.LoginProjectId;
technicalDisclose.UnitId = this.drpUnit.SelectedValue;
technicalDisclose.UnitWorkId = Request.Params["UnitWorkId"];
string dataId = Request.Params["DataId"];
technicalDisclose.DataId = dataId;
string discloseName = string.Empty;
Model.WBS_WorkPackage workPackage = BLL.WorkPackageService.GetWorkPackageByWorkPackageId(dataId);
if (workPackage != null)
{
discloseName = workPackage.PackageContent;
}
else
{
var controlItemAndCycle = BLL.ControlItemAndCycleService.GetControlItemAndCycleById(dataId);
if (controlItemAndCycle != null)
{
discloseName = controlItemAndCycle.ControlItemContent;
}
}
technicalDisclose.DiscloseName = discloseName;
technicalDisclose.State = "0"; //未交底
technicalDisclose.CompileMan = this.CurrUser.PersonId;
technicalDisclose.CompileDate = DateTime.Now;
BLL.CQMS_TechnicalDiscloseService.AddTechnicalDisclose(technicalDisclose);
ShowNotify("发起成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideReference());
}
}
}