192 lines
7.3 KiB
C#
192 lines
7.3 KiB
C#
|
using BLL;
|
|||
|
using BLL.CQMS.Comprehensive;
|
|||
|
using System;
|
|||
|
using System.Linq;
|
|||
|
|
|||
|
namespace FineUIPro.Web.CQMS.Comprehensive
|
|||
|
{
|
|||
|
public partial class QualitySampleFirstAccFileEdit : PageBase
|
|||
|
{
|
|||
|
#region 定义变量
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string QualitySampleFirstAccFileId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["QualitySampleFirstAccFileId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["QualitySampleFirstAccFileId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
GetButtonPower();
|
|||
|
this.QualitySampleFirstAccFileId = Request.Params["QualitySampleFirstAccFileId"];
|
|||
|
BLL.UnitService.InitUnitDownList(this.dpUnit, this.CurrUser.LoginProjectId, true);
|
|||
|
var punit = ProjectUnitService.GetProjectUnitByUnitIdProjectId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId);
|
|||
|
if (CurrUser.UserId == Const.sysglyId || CommonService.GetProjectUnitType(this.CurrUser.LoginProjectId, this.CurrUser.UnitId) == BLL.Const.ProjectUnitType_1 || (punit!=null && punit.UnitType == Const.ProjectUnitType_3))
|
|||
|
{
|
|||
|
BLL.UnitService.InitUnitDownList(this.dpUnit, this.CurrUser.LoginProjectId, true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
dpUnit.SelectedValue = this.CurrUser.UnitId;
|
|||
|
dpUnit.Enabled = false;
|
|||
|
}
|
|||
|
|
|||
|
Model.Comprehensive_QualitySampleFirstAccFile QualitySampleFirstAccFile = BLL.QualitySampleFirstAccFileService.getQualitySampleFirstAccFile(this.QualitySampleFirstAccFileId);
|
|||
|
if (QualitySampleFirstAccFile != null)
|
|||
|
{
|
|||
|
this.QualitySampleFirstAccFileId = QualitySampleFirstAccFile.QualitySampleFirstAccFileId;
|
|||
|
this.hdAttachUrl.Text = QualitySampleFirstAccFile.QualitySampleFirstAccFileId;
|
|||
|
if (!string.IsNullOrEmpty(QualitySampleFirstAccFile.UnitId))
|
|||
|
{
|
|||
|
this.dpUnit.SelectedValue = QualitySampleFirstAccFile.UnitId;
|
|||
|
}
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(QualitySampleFirstAccFile.InspectionCode)) {
|
|||
|
this.txtInspectionCode.Text = QualitySampleFirstAccFile.InspectionCode;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(QualitySampleFirstAccFile.InspectionName)) {
|
|||
|
this.txtInspectionName.Text = QualitySampleFirstAccFile.InspectionName;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(QualitySampleFirstAccFile.Remark))
|
|||
|
{
|
|||
|
this.txtRemark.Text = QualitySampleFirstAccFile.Remark;
|
|||
|
}
|
|||
|
if (QualitySampleFirstAccFile.InspectionDate.HasValue) {
|
|||
|
this.dpDate.Text = QualitySampleFirstAccFile.InspectionDate.Value.ToString("yyyy-MM-dd");
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 禁止编辑
|
|||
|
/// </summary>
|
|||
|
public void Readonly()
|
|||
|
{
|
|||
|
this.txtInspectionCode.Readonly = true;
|
|||
|
this.txtInspectionName.Readonly = true;
|
|||
|
this.txtRemark.Readonly = true;
|
|||
|
this.dpDate.Readonly = true;
|
|||
|
this.dpUnit.Readonly = true;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region 保存
|
|||
|
/// <summary>
|
|||
|
/// 保存
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
Model.Comprehensive_QualitySampleFirstAccFile QualitySampleFirstAccFile = new Model.Comprehensive_QualitySampleFirstAccFile();
|
|||
|
QualitySampleFirstAccFile.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
QualitySampleFirstAccFile.InspectionCode = this.txtInspectionCode.Text.Trim();
|
|||
|
QualitySampleFirstAccFile.InspectionName = this.txtInspectionName.Text.Trim();
|
|||
|
if (!string.IsNullOrEmpty(this.txtRemark.Text))
|
|||
|
{
|
|||
|
QualitySampleFirstAccFile.Remark = this.txtRemark.Text.Trim();
|
|||
|
}
|
|||
|
QualitySampleFirstAccFile.InspectionDate = this.dpDate.SelectedDate;
|
|||
|
QualitySampleFirstAccFile.UnitId = this.dpUnit.SelectedValue;
|
|||
|
|
|||
|
|
|||
|
if (string.IsNullOrEmpty(this.QualitySampleFirstAccFileId))
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
|||
|
{
|
|||
|
QualitySampleFirstAccFile.QualitySampleFirstAccFileId = this.hdAttachUrl.Text;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
QualitySampleFirstAccFile.QualitySampleFirstAccFileId = SQLHelper.GetNewID(typeof(Model.Comprehensive_SpecialEquipment));
|
|||
|
this.hdAttachUrl.Text = QualitySampleFirstAccFile.QualitySampleFirstAccFileId;
|
|||
|
}
|
|||
|
|
|||
|
QualitySampleFirstAccFile.CreateMan = this.CurrUser.UserId;
|
|||
|
QualitySampleFirstAccFile.CreateDate = DateTime.Now;
|
|||
|
BLL.QualitySampleFirstAccFileService.AddQualitySampleFirstAccFile(QualitySampleFirstAccFile);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
QualitySampleFirstAccFile.QualitySampleFirstAccFileId = this.QualitySampleFirstAccFileId;
|
|||
|
|
|||
|
|
|||
|
BLL.QualitySampleFirstAccFileService.UpdateQualitySampleFirstAccFile(QualitySampleFirstAccFile);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#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_SpecialEquipment));
|
|||
|
}
|
|||
|
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/QualitySampleFirstAccFile&menuId={1}", this.hdAttachUrl.Text, BLL.Const.QualitySampleFirstAccFileMenuId)));
|
|||
|
}
|
|||
|
#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.QualitySampleFirstAccFileMenuId);
|
|||
|
if (buttonList.Count() > 0)
|
|||
|
{
|
|||
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|||
|
{
|
|||
|
this.btnSave.Hidden = false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|