Exemple #1
0
        ConvertPivotDatatableToList(Dictionary <DataTable, List <DescriptiveStatistics> > dataTableDictionary,
                                    GadgetParameters gadgetParameters)

        {
            Dictionary <List <EwavFrequencyControlDto>, List <DescriptiveStatistics> > DtoDictionary =
                new Dictionary <List <EwavFrequencyControlDto>, List <DescriptiveStatistics> >();

            EwavGadgetParameters g = new EwavGadgetParameters()
            {
                CrosstabVariableName = gadgetParameters.CrosstabVariableName,
                CustomFilter         = gadgetParameters.CustomFilter,
                CustomSortColumnName = gadgetParameters.CustomSortColumnName,
                InputVariableList    = gadgetParameters.InputVariableList,
                MainVariableName     = gadgetParameters.MainVariableName,
                MainVariableNames    = gadgetParameters.MainVariableNames,
                ShouldIncludeFullSummaryStatistics = gadgetParameters.ShouldIncludeFullSummaryStatistics,
                ShouldIncludeMissing         = gadgetParameters.ShouldIncludeMissing,
                ShouldShowCommentLegalLabels = gadgetParameters.ShouldSortHighToLow,
                ShouldUseAllPossibleValues   = gadgetParameters.ShouldUseAllPossibleValues,
                StrataVariableNames          = gadgetParameters.StrataVariableNames,
                WeightVariableName           = gadgetParameters.WeightVariableName,
                NameOfDtoList = gadgetParameters.MainVariableName
            };

            foreach (KeyValuePair <DataTable, List <DescriptiveStatistics> > khp in dataTableDictionary)
            {
                DataTable dt = Ewav.Web.Utilities.Pivot(khp.Key, "Frequency", "MainVarname", "totals");
                List <EwavFrequencyControlDto> ewavFrequencyControlDto = Mapper.FrequencyOutputList(dt, g);
                DtoDictionary.Add(ewavFrequencyControlDto, khp.Value);
            }

            return(DtoDictionary);
        }
 /// <summary>
 /// Copy Constructor
 /// </summary>
 public EwavGadgetParameters(EwavGadgetParameters parameters)
 {
     MainVariableNames = parameters.MainVariableNames;
     MainVariableName  = parameters.MainVariableName;
     ColumnNames       = parameters.ColumnNames;
     //  GadgetStatusUpdate = parameters.GadgetStatusUpdate;
     InputVariableList    = parameters.InputVariableList;
     CustomFilter         = parameters.CustomFilter;
     CustomSortColumnName = parameters.CustomSortColumnName;
     ShouldIncludeFullSummaryStatistics = parameters.ShouldIncludeFullSummaryStatistics;
     ShouldUseAllPossibleValues         = parameters.ShouldUseAllPossibleValues;
     ShouldShowCommentLegalLabels       = parameters.ShouldShowCommentLegalLabels;
     ShouldSortHighToLow  = parameters.ShouldSortHighToLow;
     ShouldIncludeMissing = parameters.ShouldIncludeMissing;
     CrosstabVariableName = parameters.CrosstabVariableName;
     WeightVariableName   = parameters.WeightVariableName;
     StrataVariableNames  = parameters.StrataVariableNames;
 }
Exemple #3
0
        public static List <DTO.EwavFrequencyControlDto> FrequencyOutputList(System.Data.DataTable dt, EwavGadgetParameters ewavGadgetParameters)
        {
            List <EwavFrequencyControlDto> fdsList = new List <EwavFrequencyControlDto>();

            for (int x = 0; x < dt.Rows.Count; x++)
            {
                for (int i = 1; i < dt.Columns.Count; i++)
                {
                    Dictionary <string, double> dic = GetConfLimit((double)dt.Rows[x][i],
                                                                   (double)dt.Compute(string.Format("SUM([{0}])", dt.Columns[i].ColumnName), ""));

                    EwavFrequencyControlDto frequencyItem = new EwavFrequencyControlDto
                    {
                        FrequencyColumn     = dt.Rows[x][i].ToString(),
                        FreqVariable        = dt.Rows[x][ewavGadgetParameters.MainVariableName].ToString(),
                        Perc95ClLowerColumn = dic["lower"].ToString(),  //dtDataSources.Rows[x]["freq"].ToString(),  // dtDataSources.Rows[x][ewavGadgetParameters.MainVariableName].ToString(),
                        Perc95ClUpperColumn = dic["upper"].ToString(),  //dtDataSources.Rows[x]["freq"].ToString(), //dtDataSources.Rows[x][ewavGadgetParameters.MainVariableName].ToString(),
                        PercentColumn       = dt.Rows[x][i].ToString(), //dtDataSources.Rows[x][ewavGadgetParameters.MainVariableName].ToString(),
                        NameOfDtoList       = dt.TableName.ToString()
                    };
                    if (frequencyItem.NameOfDtoList.Trim().IndexOf("=") > 0)
                    {
                        switch (frequencyItem.NameOfDtoList.ToString().Substring(frequencyItem.NameOfDtoList.Trim().IndexOf("=") + 1))
                        {
                        case " 0":
                            frequencyItem.NameOfDtoList = frequencyItem.NameOfDtoList.Replace(frequencyItem.NameOfDtoList.ToString().Substring(frequencyItem.NameOfDtoList.Trim().IndexOf("=") + 1), " No");
                            break;

                        case " false":
                            frequencyItem.NameOfDtoList = frequencyItem.NameOfDtoList.Replace(frequencyItem.NameOfDtoList.ToString().Substring(frequencyItem.NameOfDtoList.Trim().IndexOf("=") + 1), " No");
                            break;

                        case " 1":
                            frequencyItem.NameOfDtoList = frequencyItem.NameOfDtoList.Replace(frequencyItem.NameOfDtoList.ToString().Substring(frequencyItem.NameOfDtoList.Trim().IndexOf("=") + 1), " Yes");
                            break;

                        case " true":
                            frequencyItem.NameOfDtoList = frequencyItem.NameOfDtoList.Replace(frequencyItem.NameOfDtoList.ToString().Substring(frequencyItem.NameOfDtoList.Trim().IndexOf("=") + 1), " Yes");
                            break;

                        case " ":
                            frequencyItem.NameOfDtoList = string.Format("{0}Missing", frequencyItem.NameOfDtoList);
                            break;

                        default:
                            break;
                        }
                    }

                    fdsList.Add(frequencyItem);
                }
            }

            return(fdsList);
        }