Ejemplo n.º 1
0
        private void Disconnect()
        {
            DialogResult dialogTruckDriver;
            string       MSG = "";

            MSG = Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject("Do you really want to disconnect the company ", dgvTruckDriverCompany.SelectedRows[0].Cells[2].Value), " to this driver truck "), lblNameDriver.Text), " ?"));
            dialogTruckDriver = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Disconnect Driver Truck", MSG, My.Resources.Resources.caution, this);
            if (dialogTruckDriver == DialogResult.Yes)
            {
                string MSGLog = "";
                int    Id     = Conversions.ToInteger(dgvTruckDriverCompany.SelectedRows[0].Cells[0].Value);
                var    L      = TruckDriverCompanyService.GetById(Id);
                foreach (var item in L)
                {
                    MSGLog = "Items that have been deleted: CompanyId: #" + item.CompanyId.ToString() + " TruckDriverId: " + item.TruckDriverId.ToString();
                }
                if (TruckDriverCompanyService.Delete(Id))
                {
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, Id.ToString(), "DELETE", "TRUCK DRIVER", MSGLog);
                    LoadDataGridView();
                    My.MyProject.Forms.FrmParentScreen.f.LoadForm();
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error in disconnect the company our this truck driver", "", this);
                }
            }
        }
Ejemplo n.º 2
0
        // ' Public isBookingChange As Boolean = False

        private void transferButton_Click(object sender, EventArgs e)
        {
            MdlLoadingSetting.waitForm.Show();
            var selectedCont = new List <int>();

            for (int i = 0, loopTo = My.MyProject.Forms.FrmAssignContainer.assignedContainersBunifuDataGridView2.Rows.Count - 1; i <= loopTo; i++)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(My.MyProject.Forms.FrmAssignContainer.assignedContainersBunifuDataGridView2.Rows[i].Cells[0].Value, true, false)))
                {
                    selectedCont.Add(Conversions.ToInteger(My.MyProject.Forms.FrmAssignContainer.assignedContainersBunifuDataGridView2.Rows[i].Cells[11].Value));
                }
            }

            {
                var withBlock = My.MyProject.Forms.FrmAssignContainer;
                var canInOut  = new Containers_In_OutService();
                foreach (var contNum in selectedCont)
                {
                    dbCeres.unassignBooking(contNum, true);
                    canInOut.UnassignContainerFromMinibooking(contNum, My.MyProject.Forms.FrmAssignContainer.SelectedMBObj.MiniBookingId, false);
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + contNum.ToString() + " | MbID: " + My.MyProject.Forms.FrmAssignContainer.SelectedMBObj.MiniBookingId.ToString(), "UNASSIGN", "CONTAINER", "Container unassigned from booking");
                }

                saveAssigment(selectedContainers, selectedBookingNumber);
            }

            MdlLoadingSetting.waitForm.Close();
            My.MyProject.Forms.FrmAssignContainer.selectAllCheckBox.Checked = false;
            searchBunifuTextBox1.Text = "";
            Close();
            // End If
        }
Ejemplo n.º 3
0
        private void freeContainer(string AssignMode, string ThisContainer)
        {
            // DBConnect = New SqlClient.SqlConnection("Server=tcp:WTC-Ceres.database.windows.net,1433;Initial Catalog=WTC-Ceres;Persist Security Info=False;User ID=CeresAdmin;Password=C3r3$@dm!n;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;")
            // DBConnect.Open()
            int RecCount       = 0;
            var DbObjAdapter   = new System.Data.SqlClient.SqlDataAdapter("Select * From [Containers In-Out] Where [Container Number] = '" + ThisContainer + "' and ([Container Rejected] = 0 or [Container Rejected] is null)", DBConnect);
            var DbObjCommand   = new System.Data.SqlClient.SqlCommandBuilder(DbObjAdapter);
            var DbObjDataTable = new DataTable();

            DbObjAdapter.Fill(DbObjDataTable);
            if (DbObjDataTable.Rows.Count == 1)
            {
                RecCount = DbObjDataTable.Rows.Count - 1;
                DbObjDataTable.Rows[RecCount]["In-Gate To Excel"]  = false;
                DbObjDataTable.Rows[RecCount]["Assigned To Excel"] = false;
                if (AssignMode == Conversions.ToString('\0'))
                {
                    DbObjDataTable.Rows[RecCount]["Assigned To Storage"]  = false;
                    DbObjDataTable.Rows[RecCount]["Assigned To Extra"]    = false;
                    DbObjDataTable.Rows[RecCount]["Excel Booking Number"] = DBNull.Value;
                    DbObjDataTable.Rows[RecCount]["Booking Number"]       = DBNull.Value;
                    DbObjDataTable.Rows[RecCount]["MinibookingId"]        = DBNull.Value;
                    DbObjAdapter.Update(DbObjDataTable);
                }

                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "Can: " + ThisContainer, "FREE", "CONTAINER", "Container was released from storage");
            }
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtVesselName.Text))
            {
                txtVesselName.BackColor = Color.LightCoral;
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("The Vessel Name field cannot be empty.", "", this);
                return;
            }

            if (string.IsNullOrEmpty(txtVesselCapacity.Text))
            {
                txtVesselCapacity.Text = "0";
            }

            if (string.IsNullOrEmpty(txtVesselYear.Text))
            {
                txtVesselYear.Text = "0";
            }

            if (VesselId == 0)
            {
                if (VesselService.Insert(txtVesselName.Text, txtVesselOwner.Text, txtVesselManager.Text, Convert.ToDecimal(txtVesselCapacity.Text), Convert.ToInt32(txtVesselYear.Text), cboFlag.Text, ckbActive.Checked))
                {
                    if (EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, VesselService.GetLastVesselId().ToString(), "INSERT", "VESSEL", "Insert of vessel information"))
                    {
                    }

                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("The Vessel has been successfully inserted.", "Inserted!", this);
                    My.MyProject.Forms.frmVesselList.LoadFormAddItem(VesselService.GetLastVesselId(), txtVesselName.Text, txtVesselOwner.Text, txtVesselManager.Text, Convert.ToDecimal(txtVesselCapacity.Text), Convert.ToInt32(txtVesselYear.Text), cboFlag.Text, ckbActive.Checked);
                    My.MyProject.Forms.frmVesselList.SearchByColumn();
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error inserting the vessel, try again if the error persists inform the IT department. #1351", "Error", this);
                }
            }
            else if (VesselService.Update(VesselId, txtVesselName.Text, txtVesselOwner.Text, txtVesselManager.Text, Convert.ToDecimal(txtVesselCapacity.Text), Convert.ToInt32(txtVesselYear.Text), cboFlag.Text, ckbActive.Checked))
            {
                if (EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, VesselId.ToString(), "UPDATE", "VESSEL", "Edition of vessel information"))
                {
                }

                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Vessel has been updated successfully.", "Updated!", this);
                My.MyProject.Forms.frmVesselList.LoadForm();
                My.MyProject.Forms.frmVesselList.SearchByColumn();
            }
            else
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error updating the vessel, try again if the error persists inform the IT department. #1352", "Error", this);
            }

            Close();
        }
Ejemplo n.º 5
0
        public void saveAssigment(Dictionary <string, int> containerList, string bookingNumber, bool shouldHoldCOnt)
        {
            int recordID;
            var ContainerMinibooking = new ContainerMinibookingService();

            foreach (var containerNumb in containerList)
            {
                recordID = containerNumb.Value;
                dbCeres.saveContrAssignment(recordID, bookingNumber, SelectedMBObj.MiniBookingId, true, true, false, false, false, shouldHoldCOnt);
                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + recordID.ToString() + " | MbID: " + SelectedMBObj.MiniBookingId.ToString(), "ASSIGN", "CONTAINER", "Container assigned to booking " + SelectedMBObj.MinibookingNumber);
                ContainerMinibooking.Insert(recordID, SelectedMBObj.MiniBookingId);
            }
        }
Ejemplo n.º 6
0
        private void saveAssigment(Dictionary <string, int> containerList, string bookingNumber)
        {
            int focusedIndex  = bookingsBunifuDataGridView1.CurrentRow.Index;
            var miniBookingID = bookingsBunifuDataGridView1.Rows[focusedIndex].Cells[3].Value;
            int recordID;
            var ContainerMinibooking = new ContainerMinibookingService();

            foreach (var containerNumb in containerList)
            {
                recordID = containerNumb.Value;
                dbCeres.saveContrAssignment(recordID, bookingNumber, Conversions.ToInteger(miniBookingID), true, true, false, false, true, false);
                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + recordID.ToString() + " | MbID: " + miniBookingID.ToString(), "ASSIGN", "CONTAINER", "Container reassigned to booking");
                ContainerMinibooking.Insert(recordID, Conversions.ToInteger(miniBookingID));
            }
        }
Ejemplo n.º 7
0
        private void UnassignUnits()
        {
            var mbus         = new MinibookingMiniUnitAssignmentService();
            var isUnassigned = default(bool);
            var mbIdList     = new Dictionary <int, string>();
            List <VW_MinibookingMiniUnitAssignment> assignedCansList;
            VW_MinibookingMiniUnitAssignment        muAsn;

            MdlLoadingSetting.waitForm.Show();
            for (int i = 0, loopTo = dgvBookingUnit.Rows.Count - 1; i <= loopTo; i++)
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(dgvBookingUnit.Rows[i].Cells[0].Value, true, false)))
                {
                    muAsn = (VW_MinibookingMiniUnitAssignment)dgvBookingUnit.Rows[i].DataBoundItem;
                    if (!mbIdList.ContainsKey(muAsn.MinibookingId))
                    {
                        mbIdList.Add(muAsn.MinibookingId, Strings.Trim(muAsn.BookingNumber));
                    }

                    isUnassigned = mbus.Delete(muAsn.AssignmentId, muAsn.isStorageUnit == true);
                    if (muAsn.isStorageUnit == true)
                    {
                        EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "UnitId: " + muAsn.MiniUnitId.ToString() + " | MbId: " + muAsn.MinibookingId.ToString(), "UNASSIGN", "UNIT", "Storage Unit Source " + muAsn.MiniUnitNumber + " unassigned from booking " + muAsn.BookingNumber);
                    }
                    else
                    {
                        EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "UnitId: " + muAsn.MiniUnitId.ToString() + " | MbId: " + muAsn.MinibookingId.ToString(), "UNASSIGN", "UNIT", "Unit Source " + muAsn.MiniUnitNumber + " unassigned from booking " + muAsn.BookingNumber);
                    }
                }
            }

            foreach (var value in mbIdList)
            {
                // updateUnitsInExcelFile(value.Value, assignedCansList)
                assignedCansList = MinibookingMiniUnitAssignmentService.GetByMiniBookingId(value.Key);
            }
            dgvBookingUnit.DataSource = MinibookingMiniUnitAssignmentService.GetByUnitSourceId(focusedUnitID);
            MdlLoadingSetting.waitForm.Close();
            if (isUnassigned)
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Sucess!", "Unit source(s) unassigned with success!", this);
            }

            btnUnassign.Enabled = false;
        }
Ejemplo n.º 8
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.º 9
0
        private void btnComplete_Click(object sender, EventArgs e)
        {
            VW_BookingMinibooking mb;
            var mbService = new MinibookingService();

            if (GoodToGo())
            {
                if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(cboCarrierOut.SelectedValue, 0, false)))
                {
                    var result = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Warning:", "There is not carrier selected. If you proceed, the carrier out information will be removed from the selected bookings." + Constants.vbNewLine + " Would you like to proceed?", My.Resources.Resources.warning, this);
                    if (result == DialogResult.Yes)
                    {
                        foreach (DataGridViewRow row in dgvBookings.Rows)
                        {
                            if (row.Cells[0].Equals("✔"))
                            {
                                mb = (VW_BookingMinibooking)row.DataBoundItem;
                                mbService.UpdateCarrierOut(mb.MiniBookingId, Conversions.ToInteger(cboCarrierOut.SelectedValue));
                            }
                        }

                        My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Success!", "Carrier out updated with success", this);
                        Close();
                    }
                }
                else
                {
                    foreach (DataGridViewRow row in dgvBookings.Rows)
                    {
                        if (row.Cells[0].Value.Equals("✔"))
                        {
                            mb = (VW_BookingMinibooking)row.DataBoundItem;
                            EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, mb.MinibookingNumber, "UPDATE", "CARRIER BOOKING ASSIGNMENT", "Assigned " + cboCarrierOut.Text + " to Booking " + mb.MinibookingNumber);
                            mbService.UpdateCarrierOut(mb.MiniBookingId, Conversions.ToInteger(cboCarrierOut.SelectedValue));
                        }
                    }

                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Success!", "Carrier out updated with success", this);
                    Close();
                }
            }
        }
Ejemplo n.º 10
0
        private void Connect()
        {
            DialogResult dialogConnect;
            string       MSG;
            int          TDI = DriverId;
            int          CID;
            bool         IsEmptyField = false;

            if (FieldIsEmpty())
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Check the empty fields.", "", this);
                return;
            }

            CID = Convert.ToInt32(ddlTruckCompany.SelectedValue);
            var List = (from b in listTruckDriver
                        where b.TruckDriverId.Equals(TDI) & b.CompanyId.Equals(CID)
                        select b).ToList();

            if (List.Count > 0)
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("This Driver Truck is already connected to this company.", "", this);
                return;
            }

            MSG           = "Do you really want to connect the company " + ddlTruckCompany.Text + " to this driver truck " + lblNameDriver.Text + " ?";
            dialogConnect = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Connect Driver Truck", MSG, My.Resources.Resources.caution, this);
            if (dialogConnect == DialogResult.Yes)
            {
                if (TruckDriverCompanyService.Insert(TDI, CID))
                {
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, TruckDriverCompanyService.LastTruckDriverCompanyId().ToString(), "INSERT", "TRUCK DRIVER", "New Truck Driver Company Id: " + CID.ToString() + " Connect with TruckDriverId: " + DriverId.ToString());
                    LoadDataGridView();
                    My.MyProject.Forms.FrmParentScreen.f.LoadForm();
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("ERROR", "An error has occurred, please try again. If the error persists, inform the IT department. #3421", this);
                }
            }
        }
Ejemplo n.º 11
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.º 12
0
        public void unassignbooking(string bookingBumber, List <int> selectedCountainers, bool isBookingChange)
        {
            //  My.MyProject.Forms.FrmParentScreen.showLOadForm();
            string ThisXLSFile = "";
            var    dbCeres     = new DatabaseHelperCeres();

            try
            {
                // unassign on database
                var canInOut = new Containers_In_OutService();
                foreach (var contNum in selectedCountainers)
                {
                    dbCeres.unassignBooking(contNum, false);
                    canInOut.UnassignContainerFromMinibooking(contNum, SelectedMBObj.MiniBookingId, false);
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, "CanID: " + contNum.ToString() + " | MbID: " + SelectedMBObj.MiniBookingId.ToString(), "UNASSIGN", "CONTAINER", "Container unassigned from booking");
                }

                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);
                //   My.MyProject.Forms.FrmParentScreen.HideLoadForm();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An unexpected error occured. Please close this tab and try again. Error: " + ex.Message);
                //   My.MyProject.Forms.FrmParentScreen.HideLoadForm();
            }

            selectedAssgnContainers.Clear();
        }
Ejemplo n.º 13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DialogResult dialogSave;

            if (FieldIsEmpty())
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Check the empty fields.", "", this);
                return;
            }

            string msg = ReturnMessage(Conversions.ToInteger(ddlTruckCompany.SelectedValue), TruckDriverCompanyId);

            dialogSave = My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to make this change?", msg, My.Resources.Resources.caution, this);
            if (dialogSave == DialogResult.Yes)
            {
                if (TruckDriverCompanyService.Update(TruckDriverCompanyId, DriverId, Conversions.ToInteger(ddlTruckCompany.SelectedValue)))
                {
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, TruckDriverCompanyId.ToString(), "UPDATE", "TRUCK DRIVER COMPANY", msg + "YES");
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Truck Driver information updated successfully!", "", this);
                    LoadDataGridView();
                    My.MyProject.Forms.FrmParentScreen.f.LoadForm();
                    ckbEdit.Checked = false;
                    VerifiCheckBox();
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("ERROR", "An error has occurred, please try again. If the error persists, inform the IT department. #3422", this);
                }
            }
            else
            {
                ddlTruckCompany.Text = "";
                ckbEdit.Checked      = false;
                btnSave.Enabled      = true;
            }
        }
Ejemplo n.º 14
0
        private void saveBunifuButton_Click(object sender, EventArgs e)
        {
            string  actionTaken = "";
            int     lastEDIRecordAdded;
            DataRow dataRows;
            string  gateAction;
            var     recordID = default(int);

            if (My.MyProject.Forms.FrmInOutGate.isNewRecord)
            {
                MdlContainerManagement.saveInGate(0, this);
                recordID    = MdlContainerManagement.lastrecordID;
                actionTaken = "CREATE";
                gateAction  = "IN-GATE";
            }
            else
            {
                for (int i = 0, loopTo = My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows.Count - 1; i <= loopTo; i++)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows[i].Cells[1].Value, true, false)))
                    {
                        recordID = Conversions.ToInteger(My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows[i].Cells[0].Value);
                        break;
                    }
                }

                MdlContainerManagement.saveInGate(recordID, this);
                actionTaken = "UPDATE";
                gateAction  = "IN-GATE";
            }

            EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), actionTaken, gateAction, "");

            // ' To send EDI -- program only allow specific ss lines
            string ssLineCode;

            ssLineCode = Strings.Trim(shippingLineBunifuDropdown.SelectedItem.ToString().Split('(')[0]);
            if (sendEDIBunifuToggleSwitch.Value == true)
            {
                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), actionTaken, gateAction, "Requested EDI to be sent");
                db.AddEDILog(recordID, "IN-GATE", gateAction);
                lastEDIRecordAdded = db.getLadstEDIadded();
                if (My.MyProject.Forms.FrmChangeEDI.changeEDIRadioButton.Checked)
                {
                    DateTime modDateTime;
                    DateTime modDateTimeSTR;
                    modDateTimeSTR = Conversions.ToDate(My.MyProject.Forms.FrmChangeEDI.EDIDateTimePicker.Value.ToShortDateString() + " " + My.MyProject.Forms.FrmChangeEDI.EdiTimePicker.Value.ToShortTimeString());
                    modDateTime    = Convert.ToDateTime(modDateTimeSTR);
                    db.saveEDIModifiedRecord(lastEDIRecordAdded, modDateTime);
                    db.pushEDIRequest(recordID, true, false, lastEDIRecordAdded, modDateTime);
                }
                else
                {
                    DateTime gateDateTime;
                    DateTime gateDateTimeTR;
                    gateDateTimeTR = Conversions.ToDate(dateDateTimePicker.Value.ToShortDateString() + " " + timeDateTimePicker.Value.ToShortTimeString());
                    gateDateTime   = Convert.ToDateTime(gateDateTimeTR);
                    db.pushEDIRequest(recordID, true, false, lastEDIRecordAdded, gateDateTime);
                }
            }

            My.MyProject.Forms.FrmInOutGate.isRefresh = true;
            My.MyProject.Forms.FrmInOutGate.getInOutContainers();
            cleanFields();
            for (int i = 0, loopTo1 = My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows.Count - 1; i <= loopTo1; i++)
            {
                My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows[i].Cells[1].Value = false;
            }
            My.MyProject.Forms.FrmInOutGate.checkButtons();
            Close();
        }
Ejemplo n.º 15
0
        private void saveBunifuButton_Click(object sender, EventArgs e)
        {
            string  actionTaken = "";
            int     lastEDIRecordAdded;
            DataRow dataRows;
            string  gateAction;

            // recordID = inGateUniqueIDList(0)

            if (My.MyProject.Forms.FrmInOutGate.isNewRecord)
            {
                actionTaken = "Create";
            }
            else
            {
                actionTaken = "Update";
            }

            gateAction = "OUT-GATE";
            // Save Outgate info
            MdlContainerManagement.saveOutGate(recordID, this);

            // Save Log
            EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), actionTaken, gateAction, "");
            string ssLineCode;

            ssLineCode = Strings.Trim(shippingLineBunifuDropdown.SelectedItem.ToString().Split('(')[0]);
            if (sendEDIBunifuToggleSwitch.Value == true)
            {
                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), actionTaken, gateAction, "Requested EDI to be sent");
                db.AddEDILog(recordID, "OUT-GATE", gateAction);
                lastEDIRecordAdded = db.getLadstEDIadded();
                if (My.MyProject.Forms.FrmChangeEDI.changeEDIRadioButton.Checked)
                {
                    DateTime modDateTime;
                    DateTime modDateTimeSTR;
                    modDateTimeSTR = Conversions.ToDate(My.MyProject.Forms.FrmChangeEDI.EDIDateTimePicker.Value.ToShortDateString() + " " + My.MyProject.Forms.FrmChangeEDI.EdiTimePicker.Value.ToShortTimeString());
                    modDateTime    = Convert.ToDateTime(modDateTimeSTR);
                    db.saveEDIModifiedRecord(lastEDIRecordAdded, modDateTime);
                    // db.UpdatePreSendStatus(recordID, True)
                    db.pushEDIRequest(recordID, false, true, lastEDIRecordAdded, modDateTime);
                }
                else
                {
                    DateTime gateDateTime;
                    DateTime gateDateTimeTR;
                    gateDateTimeTR = Conversions.ToDate(dateDateTimePicker.Value.ToShortDateString() + " " + timeDateTimePicker.Value.ToShortTimeString());
                    gateDateTime   = Convert.ToDateTime(gateDateTimeTR);
                    // db.UpdatePreSendStatus(recordID, True)
                    db.pushEDIRequest(recordID, false, true, lastEDIRecordAdded, gateDateTime);
                }
            }

            cleanFields();
            for (int i = 0, loopTo = My.MyProject.Forms.FrmInOutGate.OutGateDataGridView.Rows.Count - 1; i <= loopTo; i++)
            {
                My.MyProject.Forms.FrmInOutGate.OutGateDataGridView.Rows[i].Cells[1].Value = false;
            }
            My.MyProject.Forms.FrmInOutGate.isRefresh = true;
            My.MyProject.Forms.FrmInOutGate.tabinoutGate.SelectedIndex = 1;
            My.MyProject.Forms.FrmInOutGate.getInOutContainers();
            My.MyProject.Forms.FrmInOutGate.checkButtons();
            Close();
        }
Ejemplo n.º 16
0
        private void createTransfetTouchButton_Load(object sender, EventArgs e)
        {
            string companyCode;
            string fromTerminal;
            string toTerminal;
            string typeOfTransfer;

            if (statusComboBox.SelectedItem.Equals("Empty"))
            {
                weightTextBox.Text = 0.ToString();
            }

            foreach (DataGridViewRow containerNumber in okToTransferDataGrid.Rows)
            {
                char[] c = new char[] { ')' };
                char[] d = new char[] { '(' };
                companyCode  = Conversions.ToString(truckerComboBox.SelectedItem.ToString().Split(c)[0].Split(d)[1]).ToUpper();
                fromTerminal = Conversions.ToString(fromComboBox.SelectedItem.ToString().Split(c)[0].Split(d)[1]).ToUpper();
                toTerminal   = Conversions.ToString(toComboBox.SelectedItem.ToString().Split(c)[0].Split(d)[1]).ToUpper();
                if (dueTypeBunifuDropdown.SelectedItem.Equals("Days"))
                {
                    due = DateAndTime.Now.AddDays((double)NumericUpDown.Value);
                }
                else if (dueTypeBunifuDropdown.SelectedItem.Equals("Weeks"))
                {
                    due = DateAndTime.Now.AddDays((double)(NumericUpDown.Value * 7m));
                }
                else if (dueTypeBunifuDropdown.SelectedItem.Equals("Months"))
                {
                    due = DateAndTime.Now.AddMonths((int)Math.Round(NumericUpDown.Value));
                }

                if ((fromTerminal.Equals("LINDSEY") | fromTerminal.Equals("EWEN")) & (toTerminal.Equals("LINDSEY") | toTerminal.Equals("EWEN")))
                {
                    typeOfTransfer = "INTERNAL";
                }
                else if (!(fromTerminal.Equals("LINDSEY") | fromTerminal.Equals("EWEN")) & (toTerminal.Equals("LINDSEY") | toTerminal.Equals("EWEN")))
                {
                    typeOfTransfer = "INBOUND";
                }
                else if ((fromTerminal.Equals("LINDSEY") | fromTerminal.Equals("EWEN")) & !(toTerminal.Equals("LINDSEY") | toTerminal.Equals("EWEN")))
                {
                    typeOfTransfer = "OUTBOUND";
                }
                else
                {
                    typeOfTransfer = "EXTERNAL";
                }

                try
                {
                    var dateOfCreation = DateAndTime.Now;
                    db.saveAlowedTransfer(My.MyProject.Forms.FrmLoginWindow._userID, Conversions.ToString(containerNumber.Cells[0].Value), companyCode, Conversions.ToString(sizeComboBox.SelectedItem.ToString().Replace("'", "")), Conversions.ToString(statusComboBox.SelectedItem), weightTextBox.Text, fromTerminal, toTerminal, due.Date, typeOfTransfer, dateOfCreation);
                    string condition = "where [Date of Creation] = '" + Conversions.ToString(dateOfCreation) + "' order by ID DESC";
                    string message   = "New " + typeOfTransfer + " transfer has been created";

                    // dbCeresLogs.saveAlowedTransfer(FrmLoginWindow._userID, containerNumber.Cells(0).Value, companyCode,
                    // sizeComboBox.SelectedItem.Replace("'", ""), statusComboBox.SelectedItem,
                    // weightTextBox.Text, fromTerminal, toTerminal, due.Date, typeOfTransfer, dateOfCreation)

                    int recordID = Conversions.ToInteger(dbCeres.getTableInfo("[Allowed Transfers]", "ID", condition).Rows[0]["ID"]);
                    EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), "CREATE", "TRANSFER", message);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject("There was an error saving transfer of Container #: ", containerNumber.Cells[0].Value), ". Error: "), ex.Message)));
                }
            }

            titlewarningLabel.Text      = "The containers were added to the allowed transfer list successfuly!";
            titlewarningLabel.ForeColor = Color.Green;
            cleanDataGrids();
            explanationTableLayoutPanel.Hide();
        }
Ejemplo n.º 17
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();
        }
Ejemplo n.º 18
0
        /* TODO ERROR: Skipped RegionDirectiveTrivia */

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dtpERD.CustomFormat == "MMM dd, yyyy")
            {
                ERDDate = Conversions.ToString(dtpERD.Value);
            }

            if (dtpETD.CustomFormat == "MMM dd, yyyy")
            {
                ETDDate = Conversions.ToString(dtpETD.Value);
            }

            if (dtpLRD.CustomFormat == "MMM dd, yyyy")
            {
                LRDDate = Conversions.ToString(dtpLRD.Value);
            }

            if (dtpETA.CustomFormat == "MMM dd, yyyy")
            {
                ETADate = Conversions.ToString(dtpETA.Value);
            }

            if (VerifyFieldsIsEmpty())
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Please enter values for the fields.", "Fields that are highlighted cannot be empty.", this);
                return;
            }

            if (VerifyLRDIsMoreOrEqualToday(Conversions.ToDate(LRDDate)) == false)
            {
                dtpLRD.BackColor = Color.LightCoral;
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Please verify field LRD.", "LRD must have a date greater than or equal to today's date.", this);
                return;
            }

            if (CompareETDIsEqualOrMoreLRD(Conversions.ToDate(ETDDate), Conversions.ToDate(LRDDate)) == false)
            {
                dtpETD.BackColor = Color.LightCoral;
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Please verify fields ETD and LRD.", "ETD must have a date greater than or equal to LRD date.", this);
                return;
            }

            if (VesselVoyageId == 0)
            {
                // 5 - Verify Duplicate voyage
                if (VesselVoyageService.GetUniqueActiveVoyageByVoyageNumber_Vessel_Port(txtVoyageNumber.Text, Conversions.ToInteger(cboVessel.SelectedValue), Conversions.ToInteger(cboCompany.SelectedValue)))
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("It is not possible to include the voyage", "There is already an active Vessel Voyage for this Vessel for the same Port Name", this);
                    return;
                }

                if (VesselVoyageService.Insert(txtVoyageNumber.Text, ERDDate, LRDDate, ETADate, ETDDate, txtCity.Text, cboCountry.Text, ckbActive.Checked, Conversions.ToInteger(cboVoyageStatus.SelectedValue), Conversions.ToInteger(cboVessel.SelectedValue), Conversions.ToInteger(cboCompany.SelectedValue)))
                {
                    if (EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, VesselVoyageService.GetLastVesselVoyageId().ToString(), "INSERT", "VESSEL VOYAGE", "Create of vessel voyage information"))
                    {
                    }

                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("The vessel voyage has been successfully inserted.", "", this);
                    var comp = cboCompany.Text.Split('-');
                    My.MyProject.Forms.frmVesselVoyageList.LoadFormAddItem(Conversions.ToInteger(VesselVoyageService.GetLastVesselVoyageId().ToString()), txtVoyageNumber.Text, ERDDate, LRDDate, ETADate, ETDDate, Convert.ToDateTime(LRDDate), txtCity.Text, cboCountry.Text, ckbActive.Checked, Conversions.ToInteger(cboVessel.SelectedValue), Conversions.ToInteger(cboCompany.SelectedValue), Conversions.ToInteger(cboVoyageStatus.SelectedValue), cboVessel.Text, cboVoyageStatus.Text, cboCompany.Text, comp[0].Trim(), comp[1].TrimEnd());
                    My.MyProject.Forms.frmVesselVoyageList.SearchByColumn();
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error inserting the vessel voyage, try again if the error persists inform the IT department. #1353", "ERROR", this);
                }
            }
            else
            {
                // 5 - Verify Duplicate voyage
                if (VesselVoyageService.GetUniqueActiveVoyageByVoyageNumber_Vessel_Port_Update(txtVoyageNumber.Text, Conversions.ToInteger(cboVessel.SelectedValue), Conversions.ToInteger(cboCompany.SelectedValue), VesselVoyageId) == false)
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("There is already an active Vessel Voyage for this Vessel for the same Port Name. Try again.", "", this);
                    return;
                }

                if (VesselVoyageService.Update(VesselVoyageId, txtVoyageNumber.Text, ERDDate, LRDDate, ETADate, ETDDate, txtCity.Text, cboCountry.Text, ckbActive.Checked, Conversions.ToInteger(cboVoyageStatus.SelectedValue), Conversions.ToInteger(cboVessel.SelectedValue), Conversions.ToInteger(cboCompany.SelectedValue)))
                {
                    if (EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, VesselVoyageId.ToString(), "UPDATE", "VESSEL VOYAGE", "Edition of vessel voyage information"))
                    {
                    }

                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Vessel voyage has been updated successfully.", "Updated!", this);
                    My.MyProject.Forms.frmVesselVoyageList.LoadForm();
                    My.MyProject.Forms.frmVesselVoyageList.SearchByColumn();
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error updating the vessel voyage, try again if the error persists inform the IT department. #1354", "Error", this);
                }
            }

            Close();
        }
Ejemplo n.º 19
0
        private void changeEDIButton_Click(object sender, EventArgs e)
        {
            int             recordID;
            DataGridViewRow row;
            DateTime        gateDateTime;
            int             lastEDIRecordAdded;

            {
                var withBlock = My.MyProject.Forms.FrmEDIManagement;
                if (ediMode.Equals("RESEND"))
                {
                    MdlLoadingSetting.waitForm.Show();
                    // selectedIDs = .getSelectedContIDs(.InGateDataGridView)

                    foreach (DataGridViewRow currentRow in My.MyProject.Forms.FrmEDIManagement.InGateDataGridView.Rows)
                    {
                        row = currentRow;
                        if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(row.Cells[1].Value, true, false)))
                        {
                            recordID     = Conversions.ToInteger(row.Cells[0].Value);
                            gateDateTime = Convert.ToDateTime(row.Cells[9].Value);
                            EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), "CREATE", "IN-GATE", "Requested EDI to be RESENT");
                            db.AddEDILog(recordID, "IN-GATE", "IN GATE - Resend EDI");
                            lastEDIRecordAdded = db.getLadstEDIadded();
                            DateTime EDIDateTime;
                            if (systemEDIRadioButton.Checked)
                            {
                                db.saveEDIModifiedRecord(lastEDIRecordAdded, gateDateTime);
                                db.pushEDIRequest(recordID, true, false, lastEDIRecordAdded, gateDateTime);
                            }
                            else
                            {
                                string EDIdateTimeSrt;
                                EDIdateTimeSrt = EDIDateTimePicker.Value.ToShortDateString() + " " + EdiTimePicker.Value.ToShortTimeString();
                                EDIDateTime    = Convert.ToDateTime(EDIdateTimeSrt);
                                db.pushEDIRequest(recordID, true, false, lastEDIRecordAdded, EDIDateTime);
                            }
                        }
                    }

                    withBlock.getEDIs(withBlock.InGateDataGridView);
                    MdlLoadingSetting.waitForm.Close();
                }
                else if (ediMode.Equals("PRE-SEND"))
                {
                    MdlLoadingSetting.waitForm.Show();
                    foreach (DataGridViewRow currentRow1 in My.MyProject.Forms.FrmEDIManagement.OutGateDataGridView.Rows)
                    {
                        row = currentRow1;
                        if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(row.Cells[1].Value, true, false)))
                        {
                            recordID     = Conversions.ToInteger(row.Cells[0].Value);
                            gateDateTime = DateAndTime.Now;
                            EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), "CREATE", "OUT-GATE", "Requested EDI to be PRE-SENT");
                            db.AddEDILog(recordID, "OUT-GATE", "OUT GATE - Pre-Send EDI");
                            lastEDIRecordAdded = db.getLadstEDIadded();
                            DateTime EDIDateTime;
                            if (systemEDIRadioButton.Checked)
                            {
                                // EDIHelper.EDIContainers(selContainer.Value, ediMode, False, selContainer.Key)

                                db.saveEDIModifiedRecord(lastEDIRecordAdded, gateDateTime);
                                db.UpdatePreSendStatus(recordID, true);
                                db.pushEDIRequest(recordID, false, true, lastEDIRecordAdded, gateDateTime);
                            }
                            else
                            {
                                string EDIdateTimeSrt;
                                EDIdateTimeSrt = EDIDateTimePicker.Value.ToShortDateString() + " " + EdiTimePicker.Value.ToShortTimeString();
                                EDIDateTime    = Convert.ToDateTime(EDIdateTimeSrt);
                                db.UpdatePreSendStatus(recordID, true);
                                db.pushEDIRequest(recordID, false, true, lastEDIRecordAdded, Conversions.ToDate(EDIdateTimeSrt));
                            }
                        }
                    }

                    withBlock.getEDIs(withBlock.OutGateDataGridView);
                    MdlLoadingSetting.waitForm.Close();
                }
            }

            Hide();
        }
Ejemplo n.º 20
0
        private void yesBunifuButton_Click(object sender, EventArgs e)
        {
            buttonPressed = "Yes";
            MdlLoadingSetting.waitForm.Show();
            int    recordID = 0;
            object dataRows;
            string tabName = "";

            if (deleteRecord.Equals("InGate"))
            {
                for (int i = 0, loopTo = My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows.Count - 1; i <= loopTo; i++)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows[i].Cells[1].Value, true, false)))
                    {
                        recordID = Conversions.ToInteger(My.MyProject.Forms.FrmInOutGate.InGateDataGridView.Rows[i].Cells[0].Value);
                        break;
                    }
                }

                // dataRows = dbCeres.getTableInfo("[Containers In-Out]", "*", "where [Unique ID] = " + recordID.ToString).Rows(0)
                dbCeres.deleteRows("[Containers In-Out]", "where [Unique ID] = " + recordID.ToString());
                tabName = "IN-GATE";

                // dbLogs.createInOutGateLog(dataRows)

                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), "DELETE", tabName, "");
                My.MyProject.Forms.FrmInOutGate.getInOutContainers();
            }
            else if (deleteRecord.Equals("OutGate"))
            {
                for (int i = 0, loopTo1 = My.MyProject.Forms.FrmInOutGate.OutGateDataGridView.Rows.Count - 1; i <= loopTo1; i++)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(My.MyProject.Forms.FrmInOutGate.OutGateDataGridView.Rows[i].Cells[1].Value, true, false)))
                    {
                        recordID = Conversions.ToInteger(My.MyProject.Forms.FrmInOutGate.OutGateDataGridView.Rows[i].Cells[0].Value);
                        break;
                    }
                }

                dbCeres.clearOutGate(recordID.ToString());
                tabName = "OUT-GATE";
                EmployeeActivityLogService.Insert(My.MyProject.Forms.FrmLoginWindow._userID, recordID.ToString(), "DELETE", tabName, "");
                My.MyProject.Forms.FrmInOutGate.getInOutContainers();
            }
            else if (deleteRecord.Equals("Transfer"))
            {
                // Dim currentRow As Integer = FrmListTransfers.transfersBunifuDataGridView.CurrentRow.Index
                for (int i = My.MyProject.Forms.FrmListTransfers.transfersBunifuDataGridView.Rows.Count - 1; i >= 0; i -= 1)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(My.MyProject.Forms.FrmListTransfers.transfersBunifuDataGridView.Rows[i].Cells[1].Value, true, false)))
                    {
                        recordID = Conversions.ToInteger(My.MyProject.Forms.FrmListTransfers.transfersBunifuDataGridView.Rows[i].Cells[0].Value);
                        dbCeres.deleteRows("[Allowed Transfers]", "where [ID] = " + recordID.ToString());
                        My.MyProject.Forms.FrmListTransfers.transfersBunifuDataGridView.Rows.RemoveAt(i);
                    }
                }
            }
            else if (deleteRecord.Equals("Block"))
            {
                // Dim currentRow As Integer = FrmListTransfers.transfersBunifuDataGridView.CurrentRow.Index
                for (int i = My.MyProject.Forms.FrmListBlockedContainers.blockContBunifuDataGridView.Rows.Count - 1; i >= 0; i -= 1)
                {
                    if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(My.MyProject.Forms.FrmListBlockedContainers.blockContBunifuDataGridView.Rows[i].Cells[1].Value, true, false)))
                    {
                        recordID = Conversions.ToInteger(My.MyProject.Forms.FrmListBlockedContainers.blockContBunifuDataGridView.Rows[i].Cells[0].Value);
                        dbCeres.deleteRows("[Blocked Containers]", "where [ID] = " + recordID.ToString());
                        My.MyProject.Forms.FrmListBlockedContainers.blockContBunifuDataGridView.Rows.RemoveAt(i);
                    }
                }
            }
            else if (deleteRecord.Equals("assign"))
            {
                My.MyProject.Forms.FrmAssignContainer.isDeletedFromExcel = true;
                Close();
            }
            else if (deleteRecord.Equals("Booking"))
            {
            }

            // Dim currentRow As Integer = FrmListTransfers.transfersBunifuDataGridView.CurrentRow.Index
            // Dim bokngNumb As String = FrmBookingList.selectedBookings(0)
            // dbCeres.deleteRows("[Bookings]", "where [Booking Number] = '" + bokngNumb + "'")
            // FrmBookingList.FetchBookingListing(True, "")
            else
            {
                Close();
            }
            // record deletion into Logs Database

            mainMessageLabel.Text        = "Record was deleted successfully";
            imageWarningLabel.ImageIndex = 1;
            tileLabel.Hide();
            confirmationPanel.Hide();
            confirmationBunifuTextBox.Text = "";
            ButtonPanel.Hide();
            MdlLoadingSetting.waitForm.Close();
        }