Пример #1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            String Name = PoolN.Text;
            String City = PoolC.Text;


            /*בודק שהוכנסו כל הנתונים שהם חובה
             * EmpN name of textBox*/
            if (PoolN.Text == "" || PoolC.Text == "")
            {
                this.Title = "Erorr";
                return;
            }

            /*   שומר את הנתונים שהוקלדו והוכנסו אל המשתנים המתאימים בטבלה
             * EmpName השם של העמודה בטבלה*/
            Pool_Tbl a1 = new Pool_Tbl();

            a1.PoolCity = City;
            a1.PoolName = Name;



            db.Pool_Tbl.Add(a1);
            db.SaveChanges();
            this.Title = "Employee Add";

            PoolN.Text = "";
            PoolC.Text = "";

            this.Title = "sucsses";
            UpdateDGV();
            updateCB();
        }
Пример #2
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            Pool_Tbl a1 = (Pool_Tbl)CB.SelectedItem;
            Pool_Tbl a2 = (from s in db.Pool_Tbl where s.PoolId == a1.PoolId select s).FirstOrDefault();

            a2.PoolCity = PoolC.Text;
            a2.PoolName = PoolC.Text;


            db.SaveChanges();
            updateCB();
            UpdateDGV();
        }
Пример #3
0
        private void CB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pool_Tbl a1 = (Pool_Tbl)CB.SelectedItem;

            if (a1 == null)
            {
                PoolN.Text = "";
                PoolC.Text = "";


                return;
            }
            PoolN.Text = a1.PoolName;
            PoolC.Text = a1.PoolCity;
        }