using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Windows.Forms; namespace AyaNovaQBI { public partial class SetWOStatus : Form { public SetWOStatus() { InitializeComponent(); } public string DialogTitle { get; set; } public string OptionTitle { get; set; } public string OptionDescription { get; set; } private long _SelectedStatus = 0; public long SelectedStatus { get { return (long)cbStatus.SelectedValue; } set { _SelectedStatus = value; } } private bool _Pre = true; /// /// Used to indicate if dialog should display for post or pre /// status /// public bool PreStatus { set { _Pre = value; } } private void SetWOStatus_Load(object sender, EventArgs e) { this.Text = DialogTitle; this.lblDescription.Text = OptionDescription; this.lblTitle.Text = OptionTitle; this.btnCancel.Text = util.AyaTranslations["Cancel"]; this.btnOK.Text = util.AyaTranslations["OK"]; List items = util.AyaWOStatusList.OrderBy(z => z.Name).Select(z => new NameIdItem { Id = z.Id, Name = z.Name }).ToList(); items.Insert(0, new NameIdItem { Id = 0, Name = _Pre ? "< Any status >" : "< Do not change status >" }); this.cbStatus.DataSource = items; this.cbStatus.DisplayMember = "Name"; this.cbStatus.ValueMember = "Id"; this.cbStatus.SelectedValue = _SelectedStatus; this.lblStatus.Text = util.AyaTranslations["WorkOrderStatus"]; ////NVCHANGED //GenericNVList ls = GenericNVList.GetList("aWorkorderStatus", "aID", "aName", true, false, false); //if (_Pre) // this.cbStatus.SelectedItem = this.cbStatus.Items.Add(Guid.Empty, "< Any status >"); //else // this.cbStatus.SelectedItem = this.cbStatus.Items.Add(Guid.Empty, "< Do not change status >"); //foreach (DictionaryEntry d in ls.BindableList) //{ // Guid gItem = new Guid(d.Key.ToString()); // Infragistics.Win.ValueListItem v = this.cbStatus.Items.Add(gItem, d.Value.ToString()); // if (_SelectedStatus == gItem) // { // this.cbStatus.SelectedItem = v; // } //} } private void SetWOStatus_FormClosing(object sender, FormClosingEventArgs e) { } private void btnOK_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; this.Close(); } } }