public object Clone() { TableRelation obj = new TableRelation(); obj.Table1 = Table1; obj.Table2 = Table2; obj.Relation = Relation; if (JoinFields != null) { obj.JoinFields = new EPJoin[JoinFields.Length]; for (int i = 0; i < JoinFields.Length; i++) { obj.JoinFields[i] = (EPJoin)JoinFields[i].Clone(); } } return(obj); }
private void btOK_Click(object sender, System.EventArgs e) { try { bool bOK = false; EPJoin J; join = new TableRelation(); if (rdoInner.Checked) { join.Relation = enmTableRelation.INNER; } else if (radioButton1.Checked) { join.Relation = enmTableRelation.LEFT; } else { //no join join = new TableRelation(); join.Relation = enmTableRelation.NONE; join.Table2 = lblTable.Text; this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); return; } string s; EPField fld = null; TableAlias tbl; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { bOK = false; J = new EPJoin(); s = ds.Tables[0].Rows[i][0].ToString(); if (s.Length > 0) { if (srcType == enumRecSource.Table) { fld = newTable.FindField(s); } else if (srcType == enumRecSource.View) { fld = newView.FindField(s); } if (fld != null) { J.field2 = (EPField)fld.Clone(); J.field2.FromTableName = lblTable.Text; s = ds.Tables[0].Rows[i][1].ToString(); tbl = parser.query.T[s]; if (tbl != null) { s = ds.Tables[0].Rows[i][2].ToString(); J.field1 = tbl.FindField(s); if (J.field1 != null) { J.field1.FromTableName = tbl.TableName; join.AddJoin(J); bOK = true; } } } } if (!bOK) { break; } } if (!bOK) { MessageBox.Show(this, Resource1.addT3, this.Text, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop); } else if (join.FieldCount <= 0) { MessageBox.Show(this, Resource1.addT4, this.Text, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop); } else { this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } } catch (Exception er) { MessageBox.Show(this, er.Message, this.Text, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop); } }