コード例 #1
0
ファイル: TextForm.cs プロジェクト: tomtangrx/wilsonormapper
        public static string Show(string fileName, string textFile)
        {
            TextForm form = new TextForm();

            form.Text          = fileName;
            form.TextFile.Text = textFile;
            form.ShowDialog();
            return(finalFileName);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: tomtangrx/wilsonormapper
        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);
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: tomtangrx/wilsonormapper
        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);
            }
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: tomtangrx/wilsonormapper
        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);
            }
        }
コード例 #5
0
ファイル: TextForm.cs プロジェクト: cnporras/wilsonormapper
		public static string Show(string fileName, string textFile) {
			TextForm form = new TextForm();
			form.Text = fileName;
			form.TextFile.Text = textFile;
			form.ShowDialog();
			return finalFileName;
		}
コード例 #6
0
ファイル: MainForm.cs プロジェクト: tomtangrx/wilsonormapper
        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);
            }
        }