| | |
| | | |
| | | namespace HStation.WinFrmUI.Assets |
| | | { |
| | | public partial class EditThreeLinkMainDlg : DevExpress.XtraEditors.XtraForm |
| | | public partial class EditAssetsThreelinkMainDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public EditThreeLinkMainDlg() |
| | | public EditAssetsThreelinkMainDlg() |
| | | { |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | } |
| | | |
| | | private Vmo.ThreeLinkMainVmo _ThreeLinkVmo = null; |
| | | private Vmo.AssetsThreelinkMainVmo _ThreeLinkVmo = null; |
| | | |
| | | public async void SetBindingData(Vmo.ThreeLinkMainVmo ThreeLinkVmo) |
| | | public async void SetBindingData(Vmo.AssetsThreelinkMainVmo ThreeLinkVmo) |
| | | { |
| | | _ThreeLinkVmo = ThreeLinkVmo; |
| | | var allCaliber = await new Yw.BLL.SysDictData().GetByTypeCode("1"); |
| | |
| | | { |
| | | TextEditCaliber.EditValue = _ThreeLinkVmo.Caliber.ToString(); |
| | | } |
| | | if (_ThreeLinkVmo.MaterialName == null) |
| | | if (_ThreeLinkVmo.Material == null) |
| | | { |
| | | TextEditMaterial.EditValue = "默认"; |
| | | } |
| | | else |
| | | { |
| | | TextEditMaterial.EditValue = _ThreeLinkVmo.MaterialName.ToString(); |
| | | TextEditMaterial.EditValue = _ThreeLinkVmo.Material.ToString(); |
| | | } |
| | | this.textEditRunThroughCoefficient.Text = _ThreeLinkVmo.RunThroughMinorLoss.ToString(); |
| | | this.textEditBranchThroughCoefficient.Text = _ThreeLinkVmo.BranchThroughMinorLoss.ToString(); |
| | | this.TextEditName.Text = _ThreeLinkVmo.Name; |
| | | this.DescriptionTextEdit.Text = _ThreeLinkVmo.Description; |
| | | this.TextEditCoefficient.Text = _ThreeLinkVmo.Coefficient.ToString(); |
| | | this.TextEditKeyWorld.Text = _ThreeLinkVmo.KeyWord; |
| | | this.TextEditMinorLoss.Text = _ThreeLinkVmo.MinorLoss.ToString(); |
| | | this.TextEditKeyWord.Text = string.Join(",", _ThreeLinkVmo.KeyWord); |
| | | } |
| | | |
| | | public event Func<Vmo.ThreeLinkMainVmo, Task<bool>> ReloadDataEvent = null; |
| | | public event Func<Vmo.AssetsThreelinkMainVmo, Task<bool>> ReloadDataEvent = null; |
| | | |
| | | //数据验证 |
| | | private bool Valid() |
| | |
| | | { |
| | | if (!(Valid())) |
| | | return; |
| | | _ThreeLinkVmo.MaterialName = TextEditMaterial.Text.Trim(); |
| | | _ThreeLinkVmo.Material = TextEditMaterial.Text.Trim(); |
| | | _ThreeLinkVmo.Description = DescriptionTextEdit.Text.Trim(); |
| | | _ThreeLinkVmo.Name = TextEditName.Text.Trim(); |
| | | _ThreeLinkVmo.KeyWord = TextEditKeyWorld.Text.Trim(); |
| | | _ThreeLinkVmo.KeyWord = this.TextEditKeyWord.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); |
| | | if (double.TryParse(TextEditCaliber.Text, out double caliber)) |
| | | { |
| | | _ThreeLinkVmo.Caliber = caliber; |
| | | } |
| | | if (double.TryParse(TextEditCoefficient.Text, out double Coefficient)) |
| | | if (double.TryParse(TextEditMinorLoss.Text, out double MinorLoss)) |
| | | { |
| | | _ThreeLinkVmo.Coefficient = Coefficient; |
| | | _ThreeLinkVmo.MinorLoss = MinorLoss; |
| | | } |
| | | else if (TextEditCaliber.Text == "默认") |
| | | { |
| | | _ThreeLinkVmo.Caliber = null; |
| | | } |
| | | if (double.TryParse(textEditRunThroughCoefficient.Text, out double runThrough)) |
| | | { |
| | | _ThreeLinkVmo.RunThroughMinorLoss = runThrough; |
| | | } |
| | | if (double.TryParse(textEditBranchThroughCoefficient.Text, out double branchThough)) |
| | | { |
| | | _ThreeLinkVmo.BranchThroughMinorLoss = branchThough; |
| | | } |
| | | if (await this.ReloadDataEvent.Invoke(_ThreeLinkVmo)) |
| | | { |
| | | TipFormHelper.ShowSucceed("修改成功!"); |