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 FEQ0000.Purchase
{
    public partial class fMailForm : Form
    {
        public fMailForm()
        {
            InitializeComponent();
        }

        private void fMailForm_Load(object sender, EventArgs e)
        {
            var db = new DataClasses1DataContext();

            var mailform = db.MailForm.Where(t => t.cate == "PC").ToList();
            this.cmbForm.DataSource = mailform;
            this.cmbForm.DisplayMember = "title";
            this.cmbForm.ValueMember = "idx";
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var item = this.cmbForm.SelectedItem as MailForm;
            this.tbSubject.Text = item.subject;
            this.tbTo.Text = item.tolist;
            this.tbCC.Text = item.cc;
            this.tbBcc.Text = item.bcc;
            this.htmlEditor1.Html = item.body;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
        }
    }
}
