Exemplo n.º 1
0
        private void PaymentButton_Click(object sender, EventArgs e)
        {
            double paymentAmount;

            if (AmountTextBox.Text == "")
            {
                paymentAmount = 0;
            }
            else
            {
                paymentAmount = Convert.ToDouble(AmountTextBox.Text);
            }
            if (paymentAmount > cardAmount)
            {
                MessageBox.Show("Недостатньо коштiв для виконання переказу!", "Помилка списання коштiв", MessageBoxButtons.OK);
            }
            else
            {
                cardAmount -= paymentAmount;
                string paymentDate = (DateTime.Now).ToString("yyyy.MM.dd");
                string paymentType = "списання";
                string SqlText     = "INSERT INTO operation (data,cardId,amount,type) VALUES ";
                SqlText += "(\'" + paymentDate + "\'," + Convert.ToString(cardID) + "," + Convert.ToString(paymentAmount).Replace(",", ".") + ",N\'" + paymentType + "\')";
                MyExecuteNonQuery(SqlText);
                AmountLabel.Text = Convert.ToString(cardAmount);
                SqlText          = "UPDATE card SET balance = \'" + Convert.ToString(cardAmount).Replace(",", ".") + "\' WHERE Id =" + Convert.ToString(cardID);
                MyExecuteNonQuery(SqlText);
                MessageBox.Show("Переказ успiшно проведено.", "операцiя списання коштiв", MessageBoxButtons.OK);
                AmountTextBox.Clear();
            }
        }
Exemplo n.º 2
0
 private void ClearAllTextBoxes()
 {
     ItemTextBox.Clear();
     AmountTextBox.Clear();
     CostTextBox.Clear();
     MeasureTextBox.Clear();
     EndDate.Text = DateOfIncome.Text;
 }
Exemplo n.º 3
0
 private void ResetButton_Click(object sender, EventArgs e)
 {
     TodayDateRadioButton.Checked   = true;
     ExpDateTimePicker.CustomFormat = " ";
     CatagoryComboBox.SelectedIndex = -1;
     AmountTextBox.Clear();
     ExpDescTextBox.Clear();
     ExpDateTimePicker.Focus();
 }
Exemplo n.º 4
0
 private void ClearAllToolBoxs()
 {
     IDTextBox.Clear();
     ExpDateTimePicker.CustomFormat = " ";
     CatagoryComboBox.SelectedIndex = -1;
     SearchTextBox.Clear();
     AmountTextBox.Clear();
     ExpDescTextBox.Clear();
     IDTextBox.Focus();
     GetAllExpances();
 }
Exemplo n.º 5
0
        private void clearLoanIssuePage()
        {
            AmountTextBox.Clear();
            PayDatePicker.SelectedDate = System.DateTime.Now;
            PayedByTextBox.Clear();
            RemarkTextBox.Clear();

            PaymentReset(_newPayment);
            Selected = _newPayment;
            refreshLoanPaymentList(1);
            Mode = Mode.NEW;
        }
Exemplo n.º 6
0
 private void clearLoanIssuePage()
 {
     clearData();
     CustomerTextBox.Clear();
     EmployeeTextBox.Clear();
     LoanTypeTextBox.Clear();
     AmountTextBox.Clear();
     InstalmentTextBox.Clear();
     LoanCodeTextBox.Clear();
     StartDateDatePicker.SelectedDate = System.DateTime.Now;
     EndDateDatePicker.SelectedDate   = System.DateTime.Now;
     RemarkTextBox.Clear();
 }
Exemplo n.º 7
0
 private void AddExpButton_Click(object sender, EventArgs e)
 {
     if (IsValidated())
     {
         GetAllRecored();
         MessageBox.Show("New Record Added SuccsessFully...", "Record Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TodayDateRadioButton.Checked   = true;
         ExpDateTimePicker.CustomFormat = " ";
         CatagoryComboBox.SelectedIndex = -1;
         AmountTextBox.Clear();
         ExpDescTextBox.Clear();
         ExpDateTimePicker.Focus();
     }
 }
Exemplo n.º 8
0
 private void AddDishClick(object sender, RoutedEventArgs e)
 {
     try
     {
         foreach (char c in AmountTextBox.Text)
         {
             if (c < '0' || c > '9')
             {
                 throw new Exception("You have to right the amount correctly");
             }
         }
         if (DishesMenu.SelectedIndex == -1)
         {
             throw new Exception("You have to select dish");
         }
         if (TotalPrice + (float.Parse(AmountTextBox.Text) * ((Dish)DishesMenu.SelectedItem).DishPrice) > 1000)
         {
             throw new Exception("You cannot Order by more than 1000 ₪!");
         }
         CurrentDishPrice += (CurrentDishPrice == 0 ? float.Parse(AmountTextBox.Text) * ((Dish)DishesMenu.SelectedItem).DishPrice : 0);
         TotalPrice       += CurrentDishPrice;
         CurrentDishPrice  = 0;
         Ordered_Dish OD = new Ordered_Dish();
         OD.AmountSameDishes = int.Parse(AmountTextBox.Text);
         AmountTextBox.Clear();
         OD.DishNumber              = ((Dish)DishesMenu.SelectedItem).DishID;
         OD.ODS                     = OrderedDish_Situation.IN_PROGRESS;
         OrderedDishes.IsEnabled    = true;
         RemoveDish.IsEnabled       = true;
         ContinueToBranch.IsEnabled = true;
         SelectedDishes.Add(OD);
         TotalPriceShow.Content = TotalPrice.ToString() + "₪";
     }
     catch (Exception f)
     {
         MessageBox.Show(f.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Exemplo n.º 9
0
        private void addSupplybtn_Click(object sender, RoutedEventArgs e)
        {
            int i1 = 0, i2 = 0;

            foreach (UIElement elem in SupplyAddGrid.Children)
            {
                TextBox textbox = new TextBox();
                if (elem is TextBox)
                {
                    textbox = elem as TextBox;
                    i1++;
                    if (textbox.Text != "" && !Validation.GetHasError(textbox))
                    {
                        i2++;
                    }
                }
            }
            if (i1 == i2 && namebox.Text != "" && datepicker.Text != "")
            {
                Supply supply = new Supply();
                supply.Company = namebox.Text;
                supply.Amount  = Convert.ToInt32(AmountTextBox.Text);
                supply.SupDate = Convert.ToDateTime(datepicker.Text + " " + HourTextBox.Text + ":" + MinuteTextBox.Text);
                db.Supplies.Add(supply);
                db.SaveChanges();
                MessageBox.Show("Добавлено!");
                namebox.Text = "";
                AmountTextBox.Clear();
                datepicker.Text = "";
                HourTextBox.Clear();
                MinuteTextBox.Clear();
            }
            else
            {
                MessageBox.Show("Неккоректные данные");
            }
        }