提交代码
This commit is contained in:
@@ -9,64 +9,132 @@ namespace FineUIPro.Web.TestRun
|
||||
{
|
||||
public partial class DriverScheme : PageBase
|
||||
{
|
||||
#region 加载
|
||||
#region 加载页面
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetButtonPower();
|
||||
BindGrid();
|
||||
btnNew.OnClientClick = Window1.GetShowReference("DriverSchemeEdit.aspx") + "return false;";
|
||||
BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
|
||||
InitTree();//加载类别树
|
||||
}
|
||||
}
|
||||
|
||||
#region 绑定方案类别
|
||||
/// <summary>
|
||||
/// 绑定方案树节点
|
||||
/// </summary>
|
||||
private void InitTree()
|
||||
{
|
||||
this.tvDataTypeInit.Nodes.Clear();
|
||||
TreeNode node = new TreeNode();
|
||||
node.Text = "开车方案管理";
|
||||
node.NodeID = "0";
|
||||
node.Expanded = true;
|
||||
this.tvDataTypeInit.Nodes.Add(node);
|
||||
var types = BLL.TestRunConstructSolutionService.GetSolutionType();
|
||||
foreach (var q in types)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.ToolTip = q.Text;
|
||||
newNode.Text = q.Text;
|
||||
newNode.NodeID = q.Value;
|
||||
newNode.EnableExpandEvent = true;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 展开树
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//protected void trWBS_NodeExpand(object sender, TreeNodeEventArgs e)
|
||||
//{
|
||||
// e.Node.Nodes.Clear();
|
||||
// var types = from x in Funs.DB.DriverPrepare_DriverDataType
|
||||
// where x.ProjectId == this.CurrUser.LoginProjectId && x.ParentId == e.Node.NodeID
|
||||
// select x;
|
||||
// if (types.Count() > 0)
|
||||
// {
|
||||
// foreach (var type in types)
|
||||
// {
|
||||
// TreeNode newNode = new TreeNode();
|
||||
// newNode.ToolTip = type.DriverDataTypeName;
|
||||
// newNode.Text = type.DriverDataTypeName;
|
||||
// newNode.NodeID = type.DriverDataTypeId;
|
||||
// newNode.EnableExpandEvent = true;
|
||||
// newNode.EnableClickEvent = true;
|
||||
// e.Node.Nodes.Add(newNode);
|
||||
// var childTypes = from x in Funs.DB.DriverPrepare_DriverDataType where x.ParentId == type.DriverDataTypeId select x;
|
||||
// if (childTypes.Count() > 0)
|
||||
// {
|
||||
// TreeNode temp = new TreeNode();
|
||||
// temp.Text = "";
|
||||
// temp.NodeID = "";
|
||||
// newNode.Nodes.Add(temp);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 树点击事件
|
||||
/// <summary>
|
||||
/// 资料库类别树点击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void tvDataTypeInit_NodeCommand(object sender, TreeCommandEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 数据绑定
|
||||
//加载列表
|
||||
/// <summary>
|
||||
/// 数据绑定
|
||||
/// </summary>
|
||||
public void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT DriverScheme.DriverSchemeId,
|
||||
DriverScheme.ProjectId,
|
||||
DriverScheme.Code,
|
||||
DriverScheme.SchemeName,
|
||||
DriverScheme.SchemeCode,
|
||||
DriverScheme.CompileMan,
|
||||
DriverScheme.ApprovalUnitId,
|
||||
DriverScheme.ExaminationUnitId,
|
||||
DriverScheme.PlanCompileDate,
|
||||
DriverScheme.ActualCompileDate,
|
||||
DriverScheme.SubmitDate,
|
||||
DriverScheme.ApprovalCompletionDate,
|
||||
DriverScheme.AttachUrl,
|
||||
DriverScheme.Remark,
|
||||
DriverScheme.UnitWorkId,
|
||||
U.UserName AS CompileManName,
|
||||
Unit.UnitName AS ApprovalUnitName,
|
||||
Unit2.UnitName AS ExaminationUnitName,
|
||||
UnitWork.UnitWorkName"
|
||||
+ @" FROM Driver_DriverScheme AS DriverScheme "
|
||||
+ @" LEFT JOIN Sys_User AS U ON U.UserId=DriverScheme.CompileMan"
|
||||
+ @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId =DriverScheme.ApprovalUnitId"
|
||||
+ @" LEFT JOIN Base_Unit AS Unit2 ON Unit2.UnitId = DriverScheme.ExaminationUnitId"
|
||||
+ @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId=DriverScheme.UnitWorkId WHERE DriverScheme.ProjectId=@projectId";
|
||||
string strSql = @"SELECT chec.ConstructSolutionId,chec.ProjectId,chec.UnitId,chec.UnitWorkIds,chec.CNProfessionalCodes,"
|
||||
+ @" chec.CompileMan,chec.CompileDate,chec.code,chec.state,chec.SolutionType,chec.SolutionName,"
|
||||
+ @" unit.UnitName,u.userName as CompileManName,chec.SpecialSchemeTypeId,"
|
||||
+ @" t.SpecialSchemeTypeName"
|
||||
+ @" FROM Solution_TestRunConstructSolution chec "
|
||||
+ @" left join Base_Unit unit on unit.unitId=chec.UnitId "
|
||||
+ @" left join sys_User u on u.userId = chec.CompileMan"
|
||||
+ @" left join[dbo].[Base_SpecialSchemeType] t on chec.SpecialSchemeTypeId=t.SpecialSchemeTypeId"
|
||||
+ @" where chec.ProjectId=@ProjectId and chec.SolutionType=@SolutionType";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
|
||||
if (!string.IsNullOrEmpty(this.drpUnitWorkId.SelectedValue) && this.drpUnitWorkId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND DriverScheme.UnitWorkId=@unitWorkId";
|
||||
listStr.Add(new SqlParameter("@unitWorkId", this.drpUnitWorkId.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtSchemeName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND DriverScheme.SchemeName LIKE @schemeName";
|
||||
listStr.Add(new SqlParameter("@schemeName", "%" + this.txtSchemeName.Text.Trim() + "%"));
|
||||
}
|
||||
listStr.Add(new SqlParameter("@SolutionType", this.tvDataTypeInit.SelectedNodeID));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
var CNProfessional = CNProfessionalService.GetList();
|
||||
var uniWork = UnitWorkService.GetUnitWorkLists(CurrUser.LoginProjectId);
|
||||
if (tb.Rows.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < tb.Rows.Count; i++)
|
||||
{
|
||||
if (tb.Rows[i]["CNProfessionalCodes"] != null)
|
||||
{
|
||||
var code = tb.Rows[i]["CNProfessionalCodes"].ToString().Split(',');
|
||||
var listf = CNProfessional.Where(p => code.Contains(p.CNProfessionalId)).Select(p => p.ProfessionalName).ToArray();
|
||||
tb.Rows[i]["CNProfessionalCodes"] = string.Join(",", listf);
|
||||
}
|
||||
if (tb.Rows[i]["UnitWorkIds"] != null)
|
||||
{
|
||||
var code = tb.Rows[i]["UnitWorkIds"].ToString().Split(',');
|
||||
var workid = uniWork.Where(p => code.Contains(p.UnitWorkId)).Select(p => p.UnitWorkName + BLL.UnitWorkService.GetProjectType(p.ProjectType)).ToArray();
|
||||
tb.Rows[i]["UnitWorkIds"] = string.Join(",", workid);
|
||||
}
|
||||
}
|
||||
}
|
||||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
var table = GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
@@ -107,8 +175,12 @@ namespace FineUIPro.Web.TestRun
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 搜索
|
||||
//搜索按钮事件
|
||||
#region 查询
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
@@ -123,10 +195,38 @@ namespace FineUIPro.Web.TestRun
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
InitTree();
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 增加按钮
|
||||
/// <summary>
|
||||
/// 增加
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.tvDataTypeInit.SelectedNode != null)
|
||||
{
|
||||
//if (this.trWBS.SelectedNode.Nodes.Count == 0) //末级节点
|
||||
if (this.tvDataTypeInit.SelectedNodeID != "0")
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSchemeEdit.aspx?SolutionType={0}", this.tvDataTypeInit.SelectedNode.NodeID, "新增 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("请选择方案类别!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("请选择树节点!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑
|
||||
protected void btnMenuModify_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -150,29 +250,109 @@ namespace FineUIPro.Web.TestRun
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSchemeEdit.aspx?id={0}", Grid1.SelectedRowID, "编辑 - ")));
|
||||
string id = Grid1.SelectedRowID.Split(',')[0];
|
||||
Model.Solution_TestRunConstructSolution constructSolution = TestRunConstructSolutionService.GetConstructSolutionByConstructSolutionId(id);
|
||||
if (constructSolution.State == Const.TestRunConstructSolution_Complete)
|
||||
{
|
||||
Alert.ShowInTop("该方案已经审批完成,无法操作,请右键查看!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
else if (constructSolution.State == Const.TestRunConstructSolution_Compile)
|
||||
{
|
||||
if (constructSolution.CompileMan == CurrUser.UserId || CurrUser.UserId == Const.sysglyId)
|
||||
{
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSchemeEdit.aspx?constructSolutionId={0}", id)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您不是编制人,无法操作!请右键查看", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (constructSolution.State == Const.TestRunConstructSolution_Audit || constructSolution.State == Const.TestRunConstructSolution_ReCompile)
|
||||
{
|
||||
var approve = TestRunConstructSolutionApproveService.GetThisApproveByConstructSolutionId(id);
|
||||
if (approve != null && approve.ApproveMan == this.CurrUser.UserId)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSchemeEdit.aspx?constructSolutionId={0}", id)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您不是办理用户,无法操作!请右键查看", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnMenuView_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string id = Grid1.SelectedRowID.Split(',')[0];
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("DriverSchemeView.aspx?constructSolutionId={0}", id)));
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 右键删除
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string id = Grid1.SelectedRowID.Split(',')[0];
|
||||
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId, Const.TestRunConstructSolutionMenuId, Const.BtnDelete))
|
||||
{
|
||||
var constructSolution = TestRunConstructSolutionService.GetConstructSolutionByConstructSolutionId(id);
|
||||
if (constructSolution.State == Const.TestRunConstructSolution_ReCompile || constructSolution.State == Const.TestRunConstructSolution_Compile)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var info = BLL.DriverSchemeService.GetDriverSchemeById(rowID);
|
||||
if (info != null)
|
||||
if (constructSolution.CompileMan == this.CurrUser.UserId || this.CurrUser.UserId == Const.hfnbdId || this.CurrUser.UserId == Const.sysglyId)
|
||||
{
|
||||
BLL.DriverSchemeService.DeleteDriverScheme(rowID);
|
||||
TestRunConstructSolutionApproveService.DeleteConstructSolutionApprovesByConstructSolutionId(id);
|
||||
TestRunConstructSolutionService.DeleteConstructSolution(id);
|
||||
LogService.AddSys_Log(CurrUser, constructSolution.Code, id, Const.TestRunConstructSolutionMenuId, "删除方案审查");
|
||||
BindGrid();
|
||||
Alert.ShowInTop("删除成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
BindGrid();
|
||||
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
||||
else
|
||||
{
|
||||
if (this.CurrUser.UserId == Const.hfnbdId || this.CurrUser.UserId == Const.sysglyId)
|
||||
{
|
||||
|
||||
TestRunConstructSolutionApproveService.DeleteConstructSolutionApprovesByConstructSolutionId(id);
|
||||
TestRunConstructSolutionService.DeleteConstructSolution(id);
|
||||
LogService.AddSys_Log(CurrUser, constructSolution.Code, id, Const.TestRunConstructSolutionMenuId, "删除方案审查");
|
||||
BindGrid();
|
||||
Alert.ShowInTop("删除成功!", MessageBoxIcon.Success);
|
||||
return;
|
||||
}
|
||||
Alert.ShowInTop("删除失败,方案正在审批中!", MessageBoxIcon.Success);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -188,7 +368,7 @@ namespace FineUIPro.Web.TestRun
|
||||
string id = Grid1.DataKeys[e.RowIndex][0].ToString();
|
||||
if (e.CommandName == "AttachUrl")
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/TestRun/DriverScheme&menuId={1}", id, BLL.Const.DriverSchemeMenuId)));
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/TestRun/DriverPrepare/DriverData&menuId={1}", id, BLL.Const.TestRunConstructSolutionMenuId)));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -199,7 +379,7 @@ namespace FineUIPro.Web.TestRun
|
||||
/// </summary>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DriverSchemeMenuId);
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestRunConstructSolutionMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
|
||||
Reference in New Issue
Block a user