private void pbxRefreshComboBox_Click(object sender, EventArgs e) { // WaitForm.Show(); VesselVoyageStatusBindingSource.DataSource = VesselVoyageStatusService.GetAll(); CountryBindingSource.DataSource = CountryService.GetAll(); CompaniesNameBindingSource.DataSource = CompanyService.GetCompaniesCodeAndNameByTypeId(5); VesselBindingSource.DataSource = VesselService.GetVesselByActive(true, true); // WaitForm.Close(); }
public ActionResult Index() { SearchReportViewModel vm = new SearchReportViewModel(); VesselService vesselSvc = new VesselService(); vm.Vessels = vesselSvc.GetVesselList(); return(View(vm)); }
/* 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(); }
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?", "", 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("✔")) { VesselService.UpdateIsActive(IdVessel, false); } } catch (Exception ex) { string a = ex.ToString(); } } My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Information updated successfully.", "", this); btnUpdateActive.Visible = false; } } else if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to activate the selected vessels?", "", 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("✔")) { VesselService.UpdateIsActive(IdVessel, true); } } catch (Exception ex) { string a = ex.ToString(); } } My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Information updated successfully.", "", this); btnUpdateActive.Visible = false; } LoadForm(); SearchByColumn(); }
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(); }
//TODO:Use dependency injection static void Main(string[] args) { //TODO:Use dependency injection IVesselRepository repository = new VesselRepository(); ILoggerService logger = new LoggerService(); VesselService vesselService = new VesselService(repository, logger); vesselService.Add(new Vessel() { VesselId = 1, Name = "Test" }); Console.WriteLine("Hello World!"); }
/* TODO ERROR: Skipped EndRegionDirectiveTrivia *//* TODO ERROR: Skipped RegionDirectiveTrivia */ public void LoadVessel(int VesselId) { if (VesselId == 0) { txtVesselName.Text = ""; txtVesselOwner.Text = ""; txtVesselManager.Text = ""; txtVesselCapacity.Text = ""; txtVesselYear.Text = ""; ckbActive.Checked = true; lblTitleVessel.Text = "Add Vessel"; CountryBindingSource.DataSource = CountryService.GetCountryDropBox(); cboFlag.Text = ""; } else { var L = VesselService.GetById(VesselId); CountryBindingSource.DataSource = CountryService.GetCountryDropBox(); foreach (var item in L) { txtVesselName.Text = item.VesselName; txtVesselOwner.Text = item.VesselOwner; txtVesselCapacity.Text = item.Capacity.ToString(); if (item.VesselYear is null) { txtVesselYear.Text = ""; } else { txtVesselYear.Text = item.VesselYear.ToString(); } txtVesselManager.Text = item.Manager; ckbActive.Checked = item.IsActiveVessel == true; lblTitleVessel.Text = "Update Vessel"; cboFlag.Text = item.Flag; } } }
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); } } }
public List <ReportDto> GetVesselReports(SearchReportViewModel vm, bool fetchNewData) { try { var selectedIMOs = new List <int>(); if (vm.SelectedIMOs != null && vm.SelectedIMOs.Any()) { selectedIMOs = vm.SelectedIMOs.ToList(); } var dateRange = vm.DateRange.Split('-'); DateTime dateFrom = Convert.ToDateTime(dateRange[0].Trim()); DateTime dateTo = Convert.ToDateTime(dateRange[1].Trim()); VesselService vesselSvc = new VesselService(); var results = vesselSvc.GetVesselsReports(selectedIMOs, dateFrom, dateTo, fetchNewData); return(results); } catch (Exception) { throw; } }
/* TODO ERROR: Skipped EndRegionDirectiveTrivia *//* TODO ERROR: Skipped RegionDirectiveTrivia */ public void LoadForm() { listVessel = VesselService.GetAll(); SearchByColumn(); }
private void SyncSave() { int countRow = 0; int IdVessel = 0; bool isActive = false; foreach (DataGridViewRow row in dgvVesselCSV.Rows) { countRow += 1; try { if (countRow < dgvVesselCSV.Rows.Count) { string VesselName = Conversions.ToString(row.Cells[0].Value); string Owner = Conversions.ToString(row.Cells[1].Value); string Manager = Conversions.ToString(row.Cells[2].Value); string Capacity = Conversions.ToString(row.Cells[3].Value); string Year = Conversions.ToString(row.Cells[4].Value); string Flag = Conversions.ToString(row.Cells[5].Value); string Active = Conversions.ToString(row.Cells[6].Value); IdVessel = VesselService.GetVesselIdByVesselName(VesselName); if (string.IsNullOrEmpty(Owner)) { Owner = ""; } if (string.IsNullOrEmpty(Manager)) { Manager = ""; } if (string.IsNullOrEmpty(Flag)) { Flag = ""; } if (Active.ToUpper().Equals("TRUE")) { isActive = true; } else { isActive = false; } if (string.IsNullOrEmpty(Capacity) | string.IsNullOrWhiteSpace(Capacity)) { Capacity = "0"; } if (string.IsNullOrEmpty(Year) | string.IsNullOrWhiteSpace(Year)) { Year = "0"; } if (IdVessel == 0) { if (VesselService.Insert(VesselName, Owner, Manager, Convert.ToDecimal(Capacity), Convert.ToInt32(Year), Flag, isActive)) { dgvVesselCSV.Rows.Remove((DataGridViewRow)row); } else { pnlMessage.Visible = true; } } else if (VesselService.Update(IdVessel, VesselName, Owner, Manager, Convert.ToDecimal(Capacity), Convert.ToInt32(Year), Flag, isActive)) { dgvVesselCSV.Rows.Remove((DataGridViewRow)row); } else { pnlMessage.Visible = true; } } } catch (Exception ex) { string a = ex.ToString(); pnlMessage.Visible = true; } } if (pnlMessage.Visible == false) { My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("", "Vessel updated successfully.", this); ClearDataGridView(); Close(); } }