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 LinkOrImportAyaObject : Form
    {

        public string SelectedQBItemName
        {
            get
            {
                return ((DataRowView)cbQBItems.SelectedItem).Row[1].ToString();
            }
        }

        public string SelectedQBItemId
        {
            get
            {
                return ((DataRowView)cbQBItems.SelectedItem).Row[0].ToString();
            }
        }

        public DataTable QBItems { get; set; }
        public string AyaItemName { get; set; }
        public string Choice { get; set; } = "CANCEL";

        public bool CanImport { get; set; }

        public LinkOrImportAyaObject()
        {
            InitializeComponent();
        }

        private void LinkOrImportAyaObject_Load(object sender, EventArgs e)
        {

            lblTitle.Text = AyaItemName;
            cbQBItems.DataSource = QBItems;
            cbQBItems.DisplayMember = "FullName";
            cbQBItems.ValueMember = "ID";
            btnCancel.Text = util.AyaTranslations["Cancel"];
            btnOK.Text = util.AyaTranslations["OK"];
            lblImport.Visible = btnImport.Visible = CanImport;
        }


        private void btnCancel_Click(object sender, EventArgs e)
        {
            Choice = "CANCEL";
            DialogResult = DialogResult.Cancel;
            Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            Choice = "LINK";
            DialogResult = DialogResult.OK;
            Close();
        }

        private void btnImport_Click(object sender, EventArgs e)
        {
            Choice = "IMPORT";
            DialogResult = DialogResult.OK;
            Close();
        }
    }//eoc
}//eons
