361 lines
16 KiB
C#
361 lines
16 KiB
C#
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 DataReceivingDocDataInNewEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 临时表主键
|
|
/// </summary>
|
|
public string TempId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["TempId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["TempId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.TempId = Request.Params["TempId"];
|
|
this.txtValue1.Focus();
|
|
var dataInTemp = BLL.Sys_CQMS_DataInTempService.GetDataInTempByTempId(this.TempId);
|
|
if (dataInTemp != null)
|
|
{
|
|
this.txtValue1.Text = dataInTemp.Value1;
|
|
this.txtValue2.Text = dataInTemp.Value2;
|
|
this.txtValue3.Text = dataInTemp.Value3;
|
|
this.txtValue4.Text = dataInTemp.Value4;
|
|
this.txtValue5.Text = dataInTemp.Value5;
|
|
this.txtValue6.Text = dataInTemp.Value6;
|
|
this.txtValue7.Text = dataInTemp.Value7;
|
|
this.txtValue8.Text = dataInTemp.Value8;
|
|
this.txtValue9.Text = dataInTemp.Value9;
|
|
this.txtValue10.Text = dataInTemp.Value10;
|
|
this.txtValue11.Text = dataInTemp.Value11;
|
|
this.txtValue12.Text = dataInTemp.Value12;
|
|
this.txtValue13.Text = dataInTemp.Value13;
|
|
this.txtValue14.Text = dataInTemp.Value14;
|
|
this.txtValue15.Text = dataInTemp.Value15;
|
|
this.txtValue16.Text = dataInTemp.Value16;
|
|
this.txtValue17.Text = dataInTemp.Value17;
|
|
this.txtValue18.Text = dataInTemp.Value18;
|
|
this.txtValue19.Text = dataInTemp.Value19;
|
|
this.txtValue20.Text = dataInTemp.Value20;
|
|
|
|
this.lbErrCout.Text = dataInTemp.ToopValue;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存按钮
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
var dataInTemp = BLL.Sys_CQMS_DataInTempService.GetDataInTempByTempId(this.TempId);
|
|
if (this.ckAll.Checked)
|
|
{
|
|
var allDataInTemp = from x in Funs.DB.Sys_CQMS_DataInTemp where x.ProjectId == this.CurrUser.LoginProjectId && x.UserId == this.CurrUser.UserId && x.Type == "DataReceivingDoc" select x;
|
|
if (dataInTemp.Value1 != this.txtValue1.Text.Trim())
|
|
{
|
|
var tempValue1 = allDataInTemp.Where(x => x.Value1 == dataInTemp.Value1 || (x.Value1 == null && dataInTemp.Value1 == null));
|
|
if (tempValue1 != null)
|
|
{
|
|
foreach (var item in tempValue1)
|
|
{
|
|
item.Value1 = this.txtValue1.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value2 != this.txtValue2.Text.Trim())
|
|
{
|
|
var tempValue2 = allDataInTemp.Where(x => x.Value2 == dataInTemp.Value2 || (x.Value2 == null && dataInTemp.Value2 == null));
|
|
if (tempValue2 != null)
|
|
{
|
|
foreach (var item in tempValue2)
|
|
{
|
|
item.Value2 = this.txtValue2.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value3 != this.txtValue3.Text.Trim())
|
|
{
|
|
var tempValue3 = allDataInTemp.Where(x => x.Value3 == dataInTemp.Value3 || (x.Value3 == null && dataInTemp.Value3 == null));
|
|
if (tempValue3 != null)
|
|
{
|
|
foreach (var item in tempValue3)
|
|
{
|
|
item.Value3 = this.txtValue3.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value5 != this.txtValue5.Text.Trim())
|
|
{
|
|
var tempValue5 = allDataInTemp.Where(x => x.Value5 == dataInTemp.Value5 || (x.Value5 == null && dataInTemp.Value5 == null));
|
|
if (tempValue5 != null)
|
|
{
|
|
foreach (var item in tempValue5)
|
|
{
|
|
item.Value5 = this.txtValue5.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value6 != this.txtValue6.Text.Trim())
|
|
{
|
|
var tempValue6 = allDataInTemp.Where(x => x.Value6 == dataInTemp.Value6 || (x.Value6 == null && dataInTemp.Value6 == null));
|
|
if (tempValue6 != null)
|
|
{
|
|
foreach (var item in tempValue6)
|
|
{
|
|
item.Value6 = this.txtValue6.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value7 != this.txtValue7.Text.Trim())
|
|
{
|
|
var tempValue7 = allDataInTemp.Where(x => x.Value7 == dataInTemp.Value7 || (x.Value7 == null && dataInTemp.Value7 == null));
|
|
if (tempValue7 != null)
|
|
{
|
|
foreach (var item in tempValue7)
|
|
{
|
|
item.Value7 = this.txtValue7.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value8 != this.txtValue8.Text.Trim())
|
|
{
|
|
var tempValue8 = allDataInTemp.Where(x => x.Value8 == dataInTemp.Value8 || (x.Value8 == null && dataInTemp.Value8 == null));
|
|
if (tempValue8 != null)
|
|
{
|
|
foreach (var item in tempValue8)
|
|
{
|
|
item.Value8 = this.txtValue8.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value9 != this.txtValue9.Text.Trim())
|
|
{
|
|
var tempValue9 = allDataInTemp.Where(x => x.Value9 == dataInTemp.Value9 || (x.Value9 == null && dataInTemp.Value9 == null));
|
|
if (tempValue9 != null)
|
|
{
|
|
foreach (var item in tempValue9)
|
|
{
|
|
item.Value9 = this.txtValue9.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value10 != this.txtValue10.Text.Trim())
|
|
{
|
|
var tempValue10 = allDataInTemp.Where(x => x.Value10 == dataInTemp.Value10 || (x.Value10 == null && dataInTemp.Value10 == null));
|
|
if (tempValue10 != null)
|
|
{
|
|
foreach (var item in tempValue10)
|
|
{
|
|
item.Value10 = this.txtValue10.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value11 != this.txtValue11.Text.Trim())
|
|
{
|
|
var tempValue11 = allDataInTemp.Where(x => x.Value11 == dataInTemp.Value11 || (x.Value11 == null && dataInTemp.Value11 == null));
|
|
if (tempValue11 != null)
|
|
{
|
|
foreach (var item in tempValue11)
|
|
{
|
|
item.Value11 = this.txtValue11.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value12 != this.txtValue12.Text.Trim())
|
|
{
|
|
var tempValue12 = allDataInTemp.Where(x => x.Value12 == dataInTemp.Value12 || (x.Value12 == null && dataInTemp.Value12 == null));
|
|
if (tempValue12 != null)
|
|
{
|
|
foreach (var item in tempValue12)
|
|
{
|
|
item.Value12 = this.txtValue12.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value13 != this.txtValue13.Text.Trim())
|
|
{
|
|
var tempValue13 = allDataInTemp.Where(x => x.Value13 == dataInTemp.Value13 || (x.Value13 == null && dataInTemp.Value13 == null));
|
|
if (tempValue13 != null)
|
|
{
|
|
foreach (var item in tempValue13)
|
|
{
|
|
item.Value13 = this.txtValue13.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value14 != this.txtValue14.Text.Trim())
|
|
{
|
|
var tempValue14 = allDataInTemp.Where(x => x.Value14 == dataInTemp.Value14 || (x.Value14 == null && dataInTemp.Value14 == null));
|
|
if (tempValue14 != null)
|
|
{
|
|
foreach (var item in tempValue14)
|
|
{
|
|
item.Value14 = this.txtValue14.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value15 != this.txtValue15.Text.Trim())
|
|
{
|
|
var tempValue15 = allDataInTemp.Where(x => x.Value15 == dataInTemp.Value15 || (x.Value15 == null && dataInTemp.Value15 == null));
|
|
if (tempValue15 != null)
|
|
{
|
|
foreach (var item in tempValue15)
|
|
{
|
|
item.Value15 = this.txtValue15.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value16 != this.txtValue16.Text.Trim())
|
|
{
|
|
var tempValue16 = allDataInTemp.Where(x => x.Value16 == dataInTemp.Value16 || (x.Value16 == null && dataInTemp.Value16 == null));
|
|
if (tempValue16 != null)
|
|
{
|
|
foreach (var item in tempValue16)
|
|
{
|
|
item.Value16 = this.txtValue16.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value17 != this.txtValue17.Text.Trim())
|
|
{
|
|
var tempValue17 = allDataInTemp.Where(x => x.Value17 == dataInTemp.Value17 || (x.Value17 == null && dataInTemp.Value17 == null));
|
|
if (tempValue17 != null)
|
|
{
|
|
foreach (var item in tempValue17)
|
|
{
|
|
item.Value17 = this.txtValue17.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value18 != this.txtValue18.Text.Trim())
|
|
{
|
|
var tempValue18 = allDataInTemp.Where(x => x.Value18 == dataInTemp.Value18 || (x.Value18 == null && dataInTemp.Value18 == null));
|
|
if (tempValue18 != null)
|
|
{
|
|
foreach (var item in tempValue18)
|
|
{
|
|
item.Value18 = this.txtValue18.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value19 != this.txtValue19.Text.Trim())
|
|
{
|
|
var tempValue19 = allDataInTemp.Where(x => x.Value19 == dataInTemp.Value19 || (x.Value19 == null && dataInTemp.Value19 == null));
|
|
if (tempValue19 != null)
|
|
{
|
|
foreach (var item in tempValue19)
|
|
{
|
|
item.Value19 = this.txtValue19.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
if (dataInTemp.Value20 != this.txtValue20.Text.Trim())
|
|
{
|
|
var tempValue20 = allDataInTemp.Where(x => x.Value20 == dataInTemp.Value20 || (x.Value20 == null && dataInTemp.Value20 == null));
|
|
if (tempValue20 != null)
|
|
{
|
|
foreach (var item in tempValue20)
|
|
{
|
|
item.Value20 = this.txtValue20.Text.Trim();
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
var toopValue = allDataInTemp.Where(x => x.ToopValue == dataInTemp.ToopValue);
|
|
if (toopValue != null)
|
|
{
|
|
foreach (var item in toopValue)
|
|
{
|
|
item.ToopValue = null;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Model.Sys_CQMS_DataInTemp newDataInTemp = new Model.Sys_CQMS_DataInTemp();
|
|
newDataInTemp.ProjectId = this.CurrUser.LoginProjectId;
|
|
newDataInTemp.UserId = this.CurrUser.UserId;
|
|
newDataInTemp.Time = System.DateTime.Now;
|
|
newDataInTemp.Type = "DataReceivingDoc";
|
|
newDataInTemp.Value1 = this.txtValue1.Text.Trim();
|
|
newDataInTemp.Value2 = this.txtValue2.Text.Trim();
|
|
newDataInTemp.Value3 = this.txtValue3.Text.Trim();
|
|
newDataInTemp.Value4 = this.txtValue4.Text.Trim();
|
|
newDataInTemp.Value5 = this.txtValue5.Text.Trim();
|
|
newDataInTemp.Value6 = this.txtValue6.Text.Trim();
|
|
newDataInTemp.Value7 = this.txtValue7.Text.Trim();
|
|
newDataInTemp.Value8 = this.txtValue8.Text.Trim();
|
|
newDataInTemp.Value9 = this.txtValue9.Text.Trim();
|
|
newDataInTemp.Value10 = this.txtValue10.Text.Trim();
|
|
newDataInTemp.Value11 = this.txtValue11.Text.Trim();
|
|
newDataInTemp.Value12 = this.txtValue12.Text.Trim();
|
|
newDataInTemp.Value13 = this.txtValue13.Text.Trim();
|
|
newDataInTemp.Value14 = this.txtValue14.Text.Trim();
|
|
newDataInTemp.Value15 = this.txtValue15.Text.Trim();
|
|
newDataInTemp.Value16 = this.txtValue16.Text.Trim();
|
|
newDataInTemp.Value17 = this.txtValue17.Text.Trim();
|
|
newDataInTemp.Value18 = this.txtValue18.Text.Trim();
|
|
newDataInTemp.Value19 = this.txtValue19.Text.Trim();
|
|
newDataInTemp.Value20 = this.txtValue20.Text.Trim();
|
|
if (!string.IsNullOrEmpty(this.TempId))
|
|
{
|
|
newDataInTemp.TempId = this.TempId;
|
|
newDataInTemp.ToopValue = null;
|
|
BLL.Sys_CQMS_DataInTempService.UpdateDataInTemp(newDataInTemp);
|
|
}
|
|
}
|
|
ShowNotify("信息修改完成!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
#endregion
|
|
}
|
|
} |