internal void Update(ClaseExtra parent) { this.RaiseListChangedEvents = false; // update (thus deleting) any deleted child objects foreach (Sesion obj in DeletedList) { obj.DeleteSelf(parent); } // now that they are deleted, remove them from memory too DeletedList.Clear(); // AddItem/update any current child objects foreach (Sesion obj in this) { if (obj.IsNew) { obj.Insert(parent); } else { obj.Update(parent); } } this.RaiseListChangedEvents = true; }
internal void DeleteSelf(ClaseExtra 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 <SesionRecord>(Oid)); } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkNew(); }
internal void Update(ClaseExtra 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; OidClaseExtra = parent.Oid; try { ValidationRules.CheckRules(); if (!IsValid) { throw new iQValidationException(moleQule.Library.Resources.Messages.GENERIC_VALIDATION_ERROR); } SesionRecord obj = parent.Session().Get <SesionRecord>(Oid); obj.CopyValues(this.Base.Record); parent.Session().Update(obj); } catch (Exception ex) { iQExceptionHandler.TreatException(ex); } MarkOld(); }
private void DataPortal_Fetch(CriteriaEx criteria) { try { SessionCode = criteria.SessionCode; Childs = criteria.Childs; if (nHMng.UseDirectSQL) { PlanExtra.DoLOCK(Session()); IDataReader reader = PlanExtra.DoSELECT(AppContext.ActiveSchema.Code, Session(), criteria.Oid); if (reader.Read()) { _base.CopyValues(reader); } if (Childs) { string query = string.Empty; ClaseExtra.DoLOCK(Session()); query = ClaseExtras.SELECT_CLASES_EXTRAS_PLAN(this.Oid); reader = nHManager.Instance.SQLNativeSelect(query, Session()); _c_extras = ClaseExtras.GetChildList(reader); } } else { _base.Record.CopyValues((PlanExtraRecord)(criteria.UniqueResult())); //Session().Lock(Session().Get<PlanExtraRecord>(Oid), LockMode.UpgradeNoWait); if (Childs) { criteria = ClaseExtra.GetCriteria(Session()); criteria.AddEq("OidPlan", this.Oid); _c_extras = ClaseExtras.GetChildList(criteria.List <ClaseExtra>()); } } } catch (NHibernate.ADOException) { if (Transaction() != null) { Transaction().Rollback(); } throw new iQLockException(moleQule.Library.Resources.Messages.LOCK_ERROR); } catch (Exception ex) { if (Transaction() != null) { Transaction().Rollback(); } iQExceptionHandler.TreatException(ex); } }
public static Sesion NewChild(ClaseExtra parent) { if (!CanAddObject()) { throw new System.Security.SecurityException( moleQule.Library.Resources.Messages.USER_NOT_ALLOWED); } Sesion obj = new Sesion(); obj.OidClaseExtra = parent.Oid; return(obj); }
// private ClaseExtraList() { } /// <summary> /// Retrieve the complete list from db /// </summary> /// <returns>ClaseExtraList</returns> public static ClaseExtraList GetList() { CriteriaEx criteria = ClaseExtra.GetCriteria(ClaseExtra.OpenSession()); criteria.Query = ClaseExtras.SELECT(); //No criteria. Retrieve all de List ClaseExtraList list = DataPortal.Fetch <ClaseExtraList>(criteria); CloseSession(criteria.SessionCode); return(list); }
/// <summary> /// Retrieve the complete list from db /// </summary> /// <returns>ClaseExtraList</returns> public static ClaseExtraList GetDisponiblesList(long oid_promocion, long oid_horario) { CriteriaEx criteria = ClaseExtra.GetCriteria(ClaseExtra.OpenSession()); criteria.Query = ClaseExtras.SELECT_CLASES_EXTRAS_DISPONIBLES(oid_promocion, oid_horario); //No criteria. Retrieve all de List ClaseExtraList list = DataPortal.Fetch <ClaseExtraList>(criteria); CloseSession(criteria.SessionCode); return(list); }
public void CopyValues(ClaseExtra source) { if (source == null) { return; } _record.CopyValues(source.Base.Record); _modulo = source.Modulo; _submodulo = source.Submodulo; _estado = source.Estado; _tipo = source.Tipo; }
// called to copy objects data from list private void Fetch(IDataReader reader) { this.RaiseListChangedEvents = false; IsReadOnly = false; while (reader.Read()) { this.AddItem(ClaseExtra.GetChild(reader).GetInfo()); } IsReadOnly = true; this.RaiseListChangedEvents = true; }
/// <summary> /// Retrieve the complete list from db /// </summary> /// <returns>ClasePracticaList</returns> public static ClaseExtraList GetClasesPlanList(long oid_plan) { CriteriaEx criteria = ClaseExtra.GetCriteria(ClaseExtra.OpenSession()); //No criteria. Retrieve all de List if (nHManager.Instance.UseDirectSQL) { criteria.Query = ClaseExtras.SELECT_CLASES_EXTRAS_PLAN(oid_plan); } ClaseExtraList list = DataPortal.Fetch <ClaseExtraList>(criteria); CloseSession(criteria.SessionCode); return(list); }
public void CopyFrom(ClaseExtra source) { _base.CopyValues(source); }
public Sesion NewItem(ClaseExtra parent) { this.AddItem(Sesion.NewChild(parent)); return(this[Count - 1]); }