Пример #1
0
        private void btnUpdateActive_Click(object sender, EventArgs e)
        {
            if (activeToggleSwitch.Value == true)
            {
                if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to disable the selected vessels voyage?", "", My.Resources.Resources.warning, this) == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in dgvVessel.Rows)
                    {
                        try
                        {
                            string value    = Conversions.ToString(row.Cells[0].Value);
                            short  IdVessel = Conversions.ToShort(row.Cells[1].Value);
                            if (!Information.IsNothing(value) && value.Equals("✔"))
                            {
                                VesselVoyageService.UpdateIsActive(IdVessel, false);
                            }
                        }
                        catch (Exception ex)
                        {
                            string a = ex.ToString();
                        }
                    }

                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Information updated successfully.", "", this);
                    btnUpdateActive.Visible = false;
                    cbCheckAll.Checked      = false;
                }
            }
            else if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to activate the selected vessels voyage?", "", My.Resources.Resources.warning, this) == DialogResult.Yes)
            {
                foreach (DataGridViewRow row in dgvVessel.Rows)
                {
                    try
                    {
                        string value    = Conversions.ToString(row.Cells[0].Value);
                        short  IdVessel = Conversions.ToShort(row.Cells[1].Value);
                        if (!Information.IsNothing(value) && value.Equals("✔"))
                        {
                            VesselVoyageService.UpdateIsActive(IdVessel, true);
                        }
                    }
                    catch (Exception ex)
                    {
                        string a = ex.ToString();
                    }
                }

                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Information updated successfully.", "", this);
                btnUpdateActive.Visible = false;
                cbCheckAll.Checked      = false;
            }

            waitLoading.Show();
            listVesselVoyage = VesselVoyageService.GetVesselVoyageListAll();
            SearchByColumn();
            waitLoading.Close();
        }
Пример #2
0
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia *//* TODO ERROR: Skipped RegionDirectiveTrivia */

        public void LoadForm()
        {
            listVesselVoyageStatus = VesselVoyageStatusService.GetAll();
            listCountry            = CountryService.GetCountryDropBox();
            listCompany            = CompanyService.GetCompaniesCodeAndNameByTypeId(5);
            listVessel             = VesselService.GetVesselByActive(true, true);
            VesselVoyageService.UpdateIsActiveDateLRDLessThanYesterday();
            listVesselVoyage = VesselVoyageService.GetVesselVoyageListAll();
            SearchByColumn();
        }
Пример #3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to delete this Vessel Voyage?", "", My.Resources.Resources.caution, this) == DialogResult.Yes)
     {
         if (VesselVoyageService.Delete(Conversions.ToInteger(dgvVessel.CurrentRow.Cells[1].Value)))
         {
             DeleteItemList(Conversions.ToInteger(dgvVessel.CurrentRow.Cells[1].Value));
             SearchByColumn();
             My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Vessel voyage was successfully deleted.", "Vessel deleted.", this);
             btnUpdateActive.Visible = false;
         }
         else
         {
             My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Vessel voyage cannot be deleted, try again or contact the IT department. #1536", "Error", this);
         }
     }
 }
Пример #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // Check if you have any VesselVoyage attached to this vessel
            if (VesselVoyageService.GetVerificationVesselVoyageByVesselId(Conversions.ToInteger(dgvVessel.CurrentRow.Cells[1].Value)))
            {
                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("This Vessel is connected to one or more trips, active or not active for this reason it cannot be excluded.", "Warning", this);
                return;
            }

            if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to delete this Vessel?", "", My.Resources.Resources.caution, this) == DialogResult.Yes)
            {
                if (VesselService.Delete(Conversions.ToInteger(dgvVessel.CurrentRow.Cells[1].Value)))
                {
                    LoadForm();
                    SearchByColumn();
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Vessel was successfully deleted.", "Vessel deleted.", this);
                }
                else
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Vessel cannot be deleted, try again or contact the IT department. #1536", "Error", this);
                }
            }
        }
Пример #5
0
 private void loginButton_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(usernameTextBox.Text) | string.IsNullOrEmpty(passwordTextBox.Text))
     {
         warningLabel.Text = "Fields cannot be empty";
     }
     else
     {
         db.checkLogin(Strings.Trim(usernameTextBox.Text), Strings.Trim(passwordTextBox.Text));
         if (db._userExists)
         {
             var employee = EmployeeService.GetById(db._ID);
             db.getClearanceLevel();
             _employeeName     = (employee.First_Name + " " + employee.Last_Name).ToUpper();
             payMethod         = employee.Pay_Method;
             warningLabel.Text = "";
             _userID           = employee.ID;
             Hide();
             MdlOptionsManagement.checkProbationReminders();
             MdlOptionsManagement.checkHolidayReminders();
             MdlOptionsManagement.checkBlockedContainers();
             My.MyProject.Forms.FrmParentScreen.Show();
             My.MyProject.Forms.FrmParentScreen.employeeNameLabel.Text = _employeeName;
             VesselVoyageService.UpdateIsActiveDateLRDLessThanYesterday();
             // Dim newMstream As New System.IO.MemoryStream(CType(db.getEmployeePicture(_userID), Byte()))
             // 'Create a new image from the bytes from the memory
             // Dim ImageFromDB As New Bitmap(newMstream)
             var ftpMdl      = new MdlFtp();
             var ImageFromDB = ftpMdl.GetFTPImage(employee.EmployeePicturePath);
             My.MyProject.Forms.FrmParentScreen.profileShapedPictureBox1.Image = ImageFromDB;
         }
         else
         {
             warningLabel.Text = "Wrong username or password";
         }
     }
 }
Пример #6
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();
        }
Пример #7
0
        public void LoadVesselVoyage()
        {
            //  WaitForm.Show();
            if (VesselVoyageId == 0)
            {
                txtCity.Text         = "";
                txtVoyageNumber.Text = "";
                LoadComboBox();
                cboCompany.Text      = "";
                cboCountry.Text      = "";
                cboVessel.Text       = "";
                cboVoyageStatus.Text = "";
                dtpLRD.CustomFormat  = " ";
                dtpETD.CustomFormat  = " ";
                dtpERD.CustomFormat  = " ";
                dtpETA.CustomFormat  = " ";
                lblTitleVessel.Text  = "Add Vessel Voyage";
            }
            else
            {
                var L = VesselVoyageService.GetById(VesselVoyageId);
                LoadComboBox();
                foreach (var item in L)
                {
                    txtVoyageNumber.Text     = item.VoyageNumber;
                    cboCompany.SelectedValue = item.PortId;
                    LoadCountryAndCity();
                    // cboCountry.Text = item.PortCountry
                    // txtCity.Text = item.PortCity
                    cboVessel.SelectedValue       = item.VesselId;
                    cboVoyageStatus.SelectedValue = item.VesselVoyageStatusId;
                    ckbActive.Checked             = item.IsActiveTrip == true;
                    if (item.LRD is null)
                    {
                        dtpLRD.CustomFormat = " ";
                    }
                    else
                    {
                        dtpLRD.Value = (DateTime)item.LRD;
                    }

                    if (item.ETD is null)
                    {
                        dtpETD.CustomFormat = " ";
                    }
                    else
                    {
                        dtpETD.Value = (DateTime)item.ETD;
                    }

                    if (item.ERD is null)
                    {
                        dtpERD.CustomFormat = " ";
                    }
                    else
                    {
                        dtpERD.Value = (DateTime)item.ERD;
                    }

                    if (item.ETA is null)
                    {
                        dtpETA.CustomFormat = " ";
                    }
                    else
                    {
                        dtpETA.Value = (DateTime)item.ETA;
                    }

                    lblTitleVessel.Text = "Update Vessel Voyage";
                }
            }

            //  WaitForm.Close();
        }