Example #1
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBoxName.Text) && !string.IsNullOrEmpty(textBoxPrice.Text))
     {
         double price        = 0;
         int    waste        = 0;
         bool   correctWaste = false;
         try
         {
             price = Convert.ToDouble(textBoxPrice.Text);
         }
         catch
         {
             ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_PRICE);
         }
         try
         {
             waste = Convert.ToInt32(textBoxWaste.Text);
             if (waste < 100)
             {
                 correctWaste = true;
             }
             else
             {
                 ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_WASTE);
             }
         }
         catch
         {
             ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_WASTE);
         }
         if (price > 0 && correctWaste)
         {
             ConsumblesCore.AddConsumble(textBoxName.Text,
                                         ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxType.SelectedItem.ToString()),
                                         ConsumbleCategorieCore.consumbleCategories.GetID(comboBoxCategory.SelectedItem.ToString()),
                                         MeasuresCore.Measures.GetID(comboBoxMeasuring.SelectedItem.ToString()),
                                         0,
                                         price,
                                         waste);
             AdminForm.instance.AddConsumbleToGrid(textBoxName.Text);
             this.Close();
         }
     }
     else if (string.IsNullOrEmpty(textBoxName.Text) && string.IsNullOrEmpty(textBoxPrice.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME_AND_PRICE);
     }
     else if (string.IsNullOrEmpty(textBoxName.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME);
     }
     else if (string.IsNullOrEmpty(textBoxPrice.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_PRICE);
     }
 }
        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxCount.Text) && string.IsNullOrEmpty(textBoxPrice.Text))
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_PRICE_AND_COUNT);
            }
            else if (string.IsNullOrEmpty(textBoxCount.Text))
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_COUNT);
            }
            else if (string.IsNullOrEmpty(textBoxPrice.Text))
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_PRICE);
            }
            else
            {
                bool   isOK = true;
                double price = 0, count = 0;
                try
                {
                    price = Convert.ToDouble(textBoxPrice.Text);
                }
                catch
                {
                    isOK = false;
                    ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_PRICE);
                }

                try
                {
                    count = Convert.ToDouble(textBoxCount.Text);
                }
                catch
                {
                    isOK = false;
                    ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_COUNT);
                }
                if (isOK)
                {
                    int id = ArrivalCore.AddArrival(ConsumblesCore.Consumbles.GetID(comboBoxConsumbles.SelectedItem.ToString()),
                                                    SuppliersCore.Suppliers.GetID(comboBoxSupplier.SelectedItem.ToString()),
                                                    EmployeesCore.Emplyees.GetID(comboBoxCook.SelectedItem.ToString()),
                                                    count,
                                                    price);
                    ArrivalCore.GetArrivals();
                    ConsumblesCore.GetConsumbles();
                    AdminForm.instance.AddArrivalToGrid(id);
                    AdminForm.instance.UpdateDataGridViewConsumbles();
                    this.Close();
                }
            }
        }
Example #3
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxName.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME);
     }
     else
     {
         ConsumblesTypesCore.AddConsumbleType(textBoxName.Text);
         ConsumbleTypeForm.instance.DownloadConsumbleTypes();
         this.Close();
     }
 }
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxName.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME);
     }
     else
     {
         ConsumbleCategorieCore.AddConsumbleCategorie(textBoxName.Text, ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxType.SelectedItem.ToString()));
         ConsumbleCategorieForm.instance.DownloadConsumbleCategories();
         this.Close();
     }
 }
Example #5
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxAddress.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_ADDRESS);
     }
     else
     {
         ClientAddressesCore.AddClientAddress(clientID, textBoxAddress.Text);
         ClientsCore.GetClients();
         ClientDetailsForm.instance.UpdateAddressesGrid();
         this.Close();
     }
 }
Example #6
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxCompanyName.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME);
     }
     else
     {
         int id = SuppliersCore.AddSuplier(textBoxCompanyName.Text, textBoxPhone1.Text, textBoxEmeil.Text, textBoxSkype.Text, textBoxNotes.Text);
         SuppliersCore.GetSuppliers();
         AdminForm.instance.AddSupplierToDataGrid(id);
         this.Close();
     }
 }
Example #7
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxLogin.Text) || string.IsNullOrEmpty(textBoxPassword.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_LOGIN_AND_PASSWORD);
     }
     else
     {
         int id = AcountsCore.AddAcount(textBoxLogin.Text,
                                        AcountTypesCore.GetAcountType(comboBoxRole.SelectedValue.ToString()),
                                        EmployeesCore.Emplyees.GetID(comboBoxEmploye.SelectedValue.ToString()),
                                        textBoxPassword.Text);
         AdminForm.instance.UpdateDataGridViewAcounts();
         this.Close();
     }
 }
Example #8
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxDiscount.Text) && string.IsNullOrEmpty(richTextBoxReasone.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_DISCOUNT_AND_REASONE);
     }
     else if (string.IsNullOrEmpty(textBoxDiscount.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_DISCOUNT);
     }
     else if (string.IsNullOrEmpty(richTextBoxReasone.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_DISCOUNT_REASONE);
     }
     else
     {
         bool isOk     = true;
         int  discount = 0;
         try
         {
             discount = Convert.ToInt32(textBoxDiscount.Text);
             if (discount < 0 || discount >= 100)
             {
                 isOk = false;
             }
         }
         catch
         {
             isOk = false;
         }
         if (!isOk)
         {
             ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_DISCOUNT);
         }
         else
         {
             ClientsCore.EditClient(client.id, client.name, client.phone, client.email, discount, client.comment, richTextBoxReasone.Text, client.visible);
             ClientsCore.GetClients();
             ClientDetailsForm.instance.UpdateDiscount();
             this.Close();
         }
     }
 }
Example #9
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxCount.Text) && string.IsNullOrEmpty(richTextBoxComment.Text))
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_COUNT_AND_COMMENT);
            }
            else if (string.IsNullOrEmpty(textBoxCount.Text))
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_COUNT);
            }
            else if (string.IsNullOrEmpty(richTextBoxComment.Text))
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_COMMENT);
            }
            else
            {
                bool   isOK  = true;
                double count = 0;

                try
                {
                    count = Convert.ToDouble(textBoxCount.Text);
                }
                catch
                {
                    isOK = false;
                    ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_COUNT);
                }
                if (isOK)
                {
                    WriteOffCore.AddWriteOff(ConsumblesCore.Consumbles.GetID(comboBoxConsumbles.SelectedItem.ToString()),
                                             EmployeesCore.Emplyees.GetID(comboBoxCook.SelectedItem.ToString()),
                                             count,
                                             richTextBoxComment.Text);
                    WriteOffCore.GetWriteOff();
                    ConsumblesCore.GetConsumbles();
                    AdminForm.instance.UpdateDataGridViewWriteOff();
                    AdminForm.instance.UpdateDataGridViewConsumbles();
                    this.Close();
                }
            }
        }
Example #10
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            bool   isOk   = false;
            double weight = 0;

            try
            {
                weight = Convert.ToDouble(textBoxWeight.Text);
                isOk   = true;
            }
            catch
            {
                ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_WEIGHT);
            }

            if (isOk)
            {
                GoodDetailsForm.instance.AddConsumbleToGrid(comboBoxConsumbles.SelectedItem.ToString(), weight);
                this.Close();
            }
        }
Example #11
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxName.Text) && string.IsNullOrEmpty(textBoxPhone.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME_AND_PHONE);
     }
     else if (string.IsNullOrEmpty(textBoxName.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_NAME);
     }
     else if (string.IsNullOrEmpty(textBoxPhone.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_PHONE);
     }
     else
     {
         int id = ClientsCore.AddClient(textBoxName.Text, textBoxPhone.Text, string.IsNullOrEmpty(textBoxEmeil.Text)?"": textBoxEmeil.Text, string.IsNullOrEmpty(textBoxComment.Text) ? "" : textBoxComment.Text);
         ClientsCore.GetClients();
         AdminForm.instance.AddClientToGrid(id);
         this.Close();
     }
 }
Example #12
0
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textBoxFirstName.Text) || string.IsNullOrEmpty(textBoxSourname.Text))
     {
         ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_FULL_NAME);
     }
     else
     {
         int id = EmployeesCore.AddEmplyee(textBoxFirstName.Text,
                                           textBoxSourname.Text,
                                           EmployeesTypesCore.EmployeesTypes.GetID(comboBoxPosition.SelectedItem.ToString()).ToString(),
                                           textBoxPhone1.Text,
                                           textBoxPhone2.Text,
                                           textBoxEmeil.Text,
                                           textBoxAdress.Text,
                                           textBoxSkype.Text,
                                           dateTimePicker1.Value.ToString("yyyy-MM-dd"),
                                           textBoxComment.Text);
         AdminForm.instance.AddEmployeeToDataGrid(id);
         this.Close();
     }
 }
        public void DownloadConsumbleCategories()
        {
            bool isOk   = true;
            long typeID = -1;

            try
            {
                typeID = ConsumblesTypesCore.ConsumbleTypes.GetID(comboBoxConsumbleTypes.SelectedItem.ToString());
            }
            catch
            {
                isOk = false;
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_TYPE_BEFORE);
            }
            if (isOk)
            {
                new Thread(() =>
                {
                    ConsumbleCategorieCore.GetConsumbleCategorie(typeID.ToString());
                    UpdateDataGridView(typeID);
                }).Start();
            }
        }
Example #14
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            bool   isOK   = true;
            double weight = 0;
            double price  = 0;

            if (string.IsNullOrEmpty(textBoxName.Text) || string.IsNullOrEmpty(textBoxPrice.Text) || string.IsNullOrEmpty(textBoxWeight.Text))
            {
                isOK = false;
                ErrorsViewWrapper.ShowError(ErrorTexts.ENTER_ALL_FIELDS);
            }
            if (isOK)
            {
                try
                {
                    weight = Convert.ToDouble(textBoxWeight.Text);
                }
                catch
                {
                    isOK = false;
                    ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_WEIGHT);
                }
            }
            if (isOK)
            {
                try
                {
                    price = Convert.ToDouble(textBoxPrice.Text);
                }
                catch
                {
                    isOK = false;
                    ErrorsViewWrapper.ShowError(ErrorTexts.INCORRECT_PRICE);
                }
            }
            if (isOK)
            {
                if (isEdit)
                {
                    GoodsCore.EditGood(goodID, textBoxName.Text, GoodsCategoriesCore.GoodsCategories.GetID(comboBoxCategory.SelectedItem.ToString()), weight, price, comboBoxVisble.SelectedItem.ToString() == GeneralConstants.YES ? 1 : 0);
                    GoodsCore.GetGoods();
                    AdminForm.instance.UpdateDataGridViewGoods();
                    for (int i = 0; i < dataGridViewConsumbles.Rows.Count; i++)
                    {
                        DataGridViewCellCollection collection = dataGridViewConsumbles.Rows[i].Cells;
                        if (collection[0].Value.ToString() == "")
                        {
                            GoodConsumlesCore.AddGoodConsumle(goodID,
                                                              ConsumblesCore.Consumbles.GetID(collection[1].Value.ToString()),
                                                              Convert.ToDouble(collection[2].Value));
                        }
                    }
                    this.Close();
                }
                else
                {
                    Good good = GoodsCore.AddGood(textBoxName.Text,
                                                  GoodsCategoriesCore.GoodsCategories.GetID(comboBoxCategory.SelectedValue.ToString()),
                                                  Convert.ToDouble(textBoxWeight.Text),
                                                  Convert.ToDouble(textBoxPrice.Text),
                                                  comboBoxVisble.SelectedItem.ToString() == GeneralConstants.YES ? 1 : 0);

                    for (int i = 0; i < dataGridViewConsumbles.Rows.Count; i++)
                    {
                        DataGridViewCellCollection collection = dataGridViewConsumbles.Rows[i].Cells;
                        GoodConsumlesCore.AddGoodConsumle(good.id,
                                                          ConsumblesCore.Consumbles.GetID(collection[1].Value.ToString()),
                                                          Convert.ToDouble(collection[2].Value));
                    }

                    GoodsCore.GetGoods();
                    AdminForm.instance.AddGoodToGrid(good);
                    this.Close();
                }
            }
        }