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

namespace Self_Project
{
    public partial class Prices : Form
    {
        public Prices()
        {
            InitializeComponent();
        }
        Reserve R = new Reserve();
        private void Prices_Load(object sender, EventArgs e)
        {
            StudentType M = new StudentType();
            M.ShowModels(txt_Student_Type);
        }

        private void LoadInformations()
        {
            if (!Functions.IsNumber(txt_Student_Type.SelectedValue.ToString())) return;
            R.LoadPrices(Convert.ToInt16(txt_Student_Type.SelectedValue));
            txt_Price1.TEXT = R.Price1.ToString();
            txt_Price2.TEXT = R.Price2.ToString();
            txt_Price3.TEXT = R.Price3.ToString();
        }

        private void T6_SelectedIndexChanged(object sender, EventArgs e)
        {
            LoadInformations();
        }

        private void Prices_Activated(object sender, EventArgs e)
        {
            LoadInformations();
        }

        private void btn_OK_Click(object sender, EventArgs e)
        {
            R.Price1 = Convert.ToInt32(txt_Price1.TEXT);
            R.Price2 = Convert.ToInt32(txt_Price2.TEXT);
            R.Price3 = Convert.ToInt32(txt_Price3.TEXT);
            R.SetPrices(Convert.ToInt16(txt_Student_Type.SelectedValue));            
            MessageBox.Show("اطلاعات قیمت ها، با موفقیت تغییر یافت", "قیمت غذاها", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}