11
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services.Description;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
@@ -49,7 +50,8 @@ namespace FineUIPro.Web.WeldingProcess.PMI
|
||||
this.PageInfoLoad(); ///加载页面
|
||||
this.txtDetectionMethod.Text = "PMI光谱分析";
|
||||
this.txtDetectionMethod.Enabled = false;
|
||||
//this.BindGrid(result); ////初始化页面
|
||||
var viewData=Funs.DB.View_PMI_DelegationDetails.Where(t=>t.PMIId==this.PMIDelegationId).ToList();
|
||||
this.BindGrid(viewData); ////初始化页面
|
||||
this.txtDelegationDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
@@ -181,36 +183,10 @@ namespace FineUIPro.Web.WeldingProcess.PMI
|
||||
{
|
||||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.PMIDelegationId, Const.BtnSave))
|
||||
{
|
||||
var isExists = Funs.DB.PMI_Delegation.Any(t => t.DelegationNo == this.txtDelegationNo.Text.Trim() && t.ProjectId == this.CurrUser.LoginProjectId);
|
||||
if (isExists)
|
||||
{
|
||||
ShowNotify(Resources.Lan.PMICodeExists, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var pmiModel = new Model.PMI_Delegation();
|
||||
pmiModel.Id = SQLHelper.GetNewID(typeof(Model.PMI_Delegation));
|
||||
pmiModel.DelegationNo = txtDelegationNo.Text.Trim();
|
||||
pmiModel.DelegationDate = !string.IsNullOrEmpty(txtDelegationDate.Text.Trim()) ? DateTime.Parse(txtDelegationDate.Text.Trim()) : DateTime.Now;
|
||||
pmiModel.InstallationId = drpInstallationId.SelectedValue;
|
||||
pmiModel.UnitId = drpUnitId.SelectedValue;
|
||||
pmiModel.ProjectId = this.CurrUser.LoginProjectId;
|
||||
pmiModel.Remark = txtRemark.Text.Trim();
|
||||
pmiModel.DetectionStandard=txtDetectionStandard.Text.Trim();
|
||||
pmiModel.CreatedTime = DateTime.Now;
|
||||
pmiModel.Tabler = this.CurrUser.UserId;
|
||||
this.PMIDelegationId = pmiModel.Id;
|
||||
Funs.DB.PMI_Delegation.InsertOnSubmit(pmiModel);
|
||||
//先删除明细表
|
||||
var deleteEntity= Funs.DB.PMI_DelegationDetails.Where(t => t.PMIId == pmiModel.Id).ToList();
|
||||
if (deleteEntity.Any())
|
||||
{
|
||||
Funs.DB.PMI_DelegationDetails.DeleteAllOnSubmit(deleteEntity);
|
||||
}
|
||||
//再插入明细表
|
||||
this.CollectGridJointInfo();
|
||||
Funs.DB.SubmitChanges();
|
||||
SaveData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -220,8 +196,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI
|
||||
}
|
||||
|
||||
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(this.PMIDelegationId)
|
||||
+ ActiveWindow.GetHidePostBackReference());
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(this.PMIDelegationId));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -229,6 +204,69 @@ namespace FineUIPro.Web.WeldingProcess.PMI
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SaveData()
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(this.PMIDelegationId))
|
||||
{
|
||||
|
||||
var isExists = Funs.DB.PMI_Delegation.Any(t => t.DelegationNo == this.txtDelegationNo.Text.Trim()
|
||||
&& t.ProjectId == this.CurrUser.LoginProjectId && t.Id!=this.PMIDelegationId);
|
||||
if (isExists)
|
||||
{
|
||||
ShowNotify(Resources.Lan.PMICodeExists, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var result = Funs.DB.PMI_Delegation.FirstOrDefault(t => t.Id == this.PMIDelegationId);
|
||||
if(result==null)
|
||||
{
|
||||
ShowNotify(Resources.Lan.PMICodeNotExists, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
result.DelegationNo = txtDelegationNo.Text.Trim();
|
||||
result.DelegationDate = !string.IsNullOrEmpty(txtDelegationDate.Text.Trim()) ? DateTime.Parse(txtDelegationDate.Text.Trim()) : DateTime.Now;
|
||||
result.InstallationId = drpInstallationId.SelectedValue;
|
||||
result.UnitId = drpUnitId.SelectedValue;
|
||||
result.ProjectId = this.CurrUser.LoginProjectId;
|
||||
result.Remark = txtRemark.Text.Trim();
|
||||
result.DetectionStandard = txtDetectionStandard.Text.Trim();
|
||||
result.Tabler = this.CurrUser.UserId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var isExists = Funs.DB.PMI_Delegation.Any(t => t.DelegationNo == this.txtDelegationNo.Text.Trim() && t.ProjectId == this.CurrUser.LoginProjectId);
|
||||
if (isExists)
|
||||
{
|
||||
ShowNotify(Resources.Lan.PMICodeExists, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var pmiModel = new Model.PMI_Delegation();
|
||||
pmiModel.DelegationNo = txtDelegationNo.Text.Trim();
|
||||
pmiModel.DelegationDate = !string.IsNullOrEmpty(txtDelegationDate.Text.Trim()) ? DateTime.Parse(txtDelegationDate.Text.Trim()) : DateTime.Now;
|
||||
pmiModel.InstallationId = drpInstallationId.SelectedValue;
|
||||
pmiModel.UnitId = drpUnitId.SelectedValue;
|
||||
pmiModel.ProjectId = this.CurrUser.LoginProjectId;
|
||||
pmiModel.Remark = txtRemark.Text.Trim();
|
||||
pmiModel.DetectionStandard = txtDetectionStandard.Text.Trim();
|
||||
pmiModel.Tabler = this.CurrUser.UserId;
|
||||
pmiModel.Id = SQLHelper.GetNewID(typeof(Model.PMI_Delegation));
|
||||
this.PMIDelegationId = pmiModel.Id;
|
||||
pmiModel.CreatedTime = DateTime.Now;
|
||||
Funs.DB.PMI_Delegation.InsertOnSubmit(pmiModel);
|
||||
}
|
||||
|
||||
//先删除明细表
|
||||
var deleteEntity = Funs.DB.PMI_DelegationDetails.Where(t => t.PMIId == this.PMIDelegationId).ToList();
|
||||
if (deleteEntity.Any())
|
||||
{
|
||||
Funs.DB.PMI_DelegationDetails.DeleteAllOnSubmit(deleteEntity);
|
||||
}
|
||||
//再插入明细表
|
||||
this.CollectGridJointInfo();
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 收集Grid页面信息,提交明细
|
||||
|
||||
Reference in New Issue
Block a user