private void PrevRevision_barButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { PreviousRevision_Frm frm = new PreviousRevision_Frm(); ServiceCallDataElements.SQLServer sqlServer = null; string sCommandText = ""; string sPrevCostSheetID = ""; string sMessage = ""; NotificationFrm notification = null; try { sCommandText = "SELECT TOP 1 CostSheetID from Reporting.ForecastCostsheets WHERE WorkorderID = '" + myForecast.WorkOrderID + "' AND AddedOn < '" + myForecast.AddedOn + "' Order By Addedon DESC"; sqlServer = new ServiceCallDataElements.SQLServer(); sqlServer.ConnectionString = sConnectionString; sPrevCostSheetID = sqlServer.GetStringValue(sCommandText); if (sPrevCostSheetID != "") { frm.OpenPrevCostSheet(myForecast.WorkOrderID, myForecast.ConnectionString, myForecast.AddedBy, sPrevCostSheetID); frm.Show(); } else { // Display Notification there are no previous cost sheets to show! sMessage = "There are no previous cost sheets to show!"; notification = new NotificationFrm(); notification.Display(sMessage, "Work Order Adjusted", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); if (notification.ShowDialog() == DialogResult.OK) { notification.Hide(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (notification != null) { notification.Dispose(); } } }
private void IsAdjusted(string WorkOrderID) { string sCommandText = ""; string sMessage = ""; NotificationFrm notification = null; try { sCommandText = "SELECT Top 1 Adjusted FROM Reporting.forecastcostsheets WHERE WorkOrderID = '" + WorkOrderID + "' ORDER BY AddedOn DESC"; if (sqlServer.GetBooleanValue(sCommandText)) { // Display notification if the work order has been adjusted sMessage = "This work order has been adjusted! The Cost sheet will display work order data even if there are past cost sheets!"; notification = new NotificationFrm(); notification.Display(sMessage, "Work Order Adjusted", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); if (notification.ShowDialog() == DialogResult.OK) { notification.Hide(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (notification != null) { notification.Dispose(); } } }