/// <summary> /// 記錄操作控制 /// </summary> /// <param name="MachineMaintainInfo"></param> void RecordControl(MaintainRecordView MachineMaintainInfo) { try { switch (m_RecordState) { case RecordState.Creat: m_AbstractMachineMaintain.MaintainRecordCreate(MachineMaintainInfo); break; case RecordState.Modify: m_AbstractMachineMaintain.MaintainRecordModify(MachineMaintainInfo); break; case RecordState.Delete: m_AbstractMachineMaintain.MaintainRecordDelete(MachineMaintainInfo); break; case RecordState.Begin: m_AbstractMachineMaintain.MaintainRecordBegin(MachineMaintainInfo); break; case RecordState.End: m_AbstractMachineMaintain.MaintainRecordEnd(MachineMaintainInfo); break; default: break; } m_RecordState = RecordState.None; } catch (Exception ex) { ShowErrorMessage(ex); } }
void ShowRecordInfo(MaintainRecordView record) { if (record == null) { return; } if (record.PlanID != 0) { this.m_frmMaintenanceSituationBase.ComboBoxActionName.Enabled = false; } this.m_frmMaintenanceSituationBase.ComboBoxActionName.SelectedValue = record.OperationCode.ToString().Trim(); this.m_frmMaintenanceSituationBase.TextBoxDescription.Text = record.Description; this.m_frmMaintenanceSituationBase.TextBoxEventAfterMaintenance.Text = record.Remark; }
private void btnOK_Click(object sender, EventArgs e) { if (CheckBeforeSave()) { MaintainRecordView recordInfo = null; switch (_infoState) { case FormState.Add: recordInfo = new MaintainRecordView(); break; case FormState.Edit: recordInfo = this.GetSelectMaintainRecordView(); break; } if (recordInfo != null) { recordInfo.Description = this.m_frmMaintenanceSituationBase.TextBoxDescription.Text; recordInfo.Remark = this.m_frmMaintenanceSituationBase.TextBoxEventAfterMaintenance.Text; recordInfo.OperationCode = Convert.ToInt32(this.m_frmMaintenanceSituationBase.ComboBoxActionName.SelectedValue); } RecordControl(recordInfo); this.SetFormControlState(FormState.ReadOnly); _infoState = FormState.ReadOnly; } }