Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (textBoxEmail.Text == "" && textBoxName.Text != "" && textBoxPass.Text != null)
            {
                MessageBox.Show("Нового користувача не додано!\nПопробуйте ще раз!!!");
                return;
            }

            // Change my data
            if (IsChangeMyData == true)
            {
                actHomeBugaltery.SetCommand((int)HomeActionEnum.changeDataCurentUser, new ChangeCurentUserCommand(homeBugaltery,
                                                                                                                  curentUser.Id, textBoxEmail.Text, textBoxName.Text, textBoxPass.Text /*, curentUser.Family_Id*/));

                actHomeBugaltery.DoAction((int)HomeActionEnum.changeDataCurentUser);
            }
            else // add new User
            {
                actHomeBugaltery.SetCommand((int)HomeActionEnum.addNewUser, new AddNewUserCommand(homeBugaltery, textBoxEmail.Text, textBoxName.Text,
                                                                                                  textBoxPass.Text, curentUser.Family_Id));

                actHomeBugaltery.DoAction((int)HomeActionEnum.addNewUser);
            }

            updateUsers();
            panelAllUser.Enabled = true;

            textBoxEmail.Clear();
            textBoxName.Clear();
            textBoxPass.Clear();
        }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (comboBoxCategory.SelectedIndex == -1 || comboBoxUsers.SelectedIndex == -1 ||
                numericUpDownSumm.Value <= 0)
            {
                MessageBox.Show("Cannot add order!\nPlease check inputed data and try again!!!");
                return;
            }
            // Command change
            if (currentOrder != null)
            {
                actHomeBogaltery.SetCommand((int)HomeActionEnum.changeOrder, new ChangeOrderCommand(homeBugaltery, currentOrder.Id,
                                                                                                    comboBoxCategory.SelectedItem.ToString(), comboBoxUsers.SelectedItem.ToString(),
                                                                                                    dateTimePickerOrder.Value, numericUpDownSumm.Value,
                                                                                                    textBoxDescription.Text));
                actHomeBogaltery.DoAction((int)HomeActionEnum.changeOrder);
            }
            else
            {
                actHomeBogaltery.SetCommand((int)HomeActionEnum.addOrder,
                                            new AddNewOrderCommand(homeBugaltery, comboBoxCategory.SelectedItem.ToString(), comboBoxUsers.SelectedItem.ToString(),
                                                                   dateTimePickerOrder.Value, numericUpDownSumm.Value,
                                                                   textBoxDescription.Text));
                actHomeBogaltery.DoAction((int)HomeActionEnum.addOrder);
            }

            this.Close();
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (textBoxNewCategory.Text == "" && comboBoxType.SelectedIndex == -1)
            {
                MessageBox.Show("Cannot add category!\nPlease check inputed data and try again!!!");
                return;
            }

            if (comboBoxType.SelectedIndex == 1)
            {
                type = true;
            }


            // Add New Category
            if (curentCategory == null)
            {
                actHomeBogaltery.SetCommand((int)HomeActionEnum.addCategory,
                                            new AddCategoryCommand(homeBugaltery, textBoxNewCategory.Text, type));

                actHomeBogaltery.DoAction((int)HomeActionEnum.addCategory);
            } // Change curent Categoruy
            else
            {
                actHomeBogaltery.SetCommand((int)HomeActionEnum.changeCategory,
                                            new ChangeCategoryCommand(homeBugaltery, curentCategory.Id, textBoxNewCategory.Text, type));

                actHomeBogaltery.DoAction((int)HomeActionEnum.changeCategory);
            }

            updateCategory();

            textBoxNewCategory.Clear();
        }