/// <summary> /// Opens the QCL Form. /// </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { //Get Values off the arguments ImpacPersistenceManager pm = ImpacPersistenceManagerFactory.CreatePersistenceManager(); int proId = ProId.Get(context); int staffIdResponsible = StaffIdResponsible.Get(context); string comment = Comment.Get(context); if (String.IsNullOrWhiteSpace(comment)) { comment = String.Empty; } //Check if values exist in the database. var prompt = pm.GetEntity <Prompt>(new PrimaryKey(typeof(Prompt), proId)); if (prompt.IsNullEntity) { throw new InvalidOperationException("Cannot find QCL Procedure (Prompt) record with Pro_Id: " + proId); } var staffResponsible = pm.GetEntity <Staff>(new PrimaryKey(typeof(Staff), staffIdResponsible)); if (staffResponsible.IsNullEntity) { throw new InvalidOperationException("Cannot find Responsible (Staff) record with Staff_Id: " + staffIdResponsible); } int chkId = CallClarion.AddQclRecord(prompt.Text, comment, staffIdResponsible); ChkId.Set(context, chkId); }
private void LoadTabViews() { var query = new ImpacRdbQuery(typeof(ObsDef)); query.AddClause(ObsDefDataRow.OBD_GUIDEntityColumn, EntityQueryOp.EQ, Value.TabGuid); var tab = _pm.GetEntity <ObsDef>(query); query = new ImpacRdbQuery(typeof(ObsDef)); query.AddClause(ObsDefDataRow.TypeEntityColumn, EntityQueryOp.EQ, 1); query.AddClause(ObsDefDataRow.TblEntityColumn, EntityQueryOp.EQ, tab.Tbl); query.AddClause(ObsDefDataRow.ActiveEntityColumn, EntityQueryOp.EQ, true); query.AddOrderBy(ObsDefDataRow.LabelEntityColumn); _tabViews = _pm.GetEntities <ObsDef>(query); }
/// <summary> Performs the query requested. </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { //Get argument values //Get argument values. ImpacPersistenceManager pm = PersistenceManager.Expression != null ? PersistenceManager.Get(context) : PM; QueryStrategy strategy = Strategy.Get(context) ?? QueryStrategy.Normal; object key = PrimaryKey.Get(context); //Execute the query and return the result. Entity entity = pm.GetEntity <T>(new PrimaryKey(typeof(T), key), strategy); Result.Set(context, entity); }
/// <summary> /// Performs the query. /// </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { //Get arguments //Get argument values. ImpacPersistenceManager pm = PersistenceManager.Expression != null ? PersistenceManager.Get(context) : PM; QueryStrategy strategy = Strategy.Get(context) ?? QueryStrategy.Normal; string sqlQuery = Query.Get(context); //Run query and set results. var passthroughQuery = new PassthruRdbQuery(typeof(T), sqlQuery); var entity = pm.GetEntity <T>(passthroughQuery, strategy); Result.Set(context, entity); }
/// <summary> /// Estimates the dose based on the pharmacy order and calculation factor passed in. /// </summary> /// <param name="context"></param> protected override void DoWork(CodeActivityContext context) { int rxoId = RxoId.Get(context); double bsa = BSA.Get(context); ImpacPersistenceManager pm = ImpacPersistenceManagerFactory.CreatePersistenceManager(); var order = pm.GetEntity <BOM.Entities.PharmOrd>(new PrimaryKey(typeof(BOM.Entities.PharmOrd), rxoId)); if (!order.IsNullEntity) { double calculatedDose; if (DoseCalcUtils.EstimateOrderingDose(order, bsa, out calculatedDose) == DoseCalcUtils.CalcStatus.CalcSucceed) { SuggestedDose.Set(context, calculatedDose); } } }