public GetObservationsDataResponse Get(GetObservationsDataRequest request)
        {
            GetObservationsDataResponse response = new GetObservationsDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("PatientObservationDD:Get()::Unauthorized Access");
                }

                response         = Omgr.GetObservationsData(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }
        public GetPatientUtilizationsResponse Get(GetPatientUtilizationsRequest request)
        {
            GetPatientUtilizationsResponse response = null;
            ValidateTokenResponse result = null;

            try
            {
                request.Token = base.Request.Headers["Token"] as string;
                result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber);
                if (result.UserId.Trim() != string.Empty)
                {
                    request.UserId = result.UserId;
                    response = UtilManager.GetPatientUtilizations(request);
                }
                else
                    throw new UnauthorizedAccessException();
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                    UtilManager.LogException(ex);
            }
            finally
            {
                List<string> patientIds = new List<string>();

                if (response.Utilizations != null)
                {
                    response.Utilizations.ForEach(u => patientIds.Add(u.PatientId));
                }

                if (result != null)
                    AuditHelper.LogAuditData(request, result.SQLUserId, patientIds, HttpContext.Current.Request, request.GetType().Name);
            }
            return response;
        }
示例#3
0
        public GetPatientProblemsResponse Get(GetPatientProblemsRequest request)
        {
            GetPatientProblemsResponse response = new GetPatientProblemsResponse();
            ObservationsManager        om       = new ObservationsManager();
            ValidateTokenResponse      result   = null;

            try
            {
                request.Token = base.Request.Headers["Token"] as string;
                result        = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber);
                if (result.UserId.Trim() != string.Empty)
                {
                    request.UserId = result.UserId;
                    response       = om.GetPatientProblemsSummary(request);
                }
                else
                {
                    throw new UnauthorizedAccessException();
                }
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);
                if ((ex is WebServiceException) == false)
                {
                    om.LogException(ex);
                }
            }
            finally
            {
                if (result != null)
                {
                    AuditHelper.LogAuditData(request, result.SQLUserId, null, System.Web.HttpContext.Current.Request, request.GetType().Name);
                }
            }
            return(response);
        }
示例#4
0
        public static XElement ToXmlRGB(TextRecordRGB entry)
        {
            var res = new XElement(XName.Get("TextRecord6"));

            res.Add(new XAttribute("isSetup", CommonFormatter.Format(entry.Type)));
            if (entry.FontID.HasValue)
            {
                res.Add(new XAttribute("objectID", entry.FontID.Value));
            }
            if (entry.Reserved != 0)
            {
                res.Add(new XAttribute("reserved", entry.Reserved));
            }
            if (entry.XOffset.HasValue)
            {
                res.Add(new XAttribute("x", entry.XOffset.Value));
            }
            if (entry.YOffset.HasValue)
            {
                res.Add(new XAttribute("y", entry.YOffset.Value));
            }
            if (entry.FontID.HasValue)
            {
                if (!entry.TextHeight.HasValue)
                {
                    throw new InvalidOperationException("Text Height must be specified");
                }
                res.Add(new XAttribute("fontHeight", entry.TextHeight.Value));
            }
            if (entry.TextColor.HasValue)
            {
                var color = entry.TextColor.Value;
                res.Add(new XElement("color", XColorRGB.ToXml(color)));
            }
            res.Add(new XElement(XName.Get("glyphs"), entry.Glyphs.Select(FormatGlyphEntry)));
            return(res);
        }
示例#5
0
        protected override void FormatTagElement(DefineButton2Tag tag, XElement xTag)
        {
            xTag.Add(new XAttribute(MENU_ATTRIB, CommonFormatter.Format(tag.TrackAsMenu)));
            if (tag.ReservedFlags != 0)
            {
                xTag.Add(new XAttribute("reserved", tag.ReservedFlags));
            }

            var xButtons = new XElement("buttons");

            foreach (var button in tag.Characters)
            {
                xButtons.Add(XButtonRecordEx.ToXml(button));
            }
            xTag.Add(xButtons);

            var xConditions = new XElement("conditions");

            foreach (var condition in tag.Conditions)
            {
                xConditions.Add(XButtonCondition.ToXml(condition));
            }
            xTag.Add(xConditions);
        }
示例#6
0
        public GetMongoProceduresListResponse Get(GetMongoProceduresListRequest request)
        {
            GetMongoProceduresListResponse response = new GetMongoProceduresListResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("ProgramDD:Post()::Unauthorized Access");
                }

                IProceduresManager pm = new ProceduresManager();
                response         = pm.GetProceduresList(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }
示例#7
0
        public static XElement ToXml(ButtonCondition condition)
        {
            var res = new XElement("Condition",
                                   new XAttribute("key", condition.KeyPress),
                                   new XAttribute("menuEnter", CommonFormatter.Format(condition.IdleToOverDown)),
                                   new XAttribute("pointerReleaseOutside", CommonFormatter.Format(condition.OutDownToIdle)),
                                   new XAttribute("pointerDragEnter", CommonFormatter.Format(condition.OutDownToOverDown)),
                                   new XAttribute("pointerDragLeave", CommonFormatter.Format(condition.OverDownToOutDown)),
                                   new XAttribute("pointerReleaseInside", CommonFormatter.Format(condition.OverDownToOverUp)),
                                   new XAttribute("pointerPush", CommonFormatter.Format(condition.OverUpToOverDown)),
                                   new XAttribute("pointerLeave", CommonFormatter.Format(condition.OverUpToIdle)),
                                   new XAttribute("pointerEnter", CommonFormatter.Format(condition.IdleToOverUp)),
                                   new XAttribute("menuLeave", CommonFormatter.Format(condition.OverDownToIdle))
                                   );

            var xActions = new XElement("actions");

            foreach (var action in condition.Actions)
            {
                xActions.Add(XAction.ToXml(action));
            }
            res.Add(xActions);
            return(res);
        }
示例#8
0
        XElement IActionVisitor <XElement, XElement> .Visit(ActionDefineFunction2 action, XElement res)
        {
            res.Add(new XAttribute("name", action.Name ?? ""));
            res.Add(new XAttribute("argc", action.Parameters.Count));
            res.Add(new XAttribute("regc", action.RegisterCount));
            res.Add(new XAttribute("preloadParent", CommonFormatter.Format(action.PreloadParent)));
            res.Add(new XAttribute("preloadRoot", CommonFormatter.Format(action.PreloadRoot)));
            res.Add(new XAttribute("suppressSuper", CommonFormatter.Format(action.SuppressSuper)));
            res.Add(new XAttribute("preloadSuper", CommonFormatter.Format(action.PreloadSuper)));
            res.Add(new XAttribute("suppressArguments", CommonFormatter.Format(action.SuppressArguments)));
            res.Add(new XAttribute("preloadArguments", CommonFormatter.Format(action.PreloadArguments)));
            res.Add(new XAttribute("suppressThis", CommonFormatter.Format(action.SuppressThis)));
            res.Add(new XAttribute("preloadThis", CommonFormatter.Format(action.PreloadThis)));
            res.Add(new XAttribute("reserved", action.Reserved));
            res.Add(new XAttribute("preloadGlobal", CommonFormatter.Format(action.PreloadGlobal)));

            var xArgs = new XElement("args");

            foreach (var arg in action.Parameters)
            {
                xArgs.Add(new XElement("Parameter",
                                       new XAttribute("reg", arg.Register),
                                       new XAttribute("name", arg.Name)));
            }
            res.Add(xArgs);

            var xActions = new XElement("actions");

            foreach (var subaction in action.Actions)
            {
                xActions.Add(Serialize(subaction));
            }
            res.Add(xActions);

            return(res);
        }
        public PutInitializeObservationDataResponse InsertNewPatientObservation(PutInitializeObservationDataRequest request)
        {
            PutInitializeObservationDataResponse response = new PutInitializeObservationDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("PatientObservationDD:Insert()");
                }

                IPatientObservationRepository repo = new PatientObservationRepositoryFactory().GetRepository(request, RepositoryType.PatientObservation);

                response.ObservationData = (PatientObservationData)repo.Initialize(request);
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }
示例#10
0
        public static XElement ToXml(ButtonRecordEx record)
        {
            var res = new XElement("Button",
                                   new XAttribute("hitTest", CommonFormatter.Format(record.StateHitTest)),
                                   new XAttribute("down", CommonFormatter.Format(record.StateDown)),
                                   new XAttribute("over", CommonFormatter.Format(record.StateOver)),
                                   new XAttribute("up", CommonFormatter.Format(record.StateUp))
                                   );

            if (record.Reserved != 0)
            {
                res.Add(new XAttribute("reserved", record.Reserved));
            }
            if (record.BlendMode.HasValue)
            {
                res.Add(new XAttribute("blendMode", (byte)record.BlendMode));
            }
            if (!record.IsEndButton)
            {
                res.Add(new XAttribute("objectID", record.CharacterID));
                res.Add(new XAttribute("depth", record.PlaceDepth));

                res.Add(new XElement("transform", XMatrix.ToXml(record.PlaceMatrix)));
                res.Add(new XElement("colorTransform", XColorTransformRGBA.ToXml(record.ColorTransform)));
                if (record.Filters.Count > 0)
                {
                    var xFilters = new XElement("filters");
                    foreach (var filter in record.Filters)
                    {
                        xFilters.Add(XFilter.ToXml(filter));
                    }
                    res.Add(xFilters);
                }
            }
            return(res);
        }
示例#11
0
        private static double GetFocalPoint(XElement xFillStyle)
        {
            var xFocalPoint = xFillStyle.Attribute("focalPoint");

            return(CommonFormatter.ParseDouble(xFocalPoint.Value));
        }
示例#12
0
 private static void AddFocalPoint(XElement xml, double val)
 {
     xml.Add(new XAttribute("focalPoint", CommonFormatter.Format(val)));
 }
示例#13
0
        protected override bool AcceptTagAttribute(DefineEditTextTag tag, XAttribute attrib)
        {
            switch (attrib.Name.LocalName)
            {
            case INITIAL_TEXT_ATTRIB:
                tag.InitialText = attrib.Value;
                break;

            case WORD_WRAP_ATTRIB:
                tag.WordWrap = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case MULTILINE_ATTRIB:
                tag.Multiline = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case PASSWORD_ATTRIB:
                tag.Password = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case READONLY_ATTRIB:
                tag.ReadOnly = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case AUTOSIZE_ATTRIB:
                tag.AutoSize = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case HAS_LAYOUT_ATTRIB:
                tag.HasLayout = CommonFormatter.ParseBool(attrib.Value);
                break;

            case NOT_SELECTABLE_ATTRIB:
                tag.NoSelect = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case HAS_BORDER_ATTRIB:
                tag.Border = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case "static":
                tag.WasStatic = CommonFormatter.ParseBool(attrib.Value);
                break;

            case IS_HTML_ATTRIB:
                tag.HTML = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case USE_OUTLINES_ATTRIB:
                tag.UseOutlines = SwfMillPrimitives.ParseBoolean(attrib);
                break;

            case FONT_REF_ATTRIB:
                tag.FontID  = ushort.Parse(attrib.Value);
                tag.HasFont = true;
                break;

            case "fontClass":
                tag.FontClass = attrib.Value;
                break;

            case FONT_HEIGHT_ATTRIB:
                tag.FontHeight = ushort.Parse(attrib.Value);
                tag.HasFont    = true;
                break;

            case MAX_LENGTH_ATTRIB:
                tag.MaxLength = ushort.Parse(attrib.Value);
                break;

            case ALIGN_ATTRIB:
                tag.Align     = byte.Parse(attrib.Value);
                tag.HasLayout = true;
                break;

            case LEFT_MARGIN_ATTRIB:
                tag.LeftMargin = ushort.Parse(attrib.Value);
                tag.HasLayout  = true;
                break;

            case RIGHT_MARGIN_ATTRIB:
                tag.RightMargin = ushort.Parse(attrib.Value);
                tag.HasLayout   = true;
                break;

            case INDENT_ATTRIB:
                tag.Indent    = ushort.Parse(attrib.Value);
                tag.HasLayout = true;
                break;

            case LEADING_ATTRIB:
                tag.Leading   = short.Parse(attrib.Value);
                tag.HasLayout = true;
                break;

            case VARIABLE_NAME_ATTRIB:
                tag.VariableName = attrib.Value;
                break;

            default:
                return(false);
            }
            return(true);
        }
        public List <PatientData> Select(string query, string[] filterData, string querySort, int skip, int take)
        {
            #region commented code

            /* Query without filter:
             *  { sf: { $elemMatch : {'val':'528a66f4d4332317acc5095f', 'fldn':'Problem', 'act':true}}}
             *
             * Query with single field filter:
             *  { $and : [
             *      { sf: { $elemMatch : {'val':'528a66f4d4332317acc5095f', 'fldn':'Problem', 'act':true}}},
             *      { $or : [
             *          { sf: { $elemMatch : {'val':/^<Single Field Text Here>/i, 'fldn':'FN'}}},
             *          { sf: { $elemMatch : {'val':/^<Single Field Text Here>/i, 'fldn':'LN'}}},
             *          { sf: { $elemMatch : {'val':/^<Single Field Text Here>/i, 'fldn':'PN'}}}
             *          ]
             *      }
             *   ]
             * }
             *
             * Query with double field filter:
             *  { $and : [
             *      { sf: { $elemMatch : {'val':'528a66f4d4332317acc5095f', 'fldn':'Problem', 'act':true}}},
             *      { $and : [
             *          { $or : [
             *              { sf : { $elemMatch: {'val':/^<First Field Text Here>/i, 'fldn':'FN'}}},
             *              { sf : { $elemMatch: {'val':/^<First Field Text Here>/i, 'fldn':'PN'}}}
             *            ]
             *          },
             *          { sf: { $elemMatch : {'val':/^<Second Field Text Here>/i, 'fldn':'LN'}}}
             *        ]
             *      }
             *    ]
             *  }
             *
             */

            #endregion

            try
            {
                string jsonQuery = string.Empty;
                string queryName = "TBD"; //Pass this into the method call
                string redisKey  = string.Empty;

                if (filterData[0].Trim() == string.Empty)
                {
                    jsonQuery = query;
                    redisKey  = string.Format("{0}{1}{2}", queryName, skip, take);
                }
                else
                {
                    if (filterData[1].Trim() == string.Empty)
                    {
                        redisKey = string.Format("{0}{1}{2}{3}", queryName, filterData[0].Trim(), skip, take);

                        jsonQuery  = "{ $and : [ ";
                        jsonQuery += string.Format("{0},  ", query);
                        jsonQuery += "{ $or : [  ";
                        jsonQuery += "{ sf: { $elemMatch : {'val':/^";
                        jsonQuery += string.Format("{0}/i, ", filterData[0].Trim());
                        jsonQuery += "'" + SearchField.FieldNameProperty + "':'FN'}}},  ";
                        jsonQuery += "{ sf: { $elemMatch : {'" + SearchField.ValueProperty + "':/^";
                        jsonQuery += string.Format("{0}/i, ", filterData[0].Trim());
                        jsonQuery += "'" + SearchField.FieldNameProperty + "':'LN'}}},  ";
                        jsonQuery += "{ sf: { $elemMatch : {'" + SearchField.ValueProperty + "':/^";
                        jsonQuery += string.Format("{0}/i, ", filterData[0].Trim());
                        jsonQuery += "'" + SearchField.FieldNameProperty + "':'PN'}}}]}]}";
                    }
                    else
                    {
                        redisKey = string.Format("{0}{1}{2}{3}{4}", queryName, filterData[0].Trim(), filterData[1].Trim(), skip, take);

                        jsonQuery  = "{ $and : [ ";
                        jsonQuery += string.Format("{0},  ", query);
                        jsonQuery += "{ $and : [  ";
                        jsonQuery += "{ $or : [  ";
                        jsonQuery += "{ sf : { $elemMatch: {'" + SearchField.ValueProperty + "':/^";
                        jsonQuery += string.Format("{0}/i, ", filterData[0].Trim());
                        jsonQuery += "'" + SearchField.FieldNameProperty + "':'FN'}}},  ";
                        jsonQuery += "{ sf : { $elemMatch: {'" + SearchField.ValueProperty + "':/^";
                        jsonQuery += string.Format("{0}/i, ", filterData[0].Trim());
                        jsonQuery += "'" + SearchField.FieldNameProperty + "':'PN'}}} ";
                        jsonQuery += "]}, ";
                        jsonQuery += "{ sf: { $elemMatch : {'" + SearchField.ValueProperty + "':/^";
                        jsonQuery += string.Format("{0}/i, ", filterData[1].Trim());
                        jsonQuery += "'" + SearchField.FieldNameProperty + "':'LN'}}}]}]}}";
                    }
                }

                string redisClientIPAddress = System.Configuration.ConfigurationManager.AppSettings.Get("RedisClientIPAddress");

                List <PatientData>             cohortPatientList = new List <PatientData>();
                ServiceStack.Redis.RedisClient client            = null;

                //TODO: Uncomment the following 2 lines to turn Redis cache on
                //if(string.IsNullOrEmpty(redisClientIPAddress) == false)
                //    client = new ServiceStack.Redis.RedisClient(redisClientIPAddress);

                //If the redisKey is already in Cache (REDIS) get it from there, else re-query
                if (client != null && client.ContainsKey(redisKey))
                {
                    //go get cohortPatientList from Redis using the redisKey now
                    cohortPatientList = client.Get <List <PatientData> >(redisKey);
                }
                else
                {
                    using (PatientMongoContext ctx = new PatientMongoContext(_dbName))
                    {
                        BsonDocument  searchQuery = BsonSerializer.Deserialize <BsonDocument>(jsonQuery);
                        QueryDocument queryDoc    = new QueryDocument(searchQuery);
                        SortByBuilder builder     = PatientsUtils.BuildSortByBuilder(querySort);

                        List <MECohortPatientView> meCohortPatients = ctx.CohortPatientViews.Collection.Find(queryDoc)
                                                                      .SetSortOrder(builder).SetSkip(skip).SetLimit(take).Distinct().ToList();

                        if (meCohortPatients != null && meCohortPatients.Count > 0)
                        {
                            meCohortPatients.ForEach(delegate(MECohortPatientView pat)
                            {
                                if (!pat.DeleteFlag)
                                {
                                    PatientData cohortPatient = new PatientData();
                                    cohortPatient.Id          = pat.PatientID.ToString();

                                    foreach (SearchField sf in pat.SearchFields)
                                    {
                                        cohortPatient.FirstName     = ((SearchField)pat.SearchFields.Where(x => x.FieldName == Constants.FN).FirstOrDefault()).Value;
                                        cohortPatient.LastName      = ((SearchField)pat.SearchFields.Where(x => x.FieldName == Constants.LN).FirstOrDefault()).Value;
                                        cohortPatient.Gender        = ((SearchField)pat.SearchFields.Where(x => x.FieldName == Constants.G).FirstOrDefault()).Value;
                                        cohortPatient.DOB           = CommonFormatter.FormatDateOfBirth(((SearchField)pat.SearchFields.Where(x => x.FieldName == Constants.DOB).FirstOrDefault()).Value);
                                        cohortPatient.MiddleName    = ((SearchField)pat.SearchFields.Where(x => x.FieldName == Constants.MN).FirstOrDefault()).Value;
                                        cohortPatient.Suffix        = ((SearchField)pat.SearchFields.Where(x => x.FieldName == Constants.SFX).FirstOrDefault()).Value;
                                        cohortPatient.PreferredName = ((SearchField)pat.SearchFields.Where(x => x.FieldName == Constants.PN).FirstOrDefault()).Value;
                                    }
                                    cohortPatientList.Add(cohortPatient);
                                }
                            });
                        }
                    }
                    //put cohortPatientList into cache using redisKey now
                    if (client != null)
                    {
                        client.Set <List <PatientData> >(redisKey, cohortPatientList);
                    }
                }
                return(cohortPatientList);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#15
0
 public XElement Visit(PushDoubleOpcode opcode, AbcMethodBodyInstruction arg)
 {
     return(new XElement("pushdouble", new XAttribute("value", CommonFormatter.Format(opcode.Value))));
 }
示例#16
0
        public static XElement ToXml(this AbcTrait trait)
        {
            var res = new XElement("trait",
                                   new XAttribute("name", trait.Name.ToXml()),
                                   new XAttribute("kind", trait.Kind));

            if (trait.Final)
            {
                res.Add(new XAttribute("final", CommonFormatter.Format(trait.Final)));
            }
            if (trait.Override)
            {
                res.Add(new XAttribute("override", CommonFormatter.Format(trait.Override)));
            }
            switch (trait.Kind)
            {
            case AsTraitKind.Slot:
                var slot = (AbcSlotTrait)trait;
                res.Add(new XAttribute("slotId", slot.SlotId));
                res.Add(new XAttribute("typeName", slot.TypeName.ToXml()));
                res.Add(new XAttribute("value", slot.Value.ToXml()));
                break;

            case AsTraitKind.Const:
                var con = (AbcConstTrait)trait;
                res.Add(new XAttribute("slotId", con.SlotId));
                res.Add(new XAttribute("typeName", con.TypeName.ToXml()));
                res.Add(new XAttribute("value", con.Value.ToXml()));
                break;

            case AsTraitKind.Class:
                var cl = (AbcClassTrait)trait;
                res.Add(new XAttribute("slotId", cl.SlotId));
                //todo: class ref
                break;

            case AsTraitKind.Function:
                var func = (AbcFunctionTrait)trait;
                res.Add(new XAttribute("slotId", func.SlotId));
                //todo: method ref
                break;

            case AsTraitKind.Method:
                var met = (AbcMethodTrait)trait;
                res.Add(new XAttribute("dispId", met.DispId));
                //todo: method ref
                break;

            case AsTraitKind.Getter:
                var getter = (AbcGetterTrait)trait;
                res.Add(new XAttribute("dispId", getter.DispId));
                //todo: method ref
                break;

            case AsTraitKind.Setter:
                var setter = (AbcSetterTrait)trait;
                res.Add(new XAttribute("dispId", setter.DispId));
                //todo: method ref
                break;

            default:
                throw new Exception("unsupported trait kind " + trait.Kind);
            }
            if (trait.Metadata.Count > 0)
            {
                res.Add(trait.Metadata.ToXml());
            }
            return(res);
        }