///<summary>Fills the Global Task filter combobox with options.  Only visible if Clinics are enabled, or if previous selection no is longer
        ///available, example: Clinics have been turned off, Clinic filter no longer available.</summary>
        private void FillComboGlobalFilter()
        {
            GlobalTaskFilterType globalPref = (GlobalTaskFilterType)PrefC.GetInt(PrefName.TasksGlobalFilterType);

            comboGlobalFilter.Items.Add(Lan.g(this, GlobalTaskFilterType.Disabled.GetDescription()), GlobalTaskFilterType.Disabled);
            comboGlobalFilter.Items.Add(Lan.g(this, GlobalTaskFilterType.None.GetDescription()), GlobalTaskFilterType.None);
            if (PrefC.HasClinicsEnabled)
            {
                labelGlobalFilter.Visible = true;
                comboGlobalFilter.Visible = true;
                comboGlobalFilter.Items.Add(Lan.g(this, GlobalTaskFilterType.Clinic.GetDescription()), GlobalTaskFilterType.Clinic);
                if (Defs.GetDefsForCategory(DefCat.Regions).Count > 0)
                {
                    comboGlobalFilter.Items.Add(Lan.g(this, GlobalTaskFilterType.Region.GetDescription()), GlobalTaskFilterType.Region);
                }
            }
            comboGlobalFilter.SetSelectedEnum(globalPref);
            if (comboGlobalFilter.SelectedIndex == -1)
            {
                labelGlobalFilter.Visible = true;
                comboGlobalFilter.Visible = true;
                errorProvider1.SetError(comboGlobalFilter, $"Previous selection \"{globalPref.GetDescription()}\" is no longer available.  "
                                        + "Saving will overwrite previous setting.");
                comboGlobalFilter.SelectedIndex = 0;
            }
        }
Example #2
0
        ///<summary>Builds a short section of the GlobalTaskFilterType WHERE clause.  Determines which clinics to filter by depending on the global
        ///default GlobalTaskFilterType.</summary>
        private static string GetDefaultFilterTypeString(GlobalTaskFilterType defaultFilterType, string strClinicNums, string strClinicNumsInRegion)
        {
            string command = "";

            switch (defaultFilterType)
            {
            case GlobalTaskFilterType.Clinic:
                command = " AND (patient.ClinicNum IN (" + strClinicNums + ") OR appointment.ClinicNum IN (" + strClinicNums + "))";
                break;

            case GlobalTaskFilterType.Region:
                command = " AND (patient.ClinicNum IN (" + strClinicNumsInRegion + ") OR appointment.ClinicNum IN (" + strClinicNumsInRegion + "))";
                break;

            case GlobalTaskFilterType.None:
            default:
                break;
            }
            return(command);
        }
Example #3
0
        ///<summary>Creates a TaskList.  If parent is not 0, then a parentDesc must also be provided.</summary>
        public static TaskList CreateTaskList(string descript = "", long parent = 0, bool isRepeating = false, TaskDateType dateType = TaskDateType.None, long fromNum = 0, TaskObjectType objectType = TaskObjectType.None, string parentDesc = "", GlobalTaskFilterType globalTaskFilterType = GlobalTaskFilterType.None)
        {
            TaskList taskList = new TaskList
            {
                Descript             = descript,
                Parent               = parent,
                DateTL               = DateTime.MinValue,
                IsRepeating          = isRepeating,
                DateType             = dateType,
                FromNum              = fromNum,
                ObjectType           = objectType,
                DateTimeEntry        = DateTime.Now,
                ParentDesc           = parentDesc,
                NewTaskCount         = 0,
                GlobalTaskFilterType = globalTaskFilterType,
            };

            TaskLists.Insert(taskList);
            return(taskList);
        }