using HStation.Dto;
|
|
namespace HStation.WinFrmUI.Xhs.PumpProject
|
{
|
public partial class XhsProjectUserControl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsProjectUserControl()
|
{
|
InitializeComponent();
|
}
|
|
private AddXhsProjectInput _AddXhsProjectInput = null;
|
|
//验证
|
public bool Valid()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
if (string.IsNullOrEmpty(this.NameTextEdit.Text.Trim()))
|
{
|
this.dxErrorProvider1.SetError(this.NameTextEdit, "必填项");
|
return false;
|
}
|
return true;
|
}
|
|
public AddXhsProjectInput GetData(AddXhsProjectInput model)
|
{
|
model.Name = this.NameTextEdit.Text.Trim();
|
model.CustomerName = this.CustomerNameTextEdit.Text.Trim();
|
model.CreateTime = DateTime.Now;
|
model.TagName = this.TagName.Text.Trim();
|
model.GID = Guid.NewGuid().ToString();
|
model.Description = this.DescriptionTextEdit.Text.Trim();
|
return model;
|
}
|
|
//选择文件
|
private void BtnFileChoice_Click(object sender, EventArgs e)
|
{
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
openFileDialog.Filter = "ZIP Files (*.zip)|*.zip";
|
openFileDialog.FilterIndex = 1;
|
string selectedFilePath = null;
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
{
|
selectedFilePath = openFileDialog.FileName;
|
string newFileName = selectedFilePath.EndsWith(".zip", StringComparison.OrdinalIgnoreCase)
|
? selectedFilePath.Substring(0, selectedFilePath.Length - 4) + ".hsr"
|
: selectedFilePath;
|
this.BtnFileChoice.Text = newFileName;
|
//解压文件
|
// ExtractHelper.ExractFile(selectedFilePath);
|
}
|
}
|
}
|
}
|