2024-04-25 14:36:22 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CQMS.Comprehensive
|
|
|
|
|
{
|
|
|
|
|
public partial class ConTechnologyDisclosureEdit : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 定义变量
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ConTechnologyDisclosureId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["ConTechnologyDisclosureId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["ConTechnologyDisclosureId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 加载
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
GetButtonPower();
|
|
|
|
|
BLL.UnitWorkService.InitUnitWorkDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, false);
|
|
|
|
|
BLL.UnitService.InitUnitDownList(this.drpUnitId, this.CurrUser.LoginProjectId, false);
|
|
|
|
|
BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);
|
|
|
|
|
|
|
|
|
|
this.ConTechnologyDisclosureId = Request.Params["id"];
|
|
|
|
|
Model.Comprehensive_ConTechnologyDisclosure con = BLL.ConTechnologyDisclosureService.GetConTechnologyDisclosureById(this.ConTechnologyDisclosureId);
|
|
|
|
|
if (con != null)
|
|
|
|
|
{
|
|
|
|
|
this.ConTechnologyDisclosureId = con.ConTechnologyDisclosureId;
|
|
|
|
|
if (!string.IsNullOrEmpty(con.CNProfessionalId))
|
|
|
|
|
{
|
|
|
|
|
this.drpCNProfessionalId.SelectedValue = con.CNProfessionalId;
|
|
|
|
|
}
|
|
|
|
|
this.txtDisclosureCode.Text = con.DisclosureCode;
|
|
|
|
|
this.txtDisclosureName.Text = con.DisclosureName;
|
|
|
|
|
if (!string.IsNullOrEmpty(con.UnitId))
|
|
|
|
|
{
|
|
|
|
|
this.drpUnitId.SelectedValue = con.UnitId;
|
|
|
|
|
}
|
|
|
|
|
this.txtDisclosureMan.Text = con.DisclosureMan;
|
|
|
|
|
this.txtDisclosureDate.Text = con.DisclosureDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.DisclosureDate) : "";
|
|
|
|
|
if (!string.IsNullOrEmpty(con.UnitWorkId))
|
|
|
|
|
{
|
|
|
|
|
this.drpUnitWorkIds.SelectedValueArray = con.UnitWorkId.Split(',');
|
|
|
|
|
}
|
|
|
|
|
this.txtAttendMan.Text = con.AttendMan;
|
2024-04-29 19:13:54 +08:00
|
|
|
|
this.txtRemarkCode.Text = con.RemarkCode.HasValue ? con.RemarkCode.ToString() : "";
|
2024-04-25 14:36:22 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.txtDisclosureDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (drpCNProfessionalId.SelectedValue == BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择交底负责单位!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-04-29 19:13:54 +08:00
|
|
|
|
|
2024-05-09 15:18:08 +08:00
|
|
|
|
var q = Funs.DB.Comprehensive_ConTechnologyDisclosure.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.RemarkCode == Funs.GetNewInt(this.txtRemarkCode.Text.Trim()) && (x.ConTechnologyDisclosureId != this.ConTechnologyDisclosureId || (this.ConTechnologyDisclosureId == null && x.ConTechnologyDisclosureId != null)));
|
2024-04-29 19:13:54 +08:00
|
|
|
|
if (q != null)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-25 14:36:22 +08:00
|
|
|
|
Model.Comprehensive_ConTechnologyDisclosure newCon = new Model.Comprehensive_ConTechnologyDisclosure();
|
|
|
|
|
newCon.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
newCon.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
|
|
|
|
newCon.DisclosureCode = this.txtDisclosureCode.Text.Trim();
|
|
|
|
|
newCon.DisclosureName = this.txtDisclosureName.Text.Trim();
|
|
|
|
|
newCon.UnitId = this.drpUnitId.SelectedValue;
|
|
|
|
|
newCon.DisclosureMan = this.txtDisclosureMan.Text.Trim();
|
|
|
|
|
newCon.DisclosureDate = Funs.GetNewDateTime(this.txtDisclosureDate.Text.Trim());
|
|
|
|
|
|
|
|
|
|
string ids = string.Empty;
|
|
|
|
|
var lists = this.drpUnitWorkIds.SelectedValueArray;
|
|
|
|
|
foreach (var item in lists)
|
|
|
|
|
{
|
|
|
|
|
ids += item + ",";
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(ids))
|
|
|
|
|
{
|
|
|
|
|
ids = ids.Substring(0, ids.LastIndexOf(","));
|
|
|
|
|
}
|
|
|
|
|
newCon.UnitWorkId = ids;
|
|
|
|
|
newCon.AttendMan = this.txtAttendMan.Text.Trim();
|
2024-04-29 19:13:54 +08:00
|
|
|
|
newCon.RemarkCode = Funs.GetNewInt(this.txtRemarkCode.Text.Trim());
|
2024-04-25 14:36:22 +08:00
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(this.ConTechnologyDisclosureId))
|
|
|
|
|
{
|
|
|
|
|
newCon.ConTechnologyDisclosureId = SQLHelper.GetNewID(typeof(Model.Comprehensive_ConTechnologyDisclosure));
|
|
|
|
|
|
|
|
|
|
newCon.CompileMan = this.CurrUser.UserId;
|
|
|
|
|
newCon.CompileDate = DateTime.Now;
|
|
|
|
|
BLL.ConTechnologyDisclosureService.AddConTechnologyDisclosure(newCon);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
newCon.ConTechnologyDisclosureId = this.ConTechnologyDisclosureId;
|
|
|
|
|
BLL.ConTechnologyDisclosureService.UpdateConTechnologyDisclosure(newCon);
|
|
|
|
|
}
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
if (Request.Params["value"] == BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ConTechnologyDisclosureMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
|
|
|
{
|
|
|
|
|
this.btnSave.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|