/// <summary> /// Generates command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.SUMMARIZE); //Append aggregates foreach (string item in lbxVar.Items) { command.Append(item); } //Append output table command.Append(CommandNames.TO); command.Append(txtOutput.Text.Trim()); //Append strata variables if (lbxGroupBy.Items.Count > 0) { command.Append(CommandNames.STRATAVAR); command.Append(StringLiterals.EQUAL); foreach (string item in lbxGroupBy.Items) { command.Append(item); } } //Append weighted variables if (cmbWeight.SelectedItem != null && !string.IsNullOrEmpty(cmbWeight.SelectedItem.ToString())) { command.Append(CommandNames.WEIGHTVAR); command.Append(StringLiterals.EQUAL); command.Append(cmbWeight.SelectedItem.ToString()); } CommandText = command.ToString(); }
static void Main(string[] args) { var path = "1.docx"; var maker = new WordBuilder(); var template = maker.CreateTemplate(); template.FieldsCollection = new Dictionary <string, string>(); template.FieldsCollection.Add("test", "2333"); var table1 = new DocTable(); var cells = new[] { "a", "b", "c", "d" }; table1.AddRow(cells); template.Tables = new[] { table1 }; //stream example //using (var fileStream = new FileStream(path,FileMode.Open)) //{ // using (var result = maker.Build(fileStream, template)) // { // var memStream = new MemoryStream(); // result.Seek(0, SeekOrigin.Begin); // result.CopyTo(memStream); // File.WriteAllBytes("2.docx",memStream.ToArray()); // } //} //byte[] example var byteResult = maker.Build(path, template); File.WriteAllBytes("2.docx", byteResult); }
public override bool CheckGoal(WordBuilder builder, bool countGoal) { if (!builder.isReversed) { if (builder.CurrentString.ToString().Contains(word.ToString()) && word.Length < builder.CurrentString.Length) { if (countGoal) { isGoalCompleted = true; hasUpdated = true; } return true; } } else { if (builder.CurrentReversedString.ToString().Contains(word.ToString()) && word.Length < builder.CurrentReversedString.Length) { if (countGoal) { isGoalCompleted = true; hasUpdated = true; } return true; } } return false; }
private void InitAdd(IList <LayoutContent> ls, WordBuilder tx2) { foreach (LayoutContent bs in ls) { try { //////tx2.wordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft; //////tx2.wordApp.Selection.Font.Bold = 1; //////tx2.wordApp.Selection.Font.Size = 18; //MessageBox.Show(tx2.wordApp.Selection.get_Style().ToString()); //tx2.wordApp.Selection. //tx2.wordApp.Selection.TypeText("\r\n"); tx2.wordApp.Selection.TypeText(bs.ChapterName + "\r\n"); object obj = "标题 1"; Style testStyle = tx2.wordApp.Application.ActiveDocument.Styles.get_Item(ref obj); object listObject = testStyle; tx2.wordApp.Selection.set_Style(ref listObject); tx2.InsertFromStreamGzip(bs.Contents); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// Generates command test /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append((CommandNames.SELECT).ToUpper()); command.Append(txtSelectCriteria.Text.Trim()); CommandText = command.ToString() ; }
/// <summary> /// Method that generates the command /// </summary> protected override void GenerateCommand() { string expression = txtRecAffected.Text.Trim(); #region preconditions if (expression.Trim() != "*" && !ValidExpression(expression)) //dcs0 8/1/2008 { throw new GeneralException(string.Format(SharedStrings.INVALID_EXPRESSION, expression)); } #endregion Preconditions WordBuilder command = new WordBuilder(); command.Append(CommandNames.UNDELETE); //command.Append(txtRecAffected.Text.Trim()); command.Append(expression); // dcs0 9/17/2008 if (cbkRunSilent.Checked) { command.Append(CommandNames.RUNSILENT); } CommandText = command.ToString(); try { this.EpiInterpreter.Parse(CommandText); } catch (Exception ex) { throw new GeneralException(string.Format(SharedStrings.INVALID_EXPRESSION, expression)); } }
/// <summary> /// Gets a count of records in a column /// </summary> /// <param name="columnName">Name of the column</param> /// <returns>Number of records in a column</returns> public int GetRecordCount(Rule_Context pContext, string columnName) { #region Input Validation if (string.IsNullOrEmpty(columnName)) { throw new ArgumentNullException("columnName"); } #endregion Input Validation WordBuilder queryBuilder = new WordBuilder(); queryBuilder.Append("select count" + Util.InsertInParantheses(columnName)); queryBuilder.Append(GetSqlStatementPartFrom(pContext)); if (Db.ColumnExists(PrimaryTable.TableName, ColumnNames.REC_STATUS)) { string whereStatement = GetSqlStatementPartWhere(); queryBuilder.Append(whereStatement); } else if (!string.IsNullOrEmpty(selectCriteria)) { string whereClause = " where " + this.selectCriteria; queryBuilder.Append(whereClause); } Query query = Db.CreateQuery(queryBuilder.ToString()); //recast to int before return to remove cast run time error int result = Int32.Parse((Db.ExecuteScalar(query)).ToString()); return(result); }
/// <summary> /// Method that generates the command /// </summary> protected override void GenerateCommand() { string expression = txtRecAffected.Text.Trim(); #region preconditions if (expression.Trim() != "*" && !ValidExpression(expression)) //dcs0 8/1/2008 { throw new GeneralException(string.Format(SharedStrings.INVALID_EXPRESSION, expression)); } #endregion Preconditions WordBuilder command = new WordBuilder(); command.Append(CommandNames.UNDELETE); //command.Append(txtRecAffected.Text.Trim()); command.Append(expression); // dcs0 9/17/2008 if (cbkRunSilent.Checked) { command.Append(CommandNames.RUNSILENT); } CommandText = command.ToString(); try { this.EpiInterpreter.Parse(CommandText); } catch(Exception ex) { throw new GeneralException(string.Format(SharedStrings.INVALID_EXPRESSION, expression)); } }
/// <summary> /// Generates the command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.LIST); if (lbxVariables.Items.Count > 0) { if (cbxAllExcept.Checked) { command.Append(StringLiterals.STAR); command.Append(StringLiterals.SPACE); command.Append(CommandNames.EXCEPT); } foreach (string item in lbxVariables.Items) { command.Append(FieldNameNeedsBrackets(item) ? Util.InsertInSquareBrackets(item) : item); } } else { command.Append(cmbVar.Text); } if (WinUtil.GetSelectedRadioButton(gbxDisplayMode) == rdbGrid) { command.Append(CommandNames.GRIDTABLE); } else if (WinUtil.GetSelectedRadioButton(gbxDisplayMode) == rdbAllowUpdates) { command.Append(CommandNames.UPDATE); } CommandText = command.ToString(); }
/// <summary> /// Generates command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.WRITE); command.Append((rdbReplace.Checked) ? CommandNames.REPLACE : CommandNames.APPEND); if (cmbOutputFormat.Text.ToUpper() == "TEXT" || cmbOutputFormat.Text.ToUpper() == "FLAT ASCII FILE") { command.Append("\"TEXT\""); } else { command.Append("\"Epi7\""); } command.Append("{" + txtFileName.Text.Trim() + "}"); command.Append(":"); command.Append(FieldNameNeedsBrackets(cmbDataTable.Text) ? Util.InsertInSquareBrackets(cmbDataTable.Text) : cmbDataTable.Text); if (lbxVariables.SelectedItems.Count < 1) { command.Append(StringLiterals.STAR); } else { if (cbxAllExcept.Checked) { command.Append("* EXCEPT"); } foreach (string s in lbxVariables.SelectedItems) { command.Append(FieldNameNeedsBrackets(s) ? Util.InsertInSquareBrackets(s) : s); } } CommandText = command.ToString(); }
private void Symbols_Btn_Click(object sender, EventArgs e) { if (Mode_Box.Text == "Multi-Press") { AsterixButtonPress++; OneButtonPress = -1; TwoButtonPress = -1; ThreeButtonPress = -1; FourButtonPress = -1; FiveButtonPress = -1; SixButtonPress = -1; SevenButtonPress = -1; EightButtonPress = -1; NineButtonPress = -1; HashButtonPress = -1; switch (AsterixButtonPress) { case 0: WordBuilder.AppendText(Asterix_ListBox.Items[AsterixButtonPress].ToString()); break; case 1: WordBuilder.AppendText(Asterix_ListBox.Items[AsterixButtonPress].ToString()); break; case 2: WordBuilder.AppendText(Asterix_ListBox.Items[AsterixButtonPress].ToString()); AsterixButtonPress = -1; break; } } }
private void One_Btn_Click_1(object sender, EventArgs e) { KeySequence_TextBox.AppendText("1".ToString()); //If the text box has the writing "Multi-Press" inside, then execute the code. if (Mode_Box.Text == "Multi-Press") { //Increments the value of the variable by 1 everytime the button is clicked. OneButtonPress++; TwoButtonPress = -1; ThreeButtonPress = -1; FourButtonPress = -1; FiveButtonPress = -1; SixButtonPress = -1; SevenButtonPress = -1; EightButtonPress = -1; NineButtonPress = -1; HashButtonPress = -1; AsterixButtonPress = -1; //Switch case for the variable OneButtonPress switch (OneButtonPress) { case 0: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); //If the number is zero, then execute this. break; case 1: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); break; case 2: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); break; case 3: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); break; case 4: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); break; case 5: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); break; case 6: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); break; case 7: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); break; case 8: WordBuilder.AppendText(One_ListBox.Items[OneButtonPress].ToString()); //I revert the value inside the variable to -1 so it will cycle through the switch case. OneButtonPress = -1; break; } } }
private void Three_Btn_Click_1(object sender, EventArgs e) { KeySequence_TextBox.AppendText("3".ToString()); if (Mode_Box.Text == "Multi-Press") { ThreeButtonPress++; OneButtonPress = -1; TwoButtonPress = -1; FourButtonPress = -1; FiveButtonPress = -1; SixButtonPress = -1; SevenButtonPress = -1; EightButtonPress = -1; NineButtonPress = -1; HashButtonPress = -1; AsterixButtonPress = -1; switch (ThreeButtonPress) { case 0: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 1: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 2: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 3: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 4: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 5: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 6: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 7: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); break; case 8: WordBuilder.AppendText(Three_ListBox.Items[ThreeButtonPress].ToString()); ThreeButtonPress = -1; break; } } }
/// <summary> /// Generates command test /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append((CommandNames.SELECT).ToUpperInvariant()); command.Append(txtSelectCriteria.Text.Trim()); CommandText = command.ToString(); }
// Use this for initialization void Start() { keyboardBuilder = GetComponent<KeyboardBuilder> (); entryFieldBuilder = GetComponent<EntryFieldBuilder> (); wordBuilder = GetComponent<WordBuilder> (); BuildGame (); //LoadDictionary (); }
private void BuildWords(int minSubwordLength, int maxSubwordLength, bool capitalize, params string[] words) { this.wordAnalyzer = new WordAnalyzer { MinSubwordLength = minSubwordLength, MaxSubwordLength = maxSubwordLength, }; this.wordAnalyzer.Analyze(words); this.wordBuilder = new WordBuilder(this.wordAnalyzer, standardSeed).Capitalize(capitalize); }
// Use this for initialization void Start() { // Get required components _model = GetComponent<EntryFieldModel> (); _handler = GetComponent<EntryFieldHandler> (); _wordBuilder = GameObject.Find ("Builder").GetComponent<WordBuilder>(); // Hook event handlers ConnectEvents (); }
private void initComponents() { wrdBuilder = WordBuilder.wordBuilder(); cmbTipo.Items.AddRange(Dict_ITA.POS.ToArray()); cmbTipo.SelectedItem = Dict_ITA.POS[0]; cmbLanguage.Items.AddRange(Dictionary.languages.ToArray()); cmbLanguage.SelectedItem = Dictionary.languages[0]; }
private void Zero_Btn_Click(object sender, EventArgs e) { //Appends the value of the WordBuilder text box to the notepad. Notepad.AppendText(WordBuilder.Text.ToString()); //Followed by a sapce in the notepad. Notepad.AppendText(" "); //Empty the KeySequence textbox. KeySequence_TextBox.Clear(); //Empty the WordBuilder WordBuilder.Clear(); }
/// <summary> /// Returns contents of a table. /// </summary> /// <param name="tableName"></param> /// <param name="columnNames">List of column names to select. Column names should not be bracketed; this method will add brackets.</param> /// <returns>DataTable</returns> public virtual DataTable GetTableData(string tableName, List <string> columnNames) { WordBuilder wb = new WordBuilder(","); foreach (string s in columnNames) { wb.Add(this.InsertInEscape(s)); } return(GetTableData(tableName, wb.ToString(), string.Empty)); }
/// <summary> /// Compute the union of the provided sets. this method is much faster than /// computing the union manually since it operates directly at the byte level. /// </summary> public static WAH8DocIdSet Union(ICollection <WAH8DocIdSet> docIdSets, int indexInterval) { switch (docIdSets.Count) { case 0: return(EMPTY); case 1: var iter = docIdSets.GetEnumerator(); iter.MoveNext(); return(iter.Current); } // The logic below is very similar to DisjunctionScorer int numSets = docIdSets.Count; PriorityQueue <Iterator> iterators = new PriorityQueueAnonymousInnerClassHelper(numSets); foreach (WAH8DocIdSet set in docIdSets) { Iterator iterator = (Iterator)set.GetIterator(); iterator.NextWord(); iterators.Add(iterator); } Iterator top = iterators.Top(); if (top.WordNum == int.MaxValue) { return(EMPTY); } int wordNum = top.WordNum; byte word = top.Word; WordBuilder builder = (WordBuilder)(new WordBuilder()).SetIndexInterval(indexInterval); while (true) { top.NextWord(); iterators.UpdateTop(); top = iterators.Top(); if (top.WordNum == wordNum) { word |= top.Word; } else { builder.AddWord(wordNum, word); if (top.WordNum == int.MaxValue) { break; } wordNum = top.WordNum; word = top.Word; } } return(builder.Build()); }
public override bool CheckGoal(WordBuilder builder, bool countGoal) { if (builder.isReversed) { return base.CheckGoal(builder, countGoal); } else { return false; } }
public override bool CheckGoal(WordBuilder builder, bool countGoal) { if (builder.IsPalindrome) { return base.CheckGoal(builder, countGoal); } else { return false; } }
public MainWindow() { InitializeComponent(); DirectoryInfo rootDirectory = new DirectoryInfo($"{DebugOrReleasePath}\\WordData"); rootDirectory.Create();//目錄已存在不作用 updataList(); Local_OldWord = string.Empty; WordBuilder.Instance().LocalDataChanged += MainWindow_LocalDataChanged; Local_WordListBox.SelectionChanged += Local_WordListBox_SelectionChanged; }
/// <summary> /// Generates command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.DEFINE); command.Append(txtGroupVar.Text.Trim()); command.Append(CommandNames.GROUPVAR); foreach (string s in lbxVariables.SelectedItems) { command.Append(s); } CommandText = command.ToString(); }
private void InitAdd(IList <byte[]> ls, WordBuilder tx2) { foreach (byte[] bs in ls) { try { tx2.InsertFromStreamGzip(bs); } catch { } } }
/// <summary> /// Generates the command text /// </summary> protected override void GenerateCommand() { StringBuilder sb = new StringBuilder(CommandNames.HEADER); sb.Append(StringLiterals.SPACE); sb.Append(1.ToString()); sb.Append(StringLiterals.SPACE); if (true) { sb.Append(Util.InsertInDoubleQuotes(txtTitle.Text)); WordBuilder wb = new WordBuilder(StringLiterals.COMMA); if (boldToolStripButton.Checked || italicToolStripButton.Checked || underlineToolStripButton.Checked) { sb.Append(StringLiterals.SPACE); if (boldToolStripButton.Checked) { wb.Append("BOLD"); } if (italicToolStripButton.Checked) { wb.Append("ITALIC"); } if (underlineToolStripButton.Checked) { wb.Append("UNDERLINE"); } sb.Append(Util.InsertInParantheses(wb.ToString())); } if (!string.IsNullOrEmpty(textFontColorName) && !string.IsNullOrEmpty(fontSizeToolStripDDL.Text)) { sb.Append(" TEXTFONT "); if (!string.IsNullOrEmpty(textFontColorName)) { sb.Append(textFontColorName.ToUpperInvariant()); } if (!string.IsNullOrEmpty(fontSizeToolStripDDL.Text)) { sb.Append(StringLiterals.SPACE); sb.Append(fontSizeToolStripDDL.Text); } } } CommandText = sb.ToString(); }
private void YesButton_Click(object sender, RoutedEventArgs e) { var builder = WordBuilder.Instance(); AddResult status = builder.CreateWord(wordStr); if (status == AddResult.SearchFail) { MessageBox.Show($"{wordStr}新增失敗,請再試一次。"); } else { Close(); } }
public void GetTop(string id, WordBuilder tx2) { byte[] vi = null; try { LayoutType lt1 = Services.BaseService.GetOneByKey <LayoutType>(id); if (lt1 != null) { vi = lt1.ExcelData; tx2.InsertFromStreamGzip(vi); } } catch { } }
private void Local_RemoveButton_Click(object sender, RoutedEventArgs e) { try { var builder = WordBuilder.Instance(); builder.RemoveWord(Local_WordListBox.SelectedValue.ToString()); updataList(); Local_WordListBox.SelectedIndex = 0; Local_OldWord = string.Empty; } catch (Exception e2) { MessageBox.Show("錯誤,無選取單字", e2.Message); } }
private async void Download_Button_Click(object sender, RoutedEventArgs e) { var button = sender as Button; button.Content = "Downloading, please wait!"; button.IsEnabled = false; var builder = WordBuilder.Instance(); builder.ProgressChanged += Builder_ProgressChanged; string[] words = Download_TextBox.Text.Split(new char[] { '\n' }); //TextBox文字以\n劃分各單字 words = words.Select(x => x.Replace("\r", "")).Where(x => x != string.Empty).ToArray(); var message = new StringBuilder(); var newText = new StringBuilder(); //讓成功新增的單字在Textbox上除去 var addResult = await Task.Factory.StartNew(() => builder.CreateWords(words)); for (int i = 0; i < words.Length; i++) { switch (addResult[i]) { case AddResult.HaveWord: message.Append($"{words[i]}失敗,已有此單字資料\n"); newText.Append($"{words[i]}\r\n"); break; case AddResult.SearchFail: if (!words[i].Equals(String.Empty)) { message.Append($"{words[i]}失敗,查無此單字\n"); newText.Append($"{words[i]}\r\n"); } break; default: break; } } if (!message.ToString().Equals(String.Empty)) { MessageBox.Show(message.ToString(), "新增失敗"); } //if (!newText.ToString().Equals(String.Empty)) Download_TextBox.Text = newText.ToString(); button.Content = "_Download"; button.IsEnabled = true; updataList(); }
private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (treeList1.FocusedNode == null) { return; } string uid = treeList1.FocusedNode["UID"].ToString(); LayoutContent obj = Services.BaseService.GetOneByKey <LayoutContent>(uid); WaitDialogForm wait = null; WordBuilder wb = new WordBuilder(); //if (fb != null) // wb.InsertFromStreamGzip(fb); try { wait = new WaitDialogForm("", "正在下载数据, 请稍候..."); if (obj.Contents != null && obj.Contents.Length > 0) { if (fb != null) { wb.InsertFromStreamGzip(obj.Contents); dsoFramerWordControl1.FileData = wb.FileData; } else { dsoFramerWordControl1.FileDataGzip = obj.Contents; } } else { dsoFramerWordControl1.FileNew(); } dsoFramerWordControl1.AxFramerControl.Menubar = true; wait.Close(); } catch (Exception ex) { wait.Close(); MessageBox.Show(ex.Message); } }
/// <summary> /// Generate the command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.SORT); foreach (string item in lbxSortVar.Items) { command.Append(item.Substring(0, item.Length - 4));; //Append 'DESCENDING' if (item.EndsWith(StringLiterals.HYPHEN + StringLiterals.PARANTHESES_CLOSE)) { command.Append(CommandNames.DESCENDING); } } CommandText = command.ToString(); }
/// <summary> /// Generate the command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.SORT); foreach (string item in lbxSortVar.Items) { command.Append(item.Substring(0,item.Length - 4));; //Append 'DESCENDING' if (item.EndsWith(StringLiterals.HYPHEN + StringLiterals.PARANTHESES_CLOSE)) { command.Append(CommandNames.DESCENDING); } } CommandText = command.ToString(); }
/// <summary> /// Generates command text /// </summary> protected override void GenerateCommand() { string expression = txtRecAffected.Text.Trim(); #region preconditions if (expression.Trim() != "*" && !ValidExpression(expression)) //dcs0 8/1/2008 { MessageBox.Show(string.Format(SharedStrings.INVALID_EXPRESSION, expression)); CommandText = ""; return; } if (EpiInterpreter.Context.CurrentRead.File.Contains(".xlsx") || EpiInterpreter.Context.CurrentRead.File.Contains(".xls") || EpiInterpreter.Context.CurrentRead.File.Contains("FMT=Delimited")) { MessageBox.Show("Deletion not supported for this datasource", "DELETE RECORDS"); Close(); throw new GeneralException(string.Format(SharedStrings.INVALID_DATA_SOURCE, "Excel")); } #endregion Preconditions WordBuilder command = new WordBuilder(); command.Append(CommandNames.DELETE); if (expression.Trim() != "*") { command.Append("("); } command.Append(expression); if (expression.Trim() != "*") { command.Append(")"); } if (rdbPermDeletion.Checked) { command.Append(CommandNames.PERMANENT); } if (cbkRunSilent.Checked) { command.Append(CommandNames.RUNSILENT); } CommandText = command.ToString(); }
public bool SetDictionarySwitchTabControl(string wordStr, Grid grid) { wordStr = wordStr.ToLower(); var builder = WordBuilder.Instance(); var word = builder.GetWord(wordStr); if (word == null) { MessageBox.Show("查無此單字"); return(false); } var yahooGrid = new Grid(); var cambridgeGrid = new Grid(); var helper = new WordHelper(); try { (string Name, string URL)[] wordPaths = null;
/// <summary> /// Generates the command text /// </summary> protected override void GenerateCommand() { StringBuilder sb = new StringBuilder(CommandNames.HEADER); sb.Append(StringLiterals.SPACE); sb.Append(1.ToString()); sb.Append(StringLiterals.SPACE); if (true) { sb.Append(Util.InsertInDoubleQuotes(txtTitle.Text)); WordBuilder wb = new WordBuilder(StringLiterals.COMMA); if (boldToolStripButton.Checked || italicToolStripButton.Checked || underlineToolStripButton.Checked) { sb.Append(StringLiterals.SPACE); if (boldToolStripButton.Checked) wb.Append("BOLD"); if (italicToolStripButton.Checked) wb.Append("ITALIC"); if (underlineToolStripButton.Checked) wb.Append("UNDERLINE"); sb.Append(Util.InsertInParantheses(wb.ToString())); } if (!string.IsNullOrEmpty(textFontColorName) && !string.IsNullOrEmpty(fontSizeToolStripDDL.Text)) { sb.Append(" TEXTFONT "); if (!string.IsNullOrEmpty(textFontColorName)) { sb.Append(textFontColorName.ToUpper()); } if (!string.IsNullOrEmpty(fontSizeToolStripDDL.Text)) { sb.Append(StringLiterals.SPACE); sb.Append(fontSizeToolStripDDL.Text); } } } CommandText = sb.ToString(); }
/// <summary> /// Generates command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.ASSIGN); command.Append(cmbAssignVar.Text); command.Append("="); // Fix for defect #20 - prevent the resulting command from having to = signs if the user supplies one by accident. string expression = txtExpression.Text.Trim(); if (expression.Length > 0) { if (expression[0] == '=') { expression = expression.Remove(0, 1); expression = expression.Trim(); } } command.Append(expression); CommandText = command.ToString(); }
public string GetWhereClause(View form) { string baseTableName = "t"; string whereClause = String.Empty; string recStatusComparison = "[" + baseTableName + "].[RECSTATUS] = 1"; if (RecordProcessingScope == Epi.RecordProcessingScope.Both) { recStatusComparison = "[" + baseTableName + "].[RECSTATUS] >= 0"; } else if (RecordProcessingScope == Epi.RecordProcessingScope.Deleted) { recStatusComparison = "[" + baseTableName + "].[RECSTATUS] = 0"; } whereClause = " WHERE " + recStatusComparison;// +" AND ("; string logicalOperatorString = " AND "; if (_conditionJoinType == ConditionJoinTypes.Or) { logicalOperatorString = " OR "; } bool hasFilterConditions = false; WordBuilder filterSql = new WordBuilder(logicalOperatorString); foreach (IRowFilterCondition rowFc in _rowFilterConditions) { hasFilterConditions = true; filterSql.Append(rowFc.Sql); } if (hasFilterConditions) { whereClause = whereClause + " AND (" + filterSql + ")"; } return(whereClause); }
/// <summary> /// AboutEpiInfo load event /// </summary> /// <param name="sender">Object that fired the event.</param> /// <param name="e">.NET supplied event args.</param> private void AboutEpiInfo_Load(object sender, System.EventArgs e) { try { ApplicationIdentity appId = new ApplicationIdentity(typeof(Configuration).Assembly); // App Name WordBuilder appNameBuilder = new WordBuilder(); appNameBuilder.Add(appId.SuiteName); appNameBuilder.Add(appId.Version); lblAppName.Text = appNameBuilder.ToString(); // Release date lblReleaseDate.Text = appId.VersionReleaseDate; // Description txtDescription.Text = Util.GetProductDescription(); } catch (FileNotFoundException ex) { MsgBox.ShowException(ex); } }
public SingleGameUI(SinglePlayerGame game) { InitializeComponent(); this.game = game; this.PlayerName.Content = this.game.Player.PlayerName; this.Category.Content = this.game.Category.CategoryName; if (this.game.Word.GameWord.Contains(' ')) { this.WordLength.Content = this.game.Word.GameWord.Length - 1; } else { this.WordLength.Content = this.game.Word.GameWord.Length; } this.wordBuilder = new WordBuilder(this.WordPanel, this.game.Word); this.hangman = new Hangman(this.HangmanDrawing); this.letterCount = 0; wordBuilder.BuildWord(this.game.Word); }
public void GetTop(string id, WordBuilder tx2) { byte[] vi = null; try { LayoutType lt1 = Services.BaseService.GetOneByKey<LayoutType>(id); if (lt1 != null) { vi = lt1.ExcelData; tx2.InsertFromStreamGzip(vi); } } catch { } }
/// <summary> /// Generates Xml representation of this gadget /// </summary> /// <param name="doc">The Xml docment</param> /// <returns>XmlNode</returns> public override XmlNode Serialize(XmlDocument doc) { CreateInputVariableList(); Dictionary<string, string> inputVariableList = GadgetOptions.InputVariableList; string freqVar = string.Empty; string strataVar = string.Empty; string weightVar = string.Empty; string sort = string.Empty; WordBuilder wb = new WordBuilder(","); if (GadgetOptions.StrataVariableNames != null && GadgetOptions.StrataVariableNames.Count == 1) { strataVar = GadgetOptions.StrataVariableNames[0]; } CustomOutputHeading = headerPanel.Text; CustomOutputDescription = descriptionPanel.Text; string xmlString = "<mainVariable>" + GadgetOptions.MainVariableName + "</mainVariable>" + "<outcomeVariable>" + GadgetOptions.CrosstabVariableName + "</outcomeVariable>" + "<strataVariable>" + strataVar + "</strataVariable>" + "<weightVariable>" + GadgetOptions.WeightVariableName + "</weightVariable>" + "<psuVariable>" + GadgetOptions.PSUVariableName + "</psuVariable>" + "<customHeading>" + CustomOutputHeading.Replace("<", "<") + "</customHeading>" + "<customDescription>" + CustomOutputDescription.Replace("<", "<") + "</customDescription>" + "<customCaption>" + CustomOutputCaption + "</customCaption>"; System.Xml.XmlElement element = doc.CreateElement("complexSampleTablesGadget"); element.InnerXml = xmlString; element.AppendChild(SerializeFilters(doc)); System.Xml.XmlAttribute locationY = doc.CreateAttribute("top"); System.Xml.XmlAttribute locationX = doc.CreateAttribute("left"); System.Xml.XmlAttribute collapsed = doc.CreateAttribute("collapsed"); System.Xml.XmlAttribute type = doc.CreateAttribute("gadgetType"); locationY.Value = Canvas.GetTop(this).ToString("F0"); locationX.Value = Canvas.GetLeft(this).ToString("F0"); collapsed.Value = "false"; // currently no way to collapse the gadget, so leave this 'false' for now type.Value = "Epi.WPF.Dashboard.Gadgets.Analysis.ComplexSampleTablesControl"; element.Attributes.Append(locationY); element.Attributes.Append(locationX); element.Attributes.Append(collapsed); element.Attributes.Append(type); return element; }
private void InitAdd(IList<byte[]> ls, WordBuilder tx2) { foreach (byte[] bs in ls) { try { tx2.InsertFromStreamGzip(bs); } catch { } } }
private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (treeList1.FocusedNode == null) return; string uid = treeList1.FocusedNode["UID"].ToString(); LayoutContent obj = Services.BaseService.GetOneByKey<LayoutContent>(uid); WaitDialogForm wait=null; WordBuilder wb = new WordBuilder(); //if (fb != null) // wb.InsertFromStreamGzip(fb); try { wait = new WaitDialogForm("", "������������, ���Ժ�..."); if (obj.Contents != null && obj.Contents.Length > 0) { if (fb != null) { wb.InsertFromStreamGzip(obj.Contents); dsoFramerWordControl1.FileData = wb.FileData; } else { dsoFramerWordControl1.FileDataGzip = obj.Contents; } } else { dsoFramerWordControl1.FileNew(); } dsoFramerWordControl1.AxFramerControl.Menubar = true; wait.Close(); } catch (Exception ex) { wait.Close(); MessageBox.Show(ex.Message); } }
private void barButtonItem30_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { WaitDialogForm wait = null; WordBuilder wb = new WordBuilder(); wb.InsertFromFile("Very.doc"); //TONLI.BZH.UI.DSOFramerWordControl wb = new DSOFramerWordControl(); try { wait = new WaitDialogForm("", "���ڵ���, ���Ժ�..."); IList<LayoutContent> ls = Services.BaseService.GetList<LayoutContent>("SelectLayoutContentByLayoutIDBlogData", layoutUID); System.Data.DataTable dts = DataConverter.ToDataTable((IList)ls, typeof(LayoutContent)); //IList<byte[]> lbt = new List<byte[]>(); IList<LayoutContent> lbt = new List<LayoutContent>(); InitExe("", dts, lbt); GetTop(layoutUID + "|1", wb); object obj = "���� 1"; Style testStyle = wb.wordApp.Application.ActiveDocument.Styles.get_Item(ref obj); object listObject = testStyle; wb.wordApp.Selection.set_Style(ref listObject); InitAdd(lbt, wb); GetTop(layoutUID + "|2", wb); //IList<LayoutContent> lbt = new List<LayoutContent>(); //InitExe("", dts, lbt); //GetTop(layoutUID + "|1", wb); //InitAdd(lbt, wb); //GetTop(layoutUID + "|2", wb); } catch { wb.Dispose(); wait.Close(); MsgBox.Show("����ʧ��"); return; } wait.Close(); string fname = ""; saveFileDialog1.Filter = "Microsoft word (*.doc)|*.doc"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { fname = saveFileDialog1.FileName; wb.Save(fname, true); wb.Dispose(); if (MsgBox.ShowYesNo("�����ɹ����Ƿ���ĵ���") != DialogResult.Yes) return; try { System.Diagnostics.Process.Start(fname); } catch { } } else { } }
private void InitAdd(IList<LayoutContent> ls, WordBuilder tx2) { foreach (LayoutContent bs in ls) { try { //////tx2.wordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft; //////tx2.wordApp.Selection.Font.Bold = 1; //////tx2.wordApp.Selection.Font.Size = 18; //MessageBox.Show(tx2.wordApp.Selection.get_Style().ToString()); //tx2.wordApp.Selection. //tx2.wordApp.Selection.TypeText("\r\n"); tx2.wordApp.Selection.TypeText(bs.ChapterName+"\r\n"); object obj = "���� 1"; Style testStyle = tx2.wordApp.Application.ActiveDocument.Styles.get_Item(ref obj); object listObject = testStyle; tx2.wordApp.Selection.set_Style(ref listObject); tx2.InsertFromStreamGzip(bs.Contents); } catch(Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// Generates command text /// </summary> protected override void GenerateCommand() { string expression = txtRecAffected.Text.Trim(); #region preconditions if (expression.Trim() != "*" && !ValidExpression(expression)) //dcs0 8/1/2008 { throw new GeneralException(string.Format(SharedStrings.INVALID_EXPRESSION, expression)); } if (EpiInterpreter.Context.CurrentRead.File.Contains(".xlsx") || EpiInterpreter.Context.CurrentRead.File.Contains(".xls") || EpiInterpreter.Context.CurrentRead.File.Contains("FMT=Delimited")) { MessageBox.Show("Deletion not supported for this datasource", "DELETE RECORDS"); Close(); throw new GeneralException(string.Format(SharedStrings.INVALID_DATA_SOURCE, "Excel")); } #endregion Preconditions WordBuilder command = new WordBuilder(); command.Append(CommandNames.DELETE); if(expression.Trim() != "*") command.Append("("); command.Append(expression); if (expression.Trim() != "*") command.Append(")"); if (rdbPermDeletion.Checked) { command.Append(CommandNames.PERMANENT); } if (cbkRunSilent.Checked) { command.Append(CommandNames.RUNSILENT); } CommandText = command.ToString(); }
public virtual bool CheckGoal(WordBuilder builder, bool countGoal) { if (isGoalCompleted) { return true; } else if ((wordLength == 0) || (builder.letters.Count >= wordLength)) { if (countGoal) { currentCount++; goalStatus = (float)currentCount / (float)goalTotalNumberOfWords; if (currentCount == goalTotalNumberOfWords) { isGoalCompleted = true; } hasUpdated = true; } return true; } return false; }
/// <summary> /// Gets table column names for a view. /// </summary> /// <param name="viewId">Id of the <see cref="Epi.View"/></param> /// <returns>string</returns> public string GetTableColumnNames(int viewId) { try { Query selectQuery = db.CreateQuery("select [Name] from [metaFields] " + "where [ViewId] = @ViewID and " + "[FieldTypeId] not in (2,13,15,20) " + "order by [Name]"); selectQuery.Parameters.Add(new QueryParameter("@ViewID", DbType.Int32, viewId)); WordBuilder list = new WordBuilder(StringLiterals.COMMA); DataTable columns = db.Select(selectQuery); foreach (DataRow row in columns.Rows) { list.Add(row[ColumnNames.NAME].ToString()); } return list.ToString(); } catch (Exception ex) { throw new GeneralException("Could not retrieve table column names", ex); } }
/// <summary> /// Returns contents of a table. /// </summary> /// <param name="tableName"></param> /// <param name="columnNames">List of column names to select. Column names should not be bracketed; this method will add brackets.</param> /// <returns>DataTable</returns> public virtual DataTable GetTableData(string tableName, List<string> columnNames) { WordBuilder wb = new WordBuilder(","); foreach (string s in columnNames) { wb.Add(this.InsertInEscape(s)); } return GetTableData(tableName, wb.ToString(), string.Empty); }
/// <summary> /// Generates Xml representation of this gadget /// </summary> /// <param name="doc">The Xml docment</param> /// <returns>XmlNode</returns> public override XmlNode Serialize(XmlDocument doc) { WordCloudParameters WordCloudParameters = (WordCloudParameters)Parameters; System.Xml.XmlElement element = doc.CreateElement("frequencyGadget"); //element.InnerXml = xmlString; element.AppendChild(SerializeFilters(doc)); System.Xml.XmlAttribute id = doc.CreateAttribute("id"); System.Xml.XmlAttribute locationY = doc.CreateAttribute("top"); System.Xml.XmlAttribute locationX = doc.CreateAttribute("left"); System.Xml.XmlAttribute collapsed = doc.CreateAttribute("collapsed"); System.Xml.XmlAttribute type = doc.CreateAttribute("gadgetType"); id.Value = this.UniqueIdentifier.ToString(); locationY.Value = Canvas.GetTop(this).ToString("F0"); locationX.Value = Canvas.GetLeft(this).ToString("F0"); collapsed.Value = IsCollapsed.ToString(); type.Value = "EpiDashboard.WordCloudControl"; element.Attributes.Append(locationY); element.Attributes.Append(locationX); element.Attributes.Append(collapsed); element.Attributes.Append(type); element.Attributes.Append(id); string freqVar = string.Empty; WordBuilder wb = new WordBuilder(","); //if (inputVariableList.ContainsKey("freqvar")) //{ // freqVar = inputVariableList["freqvar"].Replace("<", "<"); //} //if (inputVariableList.ContainsKey("stratavar")) //{ // strataVar = inputVariableList["stratavar"].Replace("<", "<"); //} //if (inputVariableList.ContainsKey("weightvar")) //{ // weightVar = inputVariableList["weightvar"].Replace("<", "<"); //} //if (inputVariableList.ContainsKey("sort")) //{ // sort = inputVariableList["sort"]; //} //if (inputVariableList.ContainsKey("allvalues")) //{ // allValues = bool.Parse(inputVariableList["allvalues"]); //} //if (inputVariableList.ContainsKey("showconflimits")) //{ // showConfLimits = bool.Parse(inputVariableList["showconflimits"]); //} //if (inputVariableList.ContainsKey("showcumulativepercent")) //{ // showCumulativePercent = bool.Parse(inputVariableList["showcumulativepercent"]); //} //if (inputVariableList.ContainsKey("includemissing")) //{ // includeMissing = bool.Parse(inputVariableList["includemissing"]); //} int precision = 4; CustomOutputHeading = headerPanel.Text; CustomOutputDescription = descriptionPanel.Text; XmlElement mainVariableElement = doc.CreateElement("mainVariable"); if (WordCloudParameters.ColumnNames.Count > 0) { mainVariableElement.InnerText = WordCloudParameters.ColumnNames[0]; } element.AppendChild(mainVariableElement); XmlElement precisionElement = doc.CreateElement("precision"); precisionElement.InnerText = precision.ToString(); element.AppendChild(precisionElement); XmlElement commonWordsElement = doc.CreateElement("commonWords"); commonWordsElement.InnerText = WordCloudParameters.CommonWords; element.AppendChild(commonWordsElement); //string xmlString = //"<mainVariable>" + freqVar + "</mainVariable>"; //if(GadgetOptions.StrataVariableNames.Count == 1) //{ // xmlString = xmlString + "<strataVariable>" + GadgetOptions.StrataVariableNames[0].Replace("<", "<") + "</strataVariable>"; //} //else if (GadgetOptions.StrataVariableNames.Count > 1) //{ // xmlString = xmlString + "<strataVariables>"; // foreach (string strataVariable in this.GadgetOptions.StrataVariableNames) // { // xmlString = xmlString + "<strataVariable>" + strataVariable.Replace("<", "<") + "</strataVariable>"; // } // xmlString = xmlString + "</strataVariables>"; //} //xmlString = xmlString + "<weightVariable>" + weightVar + "</weightVariable>" + //"<sort>" + sort + "</sort>" + //"<allValues>" + allValues + "</allValues>" + //"<precision>" + precision.ToString() + "</precision>" + //"<showListLabels> </showListLabels>" + //"<useFieldPrompts> </useFieldPrompts>" + //"<columnsToShow>" + wb.ToString() + "</columnsToShow>" + //"<includeMissing>" + includeMissing + "</includeMissing>" + //"<customHeading>" + CustomOutputHeading.Replace("<", "<") + "</customHeading>" + //"<customDescription>" + CustomOutputDescription.Replace("<", "<") + "</customDescription>" + //"<customCaption>" + CustomOutputCaption + "</customCaption>"; XmlElement customHeadingElement = doc.CreateElement("customHeading"); customHeadingElement.InnerText = CustomOutputHeading.Replace("<", "<"); element.AppendChild(customHeadingElement); XmlElement customDescriptionElement = doc.CreateElement("customDescription"); customDescriptionElement.InnerText = CustomOutputDescription.Replace("<", "<"); element.AppendChild(customDescriptionElement); XmlElement customCaptionElement = doc.CreateElement("customCaption"); customCaptionElement.InnerText = CustomOutputCaption; element.AppendChild(customCaptionElement); SerializeAnchors(element); return element; }
/// <summary> /// Generates Xml representation of this gadget /// </summary> /// <param name="doc">The Xml docment</param> /// <returns>XmlNode</returns> public override XmlNode Serialize(XmlDocument doc) { CreateInputVariableList(); Dictionary<string, string> inputVariableList = GadgetOptions.InputVariableList; string freqVar = string.Empty; string strataVar = string.Empty; string weightVar = string.Empty; string sort = string.Empty; bool allValues = false; bool showConfLimits = true; bool showCumulativePercent = true; bool includeMissing = false; WordBuilder wb = new WordBuilder(","); if (lbxColumns.SelectedItems.Contains("Frequency")) wb.Add("1"); if (lbxColumns.SelectedItems.Contains("Percent")) wb.Add("2"); if (lbxColumns.SelectedItems.Contains("Cumulative Percent")) wb.Add("3"); if (lbxColumns.SelectedItems.Contains("95% CI Lower")) wb.Add("4"); if (lbxColumns.SelectedItems.Contains("95% CI Upper")) wb.Add("5"); if (lbxColumns.SelectedItems.Contains("Percent bars")) wb.Add("6"); if (inputVariableList.ContainsKey("freqvar")) { freqVar = inputVariableList["freqvar"].Replace("<", "<"); } if (inputVariableList.ContainsKey("stratavar")) { strataVar = inputVariableList["stratavar"].Replace("<", "<"); } if (inputVariableList.ContainsKey("weightvar")) { weightVar = inputVariableList["weightvar"].Replace("<", "<"); } if (inputVariableList.ContainsKey("sort")) { sort = inputVariableList["sort"]; } if (inputVariableList.ContainsKey("allvalues")) { allValues = bool.Parse(inputVariableList["allvalues"]); } if (inputVariableList.ContainsKey("showconflimits")) { showConfLimits = bool.Parse(inputVariableList["showconflimits"]); } if (inputVariableList.ContainsKey("showcumulativepercent")) { showCumulativePercent = bool.Parse(inputVariableList["showcumulativepercent"]); } if (inputVariableList.ContainsKey("includemissing")) { includeMissing = bool.Parse(inputVariableList["includemissing"]); } CustomOutputHeading = headerPanel.Text; CustomOutputDescription = descriptionPanel.Text; string xmlString = "<mainVariable>" + freqVar + "</mainVariable>" + "<strataVariable>" + strataVar + "</strataVariable>" + "<weightVariable>" + weightVar + "</weightVariable>" + "<sort>" + sort + "</sort>" + "<allValues>" + allValues + "</allValues>" + "<showListLabels>" + checkboxCommentLegalLabels.IsChecked + "</showListLabels>" + "<useFieldPrompts>" + checkboxUsePrompts.IsChecked.ToString() + "</useFieldPrompts>" + "<columnsToShow>" + wb.ToString() + "</columnsToShow>" + "<includeMissing>" + includeMissing + "</includeMissing>" + "<customHeading>" + CustomOutputHeading.Replace("<", "<") + "</customHeading>" + "<customDescription>" + CustomOutputDescription.Replace("<", "<") + "</customDescription>" + "<customCaption>" + CustomOutputCaption + "</customCaption>"; System.Xml.XmlElement element = doc.CreateElement("frequencyGadget"); element.InnerXml = xmlString; element.AppendChild(SerializeFilters(doc)); System.Xml.XmlAttribute locationY = doc.CreateAttribute("top"); System.Xml.XmlAttribute locationX = doc.CreateAttribute("left"); System.Xml.XmlAttribute collapsed = doc.CreateAttribute("collapsed"); System.Xml.XmlAttribute type = doc.CreateAttribute("gadgetType"); locationY.Value = Canvas.GetTop(this).ToString("F0"); locationX.Value = Canvas.GetLeft(this).ToString("F0"); collapsed.Value = "false"; // currently no way to collapse the gadget, so leave this 'false' for now type.Value = "Epi.WPF.Dashboard.Gadgets.Analysis.FrequencyControl"; element.Attributes.Append(locationY); element.Attributes.Append(locationX); element.Attributes.Append(collapsed); element.Attributes.Append(type); return element; }
/// <summary> /// Helper method for the CreateFromXml method. Loads a list of row filter conditions from XML. /// </summary> /// <param name="element">XmlElement to process</param> private void CreateRowFiltersFromXML(XmlElement element) { if (element.Name.ToLower().Equals("rowfilter")) { foreach (XmlElement childElement in element.ChildNodes) { if (childElement.Name.ToLower().Equals("rowfilterquery")) { selectQuery = sourceProject.CollectedData.GetDbDriver().CreateQuery(childElement.InnerText.Replace(">", ">").Replace("<", "<")); } else if (childElement.Name.ToLower().Equals("rowfilterparameters")) { foreach (XmlElement gcElement in childElement.ChildNodes) { System.Data.DbType dbType = System.Data.DbType.String; string name = ""; object value = null; foreach (XmlElement ggcElement in gcElement.ChildNodes) { switch (ggcElement.Name.ToLower()) { case "dbtype": dbType = ((DbType)Int32.Parse(ggcElement.InnerText)); break; case "name": name = ggcElement.InnerText; break; case "value": value = ggcElement.InnerText; break; } } QueryParameter queryParameter = new QueryParameter(name, dbType, value); if (selectQuery != null) { selectQuery.Parameters.Add(queryParameter); } } } else if (childElement.Name.ToLower().Equals("rowfilterconditions")) { List<IRowFilterCondition> conditions = new List<IRowFilterCondition>(); foreach (XmlElement grandChildElement in childElement.ChildNodes) { if (grandChildElement.HasAttribute("filterType")) { string strType = grandChildElement.Attributes["filterType"].Value + ",Epi.ImportExport"; Type filterType = Type.GetType(strType, false, true); if (filterType != null) { IRowFilterCondition condition = (IRowFilterCondition)Activator.CreateInstance(filterType, new object[] { }); condition.CreateFromXml(grandChildElement); conditions.Add(condition); } } } this.rowFilterConditions = conditions; } } } string filter = String.Empty; if (this.rowFilterConditions.Count > 0) { filter = ImportExportSharedStrings.SCRIPT_FILTERS; WordBuilder wb = new WordBuilder(" and "); foreach (IRowFilterCondition rfc in this.rowFilterConditions) { wb.Add(rfc.Description); } filter = filter + wb.ToString(); CallbackAddStatusMessage(filter); } }
/// <summary> /// Generates the command text /// </summary> protected override void GenerateCommand() { WordBuilder command = new WordBuilder(); command.Append(CommandNames.GRAPH); if (listBoxVariables.Items.Count > 0) { foreach (string item in listBoxVariables.Items) { command.Append(FieldNameNeedsBrackets(item) ? Util.InsertInSquareBrackets(item) : item); } } else { command.Append(FieldNameNeedsBrackets(comboBoxMainVariable.Text) ? Util.InsertInSquareBrackets(comboBoxMainVariable.Text) : comboBoxMainVariable.Text); } if (comboBoxBarOfEachValueOf.Text != string.Empty) { command.Append(string.Format("* {0}", FieldNameNeedsBrackets(comboBoxBarOfEachValueOf.Text) ? Util.InsertInSquareBrackets(comboBoxBarOfEachValueOf.Text) : comboBoxBarOfEachValueOf.Text)); } if (comboBoxGraphType.Text != string.Empty) { if (comboBoxGraphType.Text == "EAR (Early Aberration Reporting)") { command.Append("GRAPHTYPE=\"EAR\""); } else { command.Append(string.Format("GRAPHTYPE=\"{0}\"", comboBoxGraphType.Text)); } } if (comboBoxStrataVar.Text != string.Empty) { command.Append(string.Format("STRATAVAR={0}", FieldNameNeedsBrackets(comboBoxStrataVar.Text) ? Util.InsertInSquareBrackets(comboBoxStrataVar.Text) : comboBoxStrataVar.Text)); } if (comboBoxWeightVar.Text != string.Empty) { string weightVar = FieldNameNeedsBrackets(comboBoxWeightVar.Text) ? Util.InsertInSquareBrackets(comboBoxWeightVar.Text) : comboBoxWeightVar.Text; switch (comboBoxShowValueOf.Text) { case "Average": weightVar = string.Format("AVG({0})", weightVar); break; case "Count": weightVar = string.Format("COUNT({0})", weightVar); break; case "Sum": weightVar = string.Format("SUM({0})", weightVar); break; case "Minimum": weightVar = string.Format("MIN({0})", weightVar); break; case "Maximum": weightVar = string.Format("MAX({0})", weightVar); break; case "Count %": weightVar = string.Format("PERCENT({0})", weightVar); break; case "Sum %": weightVar = string.Format("SUMPCT({0})", weightVar); break; } command.Append(string.Format("WEIGHTVAR={0}", weightVar)); } else { if (comboBoxShowValueOf.Text == "Count %") { command.Append("WEIGHTVAR=PERCENT()"); } } if (textBoxTitle.Text != string.Empty) { command.Append(string.Format("TITLETEXT=\"{0}\"", textBoxTitle.Text)); } if (textBoxXAxisLabel.Text != string.Empty) { command.Append(string.Format("XTITLE=\"{0}\"", textBoxXAxisLabel.Text)); } if (textBoxYAxisLabel.Text != string.Empty) { command.Append(string.Format("YTITLE=\"{0}\"", textBoxYAxisLabel.Text)); } if (comboBoxDateFormat.Text != string.Empty) { command.Append(string.Format("DATEFORMAT=\"{0}\"", comboBoxDateFormat.Text)); } if (comboBoxIntervalType.Text != string.Empty) { command.Append(string.Format("INTERVAL=\"{0} {1}\"", textBoxInterval.Text, comboBoxIntervalType.Text)); } if (startDateTime.Checked) { command.Append(string.Format("STARTFROM=\"{0}\"", startDateTime.Value.ToString())); } CommandText = command.ToString(); }
/// <summary> /// Used to generate the list of variables and options for the GadgetParameters object /// </summary> protected override void CreateInputVariableList() { // Set data filters! this.DataFilters = RowFilterControl.DataFilters; Dictionary<string, string> inputVariableList = new Dictionary<string, string>(); Parameters.ColumnNames = new List<string>(); Parameters.SortVariables = new Dictionary<string, SortOrder>(); Parameters.GadgetTitle = txtTitle.Text; Parameters.GadgetDescription = txtDesc.Text; double height = 0; double width = 0; bool success = double.TryParse(txtMaxHeight.Text, out height); if (success) { Parameters.Height = height; } success = double.TryParse(txtMaxWidth.Text, out width); if (success) { Parameters.Width = width; } List<string> listFields = new List<string>(); if (lvVariables.SelectedItems.Count > 0) { foreach (FieldInfo fieldInfo in lvVariables.SelectedItems) { if (!string.IsNullOrEmpty(fieldInfo.Name)) { listFields.Add(fieldInfo.Name); } } } listFields.Sort(); if ((Gadget as LineListControl).IsHostedByEnter) { //if (dashboardHelper.IsUsingEpiProject && checkboxAllowUpdates.IsChecked == true) //{ if (listFields.Contains("UniqueKey")) listFields.Remove("UniqueKey"); listFields.Add("UniqueKey"); //} } foreach (string field in listFields) { Parameters.ColumnNames.Add(field); } Parameters.SortColumnsByTabOrder = checkboxTabOrder.IsChecked.Value; Parameters.UsePromptsForColumnNames = checkboxUsePrompts.IsChecked.Value; Parameters.ShowColumnHeadings = checkboxColumnHeaders.IsChecked.Value; Parameters.ShowLineColumn = checkboxLineColumn.IsChecked.Value; Parameters.ShowNullLabels = checkboxShowNulls.IsChecked.Value; Parameters.ShowCommentLegalLabels = checkboxListLabels.IsChecked.Value; if (lbxSortOrder.Items.Count > 0) { foreach (string item in lbxSortOrder.Items) { if (!string.IsNullOrEmpty(item)) { //string baseStr = item; //if (baseStr.EndsWith("(ascending)")) //{ // baseStr = "[" + baseStr.Remove(baseStr.Length - 12) + "] ASC"; //} //if (baseStr.EndsWith("(descending)")) //{ // baseStr = "[" + baseStr.Remove(baseStr.Length - 13) + "] DESC"; //} //inputVariableList.Add(baseStr, "sortfield"); string baseStr = item; if (baseStr.EndsWith("(ascending)")) { baseStr = baseStr.Remove(baseStr.Length - 12); Parameters.SortVariables.Add(baseStr, SortOrder.Ascending); } if (baseStr.EndsWith("(descending)")) { baseStr = baseStr.Remove(baseStr.Length - 13); Parameters.SortVariables.Add(baseStr, SortOrder.Descending); } } } } if (cmbGroupField.SelectedIndex >= 0) { if (!string.IsNullOrEmpty(cmbGroupField.SelectedItem.ToString())) { Parameters.PrimaryGroupField = cmbGroupField.SelectedItem.ToString(); } } if (cmbSecondaryGroupField.SelectedIndex >= 0) { if (!string.IsNullOrEmpty(cmbSecondaryGroupField.SelectedItem.ToString())) { Parameters.SecondaryGroupField = cmbSecondaryGroupField.SelectedItem.ToString(); } } if (StrataGridList.Count >= 1) { Grid grid = StrataGridList[0]; SortedDictionary<int, string> sortColumnDictionary = new SortedDictionary<int, string>(); foreach (UIElement element in grid.Children) { if (Grid.GetRow(element) == 0 && element is TextBlock) { TextBlock txtColumnName = element as TextBlock; //columnOrder.Add(txtColumnName.Text); sortColumnDictionary.Add(Grid.GetColumn(element), txtColumnName.Text); } } ColumnOrder = new List<string>(); foreach (KeyValuePair<int, string> kvp in sortColumnDictionary) { ColumnOrder.Add(kvp.Value); } if (ColumnOrder.Count == listFields.Count || ColumnOrder.Count == (listFields.Count + 1)) { bool same = true; foreach (string s in listFields) { if (!ColumnOrder.Contains(s)) { same = false; } } if (same) { WordBuilder wb = new WordBuilder("^"); foreach (string s in ColumnOrder) { wb.Add(s); } inputVariableList.Add("customusercolumnsort", wb.ToString()); } else { ColumnOrder = new List<string>(); } } else { ColumnOrder = new List<string>(); } } Parameters.InputVariableList = inputVariableList; }