using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AyaNovaQBI
{
    public partial class SetQBChargeAs : Form
    {
        public SetQBChargeAs()
        {
            InitializeComponent();
        }


        public string DialogTitle { get; set; }

        public string OptionTitle { get; set; }

        public string OptionDescription { get; set; }


        public DataTable QBItems { get; set; }
        public string SelectedQBItem
        {
            get
            {
                return cbQBItems.SelectedValue.ToString();
            }

            set
            {
                _selectedQBItem = value;
            }
        }
        private string _selectedQBItem;

        private void SetQBChargeAsLoad(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"];



            this.cbQBItems.DataSource = QBItems;
            this.cbQBItems.DisplayMember = "FullName";
            this.cbQBItems.ValueMember = "ID";


            this.lblStatus.Text = "QuickBooks item:";

            if (string.IsNullOrWhiteSpace(_selectedQBItem))
                cbQBItems.SelectedIndex = 0;
            else
                this.cbQBItems.SelectedValue = _selectedQBItem;

            ////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 btnOK_Click(object sender, EventArgs e)
        {

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
