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

            a2.WorkShopDate         = WorkD.Text;
            a2.WorkShopName         = WorkN.Text;
            a2.WorkShopEmployee     = (Ecombo.SelectedItem as Employees_Tbl).EmpId;
            a2.WorkShopEmployeeName = (Ecombo.SelectedItem as Employees_Tbl).EmpName;


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

            if (a1 == null)
            {
                WorkN.Text  = "";
                WorkD.Text  = "";
                Ecombo.Text = "";

                return;
            }
            WorkN.Text  = a1.WorkShopName;
            WorkD.Text  = a1.WorkShopDate;
            Ecombo.Text = a1.Employees_Tbl.EmpName;
        }
Пример #3
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            int    Emp;
            String Name    = WorkN.Text;
            String Date    = WorkD.Text;
            String EmpName = (Ecombo.SelectedItem as Employees_Tbl).EmpName;

            try { Emp = (Ecombo.SelectedItem as Employees_Tbl).EmpId; }
            catch
            {
                this.Title = "Erorr";
                return;
            }

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

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

            a1.WorkShopDate         = Date;
            a1.WorkShopName         = Name;
            a1.WorkShopEmployee     = Emp;
            a1.WorkShopEmployeeName = EmpName;



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

            WorkD.Text  = "";
            WorkN.Text  = "";
            Ecombo.Text = "";


            this.Title = "sucsses";
            UpdateDGV();
            updateCB();
        }