private void costumercombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (sender is ComboBox && ((ComboBox)sender).SelectedIndex > -1)
     {
         BE.Costumer c = GetSelecetdCostumer();
         order.costumerTz = c.tz;
     }
 }
        private void tzComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            object a = tzComboBox.SelectedValue;

            BE.Costumer b = a as BE.Costumer;
            //if (a == null)
            //throw new Exception("must select costumer first");
            c.tz = b.tz;
        }
 public deleteCostumerWindow()
 {
     InitializeComponent();
     c = new BE.Costumer();
     this.DataContext = c;
     bl = BL.FactoryBL.GetBL();
     tzComboBox.ItemsSource = bl.listCostumers();
     //tzComboBox.DisplayMemberPath = "tz";
     //tzComboBox.DataContext = c.tz;//brirat mechdal
 }
        private void tzComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            object a = tzComboBox.SelectedValue;

            BE.Costumer b = a as BE.Costumer;
            if (a == null)
            {
                throw new Exception("must select costumer first");
            }
            c           = b;
            DataContext = b;
        }
Exemplo n.º 5
0
        public AddCostumerWindow()
        {
            try {
                InitializeComponent();
                costumerr        = new BE.Costumer();
                this.DataContext = costumerr;

                bl = BL.FactoryBL.GetBL();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private BE.Costumer GetSelecetdCostumer()
        {
            object a = costumercombobox.SelectedValue;

            //object b = DS.DataSource.costumerList.FirstOrDefault(s => s.tz == a.ToString());
            BE.Costumer c = a as BE.Costumer;
            if (a == null)
            {
                throw new Exception("must select costumer first");
            }
            else
            {
                return(c);
            }
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.SetCostumer(c);
                MessageBox.Show("Costumer  " + c.costumerName + " was updated successfully");
                //MessageBox.Show("עודכן בהצלחה" + c.costumerName + " לקוח ");

                c = new BE.Costumer();
                this.DataContext = c;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 8
0
        private void addcostumerbutton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.AddCostumer(costumerr);
                MessageBox.Show("Costumer  " + costumerr.costumerName + " was added successfully");
                //MessageBox.Show("הוסף בהצלחה" + costumerr.costumerName + " לקוח ");

                costumerr        = new BE.Costumer();
                this.DataContext = costumerr;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.DeleteCostumer(c.tz);
                MessageBox.Show("Costumer  " + c.tz + " was deleted successfully");
                // if((BE.language)MainWindow.LanguageProperty.PropertyType==  BE.language.עברית)
                //MessageBox.Show("נמחק בהצלחה" + c.tz + " לקוח ");

                //tzComboBox.ItemsSource = bl.listCostumers();
                //tzComboBox.DisplayMemberPath = "tz";

                c = new BE.Costumer();
                this.DataContext = c;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void updatebutton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if ((DateTime)dateDatePicker.SelectedDate < DateTime.Now)
                {
                    throw new Exception("canot udate order with a date that already passed...");
                }

                object      b  = branchNumberComboBox.SelectedValue;
                BE.Branch   bb = b as BE.Branch;
                object      c  = comboBox_Copy.SelectedValue;
                BE.Costumer cc = c as BE.Costumer;


                order.branchNumber = bb.branchNumber;
                order.costumerTz   = cc.tz;
                order.Hechsher     = (BE.hechsher)hechsherComboBox.SelectedValue;
                order.date         = (DateTime)dateDatePicker.SelectedDate;
                //DataContext = b;
                bl.SetOrder(order);
                MessageBox.Show("order: " + order.orderNumber + "  was updated");
                //MessageBox.Show("עודכנה בהצלחה" + order.orderNumber + " הזמנה ");

                order            = new BE.Order();
                this.DataContext = order;
                branchNumberComboBox.DataContext = "";
                hechsherComboBox.DataContext     = "";
                dateDatePicker.DataContext       = DateTime.Now;
                orderNumberCombotBox.DataContext = "";
                comboBox_Copy.DataContext        = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }