Basf_TCC7/HJGL/FineUIPro.Web/WeldingProcess/TestPackageManage/TestPackageManageItemEdit.a...

695 lines
31 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web.ModelBinding;
using System.Web.UI.DataVisualization.Charting;
using System.Windows.Forms;
using BLL;
using Model;
using Newtonsoft.Json.Linq;
namespace FineUIPro.Web.WeldingProcess.TestPackageManage
{
public partial class TestPackageManageItemEdit : PageBase
{
#region
/// <summary>
/// 试压包主键
/// </summary>
public string PTP_ID
{
get
{
return (string)ViewState["PTP_ID"];
}
set
{
ViewState["PTP_ID"] = value;
}
}
/// <summary>
/// 选择字符串
/// </summary>
public List<string> listSelects
{
get
{
return (List<string>)ViewState["listSelects"];
}
set
{
ViewState["listSelects"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
this.PTP_ID = Request.Params["PTP_ID"];
List<Model.Base_Unit> units = new List<Model.Base_Unit>();
var pUnit = BLL.Project_UnitService.GetProject_UnitByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId);
if (pUnit == null || pUnit.UnitType == BLL.Const.UnitType_1 || pUnit.UnitType == BLL.Const.UnitType_2
|| pUnit.UnitType == BLL.Const.UnitType_3 || pUnit.UnitType == BLL.Const.UnitType_4)
{
units = (from x in Funs.DB.Base_Unit
join y in Funs.DB.Project_Unit on x.UnitId equals y.UnitId
where y.ProjectId == this.CurrUser.LoginProjectId && y.UnitType.Contains(BLL.Const.UnitType_5)
select x).ToList();
}
else
{
units.Add(BLL.Base_UnitService.GetUnit(this.CurrUser.UnitId));
}
///单位
this.drpUnit.DataTextField = "UnitName";
this.drpUnit.DataValueField = "UnitId";
this.drpUnit.DataSource = units;
this.drpUnit.DataBind();
Funs.FineUIPleaseSelect(this.drpUnit);
Funs.FineUIPleaseSelect(this.drpInstallation);
// 修改人
BLL.Project_UserService.InitProjectUserDropDownList(drpModifier, true, this.CurrUser.LoginProjectId, Resources.Lan.PleaseSelect);
// 建档人
BLL.Project_UserService.InitProjectUserDropDownList(drpTabler, true, this.CurrUser.LoginProjectId, Resources.Lan.PleaseSelect);
// 试压类型
BLL.Base_PressureService.InitPressureDropDownList(drpTestType, true, Resources.Lan.PleaseSelect);
// 材质
BLL.Base_MaterialService.InitMaterialDropDownList(drpMaterial, true, Resources.Lan.PleaseSelect);
// 介质
BLL.Base_MediumService.InitMediumDropDownList(drpMedium, true, Resources.Lan.PleaseSelect);
// 管线等级
BLL.Base_PipingClassService.InitPipingClassDropDownList(drpPipingClass, true, Resources.Lan.PleaseSelect);
listSelects = new List<string>();
var list = (from x in Funs.DB.PTP_PipelineList
where x.PTP_ID == this.PTP_ID
select x).ToList();
if (list.Count() > 0)
{
foreach (var infoRow in list)
{
listSelects.Add(infoRow.PipelineId);
}
}
this.PageInfoLoad(); ///加载页面
}
}
#endregion
#region
/// <summary>
/// 加载页面输入保存信息
/// </summary>
private void PageInfoLoad()
{
var testPackageManage = BLL.TestPackageManageEditService.GetTestPackageByID(this.PTP_ID);
if (testPackageManage != null)
{
this.txtTestPackageNo.Text = testPackageManage.TestPackageNo;
if (!string.IsNullOrEmpty(testPackageManage.UnitId))
{
this.drpUnit.SelectedValue = testPackageManage.UnitId;
}
if (!string.IsNullOrEmpty(testPackageManage.InstallationId))
{
BLL.Project_InstallationService.InitInstallationDropDownList(drpInstallation, true, this.CurrUser.LoginProjectId, testPackageManage.UnitId, Resources.Lan.PleaseSelect);
drpInstallation.SelectedValue = testPackageManage.InstallationId;
var install = this.drpInstallation.Items.FirstOrDefault(x => x.Value == testPackageManage.InstallationId);
if (install != null)
{
BLL.Project_WorkAreaService.InitWorkAreaDropDownList(drpWorkArea, true, this.CurrUser.LoginProjectId, drpInstallation.SelectedValue, drpUnit.SelectedValue, null, Resources.Lan.PleaseSelect);
}
}
this.txtTestPackageName.Text = testPackageManage.TestPackageName;
//this.txtTestPackageCode.Text = testPackageManage.TestPackageCode;
if (!string.IsNullOrEmpty(testPackageManage.TestType))
{
this.drpTestType.SelectedValue = testPackageManage.TestType;
}
this.txtTestService.Text = testPackageManage.TestService;
this.txtTestHeat.Text = testPackageManage.TestHeat;
this.txtTestAmbientTemp.Text = testPackageManage.TestAmbientTemp;
this.txtTestMediumTemp.Text = testPackageManage.TestMediumTemp;
this.txtVacuumTestService.Text = testPackageManage.VacuumTestService;
this.txtVacuumTestPressure.Text = testPackageManage.VacuumTestPressure;
this.txtTightnessTestTime.Text = testPackageManage.TightnessTestTime;
this.txtTightnessTestTemp.Text = testPackageManage.TightnessTestTemp;
this.txtTightnessTest.Text = testPackageManage.TightnessTest;
this.txtTestPressure.Text = testPackageManage.TestPressure;
this.txtTestPressureTemp.Text = testPackageManage.TestPressureTemp;
this.txtTestPressureTime.Text = testPackageManage.TestPressureTime;
this.txtOperationMedium.Text = testPackageManage.OperationMedium;
this.txtPurgingMedium.Text = testPackageManage.PurgingMedium;
this.txtCleaningMedium.Text = testPackageManage.CleaningMedium;
this.txtLeakageTestService.Text = testPackageManage.LeakageTestService;
this.txtLeakageTestPressure.Text = testPackageManage.LeakageTestPressure;
this.txtAllowSeepage.Text = testPackageManage.AllowSeepage;
this.txtFactSeepage.Text = testPackageManage.FactSeepage;
this.txtModifyDate.Text = string.Format("{0:yyyy-MM-dd}", testPackageManage.ModifyDate);
if (!string.IsNullOrEmpty(testPackageManage.Modifier))
{
this.drpModifier.SelectedValue = testPackageManage.Modifier;
}
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", testPackageManage.TableDate);
if (!string.IsNullOrEmpty(testPackageManage.Tabler))
{
this.drpTabler.SelectedValue = testPackageManage.Tabler;
}
this.txtRemark.Text = testPackageManage.Remark;
var items = Funs.DB.PTP_PipelineList.Where(t => t.PTP_ID == testPackageManage.PTP_ID)
.Select(t=>t.WorkAreaId).FirstOrDefault();
if (items != null)
{
drpWorkArea.SelectedValue = items;
}
this.BindGrid(); ////初始化页面
this.ShowGridItem();
}
else
{
this.txtModifyDate.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
if (this.CurrUser.UserId != BLL.Const.GlyId)
{
this.drpTabler.SelectedValue = this.CurrUser.UserId;
this.drpModifier.SelectedValue = this.CurrUser.UserId;
}
}
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid()
{
string strSql = string.Empty;
if (string.IsNullOrEmpty(this.PTP_ID))
{
strSql = @"SELECT
IsoInfo.ProjectId,IsoInfo.WorkAreaId,WorkArea.WorkAreaCode,IsoInfo.PipelineId,IsoInfo.PipelineCode,
IsoInfo.DesignPressure,IsoInfo.DesignTemperature, WorkArea.InstallationId,IsoInfo.UnitId,
IsoInfo.TestPressure,IsoInfo.TestTemperature,bs.MediumName,IsoInfo.SingleNumber,
'全部' as WeldJointCode
FROM dbo.Pipeline_Pipeline AS IsoInfo
LEFT JOIN DBO.Project_WorkArea AS WorkArea ON IsoInfo.WorkAreaId =WorkArea.WorkAreaId
LEFT JOIN dbo.Base_Medium AS bs ON bs.MediumId = IsoInfo.MediumId
WHERE IsoInfo.ProjectId= @ProjectId AND IsoInfo.UnitId= @UnitId
AND WorkArea.InstallationId= @InstallationId AND
IsoInfo.PipelineId not in(
select PipelineId from PTP_PipelineList where PipelineId=IsoInfo.PipelineId and
WorkAreaId=IsoInfo.WorkAreaId and isAll=1
)
";
}
else
{
strSql = @"SELECT
IsoInfo.ProjectId,IsoInfo.WorkAreaId,WorkArea.WorkAreaCode,IsoInfo.PipelineId,IsoInfo.PipelineCode,
IsoInfo.DesignPressure,IsoInfo.DesignTemperature, WorkArea.InstallationId,IsoInfo.UnitId,
IsoInfo.TestPressure,IsoInfo.TestTemperature,bs.MediumName,IsoInfo.SingleNumber,
IsoList.isAll,(case when (isnull(IsoList.WeldJonintCode,'')='') then '全部' else IsoList.WeldJonintCode end) as WeldJointCode
FROM dbo.Pipeline_Pipeline AS IsoInfo
LEFT JOIN DBO.Project_WorkArea AS WorkArea ON IsoInfo.WorkAreaId =WorkArea.WorkAreaId
LEFT JOIN dbo.Base_Medium AS bs ON bs.MediumId = IsoInfo.MediumId
LEFT JOIN dbo.PTP_PipelineList AS IsoList ON IsoList.PipelineId = IsoInfo.PipelineId
and IsoInfo.WorkAreaId=IsoList.WorkAreaId and IsoList.PTP_ID=@PTP_ID
WHERE IsoInfo.ProjectId= @ProjectId AND IsoInfo.UnitId= @UnitId
AND WorkArea.InstallationId= @InstallationId ";
}
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@UnitId", this.drpUnit.SelectedValue));
listStr.Add(new SqlParameter("@InstallationId", this.drpInstallation.SelectedValue));
if (!string.IsNullOrEmpty(this.PTP_ID))
{
listStr.Add(new SqlParameter("@PTP_ID", this.PTP_ID));
}
if (this.drpWorkArea.SelectedValue != Const._Null && drpWorkArea.SelectedValue!=null)
{
strSql += " AND IsoInfo.WorkAreaId = @WorkAreaId";
listStr.Add(new SqlParameter("@WorkAreaId", this.drpWorkArea.SelectedValue));
}
if (this.drpPipingClass.SelectedValue != Const._Null)
{
strSql += " AND IsoInfo.PipingClassId = @PipingClassId";
listStr.Add(new SqlParameter("@PipingClassId", this.drpPipingClass.SelectedValue));
}
if (this.drpMedium.SelectedValue != Const._Null)
{
strSql += " AND IsoInfo.MediumId = @MediumId";
listStr.Add(new SqlParameter("@MediumId", this.drpMedium.SelectedValue));
}
if (this.drpMaterial.SelectedValue != Const._Null)
{
strSql += " AND IsoInfo.MainMaterialId = @MaterialId";
listStr.Add(new SqlParameter("@MaterialId", this.drpMaterial.SelectedValue));
}
if (txtDia.Text != "")
{
strSql += " AND (SELECT COUNT(*) FROM dbo.Pipeline_WeldJoint jot WHERE jot.PipelineId=IsoInfo.PipelineId AND jot.Dia >= @Dia)> 0";
listStr.Add(new SqlParameter("@Dia", Convert.ToDecimal(txtDia.Text)));
}
//if (this.drpWorkArea.SelectedValueArray.Count() > 1 || (this.drpWorkArea.SelectedValueArray.Count() == 1 && this.drpWorkArea.SelectedValueArray[0] != BLL.Const._Null))
//{
// strSql += " AND (IsoInfo.WorkAreaId = '' ";
// int i = 0;
// foreach (var item in this.drpWorkArea.SelectedValueArray)
// {
// if (item != BLL.Const._Null)
// {
// strSql += " OR IsoInfo.WorkAreaId = @WorkAreaId" + i.ToString();
// listStr.Add(new SqlParameter("@WorkAreaId" + i.ToString(), item));
// i++;
// }
// }
// strSql += ")";
//}
//if (!string.IsNullOrEmpty(this.txtIsono.Text.Trim()))
//{
// strSql += " AND IsoInfo.PipelineCode LIKE @PipelineCode";
// listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtIsono.Text.Trim() + "%"));
//}
//if (this.ckSelect.Checked) ///只显示选中项
//{
// if (this.listSelects.Count() > 0)
// {
// strSql += " AND (ISO_IsoNo.ISO_ID = @ISO_ID ";
// listStr.Add(new SqlParameter("@ISO_ID", ""));
// int i = 0;
// foreach (var items in this.listSelects)
// {
// List<string> item = Funs.GetStrListByStr(items, '|');
// strSql += " OR ISO_IsoNo.ISO_ID = @ISO_ID" + i.ToString();
// listStr.Add(new SqlParameter("@ISO_ID" + i.ToString(), item[0].ToString()));
// i++;
// }
// strSql += ")";
// }
//}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
Grid1.RecordCount = tb.Rows.Count;
// tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
/// <summary>
/// 对GV 赋值
/// </summary>
/// <param name="jointInfosSelectList"></param>
private void ShowGridItem()
{
for (int i = 0; i < Grid1.Rows.Count; i++)
{
Grid1.Rows[i].Values[0] = BLL.Const._False;
////操作焊接焊口信息
if (listSelects.Count() > 0)
{
foreach (var item in listSelects)
{
if (item == Grid1.DataKeys[i][0].ToString())
{
Grid1.Rows[i].Values[0] = BLL.Const._True;
}
}
}
}
}
#endregion
#region
/// <summary>
/// 单位下拉框变化事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpUnit_OnSelectedIndexChanged(object sender, EventArgs e)
{
this.drpInstallation.Items.Clear();
this.drpWorkArea.Items.Clear();
BLL.Project_InstallationService.InitInstallationDropDownList(drpInstallation, true, this.CurrUser.LoginProjectId, drpUnit.SelectedValue, Resources.Lan.PleaseSelect);
Funs.FineUIPleaseSelect(this.drpWorkArea);
}
/// <summary>
/// 单位、装置下拉框变化事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpInstallation_OnSelectedIndexChanged(object sender, EventArgs e)
{
BLL.Project_WorkAreaService.InitWorkAreaDropDownList(drpWorkArea, true, this.CurrUser.LoginProjectId, drpInstallation.SelectedValue, drpUnit.SelectedValue, null, Resources.Lan.PleaseSelect);
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
/// <summary>
/// 区域下拉框事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Find_OnSelectedIndexChanged(object sender, EventArgs e)
{
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
#endregion
#region
#region
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
#endregion
#region
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
#endregion
#region
/// <summary>
/// 分页选择下拉改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
#endregion
#endregion
#region
/// <summary>
/// 编辑试压包
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.TestPackageManageEditMenuId, Const.BtnSave))
{
if (BLL.TestPackageManageEditService.IsExistTestPackageCode(this.txtTestPackageNo.Text, this.PTP_ID, this.CurrUser.LoginProjectId))
{
ShowNotify("试压包编号已存在,请重新录入!", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtTestPackageNo.Text) || this.drpUnit.SelectedValue == BLL.Const._Null || this.drpTabler.SelectedValue == BLL.Const._Null
|| this.drpInstallation.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.txtTableDate.Text))
{
ShowNotify("必填项不能为空!", MessageBoxIcon.Warning);
return;
}
this.CollectGridJointInfo();
if (this.listSelects.Count() == 0)
{
ShowNotify("请选择管线号!", MessageBoxIcon.Warning);
return;
}
var updatetrust = BLL.TestPackageManageEditService.GetTestPackageByID(this.PTP_ID);
if (updatetrust != null && updatetrust.AduditDate.HasValue)
{
ShowNotify("此施压包已审核不能修改!", MessageBoxIcon.Warning);
return;
}
Model.PTP_TestPackage testPackage = new Model.PTP_TestPackage();
testPackage.ProjectId = this.CurrUser.LoginProjectId;
if (this.drpInstallation.SelectedValue != BLL.Const._Null)
{
testPackage.InstallationId = this.drpInstallation.SelectedValue;
}
if (this.drpUnit.SelectedValue != BLL.Const._Null)
{
testPackage.UnitId = this.drpUnit.SelectedValue;
}
testPackage.TestPackageNo = this.txtTestPackageNo.Text.Trim();
testPackage.TestPackageName = this.txtTestPackageName.Text.Trim();
testPackage.TestHeat = this.txtTestHeat.Text.Trim();
testPackage.TestService = this.txtTestService.Text.Trim();
if (this.drpTestType.SelectedValue != BLL.Const._Null)
{
testPackage.TestType = this.drpTestType.SelectedValue;
}
if (this.drpTabler.SelectedValue != BLL.Const._Null)
{
testPackage.Tabler = this.drpTabler.SelectedValue;
}
testPackage.TableDate = Funs.GetNewDateTime(this.txtTableDate.Text);
if (this.drpModifier.SelectedValue != BLL.Const._Null)
{
testPackage.Modifier = this.drpModifier.SelectedValue;
}
testPackage.ModifyDate = Funs.GetNewDateTime(this.txtModifyDate.Text);
testPackage.Remark = this.txtRemark.Text.Trim();
//testPackage.TestPackageCode = this.txtTestPackageCode.Text.Trim();
testPackage.TestAmbientTemp = this.txtTestAmbientTemp.Text.Trim();
testPackage.TestMediumTemp = this.txtTestMediumTemp.Text.Trim();
testPackage.TestPressure = this.txtTestPressure.Text.Trim();
testPackage.TestPressureTemp = this.txtTestPressureTemp.Text.Trim();
testPackage.TestPressureTime = this.txtTestPressureTime.Text.Trim();
testPackage.TightnessTest = this.txtTightnessTest.Text.Trim();
testPackage.TightnessTestTemp = this.txtTightnessTestTemp.Text.Trim();
testPackage.TightnessTestTime = this.txtTightnessTestTime.Text.Trim();
testPackage.LeakageTestService = this.txtLeakageTestService.Text.Trim();
testPackage.LeakageTestPressure = this.txtLeakageTestPressure.Text.Trim();
testPackage.VacuumTestService = this.txtVacuumTestService.Text.Trim();
testPackage.VacuumTestPressure = this.txtVacuumTestPressure.Text.Trim();
testPackage.OperationMedium = this.txtOperationMedium.Text.Trim();
testPackage.PurgingMedium = this.txtPurgingMedium.Text.Trim();
testPackage.CleaningMedium = this.txtCleaningMedium.Text.Trim();
testPackage.AllowSeepage = this.txtAllowSeepage.Text.Trim();
testPackage.FactSeepage = this.txtFactSeepage.Text.Trim();
if (!string.IsNullOrEmpty(this.PTP_ID))
{
testPackage.PTP_ID = this.PTP_ID;
BLL.TestPackageManageEditService.UpdateTestPackage(testPackage);
//BLL.TestPackageManageEditService.DeleteTestPackage(PTP_ID);
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.TestPackageManageEditMenuId, Const.BtnModify, this.PTP_ID);
}
else
{
testPackage.PTP_ID = SQLHelper.GetNewID(typeof(Model.PTP_TestPackage));
this.PTP_ID = testPackage.PTP_ID;
BLL.TestPackageManageEditService.AddTestPackage(testPackage);
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.TestPackageManageEditMenuId, Const.BtnAdd, this.PTP_ID);
}
JArray teamGroupData = Grid1.GetMergedData();
foreach (JObject teamGroupRow in teamGroupData)
{
string PipelineId = teamGroupRow["id"].ToString();
string status = teamGroupRow.Value<string>("status");
if (listSelects.Contains(PipelineId))
{
JObject values = teamGroupRow.Value<JObject>("values");
string WeldJonintCodes = values.Value<string>("WeldJointCode");
string workAreaId = values.Value<string>("WorkAreaId");
if (string.IsNullOrEmpty(WeldJonintCodes))
WeldJonintCodes = "全部";
//处理剩下来的口
List<string> listJointCode = new List<string>();
var tempData = Funs.DB.PTP_PipelineList.Where(t=>t.PipelineId== PipelineId && t.IsAll==false).Select(t => t.WeldJonintCode).ToList();
foreach (var item in tempData)
{
if (!string.IsNullOrEmpty(item))
{
string[] arr=item.Split(',');
for (int i = 0; i < arr.Length; i++)
{
listJointCode.Add(arr[i]);
}
}
}
if(WeldJonintCodes=="全部" && listJointCode.Count > 0)
{
var nextJointCode = Funs.DB.Pipeline_WeldJoint.Where(t => t.PipelineId == PipelineId && !listJointCode.Contains(t.WeldJointCode))
.Select(t => t.WeldJointCode).ToList().ToArray();
WeldJonintCodes = String.Join(",", nextJointCode.ToArray());
}
Model.PTP_PipelineList newitem = new Model.PTP_PipelineList();
newitem.PTP_ID = this.PTP_ID;
newitem.PipelineId = PipelineId;
newitem.IsAll = WeldJonintCodes=="全部" ? true : false;
newitem.WeldJonintCode = WeldJonintCodes;
newitem.WorkAreaId = workAreaId;
BLL.TestPackageManageEditService.AddPipelineList(newitem);
}
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(this.PTP_ID)
+ ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region Grid页面信息
/// <summary>
/// 收集Grid页面信息
/// </summary>
/// <returns></returns>
private void CollectGridJointInfo()
{
for (int i = 0; i < Grid1.Rows.Count; i++)
{
string rowID = Grid1.DataKeys[i][0].ToString();
CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected");
if (listSelects.Contains(rowID))
{
listSelects.Remove(rowID);
}
if (checkField.GetCheckedState(i))
{
listSelects.Add(rowID);
}
}
}
#endregion
#region Grid2列表
#endregion
#region Grid
/// <summary>
/// 全选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAllSelect_Click(object sender, EventArgs e)
{
for (int i = 0; i < Grid1.Rows.Count; i++)
{
string rowID = Grid1.DataKeys[i][0].ToString();
if (!listSelects.Contains(rowID))
{
listSelects.Add(rowID);
}
}
this.ShowGridItem();
}
/// <summary>
/// 全不选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNoSelect_Click(object sender, EventArgs e)
{
for (int i = 0; i < Grid1.Rows.Count; i++)
{
string rowID = Grid1.DataKeys[i][0].ToString();
if (listSelects.Contains(rowID))
{
listSelects.Remove(rowID);
}
}
this.ShowGridItem();
}
#endregion
#region 线
/// <summary>
/// 管线查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtIsono_OnSelectedIndexChanged(object sender, EventArgs e)
{
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
#endregion
#region
/// <summary>
/// 只显示选中项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ckSelect_OnCheckedChanged(object sender, CheckedEventArgs e)
{
this.CollectGridJointInfo();
this.BindGrid();
this.ShowGridItem();
}
#endregion
}
}