Пример #1
0
        private void buttoneRBill_Click(object sender, EventArgs e)
        {
            dataGridViewCurrentShipment.Focus();

            if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolViewShipment", true))
            {
                return;
            }

            if (dataGridViewCurrentShipment.SelectedRows.Count < 1)
            {
                MessageBox.Show("Please select a Shipment to tramsmit", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString();
            string status = dataGridViewCurrentShipment.SelectedRows[0].Cells[3].Value.ToString();

            if (status.ToLower() != "s")
            {
                MessageBox.Show("Only Shipments marked as Shipped please", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (sol_Shipment_Sp == null)
            {
                sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }
            sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RBillNumber);
            if (sol_Shipment == null)
            {
                MessageBox.Show(String.Format("Invalid RBill Number: {0}, please verify it!", RBillNumber), "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (sol_Shipment.ERBillTransmitted)
            {
                //MessageBox.Show("Shipment already transmitted!");
                //return;
                DialogResult result = MessageBox.Show("This R-Bill has already been submitted.  Are you sure you want to send it again?", "", MessageBoxButtons.YesNoCancel);    //.YesNo);
                if (result != System.Windows.Forms.DialogResult.Yes)
                {
                    return;
                }
            }

            if (sol_Agencie_Sp == null)
            {
                sol_Agencie_Sp = new Sol_Agencie_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }
            sol_Agencie = sol_Agencie_Sp.Select(sol_Shipment.AgencyID);
            if (sol_Agencie.Name.ToLower().Trim() != "abcrc")
            {
                MessageBox.Show("Shipment's agency is not ABCRC!");
                return;
            }

            ShippingShipments.eRBill(sol_Shipment, sol_Shipment_Sp);
        }
Пример #2
0
        private void buttonParse_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBoxInput.Text))
            {
                MessageBox.Show("Nothing to parse! TextBox empty.");
                return;
            }

            // Display the ProgressBar control.
            progressBar1.Visible = true;
            // Set Minimum to 1 to represent the first file being copied.
            progressBar1.Minimum = 1;
            // Set the initial value of the ProgressBar.
            progressBar1.Value = 1;
            // Set the Step property to a value of 1 to represent each file being copied.
            progressBar1.Step = 1;


            string[] tags       = textBoxInput.Text.Split('\n');
            string   strBadTags = "";

            //badTags = new string[tags.GetLength(0)];
            // Set Maximum to the total number of files to copy.
            progressBar1.Maximum = tags.GetLength(0);
            bool flagAdded = false;

            foreach (string ren in tags)
            {
                // Perform the increment on the ProgressBar.
                progressBar1.PerformStep();
                string renx = ren.Trim();
                if (String.IsNullOrEmpty(renx))
                {
                    continue;
                }

                int ps = renx.LastIndexOf(',');
                if (ps < 0)
                {
                    ps = -1;
                }
                string tagNumber = renx.Substring(ps + 1);
                if (String.IsNullOrEmpty(tagNumber))
                {
                    continue;
                }

                //was a barcode read?
                //string x = tagNumber;
                //if (x.Length > 7)
                //{
                //    x = x.Substring(x.Length - 7);
                //    int intValue = 0;
                //    Int32.TryParse(x, out intValue);
                //    if (intValue > 0)
                //        tagNumber = String.Format("{0}", intValue);
                //    else
                //        continue;

                //}

                ps        = 0;
                sol_Stage = sol_Stage_Sp._SelectByTagNumberStatus(tagNumber, "I");
                if (
                    //SearchStagedContainerOnShipment(tagNumber) ||
                    sol_Stage == null)
                {
                    //badTags[ps++] = tagNumber + " - Tag number does not exist or already in shipment\n";
                    strBadTags += tagNumber + " - Tag number does not exist or already in shipment" + Environment.NewLine;

                    continue;
                }
                //switch containers
                ShippingShipments.SwitchContainers(
                    ref ShippingShipments.listViewCurrentStagedContainers,
                    ref ShippingShipments.listViewContainersOnShipment, sol_Stage.TagNumber, true, null);

                flagAdded = true;
            }

            // Perform the increment on the ProgressBar.
            progressBar1.Value = progressBar1.Maximum;


            //tags not processed
            if (!String.IsNullOrEmpty(strBadTags))
            {
                SirLib.CajaDeMensaje.Show("Tags not processed", "Error parsing tags numbers.", strBadTags, SirLib.CajaDeMensajeImagen.Error);
            }

            string men = "Done!";

            if (flagAdded)
            {
                if (String.IsNullOrEmpty(strBadTags))
                {
                    men += " - All tags added.";
                }
                else
                {
                    men += " - With some tags not added.";
                }
            }
            else
            {
                men += " - Nothing added";
            }


            MessageBox.Show(men);
            // Set the Step property to a value of 1 to represent each file being copied.
            progressBar1.Value = 1;
            textBoxInput.Text  = "";
        }
Пример #3
0
        private void buttonPrintRBill_Click(object sender, EventArgs e)
        {
            dataGridViewCurrentShipment.Focus();

            if (dataGridViewCurrentShipment.SelectedRows.Count < 1)
            {
                MessageBox.Show("Please select a Shipment to print", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString();
            string status        = dataGridViewCurrentShipment.SelectedRows[0].Cells[3].Value.ToString();
            string strShipmentId = dataGridViewCurrentShipment.SelectedRows[0].Cells[5].Value.ToString();
            string agencyName    = dataGridViewCurrentShipment.SelectedRows[0].Cells[1].Value.ToString();
            string rBillDate     = dataGridViewCurrentShipment.SelectedRows[0].Cells[2].Value.ToString();

            if (status != "S")
            {
                MessageBox.Show("Only shipped Shipments can be printed.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            this.Cursor = Cursors.WaitCursor;

            if (agencyName.Trim().ToLower() == "abcrc")
            {
                int shipmentId = 0;
                Int32.TryParse(strShipmentId, out shipmentId);

                if (sol_Shipment_Sp == null)
                {
                    sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString);
                }
                sol_Shipment = sol_Shipment_Sp.Select(shipmentId);

                if (sol_WS_Carrier_Sp == null)
                {
                    sol_WS_Carrier_Sp = new Sol_WS_Carrier_Sp(Properties.Settings.Default.WsirDbConnectionString);
                }
                sol_WS_Carrier = sol_WS_Carrier_Sp.Select(sol_Shipment.CarrierID);
                if (sol_WS_Carrier == null)
                {
                    sol_WS_Carrier           = new Sol_WS_Carrier();
                    sol_WS_Carrier.CarrierID = 0;
                    sol_WS_Carrier.Carrier   = String.Empty;
                }

                ShippingShipments.UpdateDataSetBol2(shipmentId, RBillNumber);

                ShippingShipments.PrintBol2(
                    shipmentId,
                    RBillNumber,
                    sol_Shipment.ShippedDate.ToString(),
                    sol_WS_Carrier.Carrier,
                    sol_Shipment.TrailerNumber,
                    sol_Shipment.ProBillNumber
                    );
            }
            else
            {
                ShippingShipments.PrintRBill(strShipmentId);
            }

            this.Cursor = Cursors.Default;
        }