Ejemplo n.º 1
0
        public void Execute(object parameter)
        {
            var values = (Object[])parameter;
            var client = new BE.Client();

            client.Id = values[0].ToString();
            var PasswordBox = values[1] as PasswordBox;

            client.password = PasswordBox.Password.ToString();
            //call function in view model to check user
            String Id = lVm.CheckUser(client);

            if (Id != null)
            //save Id's user in client
            {
                Menu user = new Menu();
                user.Id = client.Id;
                user.init();
                lVm.UserControl = user;
            }
            else
            {
                MessageBox.Show("User does not exist!");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// בנאי שיופעל בחלון הוספת לקוח
 /// </summary>
 public addClientWindows()
 {
     InitializeComponent();
     newClient = new BE.Client();
     clientGrid.DataContext = newClient;
     ValueTitleButtom();//עריכת כותרת העמוד+כפתור השליחה שיתאימו לעמוד הוספה
 }
Ejemplo n.º 3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)//כפתור אישור
        {
            if (tex_num_ren.Text.Count() < 8)
            {
                tex_num_ren.Text = "0";
            }
            if (mspar_nahgim.SelectedIndex == -1)
            {
                MessageBox.Show("בחר כמות נהגים", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (data_car.SelectedIndex == -1)
            {
                MessageBox.Show("בחר מכונית", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (data_clie.SelectedIndex == -1 || data_clie.SelectedIndex >= 2)
            {
                MessageBox.Show("בעייה במספר הנהגים", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (!days.SelectedDate.HasValue || days.SelectedDate.Value < DateTime.Now)
            {
                MessageBox.Show("בחר לכמה ימים", "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }



            try
            {
                BE.Client cli = new BE.Client();
                cli = (BE.Client)data_clie.SelectedItem;

                int day = (days.SelectedDate.Value.Year - DateTime.Now.Year) * 365 + (days.SelectedDate.Value.Month - DateTime.Now.Month) * 30 + (days.SelectedDate.Value.Day - DateTime.Now.Day);
                bl.add_rent(new BE.Renting(long.Parse(tex_num_ren.Text), dra, num_car, day, DateTime.Now, days.SelectedDate.Value, false, star_KM, 0, false, 0));

                MessageBox.Show("ההזמנה התבצעה", "ברכות", MessageBoxButton.OK, MessageBoxImage.Information);
                foreach (BE.car item in bl.return_list(BE.retur.car))
                {
                    if (num_car == item.car_number)
                    {
                        bl.update_car(item, BE.update.panuy, false);
                        break;
                    }
                }
                data_clie.SelectedIndex = 0;
                this.Close();
            }
            catch (Exception exep)
            {
                MessageBox.Show(exep.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// כאשר לוחצים על שורה בטבלה הפונקציה תופעל ויפתח חלון עריכה של הלקוח
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void clickOnTableForUpdate(object sender, MouseButtonEventArgs e)
        {
            BE.Client client = new BE.Client();
            client = (BE.Client)(clientDataGrid.SelectedItem);

            Window AddClientWindows = new addClientWindows(client.idOfClient); // שליחת מספר ההלקוח לחלון עריכת מנה

            (AddClientWindows as addClientWindows).refresh += refreshTable;    //הרשמה לאירוע של חלון העריכה , יפעיל את ריענון הטבלה


            AddClientWindows.Show();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// בנאי שיופעל בחלון עריכת לקוח
        /// </summary>
        /// <param name="clientId">מספר זיהוי הלקוח אותו נערוך</param>
        public addClientWindows(uint clientId)
        {
            InitializeComponent();
            this.updateClientId = clientId;//קבלת מספר הלקוח שרוצים לעדכן

            newClient = new BE.Client();
            newClient = mybl.getClientByClientId(clientId);
            clientGrid.DataContext = newClient;



            ValueTitleButtom();//עריכת כותרת העמוד+כפתור השליחה שיתאימו לעמוד עריכה
        }
Ejemplo n.º 6
0
 public void addClient(BE.Client client)
 {
     try
     {
         this.checkAge(client.age);                    //בדיקת תקינות גיל
         checkDoubleName(client, client.nameOfClient); //בדיקה אם לא קיים שם הלקוח כבר
         myDal.addClient(client);                      //הוספת הלקוח
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 7
0
 public void updateClient(BE.Client client, string oldName)
 {
     checkAge(client.age);
     try
     {
         if (client.nameOfClient != oldName)//אם שונה השם לבדוק שהשם לא קיים כבר במערכת
         {
             checkDoubleName(client, client.nameOfClient);
         }
         myDal.updateClient(client);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            BL.IBL myBl = BL.FactoryBL.getBL();

            BE.Branch      branch      = new BE.Branch();
            BE.Client      client      = new BE.Client();
            BE.Dish        dish        = new BE.Dish();
            BE.Order       order       = new BE.Order();
            BE.OrderedDish orderedDish = new BE.OrderedDish();

            Console.WriteLine("Hello, this is a check");
            ConsoleKeyInfo input = new ConsoleKeyInfo();
            int            choice;

            while (true)
            {
                Console.WriteLine("enter your choice:");
                input  = Console.ReadKey();
                choice = int.Parse(input.KeyChar.ToString());

                switch (choice)
                {
                case 0:
                    break;

                case 3:
                    try
                    {
                        branch = init_branch(10, "g. mordechai", "vaad leumi", 123, "moshe", 12, 20, BE.Kosher.GLAT);
                        order  = init_order(1, DateTime.Now, 2, 3, false);
                        myBl.addOrder(order);
                        orderedDish = init_order_dish(1, 2, 3, BE.Kosher.GLAT, BE.SizeOfDish.LARGE);
                        myBl.addOrderedDish(orderedDish, order, branch);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    break;

                default:
                    Console.WriteLine("error");
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length < 7 ||
                textBox2.Text.Length < 3 ||
                textBox3.Text.Length < 10 ||
                textBox4.Text.Length < 12 ||
                dateTimePicker1.Enabled == false ||
                dateTimePicker2.Enabled == false)
            {
                MessageBox.Show("Error !! \nYou do not enter all the information on the right way. \n\nTry Again.",
                                "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }

            else
            {
                BE.Client newClient = new BE.Client(int.Parse(textBox1.Text), textBox3.Text, textBox2.Text, dateTimePicker1.Value, dateTimePicker2.Value, textBox4.Text);

                try
                {
                    bool result = bl.InsertClient(newClient);

                    if (result)
                    {
                        this.Close();
                        MessageBox.Show("The new client has been inserted. \n\nHis number ID is the number" + BE.Client.autoIncrement + ".",
                                        "Success",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Sorry. The new client wasn't inserted. Please try again.",
                                        "Error",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// מחיקת כל הקליינטים שנבחרו
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteClient_Click(object sender, RoutedEventArgs e)
        {
            var cellInfos = clientDataGrid.SelectedItems;
            int count     = clientDataGrid.SelectedItems.Count;

            for (int i = 0; i < count; i++)
            {
                BE.Client d = (BE.Client)clientDataGrid.SelectedItems[i];
                try
                {
                    mybl.deleteClient(d.idOfClient);
                }
                catch (Exception error)
                {
                    MessageBox.Show(error.Message);
                }
            }
            refreshTable();///ריענון הטבלה
        }
Ejemplo n.º 11
0
 public bool is_clint_young(BE.Client cli)
 {
     return(base.Channel.is_clint_young(cli));
 }
Ejemplo n.º 12
0
 public System.Threading.Tasks.Task add_clientAsync(BE.Client cli)
 {
     return(base.Channel.add_clientAsync(cli));
 }
Ejemplo n.º 13
0
 public void add_client(BE.Client cli)
 {
     base.Channel.add_client(cli);
 }
 public bool UpdateClient(BE.Client c)
 {
     return(base.Channel.UpdateClient(c));
 }
 public System.Threading.Tasks.Task <bool> UpdateClientAsync(BE.Client c)
 {
     return(base.Channel.UpdateClientAsync(c));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// check if client exists in database
 /// </summary>
 /// <param name="client"></param>
 /// <returns></returns>
 public String CheckUser(BE.Client client)
 {
     return(modelLogin.CheckUser(client));
 }
 public System.Threading.Tasks.Task <bool> InsertClientAsync(BE.Client c)
 {
     return(base.Channel.InsertClientAsync(c));
 }
Ejemplo n.º 18
0
 public System.Threading.Tasks.Task <bool> is_clint_youngAsync(BE.Client cli)
 {
     return(base.Channel.is_clint_youngAsync(cli));
 }
Ejemplo n.º 19
0
 public bool is_clint_young(BE.Client cli)
 {
     return(bl.is_clint_young(cli));
 }
Ejemplo n.º 20
0
 public void update_client(BE.Client cli, BE.update t, object obj)
 {
     bll.update_client(cli, t, obj);
     // throw new Exception("לא ניתן למימוש בשרת בגלל object");
 }
Ejemplo n.º 21
0
 public void del_client(BE.Client cli)
 {
     bl.del_client(cli.Id1);
 }
Ejemplo n.º 22
0
 public void add_client(BE.Client cli)
 {
     bl.add_client(cli);
 }
Ejemplo n.º 23
0
 /// <summary>
 ///check if user in data base
 /// </summary>
 /// <param name="client"></param>
 /// <returns></returns>
 public String CheckUser(BE.Client client)
 {
     return(bl.CheckUser(client));
 }
 public bool InsertClient(BE.Client c)
 {
     return(base.Channel.InsertClient(c));
 }