// ***************************** ***************************** ***************************** // constructor public InstruccionModViewModel(InstruccionModel p, InstruccionViewModel InstruccionViewModel) { this._ParentInstruccion = InstruccionViewModel; this._InstruccionRepository = new GestorDocument.DAL.Repository.InstruccionRepository(); this._Instruccion = new InstruccionModel() { IdInstruccion = p.IdInstruccion, CveInstruccion = p.CveInstruccion, InstruccionName = p.InstruccionName, IsActive = p.IsActive, }; }
public void GetExistInstruccion(string InstruccionName) { this._Instruccion = new InstruccionModel() { IdInstruccion = new UNID().getNewUNID(), InstruccionName = InstruccionName, CveInstruccion = 0, IsActive = true }; this._CheckSave = this._InstruccionRepository.GetInstruccionAdd(this._Instruccion); if (this._CheckSave == null) { this._InstruccionRepository.InsertInstruccion(this._Instruccion); this.Asunto.Instruccion = this.Instruccion; this.Instruccions = this._InstruccionRepository.GetInstruccions() as ObservableCollection<InstruccionModel>; } }
public bool CanSave() { bool _CanSave = false; if ((this._Instruccion != null) || !String.IsNullOrEmpty(this._Instruccion.InstruccionName)) { _CanSave = true; this._CheckSave = this._InstruccionRepository.GetInstruccionMod(this._Instruccion); if (this._CheckSave != null) { _CanSave = false; ElementExists = "El elemento ya existe."; } else { _CanSave = true; ElementExists = ""; } } return _CanSave; }