Пример #1
0
        /// <summary>
        /// Open the observation form and let the user enter data.
        /// Sets the observe form to the patient of the activity not the global patient.
        /// </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            //Get parameter values
            bool markReviewed = MarkReviewed.Expression != null?MarkReviewed.Get(context) : false;

            Guid obdGuid = ObdGuid.Get(context);

            var parms = new UddWidgetParams
            {
                MarkReviewed       = markReviewed,
                UddDataParams      = { PatId1 = PatientId.Get(context) },
                TabViewObdGuid     = obdGuid,
                Mode               = UddWidgetMode.Insert,
                IsFlowsheetDisplay = true
            };

            var view = ObsDef.GetEntityByObdGuid(obdGuid, PM);

            var securityEnum = SecurityUtility.ByteArrayToEnum(view.Security_Mask);

            bool returnResult = ReturnResult.Get(context);

            if (!returnResult)
            {
                // open an instance of the UDD with a distinct instanceid from the standard UDD indstance id
                var host = new UddWidgetModalHost(parms, securityEnum, null, Strings.FlowsheetFormActivity_UddInstanceId);

                // Defect 6398 - Clicking OK in error window cause Mosaiq crashed when trigger IQ script (create assessment by QCL task)
                // if user doesn't have modify rights in Assessment/Labs/Vital signs
                // Defect 7055: Replace IsHandleCreated with !IsDisposed because the window's handle is never created at this point
                if (!host.IsDisposed)
                {
                    var modalDialog = ModalDialog.Get(context);
                    if (modalDialog)
                    {
                        host.ShowDialog();
                    }
                    else
                    {
                        host.Show();
                        host.ForceToFront();
                    }
                }
                return;
            }

            DialogResult res = UddWidgetModalHost.ShowModal(parms, securityEnum, Strings.FlowsheetFormActivity_UddInstanceId);

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                ObrId.Set(context, parms.UddDataParams.ObrId);
            }
            //Record output parameters
            DialogResult.Set(context, res);
        }