/// <summary> /// Constructor /// </summary> public DataFilters(DashboardHelper dashboardHelper) { operandTypes = new Dictionary <string, string>(); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_BETWEEN, string.Empty); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_EQUAL_TO, StringLiterals.EQUAL); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_GREATER_THAN, StringLiterals.GREATER_THAN); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_GREATER_THAN_OR_EQUAL, StringLiterals.GREATER_THAN_OR_EQUAL); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_LESS_THAN, StringLiterals.LESS_THAN); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_LESS_THAN_OR_EQUAL, StringLiterals.LESS_THAN_OR_EQUAL); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_LIKE, "like"); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_MISSING, "is null"); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_NOT_EQUAL_TO, "<>"); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_NOT_MISSING, "is not null"); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_AND, "and"); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_OR, "or"); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_IS_ANY_OF, "in"); operandTypes.Add(SharedStrings.FRIENDLY_OPERATOR_IS_NOT_ANY_OF, "not in"); DataColumn idColumn = new DataColumn(COLUMN_ID, typeof(int)); DataColumn filterColumn = new DataColumn(COLUMN_FILTER, typeof(FilterCondition)); idColumn.AllowDBNull = false; filterColumn.AllowDBNull = false; recordProcessScope = RecordProcessingScope.Undeleted; conditionTable = new DataTable("FilterTable"); ConditionTable.Columns.Add(idColumn); ConditionTable.Columns.Add(COLUMN_JOIN, typeof(string)); ConditionTable.Columns.Add(filterColumn); ConditionTable.Columns.Add(COLUMN_GROUP, typeof(int)); this.dashboardHelper = dashboardHelper; }
private void StartExportCommandExecute() { if (!String.IsNullOrEmpty(ProjectFilePath)) { XDocument doc = XDocument.Load(ProjectFilePath); string dataDriver = doc.Element("Project").Element("CollectedData").Element("Database").Attribute("dataDriver").Value; if (!dataDriver.Equals("Epi.Data.SqlServer.SqlDBFactory, Epi.Data.SqlServer", StringComparison.OrdinalIgnoreCase)) { throw new InvalidOperationException("Only projects using Microsoft SQL Server are supported."); } } RecordProcessingScope scope = RecordProcessingScope.Undeleted; switch (RecordScope) { case "Deleted": scope = RecordProcessingScope.Deleted; break; case "Both": scope = RecordProcessingScope.Both; break; case "Active": default: scope = RecordProcessingScope.Undeleted; break; } CreateCaseSyncFileStart(null, scope); }
/// <summary> /// Constructor /// </summary> /// <param name="dataDriver">The data driver to attach to this object</param> /// <param name="joinType">Whether to use a global AND or OR to join all the conditions</param> /// <param name="recordProcessingScope">Whether to include records marked for deletion</param> public RowFilters(IDbDriver dataDriver, ConditionJoinTypes joinType = ConditionJoinTypes.And, RecordProcessingScope recordProcessingScope = Epi.RecordProcessingScope.Undeleted) { // pre Contract.Requires(dataDriver != null); // post Contract.Ensures(DataDriver != null); Contract.Ensures(_rowFilterConditions != null); _conditionJoinType = joinType; DataDriver = dataDriver; _rowFilterConditions = new List <IRowFilterCondition>(); RecordProcessingScope = recordProcessingScope; }
public XmlDataExporter(VhfProject project, bool includeContacts, RecordProcessingScope recordProcessingScope) { ExportInfo = new Epi.ImportExport.ProjectPackagers.ExportInfo(); _project = project; _includeContacts = includeContacts; _scope = recordProcessingScope; double totalMajorItems = 2; if (!_includeContacts) { totalMajorItems--; } Filters = new Dictionary <string, SyncFileFilters>(); FieldsToNull = new Dictionary <string, List <string> >(); foreach (View form in Project.Views) { FieldsToNull.Add(form.Name, new List <string>()); Filters.Add(form.Name, new SyncFileFilters(Project.CollectedData.GetDatabase())); if (!_includeContacts && form.Name.Equals(Core.Constants.CONTACT_FORM_NAME, StringComparison.OrdinalIgnoreCase)) { continue; } totalMajorItems++; // 1 for each form } StartDate = new DateTime(2000, 1, 1); EndDate = DateTime.Today.AddDays(3); _majorProgressIncrement = 100 / totalMajorItems; }
/// <summary> /// Get Record Processessing Scope By Id /// </summary> /// <param name="id">The id of the Record ProcessingS cope</param> /// <returns>Record ProcessingS copes Row</returns> public AppDataSet.RecordProcessingScopesRow GetRecordProcessessingScopeById(RecordProcessingScope id) { foreach (AppDataSet.RecordProcessingScopesRow row in this.RecordProcessingScopesDataTable.Rows) { if (row.Id == (short) id) { return row; } } throw new GeneralException("Invalid Scope Id"); }
public XmlSqlDataExporter(VhfProject project, bool includeContacts, RecordProcessingScope recordProcessingScope) : base(project, includeContacts, recordProcessingScope) { _database = "SQL Server"; }
/// <summary> /// Builds the command text /// </summary> protected override void GenerateCommand() { Configuration config = Configuration.GetNewInstance(); KeyValuePairCollection kvPairs = new KeyValuePairCollection(); kvPairs.Delimiter = CharLiterals.SPACE; if ((cmbYesAs.Text != config.Settings.RepresentationOfYes) || (hasYesAsChanged)) { kvPairs.Add(new KeyValuePair(ShortHands.YES, Util.InsertInDoubleQuotes(cmbYesAs.Text))); } if ((cmbNoAs.Text != config.Settings.RepresentationOfNo) || (hasNoAsChanged)) { kvPairs.Add(new KeyValuePair(ShortHands.NO, Util.InsertInDoubleQuotes(cmbNoAs.Text))); } if ((cmbMissingAs.Text != config.Settings.RepresentationOfMissing) || (hasMissingAsChanged)) { kvPairs.Add(new KeyValuePair(ShortHands.MISSING, Util.InsertInDoubleQuotes(cmbMissingAs.Text))); } if ((cbxGraphics.Checked != config.Settings.ShowGraphics) || (hasShowGraphicChanged)) { kvPairs.Add(new KeyValuePair(CommandNames.FREQGRAPH, Epi.Util.GetShortHand(cbxGraphics.Checked))); } if ((cbxHyperlinks.Checked != config.Settings.ShowHyperlinks) || (hasShowHyperlinkChanged)) { kvPairs.Add(new KeyValuePair(CommandNames.HYPERLINKS, Epi.Util.GetShortHand(cbxHyperlinks.Checked))); } if ((cbxPercents.Checked != config.Settings.ShowPercents) || (hasShowPercentsChanged)) { kvPairs.Add(new KeyValuePair(CommandNames.PERCENTS, Epi.Util.GetShortHand(cbxPercents.Checked))); } if ((cbxSelectCriteria.Checked != config.Settings.ShowSelection) || (hasShowSelectChanged)) { kvPairs.Add(new KeyValuePair(CommandNames.SELECT, Epi.Util.GetShortHand(cbxSelectCriteria.Checked))); } if ((cbxShowPrompt.Checked != config.Settings.ShowCompletePrompt) || (hasShowPromptChanged)) { kvPairs.Add(new KeyValuePair(CommandNames.SHOWPROMPTS, Epi.Util.GetShortHand(cbxShowPrompt.Checked))); } if ((cbxTablesOutput.Checked != config.Settings.ShowTables) || (hasShowTablesChanged)) { kvPairs.Add(new KeyValuePair(CommandNames.TABLES, Epi.Util.GetShortHand(cbxTablesOutput.Checked))); } if ((cbxIncludeMissing.Checked != config.Settings.IncludeMissingValues) || (hasIncludeMissingChanged)) { kvPairs.Add(new KeyValuePair(CommandNames.MISSING, Epi.Util.GetShortHand(cbxIncludeMissing.Checked))); } if (hasStatisticsLevelChanged) { StatisticsLevel levelIdSelected = (StatisticsLevel)short.Parse(WinUtil.GetSelectedRadioButton(gbxStatistics).Tag.ToString()); string levelTagSelected = AppData.Instance.GetStatisticsLevelById(levelIdSelected).Tag; kvPairs.Add(new KeyValuePair(CommandNames.STATISTICS, levelTagSelected)); } if (hasProcessRecordsChanged) { RecordProcessingScope scopeIdSelected = (RecordProcessingScope)short.Parse(WinUtil.GetSelectedRadioButton(gbxProcessRecords).Tag.ToString()); string scopeTagSelected = AppData.Instance.GetRecordProcessessingScopeById(scopeIdSelected).Tag; kvPairs.Add(new KeyValuePair(CommandNames.PROCESS, scopeTagSelected)); } WordBuilder command = new WordBuilder(); //Generate command only if there are key value pairs if (kvPairs.Count > 0) { if (!this.isDialogMode) { command.Append(CommandNames.SET); } command.Append(kvPairs.ToString()); if (!this.isDialogMode) { command.Append(" END-SET\n"); } this.CommandText = command.ToString(); } else { this.CommandText = string.Empty; } }
public XmlSqlDataImporter(VhfProject project, RecordProcessingScope scope) : base(project, scope) { }