public static Examen Duplicate(long oid) { ExamenInfo old = ExamenInfo.Get(oid, true); Examen item = Examen.New(); item.FechaExamen = DateTime.Today; item.FechaCreacion = DateTime.Today; item.FechaEmision = DateTime.MaxValue; item.OidPromocion = old.OidPromocion; item.Promocion = old.Promocion; item.OidProfesor = old.OidProfesor; item.Instructor = old.Instructor; item.OidModulo = old.OidModulo; item.Modulo = old.Modulo; item.Tipo = old.Tipo; item.Desarrollo = old.Desarrollo; item.Titulo = old.Titulo + "_COPIA"; item.Duracion = old.Duracion; item.MemoPreguntas = old.MemoPreguntas; item.Promociones = ExamenPromociones.NewChildList(); foreach (ExamenPromocionInfo ep in old.Promociones) { ExamenPromocion nuevo = item.Promociones.NewItem(item); nuevo.OidPromocion = ep.OidPromocion; } return(item); }
private void Fetch(Examen source) { try { SessionCode = source.SessionCode; _base.CopyValues(source); CriteriaEx criteria = Pregunta_Examen.GetCriteria(Session()); criteria.AddEq("OidExamen", this.Oid); _preguntas = Pregunta_Examens.GetChildList(criteria.List <Pregunta_Examen>()); criteria = PreguntaExamen.GetCriteria(Session()); criteria.AddEq("OidExamen", this.Oid); _preguntaexamens = PreguntaExamens.GetChildList(criteria.List <PreguntaExamen>()); criteria = Alumno_Examen.GetCriteria(Session()); criteria.AddEq("OidExamen", this.Oid); _alumnos = Alumno_Examens.GetChildList(criteria.List <Alumno_Examen>()); criteria = ExamenPromocion.GetCriteria(Session()); criteria.AddEq("OidExamen", this.Oid); _promociones = ExamenPromociones.GetChildList(criteria.List <ExamenPromocion>()); } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
//internal void Insert(Modulo parent) //{ // // if we're not dirty then don't update the database // if (!this.IsDirty) return; // //Debe obtener la sesion del padre pq el objeto es padre a su vez // SessionCode = parent.SessionCode; // _oid_modulo = parent.Oid; // try // { // ValidationRules.CheckRules(); // if (!IsValid) // throw new iQValidationException(moleQule.Library.Resources.Messages.GENERIC_VALIDATION_ERROR); // parent.Session().Save(this); // _preguntas.Update(this); // _preguntaexamens.Update(this); // _alumnos.Update(this); // } // catch (Exception ex) // { // iQExceptionHandler.TreatException(ex); // } // MarkOld(); //} //internal void Update(Modulo parent) //{ // // if we're not dirty then don't update the database // if (!this.IsDirty) return; // //Debe obtener la sesion del padre pq el objeto es padre a su vez // SessionCode = parent.SessionCode; // _oid_modulo = parent.Oid; // try // { // ValidationRules.CheckRules(); // if (!IsValid) // throw new iQValidationException(moleQule.Library.Resources.Messages.GENERIC_VALIDATION_ERROR); // Examen obj = parent.Session().Get<Examen>(Oid); // obj.CopyValues(this); // parent.Session().Update(obj); // _preguntas.Update(this); // _preguntaexamens.Update(this); // _alumnos.Update(this); // } // catch (Exception ex) // { // iQExceptionHandler.TreatException(ex); // } // MarkOld(); //} //internal void DeleteSelf(Modulo parent) //{ // // if we're not dirty then don't update the database // if (!this.IsDirty) return; // // if we're new then don't update the database // if (this.IsNew) return; // try // { // SessionCode = parent.SessionCode; // Session().Delete(Session().Get<Examen>(Oid)); // } // catch (Exception ex) // { // iQExceptionHandler.TreatException(ex); // } // MarkNew(); //} #endregion #region Root Data Access // called to retrieve data from the database private void DataPortal_Fetch(CriteriaEx criteria) { try { SessionCode = criteria.SessionCode; Childs = criteria.Childs; if (nHMng.UseDirectSQL) { Examen.DoLOCK(Session()); IDataReader reader = nHManager.Instance.SQLNativeSelect(criteria.Query, Session()); if (reader.Read()) { _base.CopyValues(reader); } if (Childs) { Pregunta_Examen.DoLOCK(Session()); string query = Pregunta_Examens.SELECT_BY_EXAMEN(this.Oid); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _preguntas = Pregunta_Examens.GetChildList(reader); PreguntaExamen.DoLOCK(Session()); query = PreguntaExamens.SELECT_BY_EXAMEN(this.Oid); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _preguntaexamens = PreguntaExamens.GetChildList(criteria.SessionCode, reader); Alumno_Examen.DoLOCK(Session()); query = Alumno_Examens.SELECT(GetInfo(false)); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _alumnos = Alumno_Examens.GetChildList(criteria.SessionCode, reader); ExamenPromocion.DoLOCK(Session()); query = ExamenPromociones.SELECT(this); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _promociones = ExamenPromociones.GetChildList(criteria.SessionCode, reader); } } } catch (Exception ex) { if (Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex); } }
/// <summary> /// Borra el registro de la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para borrar elementos<remarks/> internal void DeleteSelf(ExamenPromociones parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } // if we're new then don't update the database if (this.IsNew) { return; } SessionCode = parent.SessionCode; Session().Delete(Session().Get <ExamenPromocion>(Oid)); MarkNew(); }
/// <summary> /// Inserta el registro en la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para insertar elementos<remarks/> internal void Insert(ExamenPromociones parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR); } parent.Session().Save(this._base._record); MarkOld(); }
/// <summary> /// Actualiza el registro en la base de datos /// </summary> /// <param name="parent">Lista padre</param> /// <remarks>La utiliza la BusinessListBaseEx correspondiente para actualizar elementos<remarks/> internal void Update(ExamenPromociones parent) { // if we're not dirty then don't update the database if (!this.IsDirty) { return; } ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR); } SessionCode = parent.SessionCode; ExamenPromocionRecord obj = Session().Get <ExamenPromocionRecord>(Oid); obj.CopyValues(this._base._record); Session().Update(obj); MarkOld(); }