lixiaojun
2024-07-19 2415c4eedaa96532ffc7eb1c7e5d018106115bf4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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);
            }
        }
    }
}