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

namespace Morakhassi
{
    public partial class frmDarsadEdt : Form
    {
        public frmDarsadEdt()
        {
            InitializeComponent();
        }

        private void tblMelkDetailsPricesBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.tblMelkDetailsPricesBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dtsArzeshGozari);

        }

        private void frmDarsadEdt_Load(object sender, EventArgs e)
        {
            Class.Class_Register_Logs _log = new Morakhassi.Class.Class_Register_Logs(this.Text + " Form Is Loaded.");
            // TODO: This line of code loads data into the 'dtsArzeshGozari.tblMelkDetailsPrices' table. You can move, or remove it, as needed.
            this.tblMelkDetailsPricesTableAdapter.Fill(this.dtsArzeshGozari.tblMelkDetailsPrices);

        }

        private void Btn_Add_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.tblMelkDetailsPricesBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dtsArzeshGozari);
            MessageBox.Show("عملیات ذخیره سازی انجام شد");
        }

        private void Btn_Delete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("آیا از حذف رکورد اطمینان دارید", "اخطار حذف", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
            if (dr == DialogResult.OK)
            {
                if (tblMelkDetailsPricesIDTextBox.Text == "")
                {
                    MessageBox.Show("ركوردي براي حذف انتخاب نشده است");
                    return;
                }
                else
                {
                    this.tblMelkDetailsPricesTableAdapter.DeleteQuery(long.Parse(tblMelkDetailsPricesIDTextBox.Text.Trim()));
                    this.tblMelkDetailsPricesTableAdapter.Fill(this.dtsArzeshGozari.tblMelkDetailsPrices);
                    MessageBox.Show("رکورد مورد نظر حذف گردید");
                }
            }

        }

        private void frmDarsadEdt_FormClosed(object sender, FormClosedEventArgs e)
        {
            Class.Class_Register_Logs _log = new Morakhassi.Class.Class_Register_Logs(this.Text + " Form Is Closed.");
        }

        private void Btn_Add1_Click(object sender, EventArgs e)
        {
            tblMelkDetailsPricesBindingSource.AddNew();
        }
    }
}
