Ejemplo n.º 1
0
        private void TouchAssignExtra_ButtonClick(object sender, EventArgs e)
        {
            int    x = 0;
            string ContainerNumber  = "";
            string ListOfContainers = "";

            ListOfContainers = My.MyProject.Forms.FrmListContainers.ContainerList2.GiveSeletcedContainers();
            if (typeBunifuDropdown3.SelectedItem.Equals("Storage"))
            {
                var loopTo = Strings.Len(ListOfContainers);
                for (x = 1; x <= loopTo; x += 11)
                {
                    ContainerNumber = Strings.Mid(ListOfContainers, x, 11);
                    AssignContainerToStorage(Conversions.ToString('\u0001'), ContainerNumber, selectectedBooking);
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + ContainerNumber, "ASSIGN", "CONTAINER", "Container assigned to Storage");
                    My.MyProject.Forms.FrmListContainers.ContainerList2.AssignedContainerType(ContainerNumber, Conversions.ToString('\u0002'), selectectedBooking);
                }
            }
            else
            {
                var loopTo1 = Strings.Len(ListOfContainers);
                for (x = 1; x <= loopTo1; x += 11)
                {
                    ContainerNumber = Strings.Mid(ListOfContainers, x, 11);
                    AssignContainerToStorage(Conversions.ToString('\u0002'), Strings.Mid(ListOfContainers, x, 11), selectectedBooking);
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + ContainerNumber, "ASSIGN", "CONTAINER", "Container assigned To Extra");
                    My.MyProject.Forms.FrmListContainers.ContainerList2.AssignedContainerType(ContainerNumber, Conversions.ToString('\u0002'), selectectedBooking);
                }
            }

            var CeresExcService = new CeresExcelPendingSyncService();
            var cep             = new CeresExcelPendingSync();

            cep.RecordId      = selectedMBId;
            cep.EmployeeId    = My.MyProject.Forms.FrmLoginWindow._userID;
            cep.SyncType      = "CONTAINER ASSIGNMENT";
            cep.ExtraInfo     = "";
            cep.CurrentStatus = "QUEUE";
            cep.QtyOfAttempts = 0;
            cep.SyncMessage   = "ADDED TO QUEUE";
            cep.CreatedAt     = DateAndTime.Now;
            CeresExcService.AddOrUpdate(cep);
            My.MyProject.Forms.FrmListContainers.ContainerList2.ClearSelectedContainers();
            Close();
        }
Ejemplo n.º 2
0
        private void AssignUnitsToBooking()
        {
            string muIDmbID;
            int    railListID = 0;
            var    bus        = new MinibookingMiniUnitAssignmentService();
            VW_UnitSourceMiniUnit muRow;
            var mbRow = default(VW_BookingMinibooking);

            for (int i = 0, loopTo = dgvMiniUnit.Rows.Count - 1; i <= loopTo; i++)
            {
                muRow      = (VW_UnitSourceMiniUnit)dgvMiniUnit.Rows[i].DataBoundItem;
                railListID = (int)muRow.RecordKey;
                for (int s = 0, loopTo1 = dgvAllBookings.Rows.Count - 1; s <= loopTo1; s++)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvAllBookings.Rows[s].Cells[0].Value, true, false)))
                    {
                        mbRow    = (VW_BookingMinibooking)dgvAllBookings.Rows[s].DataBoundItem;
                        muIDmbID = muRow.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString();
                        if (!shouldNotAssignList.Contains(muIDmbID))
                        {
                            bus.Insert(mbRow.MiniBookingId, muRow.MiniUnitId);
                            EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "UnitId: " + muRow.MiniUnitId.ToString() + " | MbId: " + mbRow.MiniBookingId.ToString(), "ASSIGN", "UNIT", "Unit Source " + muRow.MiniunitNumber + " assigned to booking " + mbRow.BookingNumber);
                        }
                    }
                }

                var cep = new CeresExcelPendingSync();
                cep.RecordId      = mbRow.MiniBookingId;
                cep.EmployeeId    = My.MyProject.Forms.FrmLoginWindow._userID;
                cep.SyncType      = "UNIT ASSIGNMENT";
                cep.ExtraInfo     = "";
                cep.CurrentStatus = "QUEUE";
                cep.QtyOfAttempts = 0;
                cep.SyncMessage   = "ADDED TO QUEUE";
                cep.CreatedAt     = DateAndTime.Now;
                CeresExcService.AddOrUpdate(cep);
            }
        }
Ejemplo n.º 3
0
        private void assignBunifuButton1_Click(object sender, EventArgs e)
        {
            int  numbOfCounSelected = 0;
            bool shouldHoldCont     = statusLabel.Text.Equals("OPEN - ON HOLD");

            for (int i = 0, loopTo = containersBunifuDataGridView1.Rows.Count - 1; i <= loopTo; i++)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(containersBunifuDataGridView1.Rows[i].Cells[0].Value, true, false)))
                {
                    numbOfCounSelected += 1;
                }
            }

            if (assignedContainersBunifuDataGridView2.Rows.Count + numbOfCounSelected > 45)
            {
                if (assignedContainersBunifuDataGridView2.Rows.Count == 45)
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Cannot assign containers to booking.", "This booking has reached the maximum of containers allowed in a booking (45 cans per booking)." + Microsoft.VisualBasic.Constants.vbNewLine + "Please, create another minibooking to keep assigning", this);
                }
                else
                {
                    int totalSelected = assignedContainersBunifuDataGridView2.Rows.Count + numbOfCounSelected;
                    int maxToBeassign = totalSelected - 45;
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Cannot assign containers to booking.", "The maximum number of containers a booking can receive is 45. You can only assign " + maxToBeassign.ToString() + " containers to this booking. To keep assigning, create another minibooking and assign remaining containers.", this);
                }

                return;
            }

            if (Convert.ToInt32(totalNumberOfCans) > assignedContainersBunifuDataGridView2.Rows.Count)
            {
                if (Convert.ToInt32(totalNumberOfCans) >= assignedContainersBunifuDataGridView2.Rows.Count + numbOfCounSelected)
                {
                    saveAssigment(selectedContainers, Strings.Trim(SelectedMBObj.MinibookingNumber), shouldHoldCont);

                    // Add pending record to database
                    var cep = new CeresExcelPendingSync();
                    cep.RecordId      = SelectedMBObj.MiniBookingId;
                    cep.EmployeeId    = My.MyProject.Forms.FrmLoginWindow._userID;
                    cep.SyncType      = "CONTAINER ASSIGNMENT";
                    cep.ExtraInfo     = "";
                    cep.CurrentStatus = "QUEUE";
                    cep.QtyOfAttempts = 0;
                    cep.SyncMessage   = "ADDED TO QUEUE";
                    cep.CreatedAt     = DateAndTime.Now;
                    CeresExcService.AddOrUpdate(cep);
                    removeFromList();
                    selectedContainers.Clear();
                    populateAssignedCOntainers();
                    if (containersBunifuDataGridView1.Rows.Count > 0)
                    {
                        totalContainersLabel.Text = (containersBunifuDataGridView1.CurrentRow.Index + 1).ToString() + " of " + containersBunifuDataGridView1.Rows.Count.ToString();
                    }
                    else
                    {
                        totalContainersLabel.Text = "0 of " + containersBunifuDataGridView1.Rows.Count.ToString();
                    }

                    selectAllCheckBox.Checked = false;
                }
                else
                {
                    string message = "The total number of containers allowed is " + totalNumberOfCans.ToString() + ". Please unselect " + (numbOfCounSelected + assignedContainersBunifuDataGridView2.Rows.Count - Conversions.ToDouble(totalNumberOfCans)).ToString() + " container(s) to continue";
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Can not procced", message, this);
                }
            }
            else if (Conversions.ToDouble(totalNumberOfCans) == assignedContainersBunifuDataGridView2.Rows.Count)
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Can not procced", "The total number of containers allowed is " + totalNumberOfCans.ToString() + ". You can not add more containers to this booking.", this);
            }
            else
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Can not procced", "The total number of containers allowed is " + totalNumberOfCans.ToString() + ". Please unselect " + (numbOfCounSelected + assignedContainersBunifuDataGridView2.Rows.Count - Conversions.ToDouble(totalNumberOfCans)).ToString() + " container(s) to continue", this);
            }
            // End If
        }
Ejemplo n.º 4
0
        private void AssignUnitsToBookings()
        {
            string muIDmbID;
            var    bus = new MinibookingMiniUnitAssignmentService();
            var    gis = new GrainInventoryService();
            VW_BookingMinibooking mbRow;
            VW_UnitSourceMiniUnit unitRowUnit;
            VW_GrainUnitStorage   unitRowStorage;

            for (int i = 0, loopTo = dgvSelectedBkg.Rows.Count - 1; i <= loopTo; i++)
            {
                mbRow = (VW_BookingMinibooking)dgvSelectedBkg.Rows[i].DataBoundItem;
                if (tabUnits.SelectedIndex == 0)
                {
                    for (int s = 0, loopTo1 = dgvMiniUnits.Rows.Count - 1; s <= loopTo1; s++)
                    {
                        if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvMiniUnits.Rows[s].Cells[0].Value, true, false)))
                        {
                            unitRowUnit = (VW_UnitSourceMiniUnit)dgvMiniUnits.Rows[s].DataBoundItem;
                            muIDmbID    = unitRowUnit.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString();

                            // If mini munit key and mini booking key is not on the should not assign list,
                            // then assign unit to bkg
                            if (!shouldNotAssignList.Contains(muIDmbID))
                            {
                                // 'dbCeres.assignUnitsToMiniBkgs(unitID, mbID, bkgNumber, unitNumber, recordKey)
                                bus.Insert(mbRow.MiniBookingId, unitRowUnit.MiniUnitId);
                                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "UnitId: " + unitRowUnit.MiniUnitId.ToString() + " | MbId: " + mbRow.MiniBookingId.ToString(), "ASSIGN", "UNIT", "Unit Source " + unitRowUnit.MiniunitNumber + " assigned to booking " + mbRow.BookingNumber);
                            }
                        }
                    }
                }
                else
                {
                    for (int s = 0, loopTo2 = dgvStorageUnits.Rows.Count - 1; s <= loopTo2; s++)
                    {
                        if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvStorageUnits.Rows[s].Cells[0].Value, true, false)))
                        {
                            unitRowStorage = (VW_GrainUnitStorage)dgvStorageUnits.Rows[s].DataBoundItem;
                            muIDmbID       = unitRowStorage.MiniUnitId.ToString() + "|" + mbRow.MiniBookingId.ToString();

                            // If mini munit key and mini booking key is not on the should not assign list,
                            // then assign unit to bkg
                            if (!shouldNotAssignList.Contains(muIDmbID))
                            {
                                gis.InsertGrainInvMinibookingAssignment(mbRow.MiniBookingId, unitRowStorage.GrainInvStorageLocationId, (float)unitRowStorage.QtyInStorage, DateAndTime.Now);
                                gis.InsertGrainInventoryTransaction(unitRowStorage.GrainInventoryId, (int)MdlEnum.TransactionType.ASSIGNMENT, (float)unitRowStorage.QtyInStorage, DateAndTime.Now);
                                gis.InsertGrainInvMinibookingTransaction(mbRow.MiniBookingId, gis.GetLastGrainInventoryTransactionId());
                                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "UnitId: " + unitRowStorage.MiniUnitId.ToString() + " | MbId: " + mbRow.MiniBookingId.ToString(), "ASSIGN", "UNIT", "Storage Unit Source " + unitRowStorage.StorageUnitNumber + " assigned to booking " + mbRow.BookingNumber);
                            }
                        }
                    }
                }

                var cep = new CeresExcelPendingSync();
                cep.RecordId      = mbRow.MiniBookingId;
                cep.EmployeeId    = My.MyProject.Forms.FrmLoginWindow._userID;
                cep.SyncType      = "UNIT ASSIGNMENT";
                cep.ExtraInfo     = "";
                cep.CurrentStatus = "QUEUE";
                cep.QtyOfAttempts = 0;
                cep.SyncMessage   = "ADDED TO QUEUE";
                cep.CreatedAt     = DateAndTime.Now;
                CeresExcService.AddOrUpdate(cep);
            }

            shouldNotAssignList.Clear();
            assignBunifuButton1.Update();
            checkAsnButton();
        }