using System;
|
using System.Collections.Generic;
|
using System.Windows.Forms;
|
|
namespace TProduct.WinFrmUI.TPump
|
{
|
public partial class TestInfoCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public TestInfoCtrl()
|
{
|
InitializeComponent();
|
}
|
TProduct.Model.TestProjectBase _projectTest = null;
|
List<Model.TestProjectItemView> _items = null;
|
public void SetBindingData(TProduct.Model.TestProjectBase project,
|
List<Model.TestProjectItemView> items)
|
{
|
if (project == null || items == null)
|
return;
|
_items = items;
|
|
_projectTest = project;
|
textEdit测试编号.Text = project.Code;
|
textEdit测试名称.Text = project.Name;
|
TextEditReportFileNO.Text = project.ReportFileNO;
|
|
textEdit测试编号.Tag = string.IsNullOrEmpty(project.Code) ? "" : project.Code;
|
textEdit测试名称.Tag = string.IsNullOrEmpty(project.Name) ? "" : project.Name;
|
TextEditReportFileNO.Tag = string.IsNullOrEmpty(project.ReportFileNO) ? "" : project.ReportFileNO;
|
|
var feat = items.Find(x => x.TestType == Model.eTestType.FeatTest);
|
if (feat != null)
|
{
|
textEditFeatTestLog.Tag = string.IsNullOrEmpty(feat.ItemLogContent) ? "" : project.Name;
|
textEditFeatTestLog.Text = feat.ItemLogContent;
|
}
|
|
if (_projectTest.ProjectParas != null)
|
{
|
imageComboProjectNature.EditValue =
|
(int)_projectTest.ProjectParas.TestNature;
|
|
spinEditInspectionNumber.Value = _projectTest.ProjectParas.InspectionNumber;
|
}
|
}
|
public Action<Model.TestProjectItemView> OnSaveItem = null;
|
public Action<Model.TestProjectBase> OnSaveProject = null;
|
|
private void bbi修改参数_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
if (OnSaveItem == null)
|
return;
|
if (textEditFeatTestLog.Tag.ToString() != textEditFeatTestLog.Text)
|
{
|
var feat = _items.Find(x => x.TestType == Model.eTestType.FeatTest);
|
if (feat != null)
|
{
|
feat.ItemLogContent = textEditFeatTestLog.Text;
|
textEditFeatTestLog.Tag = textEditFeatTestLog.Text;
|
OnSaveItem(feat);
|
}
|
}
|
bool isChange = false;
|
if (textEdit测试编号.Tag.ToString() != textEdit测试编号.Text)
|
{
|
isChange = true;
|
_projectTest.Code = textEdit测试编号.Text;
|
textEdit测试编号.Tag = textEdit测试编号.Text;
|
}
|
if (TextEditReportFileNO.Tag.ToString() != TextEditReportFileNO.Text)
|
{
|
isChange = true;
|
_projectTest.ReportFileNO = TextEditReportFileNO.Text;
|
TextEditReportFileNO.Tag = TextEditReportFileNO.Text;
|
}
|
if (textEdit测试名称.Tag.ToString() != textEdit测试名称.Text)
|
{
|
isChange = true;
|
_projectTest.Name = textEdit测试名称.Text;
|
textEdit测试名称.Tag = textEdit测试名称.Text;
|
}
|
|
if (_projectTest.ProjectParas != null)
|
{
|
var nnn = (Model.eTestProjectNature)Convert.ToInt32(imageComboProjectNature.EditValue);
|
var iii = Convert.ToInt32(spinEditInspectionNumber.Value);
|
if (_projectTest.ProjectParas.TestNature != nnn)
|
{
|
isChange = true;
|
_projectTest.ProjectParas.TestNature = nnn;
|
}
|
if (_projectTest.ProjectParas.InspectionNumber != iii)
|
{
|
isChange = true;
|
_projectTest.ProjectParas.InspectionNumber = iii;
|
}
|
}
|
|
|
if (isChange && OnSaveProject != null)
|
{
|
OnSaveProject.Invoke(_projectTest);
|
}
|
|
MessageBox.Show("已保存信息");
|
}
|
}
|
}
|