示例#1
0
        private int ShipoutRtv(string rtvShipper, int shipper, string location)
        {
            string error;

            // Make sure a connection to the Honduras EEH database can be established
            int?objectCount;

            _controller.CheckHondurasConnection(out objectCount, out error);
            if (!objectCount.HasValue || objectCount < 1)
            {
                Cursor.Current    = Cursors.Default;
                _messages.Message = "Failed to connect to the Honduras database.  Nothing was processed.  Please try again.";
                _messages.ShowDialog();
                return(0);
            }

            // Ship out the RTV shipper
            bool previouslyShipped;

            _controller.ShipRtvHondurasRma(_operatorCode, shipper, location, out previouslyShipped, out error);
            if (error != "")
            {
                Cursor.Current    = Cursors.Default;
                _messages.Message = error;
                _messages.ShowDialog();
                return(0);
            }

            // Shipout RTV succeeded
            string successMessage = (previouslyShipped)
                ? ""
                : string.Format("Successfully shipped out RTV {0}.", rtvShipper);


            // Create the Honduras RMA
            _controller.CreateHondurasRma(_operatorCode, shipper, location, out error);
            if (error != "")
            {
                if (!previouslyShipped)
                {
                    Cursor.Current    = Cursors.Default;
                    _messages.Message = successMessage;  // Show that the RTV shipout succeeded
                    _messages.ShowDialog();
                }

                Cursor.Current    = Cursors.Default;
                _messages.Message = string.Format("Failed to create Honduras RMA.  You'll need to click the Shipout RTV button again for this shipper.  {0}", error);
                _messages.ShowDialog();

                // Record the error returned from the Honduras RMA procedure
                string nextError;
                _controller.RecordHondurasRmaException(_operatorCode, error, out nextError);

                return(0);
            }

            // Honduras RMA succeeded
            if (previouslyShipped)
            {
                successMessage += "Successfully created the Honduras RMA.";
            }
            else
            {
                successMessage += "  And created the Honduras RMA.";
            }

            _messages.Message = successMessage;
            _messages.ShowDialog();

            // Refresh the shippers list grid
            dgvNewShippers.DataSource = null;
            dgvNewShippers.DataSource = _controller.NewShippersList;

            linkLblClose.Visible = false;
            return(1);
        }
        private int ShipoutRtv(string rtvShipper, int shipper, string location)
        {
            string error;

            // Make sure a connection to the Honduras EEH database can be established
            int?objectCount;

            _controller.CheckHondurasConnection(out objectCount, out error);
            if (!objectCount.HasValue || objectCount < 1)
            {
                Cursor.Current    = Cursors.Default;
                _messages.Message = "Failed to connect to the Honduras database.  Nothing was processed.  Please try again.";
                _messages.ShowDialog();
                return(0);
            }



            // Ship out the RTV shipper
            bool previouslyShipped;

            _controller.ShipRtvHondurasRma(_operatorCode, shipper, location, out previouslyShipped, out error);
            if (error != "")
            {
                Cursor.Current    = Cursors.Default;
                _messages.Message = error;
                _messages.ShowDialog();
                return(0);
            }

            // Shipout RTV succeeded
            string successMessage = (previouslyShipped)
                ? ""
                : string.Format("Successfully shipped out RTV {0}.", rtvShipper);


            // Create the Honduras RMA
            _controller.CreateHondurasRma(_operatorCode, shipper, location, out error);
            if (error != "")
            {
                if (!previouslyShipped)
                {
                    Cursor.Current    = Cursors.Default;
                    _messages.Message = successMessage;  // Show that the RTV shipout succeeded
                    _messages.ShowDialog();
                }

                Cursor.Current    = Cursors.Default;
                _messages.Message = "FAILED to create the Honduras RMA!  Click the Shipout RTV button again for this shipper to complete the RMA.";
                _messages.ShowDialog();
                return(0);
            }

            // Honduras RMA succeeded
            if (previouslyShipped)
            {
                successMessage += "Successfully created the Honduras RMA.";
            }
            else
            {
                successMessage += "  AND created the Honduras RMA.";
            }

            _messages.Message = successMessage;
            _messages.ShowDialog();
            return(1);
        }