提交代码
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -232,7 +233,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
if (!string.IsNullOrWhiteSpace(this.SsubSystemId))
|
||||
{
|
||||
var result = new List<WorkData>();
|
||||
var data = from a in Funs.DB.PreRun_WorkPackage.Where(p => workPackIds.Contains(p.WorkPackId))
|
||||
var queryData = from a in Funs.DB.PreRun_WorkPackage.Where(p => workPackIds.Contains(p.WorkPackId))
|
||||
join b in Funs.DB.PreRun_SubSysWorkPackage.Where(p => p.SubSystemId == this.SsubSystemId) on a.WorkPackId equals b.WorkPackId into bb
|
||||
from t in bb.DefaultIfEmpty()
|
||||
select new WorkData()
|
||||
@@ -244,10 +245,10 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
Sort = a.Sort,
|
||||
Remark = t.Remark
|
||||
};
|
||||
if (data.Count() > 0)
|
||||
if (queryData.Count() > 0)
|
||||
{
|
||||
int num = 1;
|
||||
int i = 1;
|
||||
var data = queryData.ToList();
|
||||
foreach (var item in data.OrderBy(p => p.Sort))
|
||||
{
|
||||
var model = new WorkData();
|
||||
@@ -256,14 +257,13 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
model.SystemId = item.SystemId;
|
||||
if (string.IsNullOrWhiteSpace(item.WorkPackCode))
|
||||
{
|
||||
var workpackages = Funs.DB.TestRun_SubSysWorkPackage.Where(p => p.SystemId == this.SystemId).ToList();
|
||||
if (workpackages.Count > 0)
|
||||
var workpackages = data.Where(x => !string.IsNullOrWhiteSpace(x.WorkPackCode)).ToList();
|
||||
if (num == 1)
|
||||
{
|
||||
num = workpackages.ConvertAll(x => int.Parse(x.WorkPackCode.Replace("WP", ""))).Max(m => m);
|
||||
if (workpackages.Count > 0) num = workpackages.ConvertAll(x => int.Parse(x.WorkPackCode.Replace("WP", ""))).Max(m => m) + 1;
|
||||
}
|
||||
num = num + i;
|
||||
model.WorkPackCode = $"WP{string.Format("{0:d3}", num)}";
|
||||
i++;
|
||||
num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -273,7 +273,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
model.Remark = item.Remark;
|
||||
result.Add(model);
|
||||
}
|
||||
result = result.OrderBy(p => p.Sort).ToList();
|
||||
result = result.OrderBy(p => int.Parse(Regex.Replace(p.WorkPackCode, @"\D", ""))).ToList();
|
||||
Grid1.DataSource = result;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user