using DevExpress.XtraEditors;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Security.Cryptography;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace IStation.WinFrmUI.Basic.basic.pumpmgr
|
{
|
public partial class AddPumpDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public AddPumpDlg()
|
{
|
InitializeComponent();
|
}
|
|
public event Func<Model.Product<Model.Pump>,bool> ReloadBingData=null;
|
private Model.Product<Model.Pump> _model=null;
|
|
|
public void SetbindingData()
|
{
|
|
}
|
|
private bool Virify()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
if (string.IsNullOrEmpty(this.txtNameEdit.Text))
|
{
|
this.dxErrorProvider1.SetError(this.txtNameEdit,"必填项");
|
return false;
|
}
|
return true;
|
}
|
|
//确定
|
private void BtnOk_Click(object sender, EventArgs e)
|
{
|
if (!Virify())
|
return;
|
var pump= new Model.Pump();
|
_model = new Model.Product<Model.Pump>();
|
double Qr = 0;
|
if (double.TryParse(this.txtQrEdit.Text, out Qr)) //尝试类型转换
|
pump.Qr = Qr;
|
double er = 0;
|
if (double.TryParse(this.txtErEdit.Text, out er))
|
pump.Er = er;
|
double hr = 0;
|
if (double.TryParse(this.txtHrEdit.Text, out hr))
|
pump.Hr = hr;
|
double oc = 0;
|
if (double.TryParse(this.txtOcEdit.Text, out oc))
|
pump.Oc = oc;
|
double pr = 0;
|
if (double.TryParse(this.txtPrEdit.Text, out pr))
|
pump.Pr = pr;
|
double nr = 0;
|
if (double.TryParse(this.txtNrEdit.Text, out nr))
|
pump.Nr = nr;
|
int str = 0;
|
if (int.TryParse(this.txtStNumrEdit.Text, out str))
|
pump.StNumr = str;
|
int ic = 0;
|
if (int.TryParse(this.txtlcEdit.Text, out ic))
|
pump.Ic = ic;
|
_model.Name = this.txtNameEdit.Text;
|
_model.Supplier = this.txtSupplierEdit.Text;
|
pump.IsBp = txtIsBpEdit.Checked;
|
pump.IsSxp = txtIsSxpEdit.Checked;
|
_model.RatedParas = (pump);
|
var isOk = this.ReloadBingData.Invoke(_model);
|
if (isOk == false)
|
{
|
XtraMessageBox.Show("添加失败!");
|
return;
|
}
|
XtraMessageBox.Show("添加成功!");
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
this.Close();
|
}
|
|
|
}
|
}
|