Ejemplo n.º 1
0
        public void loadForm(bool isDeleteMB)
        {
            shouldRemoveRow   = isDeleteMB;
            btnSaveMb.Enabled = false;
            dgvMiniBks.Rows.Clear();
            {
                var withBlock = My.MyProject.Forms.FrmEditAddBooking;
                if (isDeleteMB == false)
                {
                    tempDeletedMBDT = new List <Minibooking>(withBlock.originalMBTable);
                }

                totalContInBkg        = (int)Math.Round(withBlock.totalContainersNumericUpDown.Value);
                containerToAsn        = totalContInBkg - getTotalTempMBNumb();
                lblContInMb.Text      = withBlock.getTotalContInMB().ToString();
                lbltotalNumber.Text   = totalContInBkg.ToString();
                lblTotaltoBeAsgn.Text = containerToAsn.ToString();

                // Dim cmdtyList As List(Of VW_MinibookingCommodity) = FrmEditAddBooking.MbCmdtyList
                int NumbOfCanMb = 0;
                foreach (var mb in tempDeletedMBDT)
                {
                    // NumbOfCanMb = tempDeletedMBDT.Where(Function(m) m.MiniBookingId = mb.MiniBookingId).ToList(0).NumberOfContainer
                    dgvMiniBks.Rows.Add(withBlock.bkgNumbTextBox1.Text + MdlBookingManagement.digitToLetter(mb.MiniBookingOrder), mb.NumberOfContainer);
                }
            }
        }
Ejemplo n.º 2
0
        public void loadForm(bool isDeleteMU)
        {
            numbTotalBefore     = 0m;
            shouldRemoveRow     = isDeleteMU;
            btnUpdateMu.Enabled = false;
            dgvMiniUnits.Rows.Clear();
            string cmdtyCode;
            string gradeCode;
            string custName;
            {
                var withBlock = My.MyProject.Forms.FrmEditAddRailList;
                if (isDeleteMU == false)
                {
                    tempDt = withBlock.miniUnitDT;
                }
                else
                {
                    tempDt = tempDeletedMUDT;
                }
                // Populate dgv
                string totalbStr;
                foreach (var mu in tempDt)
                {
                    if (withBlock.cboCargoType.Text.Equals("BULK"))
                    {
                        mu.TotalBilled = Convert.ToDecimal(mu.TotalBilled);
                    }
                    // totalbStr = FormatNumber(mu.TotalBilled.ToString, 3)
                    else
                    {
                        mu.TotalBilled = Convert.ToInt32(mu.TotalBilled);
                        // totalbStr = FormatNumber(mu.TotalBilled.ToString, 0)
                    }

                    cmdtyCode = CommodityService.GetById(mu.CommodityId).CommodityCode;
                    gradeCode = GradeService.GetById(mu.GradeId).GradeCode;
                    custName  = CompanyService.GetVWById(mu.CustomerId).CompanyName;
                    dgvMiniUnits.Rows.Add(withBlock.txtUnitNumber.Text + "(" + MdlBookingManagement.digitToLetter((object)mu.MiniUnitOrder).ToUpper() + ")", custName, cmdtyCode + " " + gradeCode, (object)mu.TotalBilled);
                    numbTotalBefore = (decimal)(numbTotalBefore + mu.TotalBilled);
                }

                // Set texts.
                if (withBlock.cboCargoType.Text.Equals("BULK"))
                {
                    labelTotalSomething.Text = "Total Weight:";
                    lbltotalNumber.Text      = withBlock.nudTotalBilledWeight.Value.ToString("0.###");
                    numbToReassign           = withBlock.nudTotalBilledWeight.Value - numbTotalBefore;
                    lblTotaltoBeAsgn.Text    = numbToReassign.ToString("0.###");
                    nucTotal.DecimalPlaces   = 3;
                }
                else
                {
                    labelTotalSomething.Text = "Total Pieces:";
                    lbltotalNumber.Text      = withBlock.nudTotalBilledWeight.Value.ToString("#");
                    numbToReassign           = withBlock.nudTotalBilledWeight.Value - numbTotalBefore;
                    lblTotaltoBeAsgn.Text    = numbToReassign.ToString("#");
                    nucTotal.DecimalPlaces   = 0;
                }
            }
        }
Ejemplo n.º 3
0
        private void dgvBookings_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            var ServiceCodeCel   = dgvBookings.Rows[e.RowIndex].Cells["ServiceCode"];
            var BookingNumberCel = dgvBookings.Rows[e.RowIndex].Cells["MinibookingNumber"];
            var checkCell        = dgvBookings.Rows[e.RowIndex].Cells["check"];
            var cans             = dgvBookings.Rows[e.RowIndex].Cells["NumberOfContainer"];

            checkCell.Style.Font               = new Font("Arial", 15.5f, FontStyle.Bold);
            checkCell.Style.ForeColor          = Color.Black;
            checkCell.Style.SelectionForeColor = Color.Black;
            if (MdlBookingManagement.IsOdd(e.RowIndex))
            {
                checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control);
            }
            else
            {
                checkCell.Style.SelectionBackColor = Color.White;
            }

            checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            if (Information.IsNothing(checkCell.Value))
            {
                checkCell.Value = "✔";
            }
            BookingNumberCel.Style.Font      = new Font("Arial", 10f, FontStyle.Bold);
            BookingNumberCel.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            cans.Style.Font                         = new Font("Arial", 10f, FontStyle.Bold);
            cans.Style.Alignment                    = DataGridViewContentAlignment.MiddleCenter;
            ServiceCodeCel.Style.ForeColor          = Color.White;
            ServiceCodeCel.Style.SelectionForeColor = Color.White;
            ServiceCodeCel.Style.Font               = new Font("Arial", 10f, FontStyle.Bold);
            ServiceCodeCel.Style.Alignment          = DataGridViewContentAlignment.MiddleCenter;

            // REPO Color.Thistle
            // EXPORT Color.PowderBlue
            switch (ServiceCodeCel.Value)
            {
            case "BAG":
            {
                ServiceCodeCel.Style.SelectionBackColor = Color.Olive;
                ServiceCodeCel.Style.BackColor          = Color.DarkKhaki;
                break;
            }

            case "BGR":
            {
                ServiceCodeCel.Style.SelectionBackColor = Color.DarkGoldenrod;
                ServiceCodeCel.Style.BackColor          = Color.Goldenrod;
                break;
            }

            case "BLK":
            {
                ServiceCodeCel.Style.SelectionBackColor = Color.DarkKhaki;
                ServiceCodeCel.Style.BackColor          = Color.DarkSeaGreen;
                break;
            }
            }
        }
Ejemplo n.º 4
0
        private void btnAsnToMb_Click(object sender, EventArgs e)
        {
            int    mbtempId = 0;
            string mbNumb;
            string letter;

            mbNumb = Conversions.ToString(cboMinibooking.SelectedItem);
            for (int i = dgvCansToTransfer.RowCount - 1; i >= 0; i -= 1)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvCansToTransfer.Rows[i].Cells[1].Value, true, false)))
                {
                    tempSelectedCans.RemoveAt(i);
                    letter   = mbNumb.Split('(')[1].Replace(")", "");
                    mbtempId = MdlBookingManagement.letterToDigit(letter) - 1;
                    dgvCansAsnMb.Rows.Add(dgvCansToTransfer.Rows[i].Cells[0].Value, false, dgvCansToTransfer.Rows[i].Cells[2].Value, mbNumb, mbtempId);
                }
            }

            updateGgvCansToTransfer();
        }
Ejemplo n.º 5
0
        private void dgvVessel_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            var checkCell = dgvVessel.Rows[e.RowIndex].Cells["check"];

            checkCell.Style.Font               = new Font("Arial", 15.5f, FontStyle.Bold);
            checkCell.Style.ForeColor          = Color.Black;
            checkCell.Style.SelectionForeColor = Color.Black;
            if (MdlBookingManagement.IsOdd(e.RowIndex))
            {
                checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control);
            }
            else
            {
                checkCell.Style.SelectionBackColor = Color.White;
            }

            checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            if (Information.IsNothing(checkCell.Value))
            {
                checkCell.Value = "   ";
            }
        }
Ejemplo n.º 6
0
        private void checkUnit()
        {
            PictureBox1.Hide();
            var fBold   = new Font("Segoe UI", 11f, FontStyle.Bold);
            var fNormal = new Font("Segoe UI", 11f, FontStyle.Regular);

            if (dontAsnRadioButton.Checked)
            {
                dontAsnLabel.Font       = fBold;
                chageUnitCustLabel.Font = fNormal;
                warningLabel.Text       = "";
                openFormLinkLabel.Text  = "";
                saveButton.Enabled      = true;
            }
            else if (changeUnitCustRadioButton.Checked)
            {
                dontAsnLabel.Font       = fNormal;
                chageUnitCustLabel.Font = fBold;
                if (MdlBookingManagement.isAssignedToOthersMBs(_muID))
                {
                    PictureBox1.Show();
                    warningLabel.Text      = "This unit is already assigned to another booking so the customer can not be changed. Please " + "create a Mini Unit with the desired customer.";
                    openFormLinkLabel.Text = "Edit Unit Source";
                    PictureBox1.Image      = My.Resources.Resources.icon_not_available;
                    saveButton.Enabled     = false;
                }
                else
                {
                    PictureBox1.Show();
                    warningLabel.Text      = "Able to change Customer Name";
                    openFormLinkLabel.Text = "";
                    PictureBox1.Image      = My.Resources.Resources.icon_available;
                    saveButton.Enabled     = true;
                }
            }
        }
Ejemplo n.º 7
0
        private void dgvAllBookings_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                bool value = Conversions.ToBoolean(dgvAllBookings.Rows[e.RowIndex].Cells[0].Value);
                VW_BookingMinibooking mbRow;
                VW_UnitSourceMiniUnit muRow;
                mbRow = (VW_BookingMinibooking)dgvAllBookings.Rows[e.RowIndex].DataBoundItem;
                if (value == false)
                {
                    dgvAllBookings.Rows[e.RowIndex].Cells[0].Value = true;
                    numbSelectMU = +1;
                    // selectedUnits.Add(muID, MUSource)

                    // Check if mini unit is already assigned to mini booking
                    for (int i = 0, loopTo = dgvMiniUnit.Rows.Count - 1; i <= loopTo; i++)
                    {
                        muRow = (VW_UnitSourceMiniUnit)dgvMiniUnit.Rows[i].DataBoundItem;

                        // check if mu was already assigned
                        if (Information.IsNothing(muRow.CommodityId) || muRow.CommodityId == 0)
                        {
                            var result = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Warning:", "There's no commodity added to the unit '" + muRow.MiniunitNumber + "' Yet. Would you like to add it now? " + "If No is selected, the unit will not be added to the booking", My.Resources.Resources.caution, this);
                            if (result == DialogResult.Yes)
                            {
                                My.MyProject.Forms.FrmEditAddRailList.isNewRecord = false;
                                var unit     = UnitSourceService.GetVWById(muRow.UnitSourceId);
                                var unitList = new List <VW_UnitSource>();
                                unitList.Add(unit);
                                My.MyProject.Forms.FrmEditAddRailList.isMultiEdit = false;
                                My.MyProject.Forms.FrmEditAddRailList.isNewRecord = false;
                                My.MyProject.Forms.FrmEditAddRailList.LoadForm(unitList);
                                Close();
                                MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmEditAddRailList, My.MyProject.Forms.FrmParentScreen);
                            }
                            else
                            {
                                shouldNotAssignList.Add(muRow.ToString() + "|" + mbRow.MiniBookingId.ToString());
                            }
                        }
                        // If cmdty and grade doesnt exist in mb, ask if should add.

                        else if (MdlBookingManagement.miniUnitMissingCommodity(mbRow.MiniBookingId, muRow.CommodityId, muRow.GradeId))
                        {
                            var result = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Commodity and Rate doesn't match", "The commodity and grade of the unit '" + muRow.MiniunitNumber + "' (" + muRow.GradeCode + " " + muRow.CommodityCode + ") is not added to the booking '" + mbRow.BookingNumber + "'. Would you like to add it now? " + "If No is selected, the unit will not be added to the booking", My.Resources.Resources.caution, this);
                            if (result == DialogResult.Yes)
                            {
                                MdlBookingManagement.saveBkgCommodity(mbRow.MiniBookingId, muRow.CommodityId, muRow.GradeId);
                                getCmdyAndGrades(mbRow.MiniBookingId);
                                // muRow =
                                //VWUnitSourceMiniUnitBindingSource.DataSource.Item(muRow) = MiniUnitService.GetVWByMUId(muRow.MiniUnitId);
                            }
                            else
                            {
                                shouldNotAssignList.Add(muRow.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString());
                            }
                        }
                        else if (MdlBookingManagement.miniUnitAlreadyAssigned(muRow.MiniUnitId, mbRow.MiniBookingId, Conversions.ToBoolean(0)))
                        {
                            shouldNotAssignList.Add(muRow.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString());
                            My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Unit source already added to booking", "Selected Unit source is already added to the booking " + mbRow.BookingNumber + ", so it will not be added again.", this);
                        }
                        // If cmdty and grade doesnt exist in mb, ask if should add.

                        if (mbRow.CustomerId != muRow.CustomerId)
                        {
                            var result = My.MyProject.Forms.MessageBoxCustomerMatchingWarning.ShowDialog(mbRow, muRow, this);
                            if (result == DialogResult.Yes & shouldChangeCustomer == true)
                            {
                                muRow.CustomerId = mbRow.CustomerId;
                                MdlBookingManagement.updateCustomer(MiniUnitService.GetById(muRow.MiniUnitId));
                            }
                            else
                            {
                                shouldNotAssignList.Add(muRow.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString());
                            }
                        }
                    }
                }
                else
                {
                    dgvAllBookings.Rows[e.RowIndex].Cells[0].Value = false;
                    numbSelectMU = -1;
                    for (int i = 0, loopTo1 = dgvMiniUnit.Rows.Count - 1; i <= loopTo1; i++)
                    {
                        muRow = (VW_UnitSourceMiniUnit)dgvMiniUnit.Rows[i].DataBoundItem;
                        shouldNotAssignList.Remove(muRow.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString());
                    }
                }
            }

            checkAsnButton();
        }
Ejemplo n.º 8
0
        private void dgvReleaseDistribution_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            if (inboutTabs.SelectedIndex == 1)
            {
                var DateRequested            = dgvReleaseDistribution.Rows[e.RowIndex].Cells["DataGridViewTextBoxColumn17"];
                var checkCell                = dgvReleaseDistribution.Rows[e.RowIndex].Cells["checkDist"];
                var cansRequested            = dgvReleaseDistribution.Rows[e.RowIndex].Cells["QtyRequestedDataGridViewTextBoxColumn4"];
                var cansAccepted             = dgvReleaseDistribution.Rows[e.RowIndex].Cells["TotalAcceptedOfRequestDataGridViewTextBoxColumn"];
                var StatusName               = dgvReleaseDistribution.Rows[e.RowIndex].Cells["StatusNameDataGridViewTextBoxColumn2"];
                var relNumber                = dgvReleaseDistribution.Rows[e.RowIndex].Cells["ReleaseNumberDataGridViewTextBoxColumn2"];
                var carrier                  = dgvReleaseDistribution.Rows[e.RowIndex].Cells["DataGridViewTextBoxColumn18"];
                DataGridViewImageCell msgImg = (DataGridViewImageCell)dgvReleaseDistribution.Rows[e.RowIndex].Cells["MessageColumn"];
                var msg = dgvReleaseDistribution.Rows[e.RowIndex].Cells["msg"];
                checkCell.Style.Font               = new Font("Arial", 15.5f, FontStyle.Bold);
                checkCell.Style.ForeColor          = Color.Black;
                checkCell.Style.SelectionForeColor = Color.Black;
                if (MdlBookingManagement.IsOdd(e.RowIndex))
                {
                    checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control);
                }
                else
                {
                    checkCell.Style.SelectionBackColor = Color.White;
                }

                checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                if (Information.IsNothing(checkCell.Value))
                {
                    checkCell.Value = "   ";
                }

                // dgvRequests.Columns(8).Height = 25

                DateRequested.Style.Font            = new Font("Arial", 10f, FontStyle.Bold);
                DateRequested.Style.Alignment       = DataGridViewContentAlignment.MiddleLeft;
                carrier.Style.Font                  = new Font("Arial", 10f, FontStyle.Bold);
                carrier.Style.Alignment             = DataGridViewContentAlignment.MiddleLeft;
                cansRequested.Style.Font            = new Font("Arial", 11f, FontStyle.Bold);
                cansRequested.Style.Alignment       = DataGridViewContentAlignment.MiddleCenter;
                cansAccepted.Style.Font             = new Font("Arial", 11f, FontStyle.Bold);
                cansAccepted.Style.ForeColor        = Color.DarkGreen;
                cansAccepted.Style.Alignment        = DataGridViewContentAlignment.MiddleCenter;
                StatusName.Style.ForeColor          = Color.White;
                StatusName.Style.SelectionForeColor = Color.White;
                StatusName.Style.Font               = new Font("Bahnschrift", 9f, FontStyle.Bold);
                StatusName.Style.Alignment          = DataGridViewContentAlignment.MiddleCenter;
                int width = dgvReleaseDistribution.Columns["MessageColumn"].Width;
                int heght = dgvReleaseDistribution.Rows[e.RowIndex].Height;
                // msgImg.Style.BackColor = Color.White
                // msgImg.Style.SelectionBackColor = Color.White
                msgImg.Style.Alignment          = DataGridViewContentAlignment.MiddleCenter;
                msgImg.Style.SelectionBackColor = Color.FromArgb(64, 64, 64);
                msgImg.Style.BackColor          = Color.FromArgb(64, 64, 64);
                switch (msg.Value)
                {
                case "New Message":
                {
                    msgImg.Value = newImgMsg;
                    break;
                }

                case "Old Message":
                {
                    msgImg.Value = oldImgMsg;
                    break;
                }

                default:
                {
                    msgImg.Value = noImgMsg;
                    break;
                }
                }

                switch (StatusName.Value)
                {
                case "ACCEPTED":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkGreen;
                    StatusName.Style.BackColor          = Color.Green;
                    break;
                }

                case "PENDING REPLY":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkGoldenrod;
                    StatusName.Style.BackColor          = Color.Goldenrod;
                    break;
                }

                case "DECLINED":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkRed;
                    StatusName.Style.BackColor          = Color.Red;
                    break;
                }

                case "FOLLOW UP":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkOrange;
                    StatusName.Style.BackColor          = Color.Orange;
                    break;
                }

                case "PARTIALLY ACCEPTED":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkOliveGreen;
                    StatusName.Style.BackColor          = Color.DarkOliveGreen;
                    break;
                }
                }
            }
        }
Ejemplo n.º 9
0
        private void dgvRequests_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            if (inboutTabs.SelectedIndex == 0)
            {
                var DateRequested = dgvRequests.Rows[e.RowIndex].Cells["DateRequestedDataGridViewTextBoxColumn2"];
                var checkCell     = dgvRequests.Rows[e.RowIndex].Cells["check"];
                var cansRequested = dgvRequests.Rows[e.RowIndex].Cells["QtyRequestedDataGridViewTextBoxColumn3"];
                var cansAccepted  = dgvRequests.Rows[e.RowIndex].Cells["TotalQtyAccptOfRequest"];
                var StatusName    = dgvRequests.Rows[e.RowIndex].Cells["StatusNameDataGridViewTextBoxColumn3"];
                DataGridViewButtonCell BtnAction = (DataGridViewButtonCell)dgvRequests.Rows[e.RowIndex].Cells["btnReqAction"];
                checkCell.Style.Font               = new Font("Arial", 15.5f, FontStyle.Bold);
                checkCell.Style.ForeColor          = Color.Black;
                checkCell.Style.SelectionForeColor = Color.Black;
                if (MdlBookingManagement.IsOdd(e.RowIndex))
                {
                    checkCell.Style.SelectionBackColor = Color.FromKnownColor(KnownColor.Control);
                }
                else
                {
                    checkCell.Style.SelectionBackColor = Color.White;
                }

                checkCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                if (Information.IsNothing(checkCell.Value))
                {
                    checkCell.Value = "   ";
                }
                BtnAction.Style.Font               = new Font("Arial Narrow", 8.5f, FontStyle.Bold);
                BtnAction.Style.Alignment          = DataGridViewContentAlignment.MiddleCenter;
                BtnAction.Style.SelectionForeColor = Color.White;
                BtnAction.Style.ForeColor          = Color.White;
                // dgvRequests.Columns(8).Height = 25

                DateRequested.Style.Font            = new Font("Arial", 10f, FontStyle.Bold);
                DateRequested.Style.Alignment       = DataGridViewContentAlignment.MiddleLeft;
                cansRequested.Style.Font            = new Font("Arial", 11f, FontStyle.Bold);
                cansRequested.Style.Alignment       = DataGridViewContentAlignment.MiddleCenter;
                cansAccepted.Style.Font             = new Font("Arial", 11f, FontStyle.Bold);
                cansAccepted.Style.ForeColor        = Color.DarkGreen;
                cansAccepted.Style.Alignment        = DataGridViewContentAlignment.MiddleCenter;
                StatusName.Style.ForeColor          = Color.White;
                StatusName.Style.SelectionForeColor = Color.White;
                StatusName.Style.Font              = new Font("Bahnschrift", 9f, FontStyle.Bold);
                StatusName.Style.Alignment         = DataGridViewContentAlignment.MiddleCenter;
                BtnAction.Value                    = "UPDATE STATUS";
                BtnAction.Style.BackColor          = Color.OliveDrab;
                BtnAction.Style.SelectionBackColor = Color.OliveDrab;
                switch (StatusName.Value)
                {
                case "ACCEPTED":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkGreen;
                    StatusName.Style.BackColor          = Color.Green;
                    break;
                }

                case "PENDING REPLY":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkGoldenrod;
                    StatusName.Style.BackColor          = Color.Goldenrod;
                    break;
                }

                case "DECLINED":
                {
                    StatusName.Style.SelectionBackColor = Color.DarkRed;
                    StatusName.Style.BackColor          = Color.Red; // case "FOLLOW UP"
                    break;
                }

                default:
                {
                    // StatusName.Style.Font = New Font("Arial", 10, FontStyle.Bold)
                    if (StatusName.Value.ToString().Contains("TODAY") | StatusName.Value.ToString().Contains("LATE"))
                    {
                        if (StatusName.Value.ToString().Contains("LATE"))
                        {
                            // StatusName.Style.Font = New Font("Arial", 8, FontStyle.Bold)
                            StatusName.Style.BackColor = Color.Red;
                        }
                        else
                        {
                            StatusName.Style.SelectionBackColor = Color.Maroon;
                            StatusName.Style.BackColor          = Color.OrangeRed;
                        }
                    }
                    else
                    {
                        StatusName.Style.SelectionBackColor = Color.DarkOrange;
                        StatusName.Style.BackColor          = Color.Orange;
                    }

                    break;
                }
                }
            }
        }
Ejemplo n.º 10
0
        private void checkCmdtyAndCustomer(object unitRow)
        {
            int    muID;
            string MUSource;
            string cmdtyName;
            string gradeName;
            int    cmdtyId;
            int    gradeId;
            VW_BookingMinibooking selectedMBRow;
            VW_UnitSourceMiniUnit mu = (VW_UnitSourceMiniUnit)unitRow;

            VW_GrainUnitStorage g = new VW_GrainUnitStorage();

            try
            {
                g = (VW_GrainUnitStorage)unitRow;
            }
            catch { }


            muID = mu.MiniUnitId;


            MUSource = Conversions.ToString(mu.MiniunitNumber);

            // selectedUnits.Add(muID, MUSource)

            cmdtyName = Conversions.ToString(mu.CommodityName);
            gradeName = Conversions.ToString(mu.GradeName);
            cmdtyId   = Conversions.ToInteger(mu.CommodityId);
            gradeId   = Conversions.ToInteger(mu.GradeId);

            // Check if mini unit is already assigned to mini booking
            for (int i = 0, loopTo = dgvSelectedBkg.Rows.Count - 1; i <= loopTo; i++)
            {
                selectedMBRow = (VW_BookingMinibooking)dgvSelectedBkg.Rows[i].DataBoundItem;
                bool muAlreadyAsn;
                // check if mu was already assigned
                if (tabUnits.SelectedIndex == 0)
                {
                    muAlreadyAsn = MdlBookingManagement.miniUnitAlreadyAssigned(muID, selectedMBRow.MiniBookingId, false);
                }
                else
                {
                    g            = (VW_GrainUnitStorage)unitRow;
                    muAlreadyAsn = MdlBookingManagement.miniUnitAlreadyAssigned(g.GrainInvStorageLocationId, selectedMBRow.MiniBookingId, true);
                }

                if (muAlreadyAsn)
                {
                    shouldNotAssignList.Add(muID.ToString() + "|" + selectedMBRow.MiniBookingId.ToString());
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Unit source already added to booking", "Selected Unit source is already added to the booking " + selectedMBRow.BookingNumber + ", so it will not be added again.", this);
                }

                // If cmdty doesn't exist, add to unit source.
                if (cmdtyId == 0)
                {
                    var result = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Warning:", "There's no commodity added to the unit '" + MUSource + "' Yet. Would you like to add it now? " + "If No is selected, the unit will not be added to the booking", My.Resources.Resources.caution, this);
                    if (result == DialogResult.Yes)
                    {
                        var unit     = UnitSourceService.GetVWById(Conversions.ToInteger(mu.UnitSourceId));
                        var unitList = new List <VW_UnitSource>();
                        unitList.Add(unit);
                        My.MyProject.Forms.FrmEditAddRailList.isNewRecord = false;
                        My.MyProject.Forms.FrmEditAddRailList.isMultiEdit = false;
                        My.MyProject.Forms.FrmEditAddRailList.LoadForm(unitList);
                        Close();
                        MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmEditAddRailList, My.MyProject.Forms.FrmParentScreen);
                    }
                    // If tabUnits.SelectedIndex = 0 Then
                    // VWUnitSourceMiniUnitBindingSource.DataSource.Item(unitRow) = MiniUnitService.GetVWByMUId(unitRow.MiniUnitId)
                    // 'VWUnitSourceMiniUnitBindingSource.DataSource

                    // End If
                    else if (tabUnits.SelectedIndex == 0)
                    {
                        shouldNotAssignList.Add(muID.ToString() + "|" + selectedMBRow.MiniBookingId.ToString());
                    }
                    else
                    {
                        g = (VW_GrainUnitStorage)unitRow;
                        shouldNotAssignStorageList.Add(g.GrainInvStorageLocationId.ToString() + "|" + selectedMBRow.MiniBookingId.ToString());
                    }
                }
                // If cmdty and grade doesnt exist in mb, ask if should add.
                else if (MdlBookingManagement.miniUnitMissingCommodity(selectedMBRow.MiniBookingId, cmdtyId, gradeId))
                {
                    var result = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Commodity and Rate doesn't match", "The commodity and grade of the unit '" + MUSource + "' (" + gradeName + " " + cmdtyName + ") is not added to the booking '" + selectedMBRow.BookingNumber + "'. Would you like to add it now? " + "If No is selected, the unit will not be added to the booking", My.Resources.Resources.caution, this);
                    if (result == DialogResult.Yes)
                    {
                        MdlBookingManagement.saveBkgCommodity(selectedMBRow.MiniBookingId, cmdtyId, gradeId);
                    }
                    else if (tabUnits.SelectedIndex == 0)
                    {
                        shouldNotAssignList.Add(muID.ToString() + "|" + selectedMBRow.MiniBookingId.ToString());
                    }
                    else
                    {
                        shouldNotAssignStorageList.Add(g.GrainInvStorageLocationId.ToString() + "|" + selectedMBRow.MiniBookingId.ToString());
                    }
                }

                if (mu.CustomerId != selectedMBRow.CustomerId)
                {
                    var result = My.MyProject.Forms.MessageBoxCustomerMatchingWarning.ShowDialog(selectedMBRow, unitRow, this);
                    if (result == DialogResult.Yes & shouldChangeCustomer == true)
                    {
                        MdlBookingManagement.updateCustomer(MiniUnitService.GetById(muID));

                        // update muDataGridView
                        VWUnitSourceMiniUnitBindingSource.DataSource = VW_UnitSOurceMiniUnitService.GetByFilter(Conversions.ToString(mu.CustomerName), BkServicesList, Strings.Trim(tbSearchStorageUnit.Text));
                    }
                    else if (tabUnits.SelectedIndex == 0)
                    {
                        shouldNotAssignList.Add(muID.ToString() + "|" + selectedMBRow.MiniBookingId.ToString());
                    }
                    else
                    {
                        shouldNotAssignStorageList.Add(g.GrainInvStorageLocationId.ToString() + "|" + selectedMBRow.MiniBookingId.ToString());
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private string FetchThisBooking(string ThisBookNumber, int railListID)
        {
            short  x                = 0;
            short  cnt              = 0;
            string SQL              = "";
            string BookingLine      = "";
            string BookingNumber    = "";
            string DeliverBook      = "";
            string SSLineCode       = "";
            string DeliverCanTotal  = "";
            string LRDDate          = "";
            char   LRDTime          = '\0';
            string TerminalName     = "";
            string VesselName       = "";
            char   SplitBooking     = '\0';
            string DeliverBookings  = "";
            string TempLine         = "";
            string ChangedMask      = "";
            string DeliverReadyCans = "";
            int    BookCount        = 0;
            short  TotalCans        = 0;
            short  DeliverCans      = 0;
            string bkLetter;
            string unit;
            string recordKeyQuery;

            if (railListID == 0)
            {
                recordKeyQuery = "[RailListID] is null";
            }
            else
            {
                recordKeyQuery = "[RailListID] = '" + railListID.ToString() + "'";
            }

            SQL = @"select b.*, [MiniBookingOrder], MiniUnitOrder, bus.Unit from Bookings as b
 join MiniBooking as mb on b.[Booking Number] = mb.[BookingNumber] and
b.[Booking Number] = '" + ThisBookNumber + @"'
join [Booking Unit Sources] bus on bus.[Minibooking ID] = mb.[MiniBookingId] and " + recordKeyQuery + " and Unit = '" + focusedUnitNumber + @"'
 left join MiniUnit as mu on mu.MiniUnitId = bus.MiniUnitID order by [MiniBookingOrder] ";
            var DbObjDataTable = new DataTable();
            var DbObjAdapter   = new System.Data.SqlClient.SqlDataAdapter(SQL, DBConnect);
            var DbObjCommand   = new System.Data.SqlClient.SqlCommandBuilder(DbObjAdapter);

            DbObjAdapter.Fill(DbObjDataTable);
            Refresh();
            foreach (DataRow BookNum in DbObjDataTable.Rows)
            {
                bool multiMB = DbObjDataTable.Select(Conversions.ToString(Operators.AddObject(Operators.AddObject("[Booking Number] = '", BookNum["Booking Number"]), "'"))).Length > 1;
                if (multiMB)
                {
                    bkLetter = "(" + MdlBookingManagement.digitToLetter(BookNum["MiniBookingOrder"]) + ")";
                }
                else
                {
                    bkLetter = "";
                }

                BookingNumber = MdlContainerManagement.DoFunctions.PadToString(Strings.Trim(Conversions.ToString(BookNum["Booking Number"])) + bkLetter, 40);
                if (!string.IsNullOrEmpty(Strings.RTrim(BookingNumber)))
                {
                    if (!BookNum.IsNull("LRD") & Information.IsDate(BookNum["LRD"]))
                    {
                        LRDDate = MdlContainerManagement.DoFunctions.DateToNum(DateAndTime.DateValue(Conversions.ToString(BookNum["LRD"])));
                    }
                    else
                    {
                        LRDDate = MdlContainerManagement.DoFunctions.MKL(0);
                    }

                    if (BookNum.IsNull("Terminal Name") == true)
                    {
                        TerminalName = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(' '), 40);
                    }
                    else
                    {
                        TerminalName = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(BookNum["Terminal Name"]), 40);
                    }

                    if (BookNum.IsNull("Vessel Name") == true)
                    {
                        VesselName = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(' '), 50);
                    }
                    else
                    {
                        VesselName = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(BookNum["Vessel Name"]), 50);
                    }

                    if (BookNum.IsNull("Split Booking") == false && Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(BookNum["Split Booking"], true, false)))
                    {
                        SplitBooking = '\u0001';
                    }
                    else
                    {
                        SplitBooking = '\0';
                    }

                    if (BookNum.IsNull("SS Line Code") == true)
                    {
                        SSLineCode = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(' '), 10);
                    }
                    else
                    {
                        SSLineCode = MdlContainerManagement.DoFunctions.PadToString(Conversions.ToString(BookNum["SS Line Code"]), 10);
                    }

                    LRDTime     = '\0';
                    ChangedMask = Conversions.ToString('\0') + Conversions.ToString('\0') + Conversions.ToString('\0') + Conversions.ToString('\0');

                    // DeliverBook = Mid(DeliverBookings, x, 40)
                    DeliverCanTotal = MdlContainerManagement.DoFunctions.MKL(Conversions.ToInteger(BookNum["Number Of Cans"]));
                    if (multiMB)
                    {
                        if (!Information.IsDBNull(BookNum["MiniUnitOrder"]))
                        {
                            bkLetter = "(" + MdlBookingManagement.digitToLetter(BookNum["MiniUnitOrder"]).ToUpper() + ")";
                        }
                        else
                        {
                            bkLetter = "";
                        }
                    }
                    else
                    {
                        bkLetter = "";
                    }

                    unit         = MdlContainerManagement.DoFunctions.PadToString(Strings.Trim(Conversions.ToString(BookNum["Unit"])) + bkLetter, 40);
                    TempLine     = Conversions.ToString('\0') + BookingNumber + unit + SSLineCode + LRDDate + Conversions.ToString(LRDTime) + TerminalName + VesselName + Conversions.ToString(SplitBooking) + DeliverCanTotal + MdlContainerManagement.DoFunctions.MKL(0) + MdlContainerManagement.DoFunctions.MKL(0) + MdlContainerManagement.DoFunctions.MKL(0) + MdlContainerManagement.DoFunctions.MKL(0) + ChangedMask;
                    BookingLine += TempLine;

                    // Next x
                    // End If
                }
            }

            return(BookingLine);
        }