using DevExpress.XtraEditors;
|
using HStation.Dto;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace HStation.WinFrmUI.Xhs.Project
|
{
|
public partial class ProjectUserControl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public ProjectUserControl()
|
{
|
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;
|
}
|
if (string.IsNullOrEmpty(this.BtnFileChoice.Text.Trim()))
|
{
|
this.dxErrorProvider1.SetError(this.BtnFileChoice, "必选项");
|
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.GID = Guid.NewGuid().ToString();
|
model.Description = this.DescriptionTextEdit.Text.Trim();
|
// model.CreateUserID=
|
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;
|
}
|
// string extractPath = @"C:\Users\ZKC\Desktop\sss";
|
// ZipFile.ExtractToDirectory(extractPath, selectedFilePath);
|
}
|
}
|
}
|