/// <summary>
 /// Copy Constructor
 /// </summary>
 public ComplexSampleCrosstabParameters(ComplexSampleCrosstabParameters parameters)
     : base(parameters)
 {
     GadgetTitle = parameters.GadgetTitle;
     TreatOutcomeAsContinuous = parameters.TreatOutcomeAsContinuous;
     StrataSummaryOnly = parameters.StrataSummaryOnly;
     SmartTable = parameters.SmartTable;
     ShowPercents = parameters.ShowPercents;
     YesValues = new List<string>();
     foreach (string YVal in parameters.YesValues)
     {
         YesValues.Add(YVal);
     }
     NoValues = new List<string>();
     foreach (string NVal in parameters.NoValues)
     {
         NoValues.Add(NVal);
     }
     HorizontalDisplayMode = parameters.HorizontalDisplayMode;
     MaxColumnNameLength = parameters.MaxColumnNameLength;
     ConditionalShading = parameters.ConditionalShading;
     LoColorFill = parameters.LoColorFill;
     HiColorFill = parameters.HiColorFill;
     BreakType = parameters.BreakType;
     Break1 = parameters.Break1;
     Break2 = parameters.Break2;
     Break3 = parameters.Break3;
     Break4 = parameters.Break4;
     Break5 = parameters.Break5;
     PSUVariableName = parameters.PSUVariableName;
 }
 /// <summary>
 /// Copy Constructor
 /// </summary>
 public ComplexSampleCrosstabParameters(ComplexSampleCrosstabParameters parameters)
     : base(parameters)
 {
     GadgetTitle = parameters.GadgetTitle;
     TreatOutcomeAsContinuous = parameters.TreatOutcomeAsContinuous;
     StrataSummaryOnly        = parameters.StrataSummaryOnly;
     SmartTable   = parameters.SmartTable;
     ShowPercents = parameters.ShowPercents;
     YesValues    = new List <string>();
     foreach (string YVal in parameters.YesValues)
     {
         YesValues.Add(YVal);
     }
     NoValues = new List <string>();
     foreach (string NVal in parameters.NoValues)
     {
         NoValues.Add(NVal);
     }
     HorizontalDisplayMode = parameters.HorizontalDisplayMode;
     MaxColumnNameLength   = parameters.MaxColumnNameLength;
     ConditionalShading    = parameters.ConditionalShading;
     LoColorFill           = parameters.LoColorFill;
     HiColorFill           = parameters.HiColorFill;
     BreakType             = parameters.BreakType;
     Break1          = parameters.Break1;
     Break2          = parameters.Break2;
     Break3          = parameters.Break3;
     Break4          = parameters.Break4;
     Break5          = parameters.Break5;
     PSUVariableName = parameters.PSUVariableName;
 }
        public ComplexSampleCrosstabProperties(
            DashboardHelper dashboardHelper, 
            IGadget gadget, 
            ComplexSampleCrosstabParameters parameters, 
            List<Grid> strataGridList
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget = gadget;
            this.Parameters = parameters;
            this.StrataGridList = strataGridList;

            List<string> fields = new List<string>();
            List<string> weightFields = new List<string>();
            List<string> strataItems = new List<string>();

            //Variable fields
            fields.Add(String.Empty);
            ColumnDataType columnDataType = ColumnDataType.Boolean | ColumnDataType.DateTime | ColumnDataType.Numeric | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus"))
                        fields.Add(fieldName);
                }
                else
                {
                    fields.Add(fieldName);
                }
            }

            if (fields.Contains("SYSTEMDATE"))
            {
                fields.Remove("SYSTEMDATE");
            }

            //Weight Fields
            weightFields.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus")) weightFields.Add(fieldName);
                }
                else
                {
                    weightFields.Add(fieldName);
                }
            }
            weightFields.Sort();

            //Strata Fields
            strataItems.Add(String.Empty);
            columnDataType = ColumnDataType.Numeric | ColumnDataType.Boolean | ColumnDataType.Text | ColumnDataType.UserDefined;
            foreach (string fieldName in DashboardHelper.GetFieldsAsList(columnDataType))
            {
                if (DashboardHelper.IsUsingEpiProject)
                {
                    if (!(fieldName == "RecStatus" || fieldName == "FKEY" || fieldName == "GlobalRecordId")) strataItems.Add(fieldName);
                }
                else
                {
                    strataItems.Add(fieldName);
                }
            }

            if (DashboardHelper.IsUsingEpiProject)
            {
                if (fields.Contains("RecStatus")) fields.Remove("RecStatus");
                if (weightFields.Contains("RecStatus")) weightFields.Remove("RecStatus");

                if (strataItems.Contains("RecStatus")) strataItems.Remove("RecStatus");
                if (strataItems.Contains("FKEY")) strataItems.Remove("FKEY");
                if (strataItems.Contains("GlobalRecordId")) strataItems.Remove("GlobalRecordId");
            }

            List<string> allFieldNames = new List<string>();
            allFieldNames.AddRange(fields);
            allFieldNames.AddRange(DashboardHelper.GetAllGroupsAsList());

            cbxExposureField.ItemsSource = allFieldNames;
            cbxOutcomeField.ItemsSource = fields;
            cbxFieldWeight.ItemsSource = weightFields;
            cbxFieldStrata.ItemsSource = strataItems;
            cbxFieldPSU.ItemsSource = strataItems;

            if (cbxExposureField.Items.Count > 0)
            {
                cbxExposureField.SelectedIndex = -1;
                cbxOutcomeField.SelectedIndex = -1;
            }

            if (cbxFieldWeight.Items.Count > 0)
            {
                cbxFieldWeight.SelectedIndex = -1;
            }

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(cbxExposureField.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");
            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as ComplexSampleTablesControl).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);
        }