SGGL_SHJ/SGGL/FineUIPro.Web/CQMS/PersonManage/TestPlanView.aspx.cs

121 lines
3.7 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.CQMS.PersonManage
{
public partial class TestPlanView : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string TestPlanId
{
get
{
return (string)ViewState["TestPlanId"];
}
set
{
ViewState["TestPlanId"] = value;
}
}
/// <summary>
/// 办理类型
/// </summary>
public string State
{
get
{
return (string)ViewState["State"];
}
set
{
ViewState["State"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.drpWelder.DataTextField = "PersonName";
this.drpWelder.DataValueField = "PersonId";
this.drpWelder.DataSource = (from x in Funs.DB.SitePerson_Person where x.ProjectId == this.CurrUser.LoginProjectId && x.WorkPostId == Const.WorkPost_Welder && x.States == Const.ProjectPersonStates_1 && x.IsWeldAudit == true select x).ToList();
this.drpWelder.DataBind();
Funs.FineUIPleaseSelect(this.drpWelder);
TestPlanId = Request.Params["TestPlanId"];
if (!string.IsNullOrEmpty(TestPlanId))
{
Model.Welder_TestPlan TestPlan = BLL.CQMS_TestPlanService.GetTestPlanByTestPlanId(TestPlanId);
txtTestPlanCode.Text = TestPlan.TestPlanCode;
if (TestPlan.PlanTestDate != null)
{
txtPlanTestDate.Text = string.Format("{0:yyyy-MM-dd}", TestPlan.PlanTestDate);
}
var list = BLL.CQMS_TestPlanDetailService.getListData(this.TestPlanId);
List<string> strs = BLL.CQMS_TestPlanDetailService.getPersonIdList(this.TestPlanId);
if (strs.Count > 0)
{
this.drpWelder.SelectedValueArray = strs.ToArray();
}
Grid1.DataSource = list;
Grid1.DataBind();
}
else
{
string prefix = BLL.ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId) + "-HGKS-";
txtTestPlanCode.Text = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "Welder_TestPlan", "TestPlanCode", prefix);
}
}
}
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
}
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
}
/// <summary>
/// 时间转换
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public string ConvertDate(object date)
{
if (date != null)
{
return string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(date));
}
else
{
return null;
}
}
private string GetStringByArray(string[] array)
{
string str = string.Empty;
foreach (var item in array)
{
if (item != BLL.Const._Null)
{
str += item + ",";
}
}
if (!string.IsNullOrEmpty(str))
{
str = str.Substring(0, str.LastIndexOf(","));
}
return str;
}
}
}