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 Babebi4
{
	public partial class Form__Language__Create : Form
	{
		private MainForm mainForm;

		private BabebiDataSet.LanguageDataTable languageTable;

		#region		ctors

		public Form__Language__Create(MainForm mainForm) : this()
		{
			this.mainForm = mainForm;

			this.languageTable = this.mainForm.DataSet.Language;
		}

		public Form__Language__Create()
		{
			InitializeComponent();
		}

		#endregion	ctors

		private void button__Create__Click(object sender, EventArgs e)
		{
			string code = this.textBox__Code.Text;
			string name = this.textBox__Name.Text;

			if ( ! MainForm.UserEntryChecking(this.languageTable.CodeColumn, code)) { return; }
			if ( ! MainForm.UserEntryChecking(this.languageTable.NameColumn, name)) { return; }

			BabebiDataSet.LanguageRow language =	this.languageTable.AddLanguageRow(code, name, 0, 0);

			#region		build LetterOrSymbol_Language dataRows

			foreach (BabebiDataSet.LetterRow letter in this.mainForm.DataSet.Letter)
			{
			//moisi
			//	this.mainForm.DataSet.LetterOrSymbol_Language.AddLetterOrSymbol_LanguageRow(letter, language, "", "");
			}

			#endregion	build LetterOrSymbol_Language dataRows

			this.Close();
		}
	}
}
