105 lines
3.1 KiB
C#
105 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
|
|
using ENI2.Controls;
|
|
using bsmd.database;
|
|
|
|
namespace ENI2.EditControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for EditCallPurposeDialog.xaml
|
|
/// </summary>
|
|
public partial class EditCallPurposeDialog : EditWindowBase
|
|
{
|
|
|
|
private static string[] edifact8025Codes =
|
|
{
|
|
"",
|
|
"Cargo operations",
|
|
"Passenger movement",
|
|
"Taking bunkers",
|
|
"Changing crew",
|
|
"Goodwill visit",
|
|
"Taking supplies",
|
|
"Repair",
|
|
"Laid-up",
|
|
"Awaiting orders",
|
|
"Miscellaneous",
|
|
"Crew movement",
|
|
"Cruise, leisure and recreation",
|
|
"Under government order",
|
|
"Quarantine inspection",
|
|
"Refuge",
|
|
"Unloading cargo",
|
|
"Loading cargo",
|
|
"Repair in dry dock",
|
|
"Repair in wet dock",
|
|
"Cargo tank cleaning",
|
|
"Means of transport customs clearance",
|
|
"De-gassing",
|
|
"Waste disposal"
|
|
};
|
|
|
|
private List<string> itemList = null;
|
|
|
|
public EditCallPurposeDialog()
|
|
{
|
|
InitializeComponent();
|
|
|
|
Loaded += EditCallPurposeDialog_Loaded;
|
|
|
|
}
|
|
|
|
public CallPurpose CallPurpose { get; set; }
|
|
|
|
public List<string> EdiCodes
|
|
{
|
|
get
|
|
{
|
|
if(itemList == null)
|
|
{
|
|
this.itemList = new List<string>();
|
|
for (int i = 0; i < edifact8025Codes.Length; i++)
|
|
this.itemList.Add(string.Format("{0} - {1}", i, edifact8025Codes[i]));
|
|
}
|
|
return itemList;
|
|
}
|
|
}
|
|
|
|
private void EditCallPurposeDialog_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
this.OKClicked += EditCallPurposeDialog_OKClicked;
|
|
|
|
this.comboBoxCode.ItemsSource = this.EdiCodes;
|
|
if(this.CallPurpose != null)
|
|
{
|
|
this.comboBoxCode.SelectedIndex = this.CallPurpose.CallPurposeCode;
|
|
this.textBoxDescription.Text = this.CallPurpose.CallPurposeDescription;
|
|
}
|
|
}
|
|
|
|
private void EditCallPurposeDialog_OKClicked()
|
|
{
|
|
// copy selected values back into entity
|
|
this.CallPurpose.CallPurposeCode = this.comboBoxCode.SelectedIndex;
|
|
this.CallPurpose.CallPurposeDescription = this.textBoxDescription.Text;
|
|
}
|
|
|
|
private void comboBoxCode_Selected(object sender, RoutedEventArgs e)
|
|
{
|
|
this.textBoxDescription.Text = edifact8025Codes[this.comboBoxCode.SelectedIndex];
|
|
}
|
|
}
|
|
}
|