private void Button_Add(object sender, RoutedEventArgs e)
        {
            IntackForm ink = new IntackForm();

            ink.Name            = "frmAdd";
            ink.TxtID.IsEnabled = false;
            ink.ShowDialog();
        }
        private void lstBxInk_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int        ID = int.Parse(lstBxInk.SelectedValue.ToString());
            IntackForm tt = new IntackForm(ID);

            tt.TxtName.IsEnabled  = false;
            tt.TxtDesc.IsEnabled  = false;
            tt.TxtID.IsEnabled    = false;
            tt.btnsave.IsEnabled  = false;
            tt.btnclear.IsEnabled = false;
            //tt.BtnClear.Visibility = Visibility.Hidden;
            tt.ShowDialog();
        }
 private void Button_Update(object sender, RoutedEventArgs e)
 {
     if (lstBxInk.SelectedIndex < 0)
     {
         return;
     }
     else
     {
         int        ID  = int.Parse(lstBxInk.SelectedValue.ToString());
         IntackForm ink = new IntackForm(ID);
         ink.Name = "frmUdate";
         ink.ShowDialog();
     }
 }
        public void Add_Intak(IntackForm r)
        {
            if (r.TxtName.Text == null || r.TxtDesc.Text == null)
            {
                return;
            }
            if (r.TxtName.Text == "" || r.TxtDesc.Text == "")
            {
                MessageBox.Show("Please,Enter Name and Description ");
            }

            else
            {
                Intake intk = new Intake()
                {
                    Name        = r.TxtName.Text,
                    Description = r.TxtDesc.Text
                };

                context.Intake.Add(intk);
                context.SaveChanges();
                MessageBox.Show("intake inserted");
            }
        }
        public void Update_Intak(IntackForm n)
        {
            if (n.TxtName.Text == null || n.TxtDesc.Text == null)
            {
                return;
            }
            if (n.TxtName.Text == "" || n.TxtDesc.Text == "")
            {
                MessageBox.Show("Please,Enter Name and Description ");
            }
            else
            {
                int ID = int.Parse(n.TxtID.Text.ToString());

                var intk = (from k in context.Intake
                            where k.ID == ID
                            select k).FirstOrDefault();
                intk.Name        = n.TxtName.Text;
                intk.Description = n.TxtDesc.Text;

                context.SaveChanges();
                MessageBox.Show("Sucsesfuly Update");
            }
        }
 public void clear_Intak(IntackForm c)
 {
     c.TxtName.Text = "";
     c.TxtDesc.Text = "";
 }