Пример #1
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            Employees_Tbl a1 = (Employees_Tbl)CB.SelectedItem;
            Employees_Tbl a2 = (from s in db.Employees_Tbl where s.EmpId == a1.EmpId select s).FirstOrDefault();

            a2.EmpName     = EmpN.Text;
            a2.EmpMail     = EmpE.Text;
            a2.EmpAddress  = EmpA.Text;
            a2.EmpFunction = EmpF.Text;
            a2.EmpPhone    = EmpP.Text;

            db.SaveChanges();
            updateCB();
            UpdateDGV();
        }
Пример #2
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            /*מעביר את הנתונים שהוכנסו למשתנה מתאים
             * EmpN name of textBox*/
            String Name     = EmpN.Text;
            String Email    = EmpE.Text;
            String Phone    = EmpP.Text;
            String Function = EmpF.Text;
            String Address  = EmpA.Text;



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

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

            a1.EmpName     = Name;
            a1.EmpMail     = Email;
            a1.EmpPhone    = Phone;
            a1.EmpFunction = Function;
            a1.EmpAddress  = Address;



            db.Employees_Tbl.Add(a1);
            db.SaveChanges();
            this.Title = "Employe Add";

            EmpN.Text = "";
            EmpE.Text = "";
            EmpP.Text = "";
            EmpF.Text = "";
            EmpA.Text = "";

            this.Title = "sucsses";
            UpdateDGV();
            updateCB();
        }
Пример #3
0
        private void CB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            /* combobox change*/
            Employees_Tbl a1 = (Employees_Tbl)CB.SelectedItem;

            if (a1 == null)
            {
                EmpN.Text = "";
                EmpE.Text = "";
                EmpP.Text = "";
                EmpF.Text = "";
                EmpA.Text = "";
                return;
            }
            EmpN.Text = a1.EmpName;
            EmpE.Text = a1.EmpMail;
            EmpP.Text = a1.EmpPhone;
            EmpF.Text = a1.EmpFunction;
            EmpA.Text = a1.EmpAddress;
        }