Basf_TCC7/HJGL/FineUIPro.Web/WeldingProcess/TestPackageManage/selectJointCode.aspx.cs

88 lines
2.8 KiB
C#

using BLL;
using Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.WeldingProcess.TestPackageManage
{
public partial class selectJointCode : PageBase
{
private string rowId=string.Empty;
private string jointcode=string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
this.rowId = Request.Params["rowId"];
this.jointcode = Request.Params["jointcode"];
if (string.IsNullOrEmpty(this.rowId))
{
ShowNotify("请先选择某条管线信息!", MessageBoxIcon.Warning);
return;
}
if (!IsPostBack)
{
btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.BindGridDataSource();
this.InitGridDataChecked();
}
}
void InitGridDataChecked()
{
List<int> list = new List<int>();
if (!string.IsNullOrEmpty(this.jointcode))
{
string[] arr=this.jointcode.Split(',');
for (int i = 0;i<Grid1.Rows.Count;i++)
{
string key = Grid1.DataKeys[i][0].ToString();
if (arr.Contains(key))
{
list.Add(i);
}
}
}
Grid1.SelectedRowIndexArray = list.ToArray();
}
void BindGridDataSource()
{
this.Grid1.DataSource = GetDataJointGrid2(this.rowId);
this.Grid1.DataBind();
}
private List<Pipeline_WeldJoint> GetDataJointGrid2(string PipelineID)
{
List<string> listData = 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[] strcode = item.Split(',');
for (int i = 0; i < strcode.Length; i++)
{
if (!listData.Contains(strcode[i]))
{
listData.Add(strcode[i]);
}
}
}
}
var query = Funs.DB.Pipeline_WeldJoint.Where(t => t.PipelineId == PipelineID)
.OrderBy(t => t.WeldJointCode).AsQueryable();
if (listData.Count>0)
{
query = query.Where(t => !listData.Contains(t.WeldJointCode));
}
return query.ToList();
}
}
}