private void CreateObjectSpace_Click(object sender, System.EventArgs e) { bool isCSharp = (this.Language.SelectedIndex == 0); Provider provider = (Provider)DBType.SelectedIndex; string objectspace = Global.GetObjectSpace(this.Namespace.Text, isCSharp, this.ConnectString.Text, provider.ToString(), this.DateTimeStamp.Checked); string fileName = TextForm.Show("Manager" + (isCSharp ? ".cs" : ".vb"), objectspace); if (fileName.Length > 0) { SaveFile(fileName, objectspace); } }
private void createClass(int row, string dateTimeValue) { if (this.Namespace.Text.Length == 0) { throw new ArgumentException("ORHelper: Namespace was Empty"); } string destFile = String.Empty; bool isCSharp = (this.Language.SelectedIndex == 0); while (this.Mappings[row, 0].ToString().Length == 0) { row--; } string classFile = this.Mappings[row, 2].ToString() + (isCSharp ? ".cs" : ".vb"); string classCode = Global.GetClassCode((DataTable)this.Mappings.DataSource, this.Namespace.Text, this.Prefix.Text, isCSharp, row, this.Helper.Checked, this.Events.Checked, this.Relationships.Checked, ConnectionString(), dateTimeValue, this.DateTimeStamp.Checked, this.EscapeKeywords.Checked, !this.LazyLoad.Checked); if (destDirectory.Length == 0) { destFile = TextForm.Show(classFile, classCode); if (destFile.Length > 0) { destDirectory = Path.GetDirectoryName(destFile) + @"\"; } } else { destFile = destDirectory + classFile; } if (destFile.Length > 0) { SaveFile(destFile, classCode); } }
private void CreateMappings_Click(object sender, System.EventArgs e) { string connectString = ConnectionString(); if (connectString.Length == 0) { throw new ArgumentException("ORHelper: Connection String was Empty"); } if (this.Namespace.Text.Length == 0) { throw new ArgumentException("ORHelper: Namespace was Empty"); } string mappings = Global.GetMappings((DataTable)this.Mappings.DataSource, this.Namespace.Text, this.Prefix.Text, connectString, this.Relationships.Checked, registryAppKey, true, this.DataTypes.Checked, !this.LazyLoad.Checked, this.DateTimeStamp.Checked); string fileName = TextForm.Show("Mappings.config", mappings); if (fileName.Length > 0) { SaveFile(fileName, mappings); } }
private void CreateMapping_Click(object sender, System.EventArgs e) { string connectString = ConnectionString(); int startrow = this.Mappings.CurrentRowIndex; while (this.Mappings[startrow, 0].ToString().Length == 0) { startrow--; } int endrow = startrow; while (this.Mappings[endrow + 1, 0].ToString().Length == 0) { endrow++; if (endrow >= (this.Mappings.DataSource as DataTable).Rows.Count - 1) { break; } } DataTable currentclass = new DataTable(); DataTable tables = (DataTable)this.Mappings.DataSource; foreach (DataColumn column in tables.Columns) { currentclass.Columns.Add(new DataColumn(column.ColumnName, column.DataType)); } for (int x = startrow; x <= endrow; x++) { DataRow dr = currentclass.NewRow(); for (int index = 0; index < tables.Columns.Count; index++) { dr[index] = tables.Rows[x][index]; } currentclass.Rows.Add(dr); } if (connectString.Length == 0) { throw new ArgumentException("ORHelper: Connection String was Empty"); } if (this.Namespace.Text.Length == 0) { throw new ArgumentException("ORHelper: Namespace was Empty"); } string mappings = Global.GetMappings(currentclass, this.Namespace.Text, this.Prefix.Text, connectString, this.Relationships.Checked, registryAppKey, false, this.DataTypes.Checked, !this.LazyLoad.Checked, this.DateTimeStamp.Checked); string fileName = TextForm.Show("Mappings.config", mappings); if (fileName.Length > 0) { SaveFile(fileName, mappings); } }