private void navSave_Click(object sender, EventArgs e) { String curMethodName = "Tournament:TourDivOrder:navSave"; String curMsg = ""; bool curReturn = true; int rowsProc = 0; try { if (TourDivDataGridView.Rows.Count > 0) { LoadDataButton.Focus(); TourDivDataGridView.EndEdit(); TourDivDataGridView.Focus(); DataGridViewRow curViewRow = TourDivDataGridView.Rows[myViewIdx]; String curUpdateStatus = (String)curViewRow.Cells["Updated"].Value; if (curUpdateStatus.ToUpper().Equals("Y")) { try { Int16 curRunOrder = 0; Int64 curPK = Convert.ToInt64((String)curViewRow.Cells["PK"].Value); try { curRunOrder = Convert.ToInt16((String)curViewRow.Cells["RunOrder"].Value); } catch { curRunOrder = 0; } StringBuilder curSqlStmt = new StringBuilder(""); curSqlStmt.Append("Update DivOrder Set "); curSqlStmt.Append("RunOrder = " + curRunOrder.ToString()); curSqlStmt.Append(", LastUpdateDate = GETDATE() "); curSqlStmt.Append("Where PK = " + curPK.ToString()); rowsProc = DataAccess.ExecuteCommand(curSqlStmt.ToString()); Log.WriteFile(curMethodName + ":Rows=" + rowsProc.ToString() + " " + curSqlStmt.ToString()); isDataModified = false; } catch (Exception excp) { curReturn = false; curMsg = "Error attempting to update information \n" + excp.Message; MessageBox.Show(curMsg); Log.WriteFile(curMethodName + curMsg); } } else { isDataModified = false; } } } catch (Exception excp) { curMsg = "Error attempting to save changes \n" + excp.Message; MessageBox.Show(curMsg); Log.WriteFile(curMethodName + curMsg); } }
void ReleaseDesignerOutlets() { if (LoadDataButton != null) { LoadDataButton.Dispose(); LoadDataButton = null; } if (ProcessDataButton != null) { ProcessDataButton.Dispose(); ProcessDataButton = null; } if (LoadedDataOutlineView != null) { LoadedDataOutlineView.Dispose(); LoadedDataOutlineView = null; } }