Ejemplo n.º 1
0
        public ForecastCostSheet(bool HideWorkOrderButton = false, bool IsPrevious = false, string CompanyID = "", string NetworkID = "")
        {
            InitializeComponent();

            try
            {
                sCompanyID = CompanyID;
                sNetworkID = NetworkID;

                sqlServer = new ServiceCallDataElements.SQLServer();


                bIsLoading = true;

                if (HideWorkOrderButton)
                {
                    WorkOrder_barButtonItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                }

                if (IsPrevious)
                {
                    PrevRevision_barButtonItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                }

                myForecast = new ForecastSheet();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                bIsLoading = false;
            }
        }
Ejemplo n.º 2
0
        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();
                }
            }
        }