public int NewGoal(double p_odd, string p_description, PickadosGenNHibernate.Enumerated.Pickados.PickResultEnum p_pickResult, string p_bookie, int p_event_rel, PickadosGenNHibernate.Enumerated.Pickados.LineEnum p_line, double p_quantity, bool p_asian) { GoalEN goalEN = null; int oid; //Initialized GoalEN goalEN = new GoalEN(); goalEN.Odd = p_odd; goalEN.Description = p_description; goalEN.PickResult = p_pickResult; goalEN.Bookie = p_bookie; if (p_event_rel != -1) { // El argumento p_event_rel -> Property event_rel es oid = false // Lista de oids id goalEN.Event_rel = new PickadosGenNHibernate.EN.Pickados.Event_EN(); goalEN.Event_rel.Id = p_event_rel; } goalEN.Line = p_line; goalEN.Quantity = p_quantity; goalEN.Asian = p_asian; //Call to GoalCAD oid = _IGoalCAD.NewGoal(goalEN); return(oid); }
public void SetStatusDate(int p_oid, Nullable <DateTime> p_statusDate) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Goal_setStatusDate) ENABLED START*/ // Write here your custom code... GoalCAD goalCAD = new GoalCAD(); GoalCEN goalCEN = new GoalCEN(goalCAD); if (p_oid > 0) { GoalEN goal = goalCEN.ReadOID(p_oid); if (goal != null) { if (p_statusDate != null && p_statusDate >= goal.StatusDate) { goal.StatusDate = p_statusDate; goalCAD.Modify(goal); } } } /*PROTECTED REGION END*/ }
public GoalEN ReadOIDDefault(int identifier ) { GoalEN goalEN = null; try { SessionInitializeTransaction(); goalEN = (GoalEN)session.Get(typeof(GoalEN), identifier); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } return(goalEN); }
public int New_(GoalEN goal) { try { SessionInitializeTransaction(); if (goal.CarePlan != null) { // Argumento OID y no colección. goal.CarePlan = (ChroniGenNHibernate.EN.Chroni.CarePlanEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.CarePlanEN), goal.CarePlan.Identifier); goal.CarePlan.Goal .Add(goal); } session.Save(goal); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } return(goal.Identifier); }
public void Destroy(int identifier ) { try { SessionInitializeTransaction(); GoalEN goalEN = (GoalEN)session.Load(typeof(GoalEN), identifier); session.Delete(goalEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } }
// Modify default (Update all attributes of the class) public void ModifyDefault(GoalEN goal) { try { SessionInitializeTransaction(); GoalEN goalEN = (GoalEN)session.Load(typeof(GoalEN), goal.Id); goalEN.Line = goal.Line; goalEN.Quantity = goal.Quantity; goalEN.Asian = goal.Asian; session.Update(goalEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is PickadosGenNHibernate.Exceptions.ModelException) { throw ex; } throw new PickadosGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } }
public int NewGoal(GoalEN goal) { try { SessionInitializeTransaction(); if (goal.Event_rel != null) { // Argumento OID y no colección. goal.Event_rel = (PickadosGenNHibernate.EN.Pickados.Event_EN)session.Load(typeof(PickadosGenNHibernate.EN.Pickados.Event_EN), goal.Event_rel.Id); goal.Event_rel.Pick_rel .Add(goal); } session.Save(goal); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is PickadosGenNHibernate.Exceptions.ModelException) { throw ex; } throw new PickadosGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } return(goal.Id); }
public void SetStatus(int p_oid, ChroniGenNHibernate.Enumerated.Chroni.GoalStatusEnum p_status) { /*PROTECTED REGION ID(ChroniGenNHibernate.CEN.Chroni_Goal_setStatus) ENABLED START*/ // Write here your custom code... GoalCAD goalCAD = new GoalCAD(); GoalCEN goalCEN = new GoalCEN(goalCAD); if (p_oid > 0) { GoalEN goal = goalCEN.ReadOID(p_oid); if (goal != null) { if (p_status > 0) { goal.Status = p_status; goalCAD.Modify(goal); } } } /*PROTECTED REGION END*/ }
public GoalEN ReadOID(int identifier ) { GoalEN goalEN = null; goalEN = _IGoalCAD.ReadOID(identifier); return(goalEN); }
public static GoalEN Convert(GoalDTO dto) { GoalEN newinstance = null; try { if (dto != null) { newinstance = new GoalEN(); if (dto.CarePlan_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.ICarePlanTemplateCAD carePlanTemplateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.CarePlanTemplateCAD(); newinstance.CarePlan = carePlanTemplateCAD.ReadOIDDefault(dto.CarePlan_oid); } newinstance.Id = dto.Id; newinstance.Priority = dto.Priority; if (dto.Targets != null) { MoSIoTGenNHibernate.CAD.MosIoT.ITargetCAD targetCAD = new MoSIoTGenNHibernate.CAD.MosIoT.TargetCAD(); newinstance.Targets = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.TargetEN>(); foreach (TargetDTO entry in dto.Targets) { newinstance.Targets.Add(TargetAssemblerDTO.Convert(entry)); } } newinstance.Status = dto.Status; if (dto.Condition_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IConditionCAD conditionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.ConditionCAD(); newinstance.Condition = conditionCAD.ReadOIDDefault(dto.Condition_oid); } newinstance.Description = dto.Description; newinstance.Category = dto.Category; newinstance.OutcomeCode = dto.OutcomeCode; newinstance.Name = dto.Name; } } catch (Exception ex) { throw ex; } return(newinstance); }
// Modify default (Update all attributes of the class) public void ModifyDefault(GoalEN goal) { try { SessionInitializeTransaction(); GoalEN goalEN = (GoalEN)session.Load(typeof(GoalEN), goal.Identifier); goalEN.Subject = goal.Subject; goalEN.StatusDate = goal.StatusDate; goalEN.Target = goal.Target; goalEN.Category = goal.Category; goalEN.Description = goal.Description; goalEN.Status = goal.Status; goalEN.Priority = goal.Priority; goalEN.Note = goal.Note; session.Update(goalEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } }
public void Modify(int p_Goal_OID, MoSIoTGenNHibernate.Enumerated.MosIoT.PriorityTypeEnum p_priority, MoSIoTGenNHibernate.Enumerated.MosIoT.CareStatusEnum p_status, string p_description, MoSIoTGenNHibernate.Enumerated.MosIoT.CategoryGoalEnum p_category, string p_outcomeCode, string p_name) { GoalEN goalEN = null; //Initialized GoalEN goalEN = new GoalEN(); goalEN.Id = p_Goal_OID; goalEN.Priority = p_priority; goalEN.Status = p_status; goalEN.Description = p_description; goalEN.Category = p_category; goalEN.OutcomeCode = p_outcomeCode; goalEN.Name = p_name; //Call to GoalCAD _IGoalCAD.Modify(goalEN); }
// Modify default (Update all attributes of the class) public void ModifyDefault(GoalEN goal) { try { SessionInitializeTransaction(); GoalEN goalEN = (GoalEN)session.Load(typeof(GoalEN), goal.Id); goalEN.Priority = goal.Priority; goalEN.Status = goal.Status; goalEN.Description = goal.Description; goalEN.Category = goal.Category; goalEN.OutcomeCode = goal.OutcomeCode; goalEN.Name = goal.Name; session.Update(goalEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } }
public void ModifyGoal(int p_Goal_OID, double p_odd, string p_description, PickadosGenNHibernate.Enumerated.Pickados.PickResultEnum p_pickResult, string p_bookie, PickadosGenNHibernate.Enumerated.Pickados.LineEnum p_line, double p_quantity, bool p_asian) { GoalEN goalEN = null; //Initialized GoalEN goalEN = new GoalEN(); goalEN.Id = p_Goal_OID; goalEN.Odd = p_odd; goalEN.Description = p_description; goalEN.PickResult = p_pickResult; goalEN.Bookie = p_bookie; goalEN.Line = p_line; goalEN.Quantity = p_quantity; goalEN.Asian = p_asian; //Call to GoalCAD _IGoalCAD.ModifyGoal(goalEN); }
public void Modify(int p_Goal_OID, string p_subject, Nullable <DateTime> p_statusDate, string p_target, ChroniGenNHibernate.Enumerated.Chroni.GoalCategoryEnum p_category, string p_description, ChroniGenNHibernate.Enumerated.Chroni.GoalStatusEnum p_status, ChroniGenNHibernate.Enumerated.Chroni.GoalPriorityEnum p_priority, string p_note) { GoalEN goalEN = null; //Initialized GoalEN goalEN = new GoalEN(); goalEN.Identifier = p_Goal_OID; goalEN.Subject = p_subject; goalEN.StatusDate = p_statusDate; goalEN.Target = p_target; goalEN.Category = p_category; goalEN.Description = p_description; goalEN.Status = p_status; goalEN.Priority = p_priority; goalEN.Note = p_note; //Call to GoalCAD _IGoalCAD.Modify(goalEN); }
public int New_(GoalEN goal) { try { SessionInitializeTransaction(); if (goal.CarePlanTemplate != null) { // Argumento OID y no colección. goal.CarePlanTemplate = (MoSIoTGenNHibernate.EN.MosIoT.CarePlanTemplateEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.CarePlanTemplateEN), goal.CarePlanTemplate.Id); goal.CarePlanTemplate.Goals .Add(goal); } if (goal.Condition != null) { // Argumento OID y no colección. goal.Condition = (MoSIoTGenNHibernate.EN.MosIoT.ConditionEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.ConditionEN), goal.Condition.Id); goal.Condition.Goal .Add(goal); } session.Save(goal); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in GoalCAD.", ex); } finally { SessionClose(); } return(goal.Id); }
public int New_(int p_carePlanTemplate, MoSIoTGenNHibernate.Enumerated.MosIoT.PriorityTypeEnum p_priority, MoSIoTGenNHibernate.Enumerated.MosIoT.CareStatusEnum p_status, int p_condition, string p_description, MoSIoTGenNHibernate.Enumerated.MosIoT.CategoryGoalEnum p_category, string p_outcomeCode, string p_name) { GoalEN goalEN = null; int oid; //Initialized GoalEN goalEN = new GoalEN(); if (p_carePlanTemplate != -1) { // El argumento p_carePlanTemplate -> Property carePlanTemplate es oid = false // Lista de oids id goalEN.CarePlanTemplate = new MoSIoTGenNHibernate.EN.MosIoT.CarePlanTemplateEN(); goalEN.CarePlanTemplate.Id = p_carePlanTemplate; } goalEN.Priority = p_priority; goalEN.Status = p_status; if (p_condition != -1) { // El argumento p_condition -> Property condition es oid = false // Lista de oids id goalEN.Condition = new MoSIoTGenNHibernate.EN.MosIoT.ConditionEN(); goalEN.Condition.Id = p_condition; } goalEN.Description = p_description; goalEN.Category = p_category; goalEN.OutcomeCode = p_outcomeCode; goalEN.Name = p_name; //Call to GoalCAD oid = _IGoalCAD.New_(goalEN); return(oid); }
public int New_(string p_subject, Nullable <DateTime> p_statusDate, string p_target, ChroniGenNHibernate.Enumerated.Chroni.GoalCategoryEnum p_category, string p_description, ChroniGenNHibernate.Enumerated.Chroni.GoalStatusEnum p_status, ChroniGenNHibernate.Enumerated.Chroni.GoalPriorityEnum p_priority, string p_note, int p_carePlan) { GoalEN goalEN = null; int oid; //Initialized GoalEN goalEN = new GoalEN(); goalEN.Subject = p_subject; goalEN.StatusDate = p_statusDate; goalEN.Target = p_target; goalEN.Category = p_category; goalEN.Description = p_description; goalEN.Status = p_status; goalEN.Priority = p_priority; goalEN.Note = p_note; if (p_carePlan != -1) { // El argumento p_carePlan -> Property carePlan es oid = false // Lista de oids identifier goalEN.CarePlan = new ChroniGenNHibernate.EN.Chroni.CarePlanEN(); goalEN.CarePlan.Identifier = p_carePlan; } //Call to GoalCAD oid = _IGoalCAD.New_(goalEN); return(oid); }
public static GoalDTOA Convert(GoalEN en, NHibernate.ISession session = null) { GoalDTOA dto = null; GoalRESTCAD goalRESTCAD = null; GoalCEN goalCEN = null; GoalCP goalCP = null; if (en != null) { dto = new GoalDTOA(); goalRESTCAD = new GoalRESTCAD(session); goalCEN = new GoalCEN(goalRESTCAD); goalCP = new GoalCP(session); // // Attributes dto.Id = en.Id; dto.Priority = en.Priority; dto.Status = en.Status; dto.Description = en.Description; dto.Category = en.Category; dto.OutcomeCode = en.OutcomeCode; dto.Name = en.Name; // // TravesalLink /* Rol: Goal o--> Target */ dto.Targets = null; List <TargetEN> Targets = goalRESTCAD.Targets(en.Id).ToList(); if (Targets != null) { dto.Targets = new List <TargetDTOA>(); foreach (TargetEN entry in Targets) { dto.Targets.Add(TargetAssembler.Convert(entry, session)); } } // // Service } return(dto); }
public HttpResponseMessage ReadOID(int idGoal) { // CAD, CEN, EN, returnValue GoalRESTCAD goalRESTCAD = null; GoalCEN goalCEN = null; GoalEN goalEN = null; GoalDTOA returnValue = null; try { SessionInitializeWithoutTransaction(); goalRESTCAD = new GoalRESTCAD(session); goalCEN = new GoalCEN(goalRESTCAD); // Data goalEN = goalCEN.ReadOID(idGoal); // Convert return if (goalEN != null) { returnValue = GoalAssembler.Convert(goalEN, session); } } catch (Exception e) { if (e.GetType() == typeof(HttpResponseException)) { throw e; } else if (e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto")) { throw new HttpResponseException(HttpStatusCode.Forbidden); } else if (e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(MoSIoTGenNHibernate.Exceptions.DataLayerException)) { throw new HttpResponseException(HttpStatusCode.BadRequest); } else { throw new HttpResponseException(HttpStatusCode.InternalServerError); } } finally { SessionClose(); } // Return 404 - Not found if (returnValue == null) { return(this.Request.CreateResponse(HttpStatusCode.NotFound)); } // Return 200 - OK else { return(this.Request.CreateResponse(HttpStatusCode.OK, returnValue)); } }