Exemplo n.º 1
0
        /// <summary>
        /// Opens the data item browse
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int currentValue, IQVarElementTarget target)
        {
            WidgetContract wc = new WidgetContract(NTStrings.IQCareplanVarActivity_CarePlanBrowseWidget_ClassName,
                                                   NTStrings.IQCareplanVarActivity_CarePlanBrowseWidget_InstanceName,
                                                   WidgetContract.RequestOptions.DialogResult);

            // If the current value is 0 do not pass it into the control since we internalize 0 as not valid
            if (currentValue != 0)
            {
                wc.CustomData.Add(CarePlanBrowseWidget.CustomDataKeys.SELECTED_SET_ID, currentValue.ToString());
            }

            wc.SecEnums    = SecurityEnums.EC_GEN;
            wc.WidgetTitle = Strings.IQCareplanVarActivity_WidgetTitle;

            WidgetManager.AddWidgetModule(NTStrings.IQCareplanVarActivity_CarePlanBroweseWidget_AssemblyName);
            WidgetManager.ActivateWidget(null, wc);

            // Open the browse as a modal window
            wc.ActiveWidget.ShowDialog();

            //If the user hit "close", don't update the primaryKeyValue
            return(wc.Result == WidgetContract.ResultOptions.Completed
                       ? new IQOpResult <int>
            {
                Result = OpResultEnum.Completed,
                Value = (int)wc.CustomData[CarePlanBrowseWidget.CustomDataKeys.SELECTED_SET_ID]
            }
                       : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Opens the observation orders selection browse in clarion
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            OnBeforeClarionEditorInvoke(this);

            int prsId;

            if (ShowSupplies)
            {
                prsId = CallClarion.CallCodeBro(string.Empty, true, true, 0);
            }
            else
            {
                prsId = CallClarion.CallActivityBro(string.Empty, string.Empty, true, false, false, true, string.Empty, string.Empty, false, true, true);
            }

            OnAfterClarionEditorInvoke(this);

            //If the user hit "close", don't update the primaryKeyValue
            return((prsId != 0)
                       ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = Cpt.GetEntityByID(prsId).PRS_ID
            }
                       : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 3
0
        /// <summary> Opens the template selection window. </summary>
        /// <returns></returns>
        protected override IQOpResult <string> OpenEditor(string defaultValue, IQVarElementTarget target)
        {
            // other_files_folder\eSCRIBE
            string otherFilesEscribe = EscribeOperations.EscribeRoot;

            // other_files_folder\eSCRIBE\<TemplatesRoot>
            // default TemplatesRoot to the eScribe templates, i.e. 'WKGroup'
            string templatesRoot = !String.IsNullOrEmpty(TemplatesRoot)
                                        ? TemplatesRoot
                                        : EscribeConstants.EscribeTemplatesRoot;

            string otherFilesEscribeTemplatesRoot = Path.Combine(otherFilesEscribe, templatesRoot);

            string selectedTemplate = SelectFileDialog.IsValidTemplate(defaultValue)
                                                ? Path.Combine(otherFilesEscribe, defaultValue)
                                                : defaultValue;

            var editor = new SelectFileDialog(otherFilesEscribeTemplatesRoot, String.Empty, selectedTemplate);

            if (editor.ShowDialog() != DialogResult.OK)
            {
                return new IQOpResult <string> {
                           Result = OpResultEnum.Cancelled
                }
            }
            ;

            // trim the 'other_files_folder\eSCRIBE\' part
            selectedTemplate = SelectFileDialog.TrimTemplateRoot(otherFilesEscribe, editor.SelectedFile);
            return(new IQOpResult <string> {
                Result = OpResultEnum.Completed, Value = selectedTemplate
            });
        }
    }
Exemplo n.º 4
0
        /// <summary> </summary>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            var editor = new DepartmentSelector(defaultValue);

            return((editor.ShowDialog() == DialogResult.OK)
                                           ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                                           : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 5
0
        /// <summary> Displays the tab view selection dialog </summary>
        /// <returns></returns>
        protected override IQOpResult <Guid> OpenEditor(Guid defaultValue, IQVarElementTarget target)
        {
            int obdId = GetObsDefView();

            //If the user hit "close", don't update the primaryKeyValue
            return((obdId != 0)
                       ? new IQOpResult <Guid> {
                Result = OpResultEnum.Completed, Value = ObsDef.GetEntityById(obdId).OBD_GUID
            }
                       : new IQOpResult <Guid> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 6
0
        /// <summary> Opens the string editor. </summary>
        /// <returns></returns>
        protected override IQOpResult <Boolean> OpenEditor(Boolean defaultValue, IQVarElementTarget target)
        {
            var editor = new BooleanValueEditor {
                Value = defaultValue
            };

            return((editor.ShowDialog() == DialogResult.OK)
                       ? new IQOpResult <Boolean> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                       : new IQOpResult <Boolean> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 7
0
        protected override IQOpResult <int> OpenEditor(int currentValue, IQVarElementTarget target)
        {
            var editor = new CdsReferenceSelector {
                Value = currentValue
            };

            return(editor.ShowDialog() == DialogResult.OK
                                        ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                                        : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 8
0
        /// <summary>
        /// Opens the Topog browse
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int currentValue, IQVarElementTarget target)
        {
            OnBeforeClarionEditorInvoke(this);
            int diagCode = CallClarion.CallDiagnosisBro(String.Empty, true, true, currentValue);

            OnAfterClarionEditorInvoke(this);

            return((diagCode != 0)
                                           ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = diagCode
            }
                                           : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 9
0
        /// <summary>
        /// Opens the location browse.
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            OnBeforeClarionEditorInvoke(this);
            int intVal = CallClarion.CallStaffLocBro();

            OnAfterClarionEditorInvoke(this);

            //If the user hit "close", don't update the primaryKeyValue
            return((intVal != 0)
                       ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = intVal
            }
                       : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 10
0
        /// <summary>
        /// Opens the data item browse
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <Guid> OpenEditor(Guid defaultValue, IQVarElementTarget target)
        {
            OnBeforeClarionEditorInvoke(this);
            int obdId = CallClarion.GetObsDefDataItem(0);

            OnAfterClarionEditorInvoke(this);

            //If the user hit "close", don't update the primaryKeyValue
            return((obdId != 0)
                       ? new IQOpResult <Guid> {
                Result = OpResultEnum.Completed, Value = ObsDef.GetEntityById(obdId).OBD_GUID
            }
                       : new IQOpResult <Guid> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 11
0
        /// <summary> Opens the prompt browse for QCL Procedures. </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            OnBeforeClarionEditorInvoke(this);
            int proId = CallClarion.CallPromptBro("CHG1", true, 2, false, Strings.Group);

            OnAfterClarionEditorInvoke(this);

            //If the user hit "close", don't update the primaryKeyValue
            return((proId != 0)
                       ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = proId
            }
                       : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 12
0
        /// <summary>
        /// Opens the IQEnumEditor
        /// </summary>
        /// <param name="currentValue"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        protected override IQOpResult<IQEnum> OpenEditor(IQEnum currentValue, IQVarElementTarget target)
        {
            if (target == IQVarElementTarget.Selected)
            {
                XlateMessageBox.Information(Strings.IQEnumVarActivity_PreselectedRequired);
                return new IQOpResult<IQEnum> {Result = OpResultEnum.Cancelled};
            }

            if (currentValue == null)
                currentValue = new IQEnum {Key = GetNextKey(), Value = String.Empty};

            var editor = new IQEnumEditor {Value = currentValue};
            return editor.ShowDialog() == DialogResult.OK
                       ? new IQOpResult<IQEnum> {Result = OpResultEnum.Completed, Value = editor.Value}
                       : new IQOpResult<IQEnum> {Result = OpResultEnum.Cancelled};
        }
Exemplo n.º 13
0
        /// <summary> Opens the patient browse </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            OnBeforeClarionEditorInvoke(this);
            int patId1 = CallClarion.CallPatientBro(true, true, true);

            OnAfterClarionEditorInvoke(this);

            //If the user hit "close", don't update the primaryKeyValue
            return((patId1 != -1)
                       ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = patId1
            }
                       : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 14
0
        /// <summary> Opens the string editor. </summary>
        /// <returns></returns>
        protected override IQOpResult <string> OpenEditor(string defaultValue, IQVarElementTarget target)
        {
            //Replace null values with empty string.
            if (defaultValue == null)
            {
                defaultValue = String.Empty;
            }

            //This code ensures that all instances of a standalone "\n" get converted to "\r\n"  Due to rules with Xml serialzation, CRLF's get serialized just as
            //LF's in Xml and, when de-serialized, the full CRLF is not restored.  The "defaultValue" passed in will come from the IQPrefer.IQP_Data field if
            //deserialized from a preference, meaning we need to convert all of the LF's to CRLF's.  However, iw simply do that replace, than all existing CRLFs would
            //get converted to CRLFLF, which is not waht we want.  The code below first strips off all of the CR's, ensuring that all newlines are encoded as just LF's.
            //Then all LF's are restored to CRLF's, getting our value back to it's pre-seriailized state.

            defaultValue = defaultValue.Replace("\r\n", "\n");
            defaultValue = defaultValue.Replace("\n", "\r\n");

            if (AllowMultipleLines)
            {
                var editor = new MemoValueEditor {
                    Value = defaultValue
                };
                return((editor.ShowDialog() == DialogResult.OK)
                               ? new IQOpResult <string> {
                    Result = OpResultEnum.Completed, Value = editor.Value
                }
                               : new IQOpResult <string> {
                    Result = OpResultEnum.Cancelled
                });
            }
            else
            {
                var editor = new StringValueEditor(MaxLength)
                {
                    Value = defaultValue
                };
                return((editor.ShowDialog() == DialogResult.OK)
                               ? new IQOpResult <string>
                {
                    Result = OpResultEnum.Completed, Value = editor.Value
                }
                               : new IQOpResult <string> {
                    Result = OpResultEnum.Cancelled
                });
            }
        }
Exemplo n.º 15
0
        /// <summary> Opens the prompt browse for document types. </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            OnBeforeClarionEditorInvoke(this);
            int docTypeId = CallClarion.CallPromptBro("ESC7", true, 2, false, Strings.DocumentType);

            OnAfterClarionEditorInvoke(this);
            var entity = Prompt.GetEntityByID(docTypeId);

            //If the user hit "close", don't update the primaryKeyValue)
            return((docTypeId != 0)
                                           ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = entity.Enum
            }
                                           : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 16
0
        /// <summary> Opens the string editor. </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            var editor = new IntegerValueEditor
            {
                //If a single select custom value is set, load that value.
                Value    = defaultValue,
                MinValue = MinValue,
                MaxValue = MaxValue
            };

            return((editor.ShowDialog() == DialogResult.OK)
                       ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                       : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 17
0
        /// <summary>
        /// Opens the selection window used to select a single instance of the object type the configuration object works with.
        /// This method must be drived in all derived configuration classes.
        /// </summary>
        protected override IQOpResult <int> OpenEditor(int currentValue, IQVarElementTarget target)
        {
            List <int> values = currentValue != 0 ? new List <int> {
                currentValue
            } : null;

            var editor = new NoteTypeSelector {
                IsMultiSelect = false, Value = values
            };

            return(editor.ShowDialog() == DialogResult.OK
                                           ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = editor.Value.Count > 0 ? editor.Value[0] : 0
            }
                                           : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 18
0
        /// <summary>
        /// Displays the staff browse
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int defaultValue, IQVarElementTarget target)
        {
            var wc = new WidgetContract(NTStrings.IQStaffLocVarActivity_StaffBrowseWidget_ClassName,
                                        NTStrings.IQStaffLocVarActivity_StaffBrowseWidget_InstanceName,
                                        WidgetContract.RequestOptions.DialogResult);

            // If the current value is 0 do not pass it into the control since we internalize 0 as not valid
            if (defaultValue != 0)
            {
                wc.CustomData.Add(Mosaiq.Core.Defs.Constants.StringConstants.KEY_SELECTEDID, defaultValue);
            }

            var staffProperties = new StaffProperties
            {
                HideFavorites         = true,
                HideInactive          = true,
                ShowLocations         = StaffLocationBrowseMode.StaffAndLocations,
                IncludeAllDepartments = true,
                NoEdit = true
            };

            wc.CustomData.Add(NTStrings.IQStaffLocVarActivity_StaffBrowseWidget_Properties, staffProperties);

            wc.SecEnums    = SecurityEnums.EC_GEN;
            wc.WidgetTitle = Strings.IQStaffLocVarActivity_WidgetTitle;

            WidgetManager.AddWidgetModule(NTStrings.IQStaffLocVarActivity_StaffBrowseWidget_AssemblyName);
            WidgetManager.ActivateWidget(null, wc);

            // Open the browse as a modal window
            wc.ActiveWidget.ShowDialog();

            //If the user hit "close", don't update the primaryKeyValue
            return(wc.Result == WidgetContract.ResultOptions.Completed
                       ? new IQOpResult <int>
            {
                Result = OpResultEnum.Completed,
                Value = (int)wc.CustomData[Mosaiq.Core.Defs.Constants.StringConstants.KEY_SELECTEDID]
            }
                       : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 19
0
        /// <summary> Opens the prompt browse for staff types. </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int currentValue, IQVarElementTarget target)
        {
            var pm         = ImpacPersistenceManagerFactory.CreatePersistenceManager();
            var query      = GetStaffTypesQuery();
            var staffTypes = pm.GetEntities <Prompt>(query);

            return(null);

            /*
             * var editor = new StaffTypeOrCategorySelector {Value = currentValue, Text = Strings.SelectStaffType};
             * // It seems that we cannot use the Prompt.Enum value for staff type because the database
             * // contains several entries that have Prompt.Enum = 0
             * foreach (var staffType in staffTypes)
             *      //editor.AddItem(staffType.Enum, staffType.Text);
             *      editor.AddItem(staffType.Pro_ID, staffType.Text);
             *
             * //If the user hit "close", don't update the primaryKeyValue)
             * return editor.ShowDialog() == DialogResult.OK
             *              ? new IQOpResult<int> { Result = OpResultEnum.Completed, Value = editor.Value }
             *              : new IQOpResult<int> { Result = OpResultEnum.Cancelled };
             */
        }
Exemplo n.º 20
0
        /// <summary>
        /// Opens the observation orders selection browse in clarion
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <int> OpenEditor(int currentValue, IQVarElementTarget target)
        {
            //OnBeforeClarionEditorInvoke(this);
            //int prsId = CallClarion.CallDrgBro(true, true);
            //OnAfterClarionEditorInvoke(this);

            //If the user hit "close", don't update the primaryKeyValue
            //return (prsId != 0)
            //		   ? new IQOpResult<int> { Result = OpResultEnum.Completed, Value = Drug.GetEntityByID(prsId).DRG_ID }
            //		   : new IQOpResult<int> { Result = OpResultEnum.Cancelled };

            var editor = new DrugSelector {
                Value = currentValue
            };

            return(editor.ShowDialog() == DialogResult.OK
                        ? new IQOpResult <int> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                        : new IQOpResult <int> {
                Result = OpResultEnum.Cancelled
            });
        }
        /// <summary>
        /// Opens the data item browse
        /// </summary>
        /// <returns></returns>
        protected override IQOpResult <DataItemThresholds> OpenEditor(DataItemThresholds defaultValue, IQVarElementTarget target)
        {
            var editor = new DataItemThresholdsSelector();

            editor.Value = defaultValue;
            if (editor.ShowDialog() != DialogResult.OK)
            {
                return new IQOpResult <DataItemThresholds> {
                           Result = OpResultEnum.Cancelled
                }
            }
            ;

            return(new IQOpResult <DataItemThresholds> {
                Result = OpResultEnum.Completed, Value = editor.Value
            });
        }
Exemplo n.º 22
0
        /// <summary> Opens the string editor. </summary>
        /// <returns></returns>
        protected override IQOpResult <TimeSpanRelative> OpenEditor(TimeSpanRelative defaultValue, IQVarElementTarget target)
        {
            if (defaultValue == null)
            {
                defaultValue = new TimeSpanRelative {
                    Count = 0, Unit = TimeSpanRelativeUnit.Days
                }
            }
            ;

            var editor = new TimeSpanRelativeValueEditor {
                Value = defaultValue
            };

            return((editor.ShowDialog() == DialogResult.OK)
                       ? new IQOpResult <TimeSpanRelative> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                       : new IQOpResult <TimeSpanRelative> {
                Result = OpResultEnum.Cancelled
            });
        }

        #endregion
    }
Exemplo n.º 23
0
        //private bool _availableRangesChanged = false;
        ///// <summary>
        /////
        ///// </summary>
        //[RestoreInclude]
        //[ConfigurationActivity_Category]
        //[AvailableDateRanges_DisplayName]
        //public List<DateRangeData> DateRanges
        //{
        //    get { return _dateRanges ?? AvailableDateRanges.GetRanges(); }
        //    set { _dateRanges = value; }
        //}
        //private List<DateRangeData> _dateRanges;

        #region Overrides
        /// <summary> Opens the date range editor. </summary>
        protected override IQOpResult <IQDateTimeElement> OpenEditor(IQDateTimeElement defaultValue, IQVarElementTarget target)
        {
            //var dateRanges = DateRanges.Where(item => item.Selected).ToList();
            //if (dateRanges.Count == 0)
            //    return new IQOpResult<IQDateTimeElement> {Result = OpResultEnum.Cancelled};

            var editor = new DateValueEditor
            {
                Value = defaultValue.Value,
                Type  = defaultValue.Type
            };


            return((editor.ShowDialog() == DialogResult.OK)
                       ? new IQOpResult <IQDateTimeElement>
            {
                Result = OpResultEnum.Completed,
                Value =
                    new IQDateTimeElement
                {
                    ElementType = IQVarElementType.Standard,
                    Type = editor.Type,
                    Value = editor.Value
                }
            }
                       : new IQOpResult <IQDateTimeElement> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 24
0
        /// <summary> Opens the staff role selection window. </summary>
        /// <returns></returns>
        protected override IQOpResult <StaffTypeOrCategory> OpenEditor(StaffTypeOrCategory currentValue, IQVarElementTarget target)
        {
            var editor = new StaffTypeOrCategorySelector {
                Value = currentValue
            };

            return(editor.ShowDialog() == DialogResult.OK
                                        ? new IQOpResult <StaffTypeOrCategory> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                                        : new IQOpResult <StaffTypeOrCategory> {
                Result = OpResultEnum.Cancelled
            });

            /*
             * var editor = new StaffTypeOrCategorySelector {Value = currentValue, Text = Strings.SelectStaffCategory};
             *
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Physician);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Resident);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Therapist);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.SystemManager);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Physicist);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.ServiceEngineer);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Dosimetrist);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Nurse);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Administrator);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Clerical);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.Billing);
             * AddStaffRoleInfo(editor, BOM.Entities.Defs.StaffRole.PPS);
             *
             * return editor.ShowDialog() == DialogResult.OK
             *      ? new IQOpResult<int> {Result = OpResultEnum.Completed, Value = editor.Value}
             *      : new IQOpResult<int> {Result = OpResultEnum.Cancelled};
             */
        }
Exemplo n.º 25
0
        /// <summary>
        /// Checks to see if the value is within the range of the constraints provided.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="valueType"></param>
        /// <param name="errors"></param>
        private void ValidateValueCheckInRange(IList <ValidationError> errors, int value, IQVarElementTarget valueType)
        {
            string message = String.Empty;

            //Min and max values are defined.
            if (MinValue.HasValue && MaxValue.HasValue && (value < MinValue.Value || value > MaxValue.Value))
            {
                message = Rope.Format(Strings.DoubleMustBeBetween,
                                      valueType == IQVarElementTarget.Selected
                                          ? Strings.SelectedValue
                                          : Strings.PredefinedValue,
                                      value, MinValue.Value, MaxValue.Value);
            }

            //Only minimum value is defined.
            else if (MinValue.HasValue && !MaxValue.HasValue && (value < MinValue.Value))
            {
                message = Rope.Format(Strings.DoubleMustBeGreaterThan,
                                      valueType == IQVarElementTarget.Selected
                                          ? Strings.SelectedValue
                                          : Strings.PredefinedValue,
                                      value, MinValue.Value);
            }

            //Only maximum value is defined.
            else if (!MinValue.HasValue && MaxValue.HasValue && (value > MaxValue.Value))
            {
                message = Rope.Format(Strings.DoubleMustBeLessThan,
                                      valueType == IQVarElementTarget.Selected
                                          ? Strings.SelectedValue
                                          : Strings.PredefinedValue,
                                      value, MaxValue.Value);
            }

            if (!String.IsNullOrWhiteSpace(message))
            {
                errors.Add(new ValidationError(message, false, "Config"));
            }
        }
Exemplo n.º 26
0
 /// <summary> Allows validation of a value. </summary>
 /// <param name="errors"></param>
 /// <param name="value"></param>
 /// <param name="valueType"></param>
 protected override void ValidateValue(IList <ValidationError> errors, int value, IQVarElementTarget valueType)
 {
     ValidateValueCheckInRange(errors, value, valueType);
 }
Exemplo n.º 27
0
        /// <summary> Opens the date range editor. </summary>
        protected override IQOpResult <IQDateRangeElement> OpenEditor(IQDateRangeElement defaultValue, IQVarElementTarget target)
        {
            var dateRanges = DateRanges;

            if (dateRanges.Count == 0)
            {
                return new IQOpResult <IQDateRangeElement> {
                           Result = OpResultEnum.Cancelled
                }
            }
            ;

            var editor = new DateRangeValueEditor
            {
                DateRanges = dateRanges,
                Value      = defaultValue
            };

            return((editor.ShowDialog() == DialogResult.OK)
                                           ? new IQOpResult <IQDateRangeElement> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                                           : new IQOpResult <IQDateRangeElement> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 28
0
        /// <summary>
        /// Opens the flowsheet selection editor.
        /// </summary>
        /// <param name="currentValue"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        protected override IQOpResult <FlowsheetSelection> OpenEditor(FlowsheetSelection currentValue, IQVarElementTarget target)
        {
            if (TabGuid == Guid.Empty)
            {
                return new IQOpResult <FlowsheetSelection> {
                           Result = OpResultEnum.Cancelled
                }
            }
            ;

            if (currentValue == null)
            {
                currentValue = new FlowsheetSelection {
                    TabGuid = TabGuid
                }
            }
            ;

            var editor = new FlowsheetItemSelector {
                Value = currentValue, IncudeOtherLabs = IncludeOtherLabs
            };

            return((editor.ShowDialog() == DialogResult.OK)
                               ? new IQOpResult <FlowsheetSelection> {
                Result = OpResultEnum.Completed, Value = editor.Value
            }
                               : new IQOpResult <FlowsheetSelection> {
                Result = OpResultEnum.Cancelled
            });
        }
Exemplo n.º 29
0
 /// <summary> Adding validation logic to ensure selected item is of one of the supported types. </summary>
 /// <param name="errors"></param>
 /// <param name="value"></param>
 /// <param name="valueType"></param>
 protected override void ValidateValue(IList <ValidationError> errors, Guid value, IQVarElementTarget valueType)
 {
     ValidateDataItems(value, errors);
     ValidateTableTitle(value, errors);
     base.ValidateValue(errors, value, valueType);
 }