using System;
using System.Data;
using System.Windows.Forms;

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


        public string DialogTitle { get; set; }

        public string OptionTitle { get; set; }

        public string OptionDescription { get; set; }


        public DataTable QBInvoiceTemplates { get; set; }



        public string SelectedQBInvoiceTemplate
        {
            get
            {
                return cbQBItems.SelectedValue.ToString();
            }

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

        private void SetQBClass_load(object sender, EventArgs e)
        {
            Text = DialogTitle;
            lblDescription.Text = OptionDescription;
            lblTitle.Text = OptionTitle;
            btnCancel.Text = util.AyaTranslations["Cancel"];
            btnOK.Text = util.AyaTranslations["OK"];

            cbQBItems.DataSource = QBInvoiceTemplates;
            cbQBItems.DisplayMember = "FullName";
            cbQBItems.ValueMember = "ID";
            lblStatus.Text = "QuickBooks invoice template:";

            if (string.IsNullOrWhiteSpace(_selectedQBInvoiceTemplate))
                cbQBItems.SelectedIndex = 0;
            else
                cbQBItems.SelectedValue = _selectedQBInvoiceTemplate;
        }


        private void btnOK_Click(object sender, EventArgs e)
        {

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