private void extractERDDiagram(string path) { string message = string.Empty; if (string.IsNullOrEmpty(path)) { MessageBox.Show("Must select an image file", "Select File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string extension = Path.GetExtension(path); //Parsing From Image if (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".bmp" || extension == ".vdx") { using (FileOperationManager fop = new FileOperationManager(grdColumns, project, table)) { entities = fop.extractERDDiagram(path, out message); loadTableDropDownList(); } } else { MessageBox.Show("File format invalid!", "Select File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
public MainWindow() { InitializeComponent(); Log.Info("UI initialized."); Current = 0; _operationMan = new FileOperationManager(); Log.Info("File Operation Manager initialized."); Parallel.Invoke(() => { viewModelSync.LoadPlaylists(); Log.Info("Playlists loaded."); viewModelSync.LoadDrives(viewModelSync.ShowAllDrives); Log.Info("Drives loaded. " + viewModelSync.Drives.Count + " drives found."); }); this.DataContext = viewModelSync; this.pnlProgress.DataContext = viewModelCopy; _operationMan.JobStarting += new EventHandler<LibQdownloader.Threading.JobEventArgs<FileOperation>>(copyMan_JobStarting); _operationMan.WorkCompleted += new EventHandler(copyMan_WorkCompleted); this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing); }
private void cmdGenerate_Click(object sender, EventArgs e) { try { string message = string.Empty; if (!valid(out message)) { MessageBox.Show(message, "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Question); return; } table = txtTableName.Text.Trim(); project = txtProjectLocation.Text.Trim(); connectionString = string.Format("data source={0};database={1};Integrated Security=false;user id={2};password={3};", txtDatabaseServer.Text.Trim(), txtDatabaseName.Text.Trim(), txtDatabaseUser.Text.Trim(), txtDatabasePassword.Text.Trim()); cmdGenerate.Enabled = false; cmdClear.Enabled = false; cmdExit.Enabled = false; //SqlConnection con = new SqlConnection("Persist Security Info=False;User ID=CGUser; Password=AITAgradut123; Initial Catalog=CodeGenerator;Data Source=AGRADUT3\\SQLEXPRESS"); //SqlCommand cmd = new SqlCommand(); //cmd.CommandType = CommandType.Text; //cmd.CommandText = "INSERT INTO [GenerateLog] VALUES ('" + frmLogin.userName + "', '" + Environment.MachineName + "', '" + DateTime.Now + "', '" + project + "', '" + txtConnectionString.Text.Trim() + "', '" + table + "')"; //cmd.Connection = con; //con.Open(); //int res = cmd.ExecuteNonQuery(); //con.Close(); if (1 == 1) //(res > 0) { using (DBOperationManager dbop = new DBOperationManager(connectionString, grdColumns, table)) { if (chkTable.Checked) { txtLog.Text += "\n\n" + "Creating Table ......" + "\n\n"; if (dbop.createTable(out message)) { txtLog.Text += "\n\n" + "Table Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Table." + "\n\n" + message; } } if (chkSp.Checked) { txtLog.Text += "\n\n" + "Creating Stored Procedures ......" + "\n\n"; if (dbop.createStoredProcedures(out message)) { txtLog.Text += "\n\n" + "Stored Procedures Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Stored Procedures." + "\n\n" + message; } } } using (FileOperationManager fop = new FileOperationManager(grdColumns, project, table)) { txtLog.Text += "\n\n" + "Creating Project Template ......" + "\n\n"; fop.createProjectTemplate(); txtLog.Text += "\n\n" + "Project Template Created Successfully ......" + "\n\n"; if (chkClasses.Checked) { txtLog.Text += "\n\n" + "Creating Property Class ......" + "\n\n"; if (fop.createPropertyClass(out message)) { txtLog.Text += "\n\n" + "Property Class Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Property Class." + "\n\n" + message; } txtLog.Text += "\n\n" + "Creating Provider Class ......" + "\n\n"; if (fop.createProviderClass(out message)) { txtLog.Text += "\n\n" + "Provider Class Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Provider Class." + "\n\n" + message; } txtLog.Text += "\n\n" + "Creating Manager Class ......" + "\n\n"; if (fop.createManagerClass(out message)) { txtLog.Text += "\n\n" + "Manager Class Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Manager Class." + "\n\n" + message; } } if (chkAdminPages.Checked) { txtLog.Text += "\n\n" + "Creating Admin View Page ......" + "\n\n"; if (fop.createAdminViewPage(out message)) { txtLog.Text += "\n\n" + "Admin View Page Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Admin View Page." + "\n\n" + message; } txtLog.Text += "\n\n" + "Creating Admin View Code Behind Class ......" + "\n\n"; if (fop.createAdminViewCodeBehindPage(out message)) { txtLog.Text += "\n\n" + "Admin View Code Behind Class Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Admin View Code Behind Class." + "\n\n" + message; } txtLog.Text += "\n\n" + "Creating Admin Insert Update Page ......" + "\n\n"; if (fop.createAdminInsertUpdatePage(out message)) { txtLog.Text += "\n\n" + "Admin Insert Update Page Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Admin Insert Update Page." + "\n\n" + message; } txtLog.Text += "\n\n" + "Creating Admin Insert Update Code Behind Class ......" + "\n\n"; if (fop.createAdminInsertUpdateCodeBehind(out message)) { txtLog.Text += "\n\n" + "Admin Insert Update Code Behind Class Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating Admin Insert Update Code Behind Class." + "\n\n" + message; } } if (chkVPages.Checked) { txtLog.Text += "\n\n" + "Creating View Page ......" + "\n\n"; if (fop.createViewPage(out message)) { txtLog.Text += "\n\n" + "View Page Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating View Page." + "\n\n" + message; } txtLog.Text += "\n\n" + "Creating View Page Code Behind Class ......" + "\n\n"; if (fop.createViewCodeBehindPage(out message)) { txtLog.Text += "\n\n" + "View Page Code Behind Class Created Successfully." + "\n\n"; } else { txtLog.Text += "\n\n" + "Error Creating View Page Code Behind Class." + "\n\n" + message; } } } MessageBox.Show("Process Completed. Please check the log for details.", "Process Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); cmdGenerate.Enabled = true; cmdClear.Enabled = true; cmdExit.Enabled = true; } } catch (Exception Ex) { ErrorManager errL = new ErrorManager(); errL.WriteError("", Ex.Message.ToString(), Ex.Source.ToString(), Ex.StackTrace.ToString()); txtLog.Text += "\n\n" + Ex.Message + "\n\n"; //if (con.State != ConnectionState.Closed) // con.Close(); } }