private void ImageGroupGrid_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridView dgv = (DataGridView)sender; if (dgv.Columns[e.ColumnIndex].Name != "Delete") { return; } if (!allowUpdates) { PicesSipperVariables.UpdatesNotAllowed("Group Maintenance"); return; } if (e.RowIndex < 0) { return; } PicesDataBaseImageGroup ig = dbConn.ImageGroupLoad((String)dgv.Rows[e.RowIndex].Cells[1].Value); if (ig == null) { return; } DialogResult dr = MessageBox.Show(this, "Are you sure you want to delete this group ?", "Delete " + ig.Name, MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { dbConn.ImageGroupDelete(ig.ImageGroupId); LoadGroups(); } }
private void PerformUpdate() { if (!allowUpdates) { PicesSipperVariables.UpdatesNotAllowed("Deployment Dialog"); return; } PopulateDeploymentFromScreen(); if (addingNewDeployment) { DbConn().SipperDeploymentInsert(deployment); } else if (deletingDeployment) { DbConn().SipperDeploymentDelete(deployment.CruiseName, deployment.StationName, deployment.DeploymentNum); if (DbConn().Valid()) { deploymentDeleted = true; } } else { DbConn().SipperDeploymentUpdate(deployment); } if (!DbConn().LastOpSuccessful) { MessageBox.Show(this, "Update operation failed.\n\n" + DbConn().LastErrorDesc(), "Update MySQL Server", MessageBoxButtons.OK); } }
} /* ValidateAllFields */ private void PerformUpdate() { if (!allowUpdates) { PicesSipperVariables.UpdatesNotAllowed("Sipper File Dialog"); return; } UpdateFromScreen(); if (addMode) { DbConn().SipperFileInsert(sipperFile); } else { DbConn().SipperFileUpdate(sipperFile); } if (DbConn().Valid()) { Close(); } else { MessageBox.Show(this, "Update of database failed.\n\n" + DbConn().LastErrorDesc(), "Update Failed", MessageBoxButtons.OK); } }
private void PerformUpdate() { if (!allowUpdates) { PicesSipperVariables.UpdatesNotAllowed("Cruise Dialog"); return; } cruise.CruiseName = CruiseName.Text; cruise.ShipName = ShipName.Text; cruise.Description = Description.Text; cruise.DateStart = DateStart.Value; cruise.DateEnd = DateEnd.Value; cruise.Location = CruiseLocation.Text; cruise.Objective = Objective.Text; cruise.Principal = Principal.Text; cruise.ResearchOrg = ResearchOrg.Text; if (addingNewCruise) { DbConn().SipperCruiseInsert(cruise); } else if (deletingCruise) { DbConn().SipperCruiseDelete(CruiseName.Text); } else { DbConn().SipperCruiseUpdate(cruise); } if (DbConn().Valid()) { if (deletingCruise) { cruiseDeleted = true; } if (addingNewCruise) { cruiseAdded = true; } Close(); } else { MessageBox.Show(DbConn().LastErrorDesc(), "Update Failed"); } } /* PerformUpdate */
} /* AddSipperFiles */ private void AddSipperFileButton_Click(object sender, EventArgs e) { if (!allowUpdates) { PicesSipperVariables.UpdatesNotAllowed("Deployment Dialog"); return; } OpenFileDialog ofd = new OpenFileDialog(); ofd.DefaultExt = "*.spr"; ofd.Filter = "SIPPER Files (*.spr)|*.spr|Larcos Files (*.lsc)|*.lsc"; ofd.FilterIndex = 1; ofd.InitialDirectory = lastSipperFileDir; ofd.Multiselect = true; ofd.Title = "Select SIPPER Files to Add"; DialogResult dr = ofd.ShowDialog(this); if (dr == DialogResult.OK) { AddSipperFiles(ofd.FileNames); } }
private void UpdateButton_Click(object sender, EventArgs e) { if (!allowUpdates) { PicesSipperVariables.UpdatesNotAllowed("Deployment Dialog"); return; } if (deletingDeployment) { if (SipperFiles.Nodes.Count > 0) { MessageBox.Show(this, "Can not delete deployment while there are Sipper files attached.", "Delete a Deployment", MessageBoxButtons.OK); return; } else { PerformUpdate(); Close(); } } else { if (!ChangesMade()) { MessageBox.Show("No changes have been made", "Update"); return; } ValidateAllFields(); if (!validationErrorsFound) { PerformUpdate(); Close(); } } }