public DlgEqptMaintain(LayerInfo layerInfo,int smId,EqptMaintain eqptMaintain) { InitializeComponent(); _eqptMaintain = eqptMaintain; _layerInfo = layerInfo; _smId = smId; InitForm(); }
private void btn_Save_Click(object sender, EventArgs e) { if(txt_MaintainName.Text.Trim()=="") { XtraMessageBox.Show("维护名称必须填写!", "提示"); return; } var eqptMaintainBll = new BLL.EqptMaintain(); if(_eqptMaintain==null) { _eqptMaintain = new EqptMaintain { CheckOpinion = txt_CheckOpinion.Text, Checker = txt_Checker.Text, Department = txt_Department.Text, EqptName = txt_EqptName.Text, LayerName = _layerInfo.LayerName, MaintainDate = DateEdit_MaintianDate.DateTime, MaintainType = combox_MaintianType.Text == "周期性维护" ? 0 : 1, Maintainer = txt_Maintainer.Text, Name = txt_MaintainName.Text, NextMaintainDate = dateEdit_NextMaintainDate.DateTime, Process = txt_Process.Text, Reason = txt_Reason.Text, RecordDate = dateEdit_RecordDate.DateTime, Result = txt_Result.Text, SmId = _smId }; var eqptMaintainId = eqptMaintainBll.Add(_eqptMaintain); if(eqptMaintainId>0) { _eqptMaintain.Id = eqptMaintainId; XtraMessageBox.Show("提交成功!", "提示"); DialogResult = DialogResult.OK; } } else { _eqptMaintain.CheckOpinion = txt_CheckOpinion.Text; _eqptMaintain.Checker = txt_Checker.Text; _eqptMaintain.Department = txt_Department.Text; _eqptMaintain.EqptName = txt_EqptName.Text; _eqptMaintain.MaintainDate = DateEdit_MaintianDate.DateTime; _eqptMaintain.MaintainType = combox_MaintianType.Text == "周期性维护" ? 0 : 1; _eqptMaintain.Maintainer = txt_Maintainer.Text; _eqptMaintain.Name = txt_MaintainName.Text; _eqptMaintain.NextMaintainDate = dateEdit_NextMaintainDate.DateTime; _eqptMaintain.Process = txt_Process.Text; _eqptMaintain.RecordDate = dateEdit_RecordDate.DateTime; _eqptMaintain.Reason = txt_Reason.Text; _eqptMaintain.Result = txt_Result.Text; if(eqptMaintainBll.Update(_eqptMaintain)) { XtraMessageBox.Show("提交成功!", "提示"); DialogResult = DialogResult.OK; } } }