private DataRow CreateProgramRow(Project proj) { DataTable tbl = proj.GetPgms(); DataTable clone = tbl.Clone(); DataRow row = clone.NewRow(); clone.Dispose(); tbl.Dispose(); return row; }
/// <summary> /// Creates an instance of a DataRow that is cloned after the MetaPrograms table /// </summary> /// <param name="proj">Reference to the current project</param> /// <returns>DataRow</returns> protected DataRow CreatePgmRow(Project proj) { try { DataTable tbl = proj.GetPgms(); DataTable clone = tbl.Clone(); DataRow row = clone.NewRow(); clone.Dispose(); tbl.Dispose(); return row; } catch { throw new ApplicationException("You do not have a current project."); } }
private void btnFindProject_Click(object sender, System.EventArgs e) { //isu6 - does not seem to be used except in section that was causing Defect #794. //Project oldProject = currentProject; Project newProject = null; this.cmbPrograms.SelectedIndexChanged -= new System.EventHandler(this.cmbPrograms_SelectedIndexChanged); newProject = SelectProject(); if (newProject != null) { //isu6 - Defect #794 - code was setting the values of the project loaded in memory to null. //if (oldProject != null) //{ // oldProject.Dispose(); //} this.mainForm.CurrentProject = new Project(newProject.FilePath); currentProject = this.mainForm.CurrentProject; txtProject.Text = currentProject.FilePath; programs = currentProject.GetPgms(); LoadPgms(); Clear(); } }
/// <summary> /// Finds the program in MetaPrograms table and returns it in a DataRow /// </summary> /// <param name="proj">Reference to the current project</param> /// <param name="name">Name of the pgm</param> /// <returns>DataRow</returns> protected DataRow FindPgmByName(Project proj, string name) { DataRow row = null; DataTable programs = proj.GetPgms(); if (programs.Rows.Count > 0) { DataRow[] rows; rows = programs.Select("[" + ColumnNames.PGM_NAME + "] = '" + name + "'"); if (rows.GetUpperBound( 0 ) >= 0) // Existing pgm { row = rows[0]; } } return row; }