2021-04-30 10:28:37 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CQMS.Comprehensive
|
|
|
|
|
{
|
|
|
|
|
public partial class DesignDrawingsEdit : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 定义变量
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string DesignDrawingsId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["DesignDrawingsId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["DesignDrawingsId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 加载
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
GetButtonPower();
|
2021-08-18 15:55:24 +08:00
|
|
|
|
BLL.DesignProfessionalService.InitDesignProfessionalDownList(this.drpCNProfessionalId, true);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
BLL.UnitWorkService.InitUnitWorkDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, false);
|
2021-08-13 11:15:59 +08:00
|
|
|
|
BLL.UnitService.GetUnit(this.drpUnitIds, this.CurrUser.LoginProjectId, false);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
this.DesignDrawingsId = Request.Params["DesignDrawingsId"];
|
|
|
|
|
Model.Comprehensive_DesignDrawings designDrawings = BLL.DesignDrawingsService.GetDesignDrawingsById(this.DesignDrawingsId);
|
|
|
|
|
if (designDrawings != null)
|
|
|
|
|
{
|
|
|
|
|
this.DesignDrawingsId = designDrawings.DesignDrawingsId;
|
|
|
|
|
this.hdAttachUrl.Text = this.DesignDrawingsId;
|
|
|
|
|
if (!string.IsNullOrEmpty(designDrawings.CNProfessionalId))
|
|
|
|
|
{
|
|
|
|
|
this.drpCNProfessionalId.SelectedValue = designDrawings.CNProfessionalId;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(designDrawings.UnitWorkId))
|
|
|
|
|
{
|
|
|
|
|
this.drpUnitWorkIds.SelectedValueArray = designDrawings.UnitWorkId.Split(',');
|
|
|
|
|
}
|
|
|
|
|
this.txtDesignDrawingsCode.Text = designDrawings.DesignDrawingsCode;
|
|
|
|
|
this.txtDesignDrawingsContent.Text = designDrawings.DesignDrawingsContent;
|
|
|
|
|
this.txtEdition.Text = designDrawings.Edition;
|
|
|
|
|
this.txtPageNumber.Text = designDrawings.PageNumber.HasValue ? designDrawings.PageNumber.ToString() : "";
|
|
|
|
|
this.txtReceiveDate.Text = designDrawings.ReceiveDate.HasValue ? string.Format("{0:yyyy-MM-dd}", designDrawings.ReceiveDate) : "";
|
|
|
|
|
this.txtSendDate.Text = designDrawings.SendDate.HasValue ? string.Format("{0:yyyy-MM-dd}", designDrawings.SendDate) : "";
|
|
|
|
|
if (!string.IsNullOrEmpty(designDrawings.ReceiveUnits))
|
|
|
|
|
{
|
|
|
|
|
this.drpUnitIds.SelectedValueArray = designDrawings.ReceiveUnits.Split(',');
|
|
|
|
|
}
|
|
|
|
|
this.txtReceiveMan.Text = designDrawings.ReceiveMan;
|
|
|
|
|
this.txtRemark.Text = designDrawings.Remark;
|
|
|
|
|
this.txtRemarkCode.Text = designDrawings.RemarkCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SaveData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SaveData()
|
|
|
|
|
{
|
|
|
|
|
if (drpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
Model.Comprehensive_DesignDrawings designDrawings = new Model.Comprehensive_DesignDrawings();
|
|
|
|
|
designDrawings.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
designDrawings.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
|
|
|
|
designDrawings.DesignDrawingsCode = this.txtDesignDrawingsCode.Text.Trim();
|
|
|
|
|
designDrawings.DesignDrawingsContent = this.txtDesignDrawingsContent.Text.Trim();
|
|
|
|
|
designDrawings.Edition = this.txtEdition.Text.Trim();
|
|
|
|
|
designDrawings.PageNumber = Funs.GetNewInt(this.txtPageNumber.Text.Trim());
|
|
|
|
|
designDrawings.ReceiveDate = Funs.GetNewDateTime(this.txtReceiveDate.Text);
|
|
|
|
|
designDrawings.SendDate = Funs.GetNewDateTime(this.txtSendDate.Text);
|
|
|
|
|
designDrawings.ReceiveMan = this.txtReceiveMan.Text.Trim();
|
|
|
|
|
designDrawings.Remark = this.txtRemark.Text.Trim();
|
|
|
|
|
designDrawings.RemarkCode = this.txtRemarkCode.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(","));
|
|
|
|
|
}
|
|
|
|
|
designDrawings.UnitWorkId = ids;
|
|
|
|
|
|
|
|
|
|
string unitIds = string.Empty;
|
|
|
|
|
var unitLists = this.drpUnitIds.SelectedValueArray;
|
|
|
|
|
foreach (var item in unitLists)
|
|
|
|
|
{
|
|
|
|
|
unitIds += item + ",";
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(unitIds))
|
|
|
|
|
{
|
|
|
|
|
unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
|
|
|
|
|
}
|
|
|
|
|
designDrawings.ReceiveUnits = unitIds;
|
|
|
|
|
if (!string.IsNullOrEmpty(this.DesignDrawingsId))
|
|
|
|
|
{
|
|
|
|
|
designDrawings.DesignDrawingsId = this.DesignDrawingsId;
|
|
|
|
|
BLL.DesignDrawingsService.UpdateDesignDrawings(designDrawings);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
|
|
|
|
{
|
|
|
|
|
designDrawings.DesignDrawingsId = this.hdAttachUrl.Text;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
designDrawings.DesignDrawingsId = SQLHelper.GetNewID(typeof(Model.Comprehensive_DesignDrawings));
|
|
|
|
|
this.hdAttachUrl.Text = designDrawings.DesignDrawingsId;
|
|
|
|
|
}
|
|
|
|
|
BLL.DesignDrawingsService.AddDesignDrawings(designDrawings);
|
|
|
|
|
}
|
|
|
|
|
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 附件上传
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 附件上传
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnAttach_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.hdAttachUrl.Text)) //新增记录
|
|
|
|
|
{
|
|
|
|
|
this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.Comprehensive_DesignDrawings));
|
|
|
|
|
}
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/DesignDrawings&menuId={1}", this.hdAttachUrl.Text, BLL.Const.DesignDrawingsMenuId)));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DesignDrawingsMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
|
|
|
{
|
|
|
|
|
this.btnSave.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|