public frmNavQuery(QueryFieldCollection queryfields, InfoBindingSource bs, InfoNavigator nav) { //language = CliSysMegLag.GetClientLanguage(); language = CliUtils.fClientLang; queryFields = queryfields; if (queryfields == null || queryfields.Count == 0) { DataColumnCollection dcc = ((InfoDataSet)bs.GetDataSource()).RealDataSet.Tables[bs.DataMember].Columns; colNum = dcc.Count; colName = new string[colNum]; for (int j = 0; j < colNum; j++) { colName[j] = dcc[j].ColumnName; } } else { colNum = queryfields.Count; colName = new string[colNum]; for (int j = 0; j < colNum; j++) { colName[j] = queryfields[j].FieldName; } } bSource = bs; infoNavigator = nav; InitializeComponent(); InitializeQueryConditionItem(); }
private void Init(InfoBindingSource aBindingSource, DataRelation Relation) { DataRelation R1; lbDetail.Items.Clear(); if (aBindingSource.DataSource.GetType().Equals(typeof(InfoDataSet))) { InfoDataSet set1 = (InfoDataSet)aBindingSource.DataSource; for (int I = 0; I < set1.RealDataSet.Tables[0].ChildRelations.Count; I++) { R1 = set1.RealDataSet.Tables[0].ChildRelations[I]; lbDetail.Items.Add(R1.ChildTable.TableName); FDetailList.AddObject(R1.ChildTable.TableName, R1); } } if (aBindingSource.DataSource.GetType().Equals(typeof(InfoBindingSource))) { while (!aBindingSource.DataSource.GetType().Equals(typeof(InfoDataSet))) { aBindingSource = (InfoBindingSource)aBindingSource.DataSource; } InfoDataSet set2 = (InfoDataSet)aBindingSource.DataSource; for (int num2 = 0; num2 < set2.RealDataSet.Tables.Count; num2++) { if (set2.RealDataSet.Tables[num2].TableName.Equals(Relation.ChildTable.TableName)) { for (int num3 = 0; num3 < set2.RealDataSet.Tables[num2].ChildRelations.Count; num3++) { R1 = set2.RealDataSet.Tables[num2].ChildRelations[num3]; lbDetail.Items.Add(R1.ChildTable.TableName); FDetailList.AddObject(R1.ChildTable.TableName, R1); } } } } }
public frmAnyQuerySaveLoad(InfoBindingSource ibs, String status, String queryID) { BindingSource = ibs; Status = status; QueryID = queryID; InitializeComponent(); }
public bool ShowSelDetail(InfoBindingSource aBindingSource, ref DataRelation Relation) { Init(aBindingSource, Relation); bool Result = base.ShowDialog() == DialogResult.OK; if (Result) { int Index = FDetailList.IndexOf((string)lbDetail.SelectedItem); Relation = (DataRelation)FDetailList.Objects(Index); } return Result; }
public frmRefButtonQuery(string[] colName, String[] colCaption, InfoBindingSource bs, string OrignFilter, InfoRefVal refval) { InitializeComponent(); int i = colName.Length; colNum = i; this.strColName = colName; this.strColCaption = colCaption; this.infoBs = bs; this.strOrignFilter = OrignFilter; this.infoRefVal = refval; InitializeQueryConditionItem(); }
public frmTreeView(InfoTreeView tv, bool isAdd) { InitializeComponent(); tvCopy = tv; ibs = tvCopy.BindingSource; isAddNode = isAdd; if (isAdd) { this.Text = "Add TreeNode"; } else { this.Text = "Update TreeNode"; } InitialText(); }
private void CreateQueryField(TBlockFieldItem aFieldItem, String Range, InfoRefVal aRefVal, InfoBindingSource ibs) { if (aFieldItem.QueryMode == null) return; InfoNavigator navigator1 = FRootForm.Controls["infoNavigator1"] as InfoNavigator; if (navigator1 != null) { if (aFieldItem.QueryMode.ToUpper() == "NORMAL" || aFieldItem.QueryMode.ToUpper() == "RANGE") { QueryField qField = new QueryField(); qField.FieldName = aFieldItem.DataField; qField.Caption = aFieldItem.Description; if (qField.Caption == "") qField.Caption = aFieldItem.DataField; if (aFieldItem.QueryMode.ToUpper() == "NORMAL") { if (aFieldItem.DataType == typeof(DateTime)) qField.Condition = "="; if (aFieldItem.DataType == typeof(int) || aFieldItem.DataType == typeof(float) || aFieldItem.DataType == typeof(double) || aFieldItem.DataType == typeof(Int16)) qField.Condition = "="; if (aFieldItem.DataType == typeof(String)) qField.Condition = "%"; } if (aFieldItem.QueryMode.ToUpper() == "RANGE") { qField.Condition = "And"; if (Range == "") { qField.Condition = "<="; CreateQueryField(aFieldItem, ">=", aRefVal, null); } else { qField.Condition = Range; } } switch (aFieldItem.ControlType.ToUpper()) { case "TEXTBOX": qField.Mode = "TextBox"; break; case "COMBOBOX": qField.Mode = "ComboBox"; qField.RefVal = aRefVal; break; case "REFVALBOX": qField.Mode = "RefVal"; qField.RefVal = aRefVal; break; case "DATETIMEBOX": qField.Mode = "Calendar"; break; } navigator1.QueryFields.Add(qField); } } ClientQuery aClientQuery = FRootForm.Container.Components["clientQuery1"] as ClientQuery; if (aClientQuery != null) { if (ibs != null && aClientQuery != null) aClientQuery.BindingSource = ibs; if (aFieldItem.QueryMode.ToUpper() == "NORMAL" || aFieldItem.QueryMode.ToUpper() == "RANGE") { QueryColumns qColumn = new QueryColumns(); qColumn.Column = aFieldItem.DataField; qColumn.Caption = aFieldItem.Description; if (qColumn.Caption == "") qColumn.Caption = aFieldItem.DataField; if (aFieldItem.QueryMode.ToUpper() == "NORMAL") { if (aFieldItem.DataType == typeof(DateTime)) qColumn.Operator = "="; if (aFieldItem.DataType == typeof(int) || aFieldItem.DataType == typeof(float) || aFieldItem.DataType == typeof(double) || aFieldItem.DataType == typeof(Int16)) qColumn.Operator = "="; if (aFieldItem.DataType == typeof(String)) qColumn.Operator = "%"; } if (aFieldItem.QueryMode.ToUpper() == "RANGE") { qColumn.Condition = "And"; if (Range == "") { qColumn.Operator = "<="; CreateQueryField(aFieldItem, ">=", aRefVal, null); } else { qColumn.Operator = Range; //qColumn.Condition = Range; } } switch (aFieldItem.ControlType.ToUpper()) { case "TEXTBOX": qColumn.ColumnType = "ClientQueryTextBoxColumn"; break; case "COMBOBOX": qColumn.ColumnType = "ClientQueryComboBoxColumn"; qColumn.InfoRefVal = aRefVal; break; case "REFVALBOX": qColumn.ColumnType = "ClientQueryRefValColumn"; qColumn.InfoRefVal = aRefVal; break; case "DATETIMEBOX": qColumn.ColumnType = "ClientQueryCalendarColumn"; break; case "CHECKBOX": qColumn.ColumnType = "ClientQueryCheckBoxColumn"; break; } aClientQuery.Columns.Add(qColumn); } } }
public List<TBlockItem> FindBlockItemByDataSource(InfoBindingSource DataSource) { List<TBlockItem> Result = new List<TBlockItem>(); foreach (TBlockItem BlockItem in Blocks) { if (BlockItem.BindingSource == DataSource) Result.Add(BlockItem); } return Result; }
private void ShowTableRelations(String ModuleName, String SolutionName) { InfoBindingSource IBS = new InfoBindingSource(); DataRelation R = null; try { IBS.DataSource = FInfoDataSet; IBS.DataMember = FInfoDataSet.RealDataSet.Tables[0].TableName; ShowTable(ModuleName, SolutionName, IBS, R); } finally { IBS.Dispose(); } }
private void btnNewSubDataset_Click(object sender, EventArgs e) { InfoBindingSource IBS = new InfoBindingSource(); System.Windows.Forms.TreeNode Node = tvRelation.SelectedNode; if (Node != null) { TDetailItem DetailItem = (TDetailItem)Node.Tag; IBS.DataSource = DetailItem.BindingSource; fmSelDetail detail1 = new fmSelDetail(); DataRelation R = DetailItem.Relation; if (detail1.ShowSelDetail(IBS, ref R)) { System.Windows.Forms.TreeNode Node1 = Node.Nodes.Add(R.ChildTable.TableName); SetNodeData(R, IBS, Node1); UpdatelvSelectedFields((TDetailItem)Node1.Tag); } } }
private void ShowTableRelations() { tvRelation.Nodes.Clear(); InfoBindingSource IBS = new InfoBindingSource(); DataRelation R = null; try { IBS.DataSource = FInfoDataSet; IBS.DataMember = FInfoDataSet.RealDataSet.Tables[0].TableName; ShowTable(IBS, R); } finally { IBS.Dispose(); } }
private void ShowChildRelation(DataRelationCollection Relations, System.Windows.Forms.TreeNode Node) { System.Windows.Forms.TreeNode ChildNode; foreach (DataRelation R in Relations) { InfoBindingSource IBS = new InfoBindingSource(); //if ((Node == null) || (Node.Level == 0)) //{ IBS.DataSource = FInfoDataSet; IBS.DataMember = FInfoDataSet.RealDataSet.Tables[0].TableName; //} //else //{ // TDetailItem item1 = (TDetailItem)Node.Parent.Tag; // IBS.DataSource = item1.BindingSource; // IBS.DataMember = item1.Relation.RelationName; //} ChildNode = new System.Windows.Forms.TreeNode(); ChildNode.Text = R.ChildTable.TableName; ChildNode.Name = R.ChildTable.TableName; Node.Nodes.Add(ChildNode); SetNodeData(R, IBS, ChildNode); ShowChildRelation(R.ChildTable.ChildRelations, ChildNode); } }
public frmAnyQueryAdd(InfoBindingSource bs) { BindingSource = bs; InitializeComponent(); }
private String GetHeaderText(String ColName, InfoBindingSource ibs) { if (dsDDMaster == null) { dsDDMaster = DBUtils.GetDataDictionary(ibs, false); } String strHeaderText = String.Empty; if (dsDDMaster != null && dsDDMaster.Tables.Count > 0) { int i = dsDDMaster.Tables[0].Rows.Count; for (int j = 0; j < i; j++) { if (dsDDMaster.Tables[0].Rows[j]["FIELD_NAME"].ToString().ToLower() == ColName.ToLower()) { strHeaderText = dsDDMaster.Tables[0].Rows[j]["CAPTION"].ToString(); break; } } } if (strHeaderText == String.Empty) strHeaderText = ColName; return strHeaderText; }
private String CreateColumns(InfoDataSet ids, XmlNode xn, List<Panel> panels) { int columnWidth = Convert.ToInt16(xn.Attributes["ColumnWidth"].Value); int ColumnsCount = Count; if (120 + ColumnsCount * 30 > this.Height) this.Height += 30; int standard = 40; CheckBox cbActive = new CheckBox(); cbActive.Name = ColumnsCount + "AnyQueryActiveCheckBox"; if (xn.Attributes["IsActive"].Value == "1") cbActive.Checked = true; cbActive.Width = 15; cbActive.Location = new Point(standard, 13 + ColumnsCount * 30); cbActive.CheckedChanged += new EventHandler(cbActive_CheckedChanged); this.panel2.Controls.Add(cbActive); //standard += 30; //Label labelCondition = new Label(); //labelCondition.Name = ColumnsCount + "AnyQueryConditionLabel"; //labelCondition.Width = 50; //labelCondition.Text = xn.Attributes["Condition"].Value; //labelCondition.Location = new Point(standard, 17 + ColumnsCount * 30); //labelCondition.Click += new EventHandler(labelCondition_Click); //this.panel2.Controls.Add(labelCondition); standard += 30; ComboBox cbColumn = new ComboBox(); cbColumn.Name = ColumnsCount + "AnyQueryColumnComboBox"; this.panel2.Controls.Add(cbColumn); DataView dvColumn = CreateDataViewColumn(ids); cbColumn.DataSource = dvColumn; cbColumn.DisplayMember = "CAPTION"; cbColumn.ValueMember = "FIELDNAME"; cbColumn.DropDownStyle = ComboBoxStyle.DropDownList; cbColumn.Width = columnWidth; cbColumn.Location = new Point(standard, 15 + ColumnsCount * 30); cbColumn.Text = xn.Attributes["Caption"].Value; cbColumn.SelectedIndexChanged += new EventHandler(cbColumn_SelectedIndexChanged); standard += cbColumn.Width + 5; ComboBox cbOperator = new ComboBox(); Type cbType = GetDataType(CaptionToColumn(xn.Attributes["Caption"].Value, innerAnyQuery.BindingSource)); List<String> op = new List<string>(); op.AddRange(new String[] { "=", "!=", ">", "<", ">=", "<=", "%**", "**%", "%%", "!%%", "<->", "!<->", "IN", "NOT IN" }); if (!innerAnyQuery.DisplayAllOperator) { if (cbType == typeof(Char) || cbType == typeof(String)) { op.Clear(); //op.AddRange(new String[] { "=", "!=", "%**", "**%", "%%", "!%%", "IN", "NOT IN" }); op.AddRange(new String[] { "=", "!=", "%**", "**%", "%%", "!%%" }); } else if (cbType != null && (cbType == typeof(int) || cbType == typeof(float) || cbType == typeof(double) || cbType == typeof(DateTime) || cbType.FullName == "System.Decimal" || cbType == typeof(Int16) || cbType == typeof(Int64))) { op.Clear(); //op.AddRange(new String[] { "=", "!=", "<", ">", "<=", ">=", "<->", "!<->", "IN", "NOT IN" }); op.AddRange(new String[] { "=", "!=", "<", ">", "<=", ">=", "<->", "!<->" }); } } cbOperator.Items.AddRange(op.ToArray()); cbOperator.DropDownStyle = ComboBoxStyle.DropDownList; cbOperator.Name = ColumnsCount + "AnyQueryOperatorComboBox"; cbOperator.Width = 65; cbOperator.Location = new Point(standard, 15 + ColumnsCount * 30); SetOperatorHelp(cbOperator); cbOperator.SelectedIndexChanged += new EventHandler(cbOperator_SelectedIndexChanged); this.panel2.Controls.Add(cbOperator); standard += cbOperator.Width + 5; switch (xn.Attributes["ValueType"].Value) { case "AnyQueryTextBoxColumn": TextBox tbValue = new TextBox(); tbValue.Name = ColumnsCount + "AnyQueryValue1TextBox" + xn.Attributes["ValueEnabled"].Value; tbValue.Text = xn.Attributes["Value1"].Value; tbValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); tbValue.Location = new Point(standard, 15 + ColumnsCount * 30); tbValue.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); tbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(tbValue); break; case "AnyQueryComboBoxColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "=", "!=" }); cbOperator.Items.AddRange(op.ToArray()); InfoComboBox icbValue = new InfoComboBox(); if (xn.Attributes["SelectAlias"].Value == String.Empty || xn.Attributes["SelectCommand"].Value == String.Empty) { if (xn.Attributes["RemoteName"].Value == String.Empty) { String[] temp = xn.Attributes["Items"].Value.Split(';'); foreach (String str in temp) { if (str != String.Empty) icbValue.Items.Add(str); } } else { InfoDataSet idsComboBox = new InfoDataSet(); idsComboBox.RemoteName = xn.Attributes["RemoteName"].Value; idsComboBox.Active = true; InfoBindingSource ibsComboBox = new InfoBindingSource(); ibsComboBox.DataSource = idsComboBox; ibsComboBox.DataMember = idsComboBox.RealDataSet.Tables[0].TableName; icbValue.DataSource = ibsComboBox; icbValue.DisplayMember = xn.Attributes["DisplayMember"].Value; icbValue.ValueMember = xn.Attributes["ValueMember"].Value; icbValue.EndInit(); } } else { icbValue.SelectAlias = xn.Attributes["SelectAlias"].Value; icbValue.SelectCommand = xn.Attributes["SelectCommand"].Value; icbValue.DisplayMember = xn.Attributes["DisplayMember"].Value; icbValue.ValueMember = xn.Attributes["ValueMember"].Value; icbValue.EndInit(); } icbValue.DisplayMemberOnly = Convert.ToBoolean(xn.Attributes["DisplayMemberOnly"].Value); icbValue.Name = ColumnsCount + "AnyQueryValue1InfoComboBox" + xn.Attributes["ValueEnabled"].Value; icbValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); icbValue.Location = new Point(standard, 15 + ColumnsCount * 30); icbValue.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); icbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(icbValue); icbValue.SelectedValue = xn.Attributes["Value1"].Value; icbValue.Text = xn.Attributes["ValueReal"].Value; break; case "AnyQueryCheckBoxColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "=", "!=" }); cbOperator.Items.AddRange(op.ToArray()); CheckBox cbValue = new CheckBox(); cbValue.Name = ColumnsCount + "AnyQueryValue1CheckBox" + xn.Attributes["ValueEnabled"].Value; if (xn.Attributes["Value1"].Value == "1") cbValue.Checked = true; cbValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); cbValue.Location = new Point(standard, 15 + ColumnsCount * 30); cbValue.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); cbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(cbValue); break; case "AnyQueryRefValColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "=", "!=", "IN", "NOT IN" }); cbOperator.Items.AddRange(op.ToArray()); if (xn.Attributes["Operator"].Value == "IN" || xn.Attributes["Operator"].Value == "NOT IN") { InfoDataSet idsRefButton = new InfoDataSet(); idsRefButton.RemoteName = "GLModule.cmdRefValUse"; idsRefButton.Execute(xn.Attributes["SelectCommand"].Value, CliUtils.fLoginDB, true); InfoBindingSource ibsRefButton = new InfoBindingSource(); ibsRefButton.DataSource = idsRefButton; ibsRefButton.DataMember = "cmdRefValUse"; InfoTranslate it = new InfoTranslate(); it.BindingSource = ibsRefButton; TranslateRefReturnFields trrf = new TranslateRefReturnFields(); trrf.ColumnName = xn.Attributes["ValueMember"].Value; trrf.DisplayColumnName = xn.Attributes["DisplayMember"].Value; it.RefReturnFields.Add(trrf); InfoRefbuttonBox aInfoRefbuttonBox = new InfoRefbuttonBox(); aInfoRefbuttonBox.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + xn.Attributes["ValueEnabled"].Value; aInfoRefbuttonBox.Text = xn.Attributes["Value1"].Value; aInfoRefbuttonBox.RealValue = xn.Attributes["ValueReal"].Value; aInfoRefbuttonBox.Location = new Point(standard, 15 + ColumnsCount * 30); aInfoRefbuttonBox.Width = Convert.ToInt16(xn.Attributes["Width"].Value); ; aInfoRefbuttonBox.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); aInfoRefbuttonBox.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(aInfoRefbuttonBox); //TextBox tbRefButton = new TextBox(); //tbRefButton.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + xn.Attributes["ValueEnabled"].Value; //tbRefButton.Text = xn.Attributes["Value1"].Value; //tbRefButton.AccessibleName = xn.Attributes["ValueReal"].Value; //tbRefButton.Width = Convert.ToInt16(xn.Attributes["Width"].Value); //tbRefButton.Location = new Point(standard, 15 + ColumnsCount * 30); //tbRefButton.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); //tbRefButton.Enter += new EventHandler(tbValue_Enter); //this.panel2.Controls.Add(tbRefButton); InfoRefButton ifb = new InfoRefButton(); ifb.autoPanel = true; ifb.infoTranslate = it; RefButtonMatch rbm = new RefButtonMatch(); rbm.matchColumnName = aInfoRefbuttonBox.Name; ifb.refButtonMatchs.Add(rbm); ifb.Name = ColumnsCount + "AnyQueryValue1InfoRefButton" + xn.Attributes["ValueEnabled"].Value; ifb.Text = "..."; ifb.Width = 20; ifb.Location = new Point(aInfoRefbuttonBox.Location.X + aInfoRefbuttonBox.Width + 2, 15 + ColumnsCount * 30); //ifb.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); this.panel2.Controls.Add(ifb); } else { cbOperator.Items.Remove("IN"); cbOperator.Items.Remove("NOT IN"); InfoRefvalBox irbValue = new InfoRefvalBox(); InfoRefVal aInfoRefVal = new InfoRefVal(); if (xn.Attributes["SelectAlias"].Value != String.Empty && xn.Attributes["SelectCommand"].Value != String.Empty) { aInfoRefVal.SelectAlias = xn.Attributes["SelectAlias"].Value; aInfoRefVal.SelectCommand = xn.Attributes["SelectCommand"].Value; } else { InfoDataSet idsRefVal = new InfoDataSet(); idsRefVal.RemoteName = xn.Attributes["RemoteName"].Value; idsRefVal.Active = true; InfoBindingSource ibsRefVal = new InfoBindingSource(); ibsRefVal.DataSource = idsRefVal; ibsRefVal.DataMember = idsRefVal.RealDataSet.Tables[0].TableName; aInfoRefVal.DataSource = ibsRefVal; } aInfoRefVal.DisplayMember = xn.Attributes["DisplayMember"].Value; aInfoRefVal.ValueMember = xn.Attributes["ValueMember"].Value; aInfoRefVal.EndInit(); irbValue.Name = ColumnsCount + "AnyQueryValue1InfoRefvalBox" + xn.Attributes["ValueEnabled"].Value; irbValue.RefVal = aInfoRefVal; irbValue.TextBoxText = xn.Attributes["Value1"].Value; irbValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); irbValue.Location = new Point(standard, 15 + ColumnsCount * 30); irbValue.TextBoxEnabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); irbValue.TextBoxSelectedValue = xn.Attributes["ValueReal"].Value; irbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(irbValue); } break; case "AnyQueryCalendarColumn": InfoDateTimePicker idtpValue = new InfoDateTimePicker(); idtpValue.BeginInit(); idtpValue.Name = ColumnsCount + "AnyQueryValue1InfoDateTimePicker" + xn.Attributes["ValueEnabled"].Value; idtpValue.Text = xn.Attributes["Value1"].Value; idtpValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); idtpValue.Location = new Point(standard, 15 + ColumnsCount * 30); idtpValue.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); idtpValue.Format = DateTimePickerFormat.Long; idtpValue.EndInit(); idtpValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(idtpValue); break; case "AnyQueryRefButtonColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "IN", "NOT IN" }); cbOperator.Items.AddRange(op.ToArray()); InfoDataSet idsRefButton2 = new InfoDataSet(); if (xn.Attributes["RemoteName"].Value == "GLModule.cmdRefValUse") { idsRefButton2.RemoteName = "GLModule.cmdRefValUse"; idsRefButton2.Execute(xn.Attributes["SelectCommand"].Value, CliUtils.fLoginDB, true); } else { idsRefButton2.RemoteName = xn.Attributes["RemoteName"].Value; idsRefButton2.Active = true; } InfoBindingSource ibsRefButton2 = new InfoBindingSource(); ibsRefButton2.DataSource = idsRefButton2; if (xn.Attributes["RemoteName"].Value != null) ibsRefButton2.DataMember = idsRefButton2.RealDataSet.Tables[0].TableName; else ibsRefButton2.DataMember = "cmdRefValUse"; InfoTranslate it2 = new InfoTranslate(); it2.BindingSource = ibsRefButton2; TranslateRefReturnFields trrf2 = new TranslateRefReturnFields(); trrf2.ColumnName = xn.Attributes["ValueMember"].Value; trrf2.DisplayColumnName = xn.Attributes["DisplayMember"].Value; it2.RefReturnFields.Add(trrf2); InfoRefbuttonBox aInfoRefbuttonBox2 = new InfoRefbuttonBox(); aInfoRefbuttonBox2.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + xn.Attributes["ValueEnabled"].Value; aInfoRefbuttonBox2.Text = xn.Attributes["Value1"].Value; aInfoRefbuttonBox2.RealValue = xn.Attributes["ValueReal"].Value; aInfoRefbuttonBox2.Location = new Point(standard, 15 + ColumnsCount * 30); aInfoRefbuttonBox2.Width = Convert.ToInt16(xn.Attributes["Width"].Value); ; aInfoRefbuttonBox2.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); aInfoRefbuttonBox2.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(aInfoRefbuttonBox2); //TextBox tbRefButton2 = new TextBox(); //tbRefButton2.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + xn.Attributes["ValueEnabled"].Value; //tbRefButton2.Text = xn.Attributes["Value1"].Value; //tbRefButton2.AccessibleName = xn.Attributes["ValueReal"].Value; //tbRefButton2.Width = Convert.ToInt16(xn.Attributes["Width"].Value); //tbRefButton2.Location = new Point(standard, 15 + ColumnsCount * 30); //tbRefButton2.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); //tbRefButton2.Enter += new EventHandler(tbValue_Enter); //this.panel2.Controls.Add(tbRefButton2); InfoRefButton ifb2 = new InfoRefButton(); ifb2.autoPanel = Convert.ToBoolean(xn.Attributes["AutoPanel"].Value); if (!ifb2.autoPanel) { Control[] innerPanel = (this.innerAnyQuery.OwnerComp as InfoForm).Controls.Find(xn.Attributes["Panel"].Value, true); if (innerPanel.Length > 0) { ifb2.panel = innerPanel[0] as Panel; } if (ifb2.panel == null) { for (int i = 0; i < panels.Count; i++) { if (panels[i] == null) continue; ifb2.panel = panels[i]; } if (ifb2.panel == null) { MessageBox.Show("Can not find the Panel '" + xn.Attributes["Panel"].Value + "' in your Form."); return "AND"; } } } ifb2.infoTranslate = it2; RefButtonMatch rbm2 = new RefButtonMatch(); rbm2.matchColumnName = aInfoRefbuttonBox2.Name; ifb2.refButtonMatchs.Add(rbm2); ifb2.Name = ColumnsCount + "AnyQueryValue1InfoRefButton" + xn.Attributes["ValueEnabled"].Value; ifb2.Text = "..."; ifb2.Width = 20; ifb2.Location = new Point(aInfoRefbuttonBox2.Location.X + aInfoRefbuttonBox2.Width + 2, 15 + ColumnsCount * 30); //ifb2.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); this.panel2.Controls.Add(ifb2); break; } cbOperator.SelectedIndexChanged -= new EventHandler(cbOperator_SelectedIndexChanged); cbOperator.Text = xn.Attributes["Operator"].Value; cbOperator.SelectedIndexChanged += new EventHandler(cbOperator_SelectedIndexChanged); if (xn.Attributes["Operator"].Value == "<->" || xn.Attributes["Operator"].Value == "!<->") { standard += Convert.ToInt16(xn.Attributes["Width"].Value) + 5; Label aLabel = new Label(); aLabel.Name = ColumnsCount + "AnyQueryValue1to2Label"; aLabel.Text = "~"; aLabel.Width = 10; aLabel.Location = new Point(standard, 15 + ColumnsCount * 30); this.panel2.Controls.Add(aLabel); standard += aLabel.Width + 5; switch (xn.Attributes["ValueType"].Value) { case "AnyQueryTextBoxColumn": TextBox tbValue = new TextBox(); tbValue.Name = ColumnsCount + "AnyQueryValue2TextBox2" + xn.Attributes["ValueEnabled"].Value; tbValue.Text = xn.Attributes["Value2"].Value; tbValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); tbValue.Location = new Point(standard, 15 + ColumnsCount * 30); tbValue.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); tbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(tbValue); break; case "AnyQueryComboBoxColumn": InfoComboBox icbValue = new InfoComboBox(); icbValue.DisplayMemberOnly = true; if (xn.Attributes["SelectAlias"].Value == String.Empty || xn.Attributes["SelectCommand"].Value == String.Empty) { if (xn.Attributes["DataSource"].Value == String.Empty) { String[] temp = xn.Attributes["Items"].Value.Split(';'); foreach (String str in temp) { if (str != String.Empty) icbValue.Items.Add(str); } } else { InfoDataSet idsComboBox = new InfoDataSet(); idsComboBox.RemoteName = xn.Attributes["RemoteName"].Value; idsComboBox.Active = true; InfoBindingSource ibsComboBox = new InfoBindingSource(); ibsComboBox.DataSource = idsComboBox; ibsComboBox.DataMember = idsComboBox.RealDataSet.Tables[0].TableName; icbValue.DataSource = ibsComboBox; icbValue.DisplayMember = xn.Attributes["DisplayMember"].Value; icbValue.ValueMember = xn.Attributes["ValueMember"].Value; icbValue.EndInit(); } } else { icbValue.SelectAlias = xn.Attributes["SelectAlias"].Value; icbValue.SelectCommand = xn.Attributes["SelectCommand"].Value; icbValue.DisplayMember = xn.Attributes["DisplayMember"].Value; icbValue.ValueMember = xn.Attributes["ValueMember"].Value; icbValue.EndInit(); } icbValue.Name = ColumnsCount + "AnyQueryValue1InfoComboBox" + xn.Attributes["ValueEnabled"].Value; icbValue.Text = xn.Attributes["Value1"].Value; icbValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); icbValue.Location = new Point(standard, 15 + ColumnsCount * 30); icbValue.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); icbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(icbValue); break; case "AnyQueryCheckBoxColumn": break; case "AnyQueryRefValColumn": InfoRefvalBox irbValue = new InfoRefvalBox(); InfoRefVal aInfoRefVal = new InfoRefVal(); aInfoRefVal.SelectAlias = xn.Attributes["SelectAlias"].Value; aInfoRefVal.SelectCommand = xn.Attributes["SelectCommand"].Value; aInfoRefVal.DisplayMember = xn.Attributes["DisplayMember"].Value; aInfoRefVal.ValueMember = xn.Attributes["ValueMember"].Value; aInfoRefVal.EndInit(); irbValue.Name = ColumnsCount + "AnyQueryValue2InfoRefvalBox2" + xn.Attributes["ValueEnabled"].Value; irbValue.RefVal = aInfoRefVal; irbValue.TextBoxText = xn.Attributes["Value2"].Value; irbValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); irbValue.Location = new Point(standard, 15 + ColumnsCount * 30); irbValue.TextBoxEnabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); irbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(irbValue); break; case "AnyQueryCalendarColumn": InfoDateTimePicker idtpValue = new InfoDateTimePicker(); idtpValue.BeginInit(); idtpValue.Name = ColumnsCount + "AnyQueryValue2InfoDateTimePicker2" + xn.Attributes["ValueEnabled"].Value; idtpValue.Text = xn.Attributes["Value2"].Value; idtpValue.Width = Convert.ToInt16(xn.Attributes["Width"].Value); idtpValue.Location = new Point(standard, 15 + ColumnsCount * 30); idtpValue.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); idtpValue.Format = DateTimePickerFormat.Long; idtpValue.EndInit(); idtpValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(idtpValue); break; case "AnyQueryRefButtonColumn"://<->不会用到RefButton //InfoDataSet idsRefButton2 = new InfoDataSet(); //if (xn.Attributes["RemoteName"].Value == "GLModule.cmdRefValUse") //{ // idsRefButton2.RemoteName = "GLModule.cmdRefValUse"; // idsRefButton2.Execute(xn.Attributes["SelectCommand"].Value, xn.Attributes["SelectAlias"].Value, true); //} //else //{ // idsRefButton2.RemoteName = xn.Attributes["RemoteName"].Value; // idsRefButton2.Active = true; //} //InfoBindingSource ibsRefButton2 = new InfoBindingSource(); //ibsRefButton2.DataSource = idsRefButton2; //if (xn.Attributes["RemoteName"].Value != null) // ibsRefButton2.DataMember = idsRefButton2.RealDataSet.Tables[0].TableName; //else // ibsRefButton2.DataMember = "cmdRefValUse"; //InfoTranslate it2 = new InfoTranslate(); //it2.BindingSource = ibsRefButton2; //TranslateRefReturnFields trrf2 = new TranslateRefReturnFields(); //trrf2.ColumnName = xn.Attributes["ValueMember"].Value; //it2.RefReturnFields.Add(trrf2); //TextBox tbRefButton2 = new TextBox(); //tbRefButton2.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + xn.Attributes["ValueEnabled"].Value; //tbRefButton2.Text = xn.Attributes["Value1"].Value; //tbRefButton2.Width = Convert.ToInt16(xn.Attributes["Width"].Value); //tbRefButton2.Location = new Point(standard, 15 + ColumnsCount * 30); //tbRefButton2.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); //this.panel2.Controls.Add(tbRefButton2); //InfoRefButton ifb2 = new InfoRefButton(); //ifb2.autoPanel = Convert.ToBoolean(xn.Attributes["AutoPanel"].Value); //if (!ifb2.autoPanel) //{ // Control[] innerPanel = (this.innerAnyQuery.OwnerComp as InfoForm).Controls.Find(xn.Attributes["Panel"].Value, true); // if (innerPanel.Length > 0) // { // ifb2.panel = innerPanel[0] as Panel; // } // if (ifb2.panel == null) // { // for (int i = 0; i < panels.Count; i++) // { // if (panels[i] == null) continue; // ifb2.panel = panels[i]; // } // if (ifb2.panel == null) // { // MessageBox.Show("Can not find the Panel '" + xn.Attributes["Panel"].Value + "' in your Form."); // return "AND"; // } // } //} //ifb2.infoTranslate = it2; //RefButtonMatch rbm2 = new RefButtonMatch(); //rbm2.matchColumnName = tbRefButton2.Name; //ifb2.refButtonMatchs.Add(rbm2); //ifb2.Name = ColumnsCount + "AnyQueryValue1InfoRefButton" + xn.Attributes["ValueEnabled"].Value; //ifb2.Text = "..."; //ifb2.Width = 20; //ifb2.Location = new Point(tbRefButton2.Location.X + tbRefButton2.Width + 2, 15 + ColumnsCount * 30); ////ifb2.Enabled = Convert.ToBoolean(xn.Attributes["Enabled"].Value); //this.panel2.Controls.Add(ifb2); break; } } if (innerAnyQuery.AutoDisableColumns) { cbActive_CheckedChanged(cbActive, new EventArgs()); } return xn.Attributes["Condition"].Value; }
private void CreateColumns(InfoDataSet ids, AnyQueryColumns aqc, int columnsCount, bool isActive) { String value = aqc.DefaultValue; if (aqc.DefaultValue.StartsWith("_")) { object[] realValue = CliUtils.GetValue(aqc.DefaultValue); if (realValue[0].ToString() == "0") value = realValue[1].ToString(); } int columnWidth = aqc.ColumnWidth; int ColumnsCount = columnsCount; if (120 + ColumnsCount * 30 > this.Height) this.Height += 30; int standard = 40; CheckBox cbActive = new CheckBox(); cbActive.Name = ColumnsCount + "AnyQueryActiveCheckBox"; cbActive.Width = 15; cbActive.Location = new Point(standard, 13 + ColumnsCount * 30); cbActive.Checked = isActive; cbActive.CheckedChanged += new EventHandler(cbActive_CheckedChanged); this.panel2.Controls.Add(cbActive); //standard += 30; //Label labelCondition = new Label(); //labelCondition.Name = ColumnsCount + "AnyQueryConditionLabel"; //labelCondition.Width = 50; //labelCondition.Text = aqc.Condition.ToUpper(); //labelCondition.Location = new Point(standard, 17 + ColumnsCount * 30); //labelCondition.Click += new EventHandler(labelCondition_Click); //this.panel2.Controls.Add(labelCondition); standard += 30; ComboBox cbColumn = new ComboBox(); cbColumn.Name = ColumnsCount + "AnyQueryColumnComboBox"; this.panel2.Controls.Add(cbColumn); DataView dvColumn = CreateDataViewColumn(ids); cbColumn.DataSource = dvColumn; cbColumn.DisplayMember = "CAPTION"; cbColumn.ValueMember = "FIELDNAME"; cbColumn.Width = columnWidth; //if (innerAnyQuery.QueryColumnMode == AnyQueryColumnMode.ByBindingSource) // cbColumn.Text = GetHeaderText(aqc.Column); //else cbColumn.DropDownStyle = ComboBoxStyle.DropDownList; cbColumn.Location = new Point(standard, 15 + ColumnsCount * 30); cbColumn.Text = aqc.Caption; cbColumn.SelectedIndexChanged += new EventHandler(cbColumn_SelectedIndexChanged); standard += cbColumn.Width + 5; ComboBox cbOperator = new ComboBox(); Type cbType = GetDataType(aqc.Column); List<String> op = new List<string>(); op.AddRange(new String[] { "=", "!=", ">", "<", ">=", "<=", "%**", "**%", "%%", "!%%", "<->", "!<->", "IN", "NOT IN" }); if (!innerAnyQuery.DisplayAllOperator) { if (cbType == typeof(Char) || cbType == typeof(String)) { op.Clear(); //op.AddRange(new String[] { "=", "!=", "%**", "**%", "%%", "!%%", "IN", "NOT IN" }); op.AddRange(new String[] { "=", "!=", "%**", "**%", "%%", "!%%" }); } else if (cbType != null && (cbType == typeof(int) || cbType == typeof(float) || cbType == typeof(double) || cbType == typeof(DateTime) || cbType.FullName == "System.Decimal" || cbType == typeof(Int16) || cbType == typeof(Int64))) { op.Clear(); //op.AddRange(new String[] { "=", "!=", "<", ">", "<=", ">=", "<->", "!<->", "IN", "NOT IN" }); op.AddRange(new String[] { "=", "!=", "<", ">", "<=", ">=", "<->", "!<->" }); } } cbOperator.Items.AddRange(op.ToArray()); cbOperator.DropDownStyle = ComboBoxStyle.DropDownList; cbOperator.Name = ColumnsCount + "AnyQueryOperatorComboBox"; cbOperator.Width = 65; cbOperator.Location = new Point(standard, 15 + ColumnsCount * 30); SetOperatorHelp(cbOperator); cbOperator.SelectedIndexChanged += new EventHandler(cbOperator_SelectedIndexChanged); this.panel2.Controls.Add(cbOperator); standard += cbOperator.Width + 5; switch (aqc.ColumnType) { case "AnyQueryTextBoxColumn": TextBox tbValue = new TextBox(); tbValue.Name = ColumnsCount + "AnyQueryValue1TextBox" + aqc.Enabled.ToString(); tbValue.Text = value; tbValue.Width = aqc.Width; tbValue.Location = new Point(standard, 15 + ColumnsCount * 30); tbValue.Enabled = aqc.Enabled; tbValue.Enter += new EventHandler(tbValue_Enter); tbValue.KeyPress += new KeyPressEventHandler(tbValue_KeyPress); this.panel2.Controls.Add(tbValue); break; case "AnyQueryComboBoxColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "=", "!=" }); cbOperator.Items.AddRange(op.ToArray()); InfoComboBox icbValue = new InfoComboBox(); if (aqc.InfoRefVal != null) { icbValue.DisplayMemberOnly = true; if (aqc.InfoRefVal.SelectAlias != null && aqc.InfoRefVal.SelectAlias != String.Empty && aqc.InfoRefVal.SelectCommand != null && aqc.InfoRefVal.SelectCommand != String.Empty) { icbValue.SelectAlias = aqc.InfoRefVal.SelectAlias; icbValue.SelectCommand = aqc.InfoRefVal.SelectCommand; } else { icbValue.DataSource = aqc.InfoRefVal.DataSource; } icbValue.DisplayMember = aqc.InfoRefVal.DisplayMember; icbValue.ValueMember = aqc.InfoRefVal.ValueMember; icbValue.EndInit(); } else { icbValue.DisplayMemberOnly = false; icbValue.Items.AddRange(aqc.Items); } icbValue.Name = ColumnsCount + "AnyQueryValue1InfoComboBox" + aqc.Enabled.ToString(); icbValue.Text = value; icbValue.Width = aqc.Width; icbValue.Location = new Point(standard, 15 + ColumnsCount * 30); icbValue.Enabled = aqc.Enabled; icbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(icbValue); break; case "AnyQueryCheckBoxColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "=", "!=" }); cbOperator.Items.AddRange(op.ToArray()); CheckBox cbValue = new CheckBox(); cbValue.Name = ColumnsCount + "AnyQueryValue1CheckBox" + aqc.Enabled.ToString(); if (aqc.DefaultValue == "1") cbValue.Checked = true; cbValue.Width = aqc.Width; cbValue.Location = new Point(standard, 15 + ColumnsCount * 30); cbValue.Enabled = aqc.Enabled; cbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(cbValue); break; case "AnyQueryRefValColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "=", "!=", "IN", "NOT IN" }); cbOperator.Items.AddRange(op.ToArray()); if (aqc.Operator == "IN" || aqc.Operator == "NOT IN") { InfoTranslate it = new InfoTranslate(); if (aqc.InfoRefVal.SelectAlias != null && aqc.InfoRefVal.SelectCommand != null && aqc.InfoRefVal.SelectAlias != String.Empty && aqc.InfoRefVal.SelectCommand != String.Empty) { InfoDataSet idsRefButton = new InfoDataSet(); idsRefButton.RemoteName = "GLModule.cmdRefValUse"; idsRefButton.Execute(aqc.InfoRefVal.SelectCommand, CliUtils.fLoginDB, true); InfoBindingSource ibsRefButton = new InfoBindingSource(); ibsRefButton.DataSource = idsRefButton; ibsRefButton.DataMember = "cmdRefValUse"; it.BindingSource = ibsRefButton; } else { it.BindingSource = aqc.InfoRefVal.DataSource as InfoBindingSource; } TranslateRefReturnFields trrf = new TranslateRefReturnFields(); trrf.ColumnName = aqc.InfoRefVal.ValueMember; trrf.DisplayColumnName = aqc.InfoRefVal.DisplayMember; it.RefReturnFields.Add(trrf); InfoRefbuttonBox aInfoRefbuttonBox = new InfoRefbuttonBox(); aInfoRefbuttonBox.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + aqc.Enabled.ToString(); aInfoRefbuttonBox.Text = value; aInfoRefbuttonBox.Location = new Point(standard, 15 + ColumnsCount * 30); aInfoRefbuttonBox.Width = aqc.Width; aInfoRefbuttonBox.Enabled = aqc.Enabled; aInfoRefbuttonBox.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(aInfoRefbuttonBox); //TextBox tbRefButton = new TextBox(); //tbRefButton.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + aqc.Enabled.ToString(); //tbRefButton.Text = aqc.DefaultValue; //tbRefButton.Width = aqc.Width; //tbRefButton.Location = new Point(standard, 15 + ColumnsCount * 30); //tbRefButton.Enabled = aqc.Enabled; //tbRefButton.Enter += new EventHandler(tbValue_Enter); //this.panel2.Controls.Add(tbRefButton); InfoRefButton ifb = new InfoRefButton(); ifb.autoPanel = true; ifb.infoTranslate = it; RefButtonMatch rbm = new RefButtonMatch(); rbm.matchColumnName = aInfoRefbuttonBox.Name; ifb.refButtonMatchs.Add(rbm); ifb.Name = ColumnsCount + "AnyQueryValue1InfoRefButton" + aqc.Enabled.ToString(); ifb.Text = "..."; ifb.Width = 20; ifb.Location = new Point(aInfoRefbuttonBox.Location.X + aInfoRefbuttonBox.Width + 2, 15 + ColumnsCount * 30); //ifb.Enabled = aqc.Enabled; this.panel2.Controls.Add(ifb); } else { cbOperator.Items.Remove("IN"); cbOperator.Items.Remove("NOT IN"); InfoRefvalBox irbValue = new InfoRefvalBox(); irbValue.Name = ColumnsCount + "AnyQueryValue1InfoRefvalBox" + aqc.Enabled.ToString(); irbValue.RefVal = aqc.InfoRefVal; irbValue.TextBoxText = value; irbValue.Width = aqc.Width; irbValue.Location = new Point(standard, 15 + ColumnsCount * 30); irbValue.TextBoxEnabled = aqc.Enabled; irbValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(irbValue); } break; case "AnyQueryCalendarColumn": InfoDateTimePicker idtpValue = new InfoDateTimePicker(); idtpValue.BeginInit(); idtpValue.Name = ColumnsCount + "AnyQueryValue1InfoDateTimePicker" + aqc.Enabled.ToString(); idtpValue.Text = value; idtpValue.Width = aqc.Width; idtpValue.Location = new Point(standard, 15 + ColumnsCount * 30); idtpValue.Enabled = aqc.Enabled; idtpValue.Format = DateTimePickerFormat.Long; idtpValue.EndInit(); idtpValue.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(idtpValue); break; case "AnyQueryRefButtonColumn": cbOperator.Items.Clear(); op.Clear(); op.AddRange(new String[] { "IN", "NOT IN" }); cbOperator.Items.AddRange(op.ToArray()); InfoTranslate itRefButton = new InfoTranslate(); if (aqc.InfoRefVal.SelectAlias != null && aqc.InfoRefVal.SelectCommand != null && aqc.InfoRefVal.SelectAlias != String.Empty && aqc.InfoRefVal.SelectCommand != String.Empty) { InfoDataSet idsRefButton = new InfoDataSet(); idsRefButton.RemoteName = "GLModule.cmdRefValUse"; idsRefButton.Execute(aqc.InfoRefVal.SelectCommand, CliUtils.fLoginDB, true); InfoBindingSource ibsRefButton = new InfoBindingSource(); ibsRefButton.DataSource = idsRefButton; ibsRefButton.DataMember = "cmdRefValUse"; itRefButton.BindingSource = ibsRefButton; } else { itRefButton.BindingSource = aqc.InfoRefVal.DataSource as InfoBindingSource; } TranslateRefReturnFields trrf2 = new TranslateRefReturnFields(); trrf2.ColumnName = aqc.InfoRefVal.ValueMember; trrf2.DisplayColumnName = aqc.InfoRefVal.DisplayMember; itRefButton.RefReturnFields.Add(trrf2); InfoRefbuttonBox aInfoRefbuttonBox2 = new InfoRefbuttonBox(); aInfoRefbuttonBox2.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + aqc.Enabled.ToString(); aInfoRefbuttonBox2.Text = value; aInfoRefbuttonBox2.Location = new Point(standard, 15 + ColumnsCount * 30); aInfoRefbuttonBox2.Width = aqc.Width; aInfoRefbuttonBox2.Enabled = aqc.Enabled; aInfoRefbuttonBox2.Enter += new EventHandler(tbValue_Enter); this.panel2.Controls.Add(aInfoRefbuttonBox2); //TextBox tbRefButton2 = new TextBox(); //tbRefButton2.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + aqc.Enabled.ToString(); //tbRefButton2.Text = aqc.DefaultValue; //tbRefButton2.Width = aqc.Width; //tbRefButton2.Location = new Point(standard, 15 + ColumnsCount * 30); //tbRefButton2.Enabled = aqc.Enabled; //tbRefButton2.Enter += new EventHandler(tbValue_Enter); //this.panel2.Controls.Add(tbRefButton2); InfoRefButton ifb2 = new InfoRefButton(); if (aqc.InfoRefButtonAutoPanel) ifb2.autoPanel = true; else { ifb2.autoPanel = false; ifb2.panel = aqc.InfoRefButtonPanel; } ifb2.infoTranslate = itRefButton; RefButtonMatch rbm2 = new RefButtonMatch(); rbm2.matchColumnName = aInfoRefbuttonBox2.Name;//rbm2.matchColumnName = tbRefButton2.Name; ifb2.refButtonMatchs.Add(rbm2); ifb2.Name = ColumnsCount + "AnyQueryValue1InfoRefButton" + aqc.Enabled.ToString(); ifb2.Text = "..."; ifb2.Width = 20; ifb2.Location = new Point(aInfoRefbuttonBox2.Location.X + aInfoRefbuttonBox2.Width + 2, 15 + ColumnsCount * 30);//ifb2.Location = new Point(tbRefButton2.Location.X + tbRefButton2.Width + 2, 15 + ColumnsCount * 30); //ifb2.Enabled = aqc.Enabled; this.panel2.Controls.Add(ifb2); break; } if (aqc.Operator == "%") cbOperator.Text = "**%"; else cbOperator.Text = aqc.Operator; //if (aqc.Operator == "<->" || aqc.Operator == "!<->") //{ // standard += aqc.Width + 5; // Label aLabel = new Label(); // aLabel.Name = ColumnsCount + "AnyQueryValue1to2Label"; // aLabel.Text = "~"; // aLabel.Width = 10; // aLabel.Location = new Point(standard, 15 + ColumnsCount * 30); // this.panel2.Controls.Add(aLabel); // standard += aLabel.Width + 5; // switch (aqc.ColumnType) // { // case "AnyQueryTextBoxColumn": // TextBox tbValue = new TextBox(); // tbValue.Name = ColumnsCount + "AnyQueryValue2TextBox" + aqc.Enabled.ToString(); // tbValue.Text = aqc.DefaultValue; // tbValue.Width = aqc.Width; // tbValue.Location = new Point(standard, 15 + ColumnsCount * 30); // tbValue.Enabled = aqc.Enabled; // tbValue.Enter += new EventHandler(tbValue_Enter); // this.panel2.Controls.Add(tbValue); // break; // case "AnyQueryComboBoxColumn": // InfoComboBox icbValue = new InfoComboBox(); // icbValue.DisplayMemberOnly = true; // if (aqc.InfoRefVal != null) // { // if (icbValue.SelectAlias != null && icbValue.SelectAlias != String.Empty && icbValue.SelectCommand != null && icbValue.SelectCommand != String.Empty) // { // icbValue.SelectAlias = aqc.InfoRefVal.SelectAlias; // icbValue.SelectCommand = aqc.InfoRefVal.SelectCommand; // } // else // { // icbValue.DataSource = aqc.InfoRefVal.DataSource; // } // icbValue.DisplayMember = aqc.InfoRefVal.DisplayMember; // icbValue.ValueMember = aqc.InfoRefVal.ValueMember; // icbValue.EndInit(); // } // else // { // icbValue.Items.AddRange(aqc.Items); // } // icbValue.Name = ColumnsCount + "AnyQueryValue2InfoComboBox2" + aqc.Enabled.ToString(); // icbValue.Text = aqc.DefaultValue; // icbValue.Width = aqc.Width; // icbValue.Location = new Point(standard, 15 + ColumnsCount * 30); // icbValue.Enabled = aqc.Enabled; // icbValue.Enter += new EventHandler(tbValue_Enter); // this.panel2.Controls.Add(icbValue); // break; // case "AnyQueryCheckBoxColumn": // break; // case "AnyQueryRefValColumn": // InfoRefvalBox irbValue = new InfoRefvalBox(); // irbValue.Name = ColumnsCount + "AnyQueryValue2InfoRefvalBox2" + aqc.Enabled.ToString(); // irbValue.RefVal = aqc.InfoRefVal; // irbValue.TextBoxText = aqc.DefaultValue; // irbValue.Width = aqc.Width; // irbValue.Location = new Point(standard, 15 + ColumnsCount * 30); // irbValue.TextBoxEnabled = aqc.Enabled; // irbValue.Enter += new EventHandler(tbValue_Enter); // this.panel2.Controls.Add(irbValue); // break; // case "AnyQueryCalendarColumn": // InfoDateTimePicker idtpValue = new InfoDateTimePicker(); // idtpValue.BeginInit(); // idtpValue.Name = ColumnsCount + "AnyQueryValue2InfoDateTimePicker2" + aqc.Enabled.ToString(); // idtpValue.Text = aqc.DefaultValue; // idtpValue.Width = aqc.Width; // idtpValue.Location = new Point(standard, 15 + ColumnsCount * 30); // idtpValue.Enabled = aqc.Enabled; // idtpValue.Format = DateTimePickerFormat.Long; // idtpValue.EndInit(); // idtpValue.Enter += new EventHandler(tbValue_Enter); // this.panel2.Controls.Add(idtpValue); // break; // case "AnyQueryRefButtonColumn"://<->不会用到RefButton // //InfoTranslate itRefButton = new InfoTranslate(); // //if (aqc.InfoRefVal.SelectAlias != null && aqc.InfoRefVal.SelectCommand != null && aqc.InfoRefVal.SelectAlias != String.Empty && aqc.InfoRefVal.SelectCommand != String.Empty) // //{ // // InfoDataSet idsRefButton = new InfoDataSet(); // // idsRefButton.RemoteName = "GLModule.cmdRefValUse"; // // idsRefButton.Execute(aqc.InfoRefVal.SelectCommand, aqc.InfoRefVal.SelectAlias, true); // // InfoBindingSource ibsRefButton = new InfoBindingSource(); // // ibsRefButton.DataSource = idsRefButton; // // ibsRefButton.DataMember = "cmdRefValUse"; // // itRefButton.BindingSource = ibsRefButton; // //} // //else // //{ // // itRefButton.BindingSource = aqc.InfoRefVal.DataSource as InfoBindingSource; // //} // //TranslateRefReturnFields trrf2 = new TranslateRefReturnFields(); // //trrf2.ColumnName = aqc.InfoRefVal.ValueMember; // //itRefButton.RefReturnFields.Add(trrf2); // //TextBox tbRefButton2 = new TextBox(); // //tbRefButton2.Name = ColumnsCount + "AnyQueryValue1RefTextBox" + aqc.Enabled.ToString(); // //tbRefButton2.Text = aqc.DefaultValue; // //tbRefButton2.Width = aqc.Width; // //tbRefButton2.Location = new Point(standard, 15 + ColumnsCount * 30); // //tbRefButton2.Enabled = aqc.Enabled; // //this.panel2.Controls.Add(tbRefButton2); // //InfoRefButton ifb2 = new InfoRefButton(); // //if (aqc.InfoRefButtonAutoPanel) // // ifb2.autoPanel = true; // //else // //{ // // ifb2.autoPanel = false; // // ifb2.panel = aqc.InfoRefButtonPanel; // //} // //ifb2.infoTranslate = itRefButton; // //RefButtonMatch rbm2 = new RefButtonMatch(); // //rbm2.matchColumnName = tbRefButton2.Name; // //ifb2.refButtonMatchs.Add(rbm2); // //ifb2.Name = ColumnsCount + "AnyQueryValue1InfoRefButton" + aqc.Enabled.ToString(); // //ifb2.Text = "..."; // //ifb2.Width = 20; // //ifb2.Location = new Point(tbRefButton2.Location.X + tbRefButton2.Width + 2, 15 + ColumnsCount * 30); // //ifb2.Enabled = aqc.Enabled; // //this.panel2.Controls.Add(ifb2); // break; // } //} if (innerAnyQuery.AutoDisableColumns) { cbActive_CheckedChanged(cbActive, new EventArgs()); } }
private String CaptionToColumn(String caption, InfoBindingSource ibs) { String column = String.Empty; InfoDataSet ids = ibs.DataSource as InfoDataSet; if (ids != null) { foreach (DataColumn dc in ids.RealDataSet.Tables[0].Columns) { if (GetHeaderText(dc.ColumnName, ibs) == caption) { column = dc.ColumnName; break; } } } return column; }
private static void CreateWinQueryField(Form FRootForm, TBlockFieldItem aFieldItem, string Range, InfoBindingSource ibs) { ClientQuery aClientQuery = FRootForm.Container.Components["clientQuery1"] as ClientQuery; if (aClientQuery != null) { if (ibs != null && aClientQuery != null) aClientQuery.BindingSource = ibs; if (aFieldItem.QueryMode != null && (aFieldItem.QueryMode.ToUpper() == "NORMAL" || aFieldItem.QueryMode.ToUpper() == "RANGE")) { QueryColumns qColumn = new QueryColumns(); qColumn.Column = aFieldItem.DataField; qColumn.Caption = aFieldItem.Description; if (qColumn.Caption == "") qColumn.Caption = aFieldItem.DataField; if (aFieldItem.QueryMode.ToUpper() == "NORMAL") { if (aFieldItem.DataType == typeof(DateTime)) qColumn.Operator = "="; if (aFieldItem.DataType == typeof(int) || aFieldItem.DataType == typeof(float) || aFieldItem.DataType == typeof(double) || aFieldItem.DataType == typeof(Int16)) qColumn.Operator = "="; if (aFieldItem.DataType == typeof(String)) qColumn.Operator = "%"; } if (aFieldItem.QueryMode.ToUpper() == "RANGE") { qColumn.Condition = "And"; if (Range == "") { qColumn.Operator = "<="; CreateWinQueryField(FRootForm, aFieldItem, ">=", null); } else { qColumn.Operator = Range; } } switch (aFieldItem.ControlType.ToUpper()) { case "DATETIMEBOX": qColumn.ColumnType = "ClientQueryCalendarColumn"; break; case "CHECKBOX": qColumn.ColumnType = "ClientQueryCheckBoxColumn"; break; default: qColumn.ColumnType = "ClientQueryTextBoxColumn"; break; } aClientQuery.Columns.Add(qColumn); } } }
private InfoDataSet GetInfoDataSet(InfoBindingSource bindingSource) { if (bindingSource != null) { object datasource = bindingSource.DataSource; if (datasource is InfoDataSet) { return datasource as InfoDataSet; } else if (datasource is InfoBindingSource) { return GetInfoDataSet(datasource as InfoBindingSource); } } return null; }
private DataTable FindDataTable(InfoBindingSource aBindingSource, String innerDataSetName) { InfoDataSet aDataSet = GetRootDataSet(aBindingSource); foreach (DataTable aTable in aDataSet.RealDataSet.Tables) { if (aTable.TableName.CompareTo(innerDataSetName) == 0) return aTable; //if (aTable.TableName.CompareTo(aBindingSource.Tablename) == 0) // return aTable; } return null; }
private void SetNodeData(DataRelation Relation, InfoBindingSource BindingSource, System.Windows.Forms.TreeNode Node) { TDetailItem DetailItem = new TDetailItem(); DetailItem.BindingSource = BindingSource; DetailItem.Relation = Relation; DetailItem.TableName = Relation.ChildTable.TableName; String ModuleName = tbProviderName.Text; ModuleName = ModuleName.Substring(0, ModuleName.IndexOf('.')); String SolutionName = System.IO.Path.GetFileNameWithoutExtension(FClientData.SolutionName); DetailItem.RealTableName = CliUtils.GetTableName(ModuleName, DetailItem.TableName, SolutionName, "", true); Node.Tag = DetailItem; tvRelation.SelectedNode = Node; }
private void ShowTableRelations() { if (radioButtonEntity.Checked) { ShowTable(); } else if (radioButtonInfoCommand.Checked) { tvRelation.Nodes.Clear(); InfoBindingSource IBS = new InfoBindingSource(); DataRelation R = null; try { IBS.DataSource = FInfoDataSet; IBS.DataMember = FInfoDataSet.RealDataSet.Tables[0].TableName; ShowTable(IBS, R); } finally { IBS.Dispose(); } } }
private void ShowTable(InfoBindingSource aBindingSource, DataRelation Relation) { DataRelation R1; System.Windows.Forms.TreeNode Node; InfoBindingSource IBS; if (aBindingSource.DataSource.GetType().Equals(typeof(InfoDataSet))) { InfoDataSet set1 = (InfoDataSet)aBindingSource.DataSource; for (int I = 0; I < set1.RealDataSet.Tables[0].ChildRelations.Count; I++) { R1 = set1.RealDataSet.Tables[0].ChildRelations[I]; Node = new System.Windows.Forms.TreeNode(); Node.Text = R1.ChildTable.TableName; Node.Name = R1.ChildTable.TableName; tvRelation.Nodes.Add(Node); IBS = new InfoBindingSource(); IBS.DataSource = aBindingSource; IBS.DataMember = R1.RelationName; SetNodeData(R1, IBS, Node); ShowChildRelation(R1.ChildTable.ChildRelations, Node); } } if (aBindingSource.DataSource.GetType().Equals(typeof(InfoBindingSource))) { while (!aBindingSource.DataSource.GetType().Equals(typeof(InfoDataSet))) { aBindingSource = (InfoBindingSource)aBindingSource.DataSource; } InfoDataSet set2 = (InfoDataSet)aBindingSource.DataSource; for (int num2 = 0; num2 < set2.RealDataSet.Tables.Count; num2++) { if (set2.RealDataSet.Tables[num2].TableName.Equals(Relation.ChildTable.TableName)) { for (int num3 = 0; num3 < set2.RealDataSet.Tables[num2].ChildRelations.Count; num3++) { R1 = set2.RealDataSet.Tables[num2].ChildRelations[num3]; Node = new System.Windows.Forms.TreeNode(); Node.Text = R1.ChildTable.TableName; Node.Name = R1.ChildTable.TableName; tvRelation.Nodes.Add(Node); IBS = new InfoBindingSource(); IBS.DataSource = aBindingSource; IBS.DataMember = R1.RelationName; SetNodeData(R1, IBS, Node); ShowChildRelation(R1.ChildTable.ChildRelations, Node); } } } } }
private InfoDataSet GetRootDataSetByBindingSource(InfoBindingSource aBindingSource) { if (aBindingSource.DataSource == null) return null; if (aBindingSource.DataSource is InfoDataSet) return aBindingSource.DataSource as InfoDataSet; return GetRootDataSetByBindingSource(aBindingSource.DataSource as InfoBindingSource); }
private void btnNewDataset_Click(object sender, EventArgs e) { InfoBindingSource IBS = new InfoBindingSource(); System.Windows.Forms.TreeNode node1 = tvRelation.SelectedNode; if ((node1 == null) || (node1.Level == 0)) { if (FInfoDataSet.RemoteName == "") { FInfoDataSet.RemoteName = tbProviderName.Text; } IBS.DataSource = FInfoDataSet; IBS.DataMember = tbTableName.Text; } else { TDetailItem item1 = (TDetailItem)node1.Parent.Tag; IBS.DataSource = item1.BindingSource; IBS.DataMember = item1.Relation.RelationName; } fmSelDetail detail1 = new fmSelDetail(); DataRelation R = null; if (detail1.ShowSelDetail(IBS, ref R)) { System.Windows.Forms.TreeNode Node = tvRelation.Nodes.Add(R.ChildTable.TableName); SetNodeData(R, IBS, Node); UpdatelvSelectedFields((TDetailItem)Node.Tag); } }
private void InitComponentList(Type ObjectType, ListView aListView, EventHandler aClick, ComboBox aComboBox) { aListView.BeginUpdate(); foreach (Object Obj in FTemplateForm.Container.Components) { if (Obj is Component) { Component Comp = Obj as Component; if (Comp.GetType().Equals(ObjectType)) { ListViewItem Item = aListView.Items.Add(Comp.Site.Name); Item.Tag = Comp; if (aComboBox != null) { aComboBox.Items.Add(Comp.Site.Name); cbViewBindingSource.Items.Add(Comp.Site.Name); } if (ObjectType.Equals(typeof(InfoBindingSource))) { InfoBindingSource bBindingSource = FClientData.FindBindingSource(Comp.Site.Name); if (bBindingSource == null) { bBindingSource = new InfoBindingSource(FContainer); FClientData.BindingSourceList.Add(bBindingSource); } bBindingSource.Site.Name = Comp.Site.Name; if (((InfoBindingSource)Comp).DataSource is InfoDataSet) bBindingSource.text = ((InfoDataSet)((InfoBindingSource)Comp).DataSource).Site.Name; if (((InfoBindingSource)Comp).DataSource is InfoBindingSource) bBindingSource.text = ((InfoBindingSource)((InfoBindingSource)Comp).DataSource).Site.Name; } if (ObjectType.Equals(typeof(InfoDataSet))) { InfoDataSet aDataSet = FClientData.FindDataSet(Comp.Site.Name); if (aDataSet == null) { aDataSet = new InfoDataSet(FContainer); FClientData.DataSetList.Add(aDataSet); } aDataSet.SetWizardDesignMode(true); aDataSet.Site.Name = Item.Text; } Item.SubItems.Add(""); ListViewItem.ListViewSubItem LVSI = Item.SubItems.Add(""); CreateRefValButton(Item, LVSI, aClick); } } } FixupBindingSourceReference(); aListView.EndUpdate(); }
private void ShowTable(String ModuleName, String SolutionName, InfoBindingSource aBindingSource, DataRelation Relation) { DataRelation R1; if (aBindingSource.DataSource.GetType().Equals(typeof(InfoDataSet))) { InfoDataSet set1 = (InfoDataSet)aBindingSource.DataSource; for (int I = 0; I < set1.RealDataSet.Tables[0].ChildRelations.Count; I++) { R1 = set1.RealDataSet.Tables[0].ChildRelations[I]; tbChildTableName.Text += R1.ChildTable.TableName + ","; tbRealChildTableName.Text += CliUtils.GetTableName(ModuleName, R1.ChildTable.TableName, SolutionName, "", true) + ","; } } if (aBindingSource.DataSource.GetType().Equals(typeof(InfoBindingSource))) { while (!aBindingSource.DataSource.GetType().Equals(typeof(InfoDataSet))) { aBindingSource = (InfoBindingSource)aBindingSource.DataSource; } InfoDataSet set2 = (InfoDataSet)aBindingSource.DataSource; for (int num2 = 0; num2 < set2.RealDataSet.Tables.Count; num2++) { if (set2.RealDataSet.Tables[num2].TableName.Equals(Relation.ChildTable.TableName)) { for (int num3 = 0; num3 < set2.RealDataSet.Tables[num2].ChildRelations.Count; num3++) { R1 = set2.RealDataSet.Tables[num2].ChildRelations[num3]; tbChildTableName.Text += R1.ChildTable.TableName + ","; tbRealChildTableName.Text += CliUtils.GetTableName(ModuleName, R1.ChildTable.TableName, SolutionName, "", true) + ","; } } } } if (tbChildTableName.Text != "") { tbChildTableName.Text = tbChildTableName.Text.Substring(0, tbChildTableName.Text.Length - 1); tbRealChildTableName.Text = tbRealChildTableName.Text.Substring(0, tbRealChildTableName.Text.Length - 1); } }
private void TraceTree(InfoBindingSource aBindingSource, ArrayList NewList) { foreach (InfoBindingSource aSource in FClientData.BindingSourceList) { Component C = FClientData.FindBindingSource(aSource.text); if (C == aBindingSource) { aSource.DataSource = aBindingSource; NewList.Add(aSource); TraceTree(aSource, NewList); } } }
private String GetTableNameByBindingSource(InfoBindingSource aBindingSource) { if (aBindingSource.DataSource is InfoDataSet) return aBindingSource.DataMember; if (aBindingSource.DataSource is InfoBindingSource) { InfoDataSet aDataSet = GetRootDataSetByBindingSource(aBindingSource); String TableName = GetTableNameByRelationName(aDataSet, null, aBindingSource.DataMember); return TableName; } return ""; }
public frmNavigatorCopy(InfoBindingSource ibs) { InitializeComponent(); bindingSourceCopy = ibs; InitControls(); }