private void LoadGrid() { string ObjectText = string.Empty; int EmptyCount = 0; if (cbProject.Text == "") { return; } dgvMain.Rows.Clear(); using (DataStuff sn = new DataStuff()) { DataTable dt = sn.GetProjectObjects(cbProject.Text); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { if (!string.IsNullOrEmpty(row["DBObjectName"].ToString())) { ObjectText = ""; ObjectText = LoadHelpText(row["DBName"].ToString(), row["DBObjectName"].ToString()); if (ObjectText.Trim() == "") { EmptyCount++; } dgvMain.Rows.Add(row["ProjectID"].ToString(), row["ProjectName"].ToString(), row["DBName"].ToString(), row["DBObjectName"].ToString(), ObjectText, row["ProjectObjectID"].ToString()); } } } } cmdBackup.Enabled = true; if (EmptyCount > 0) { MessageBox.Show(EmptyCount.ToString() + " objects do not have valid object text. Please make sure that you are backing up from the correct server.", "Project Backup", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private string GetProjectFilter() { string ObjName = string.Empty; string DBName = string.Empty; string ObjectList = string.Empty; using (DataStuff sn = new DataStuff()) { DataTable dt = sn.GetProjectObjects(PoPFilter); if (dt.Rows.Count > 0) { { foreach (DataRow row in dt.Rows) { DBName = row["DBName"].ToString(); if (DBName.Trim() == cbDatabaseName.Text.Trim()) { ObjName = row["DBObjectName"].ToString(); if (ObjectList.Trim() == "") { ObjectList = "'" + ObjName + "'"; } else { ObjectList = ObjectList + ", '" + ObjName + "'"; } } } } } } return(ObjectList); }