private bool ValidateForm()
        {
            if (!Regex.Match(ProductCodeTextBox.Text, @"^\d{5}$").Success)
            {
                MessageBox.Show("Invalid product code! It must contain 5 digits");
                ProductCodeTextBox.Focus();
                return(false);
            }

            if (ShipmentDateComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select Shipment date!");
                return(false);
            }

            var tempDeliveryShipment = (DeliveryShipmentDTO)ShipmentDateComboBox.SelectedItem;

            if (!Regex.Match(AmountTextBox.Text, @"^[0-9]*(?:\,[0-9]*)?$").Success || Convert.ToDouble(AmountTextBox.Text) > tempDeliveryShipment.Amount)
            {
                MessageBox.Show("Invalid amount! Check the data you've entered! Or you're trying to write off more than it is in stock!");
                AmountTextBox.Focus();
                return(false);
            }

            if (ReasonComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select reason!");
                return(false);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void KeyDown_Typed(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key != Key.Enter && e.PlatformKeyCode != 0x0A)
            {
                return;
            }
            switch (textboxWithFocus.Name)
            {
            case "AccountTextBox":
                PayeeTextBox.Focus();
                break;

            case "PayeeTextBox":
                MemoTextBox.Focus();
                break;

            case "MemoTextBox":
                OutflowButton.Focus();
                break;

            case "AmountTextBox":
                AmountTextBox.Focus();
                break;
            }
            CommitItemWithFocus();
        }
示例#3
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();
            }
        }
示例#4
0
 private void AmountTextBox_TextChanged(object sender, EventArgs e)
 {
     if (AmountTextBox.ValidateEmpty())
     {
         AmountTextBox.BackColor = System.Drawing.Color.White;
     }
 }
        private void OKButton_Click(object sender, EventArgs e)
        {
            try
            {
                var num = Convert.ToInt32(AmountTextBox.Text);
                if (!ClassBackEnd.AddBookAmount(num))
                {
                    MessageBox ib = new MessageBox(9);
                    ib.ShowDialog();
                    ib.Dispose();
                    return;
                }

                MessageBox infoBox = new MessageBox(3);
                infoBox.ShowDialog();
                infoBox.Dispose();
                Close();
            }
            catch
            {
                MessageBox infoBox = new MessageBox(13);
                infoBox.ShowDialog();
                infoBox.Dispose();
                AmountTextBox.Focus();
            }
        }
        private bool ValidateForm()
        {
            if (!Regex.Match(AmountTextBox.Text, @"^[0-9]*(?:\,[0-9]*)?$").Success || AmountTextBox.Text == "")
            {
                MessageBox.Show("Invalid amount! Check the data you've entered!");
                AmountTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(ProductCodeTextBox.Text, @"^\d{5}$").Success)
            {
                MessageBox.Show("Invalid product code! It must contain 5 digits");
                ProductCodeTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(IncomePriceTextBox.Text, @"^[0-9]*(?:\,[0-9]*)?$").Success ||
                IncomePriceTextBox.Text == "")
            {
                MessageBox.Show("Invalid price! Check the data you've entered!");
                IncomePriceTextBox.Focus();
                return(false);
            }

            return(true);
        }
        private bool ValidateForm()
        {
            if (!Regex.Match(ProductCodeTextBox.Text, @"^\d{5}$").Success)
            {
                MessageBox.Show("Invalid product code! It must contain 5 digits");
                ProductCodeTextBox.Focus();
                return(false);
            }

            if (GoodsInMarketComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select manufacture date");
                return(false);
            }

            var tempProduction = (GoodsInMarketOwnDTO)GoodsInMarketComboBox.SelectedItem;

            if (!Regex.Match(AmountTextBox.Text, @"^[0-9]*(?:\,[0-9]*)?$").Success || Convert.ToDouble(AmountTextBox.Text) > tempProduction.DoubleAmount)
            {
                MessageBox.Show("Invalid amount! Check the data you've entered! Or you're trying to write off more than it is in stock!");
                AmountTextBox.Focus();
                return(false);
            }

            if (ReasonComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select reason");
                return(false);
            }

            return(true);
        }
示例#8
0
 private void UIElement_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (AmountEditable)
     {
         IsEdited = true;
         AmountTextBox.Focus();
     }
 }
 private void AmountCueText_Click(object sender, EventArgs e)
 {
     if (AmountTextBox.Text == "")
     {
         AmountCueText.Hide();
         AmountTextBox.Focus();
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Checked_Event(object sender, RoutedEventArgs e)
 {
     AmountTextBox.Focus();
     if (AmountTextBox.Text == "0")
     {
         AmountTextBox.Text = "";
     }
 }
示例#11
0
文件: Form1.cs 项目: MAF1N/OOP_Course
 private void ClearAllTextBoxes()
 {
     ItemTextBox.Clear();
     AmountTextBox.Clear();
     CostTextBox.Clear();
     MeasureTextBox.Clear();
     EndDate.Text = DateOfIncome.Text;
 }
示例#12
0
 private void AmountTextBox_OnKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         AmountTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
         IsEdited = false;
     }
 }
 private void ResetButton_Click(object sender, EventArgs e)
 {
     TodayDateRadioButton.Checked   = true;
     ExpDateTimePicker.CustomFormat = " ";
     CatagoryComboBox.SelectedIndex = -1;
     AmountTextBox.Clear();
     ExpDescTextBox.Clear();
     ExpDateTimePicker.Focus();
 }
示例#14
0
 private void ClearAllToolBoxs()
 {
     IDTextBox.Clear();
     ExpDateTimePicker.CustomFormat = " ";
     CatagoryComboBox.SelectedIndex = -1;
     SearchTextBox.Clear();
     AmountTextBox.Clear();
     ExpDescTextBox.Clear();
     IDTextBox.Focus();
     GetAllExpances();
 }
示例#15
0
        private bool ValidateUserInputs()
        {
            int failedCount = 0;

            if (!NameTextBox.ValidateEmpty())
            {
                NameTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }
            if (!NameTextBox.ValidateUniqeName())
            {
                MessageBox.Show("Fail to add as the name alread exists");
                NameTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }

            if (!AmountTextBox.ValidateEmpty())
            {
                AmountTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }

            if (!AmountTextBox.ValidatePositiveNumber())
            {
                MessageBox.Show("The amount should be positive");
                AmountTextBox.BackColor = Color.OrangeRed;
                failedCount++;
            }

            if (!CategoryComboBox.ValidateEmpty())
            {
                CategoryComboBox.BackColor = Color.OrangeRed;
                failedCount++;
            }
            if (!CurrencyComboBox.ValidateEmpty())
            {
                CurrencyComboBox.BackColor = Color.OrangeRed;
                failedCount++;
            }
            if (!OccuredTimePicker.ValidateEmpty())
            {
                OccuredTimePicker.BackColor = Color.OrangeRed;
                OccuredTimePicker.Focus();
                failedCount++;
            }
            if (failedCount > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private bool ValidateForm()
        {
            if (!Regex.Match(AmountTextBox.Text, @"^[0-9]+$").Success)
            {
                MessageBox.Show("Invalid amount! Check the data you've entered!");
                AmountTextBox.Focus();
                return(false);
            }

            return(true);
        }
        private void AmountTextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            AmountTextBox.IsReadOnly = true;

            BindingExpression exp = AmountTextBox.GetBindingExpression(TextBox.TextProperty);

            exp.UpdateSource();


            //  OnLostFocus();
        }
		private void AmountTextBox_LostFocus(object sender, RoutedEventArgs e)
		{
			if (DataValidation.IsAmountValid(AmountTextBox.Text))
			{
				amountValid = true;
				AmountTextBox.ToValidView();
				return;
			}

			amountValid = false;
			AmountTextBox.ToInvalidView();
		}
示例#19
0
        private void clearLoanIssuePage()
        {
            AmountTextBox.Clear();
            PayDatePicker.SelectedDate = System.DateTime.Now;
            PayedByTextBox.Clear();
            RemarkTextBox.Clear();

            PaymentReset(_newPayment);
            Selected = _newPayment;
            refreshLoanPaymentList(1);
            Mode = Mode.NEW;
        }
示例#20
0
 private void AmountTextBox_TextChanged_1(object sender, EventArgs e)
 {
     if (AmountTextBox.ValidateEmpty())
     {
         AmountTextBox.BackColor = Color.White;
     }
     if (!double.TryParse(AmountTextBox.Text, out double result))
     {
         MessageBox.Show("Only numeric number is supported ");
         AmountTextBox.BackColor = Color.OrangeRed;
     }
 }
 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();
 }
 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();
     }
 }
        private bool ValidateForm()
        {
            if (!Regex.Match(AmountTextBox.Text, @"^[0-9]+$").Success)
            {
                MessageBox.Show("Invalid amount! Check the data you've entered!");
                AmountTextBox.Focus();
                return(false);
            }

            if (MarketComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select market!");
                return(false);
            }

            return(true);
        }
        private void AmountTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                BindingExpression exp = AmountTextBox.GetBindingExpression(TextBox.TextProperty);
                exp.UpdateSource();
                Keyboard.ClearFocus();
                // OnLostFocus();
                AmountTextBox.IsReadOnly = true;
                ExecuteCommand(EventsViewModel.CmdSaveInstrumentConfig);



                //Terminal.ViewModels.MarketViewModel mvm = (Terminal.ViewModels.MarketViewModel)this.DataContext;
                //mvm.
            }
        }
		private void Clear()
		{
			FrameBorder.Visibility = Visibility.Hidden;

			AmountTextBox.ToDefaultView(DefaultThickness, DefaultBrush);
			amountValid = false;
			AmountTextBox.Text = "";

			PriceTextBox.ToDefaultView(DefaultThickness, DefaultBrush);
			priceValid = false;
			PriceTextBox.Text = "";

			NameTextBox.ToDefaultView(DefaultThickness, DefaultBrush);
			nameValid = false;
			NameTextBox.Text = "";

			typeValid = false;
			TypeComboBox.SelectedIndex = -1;
		}
示例#26
0
文件: AddItem.cs 项目: ichthus/nts
        private void AddButton_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(CategoryMenu.Text);


            if (checkInput())
            {
                // create a new BudgetItem
                BudgetItem newItem = new BudgetItem
                                         (Convert.ToDateTime(dateTimePicker1.Text), CategoryMenu.Text, DescriptionTextBox.Text, float.Parse(AmountTextBox.Text));

                // add item to DB

                int    ukey    = Properties.Settings.Default.userkey;
                string command = "insert into nts_budget_items(`userkey`, `date`, `name`, `amount`, `catkey`) values(" + ukey + ", " + dateTimePicker1.Value.ToString("yyyyMMdd") + ",\"" + DescriptionTextBox.Text + "\"," + AmountTextBox.Text + ", " + CategoryMenu.SelectedValue + ");";
                sqlConn.Open();
                SQLiteDataReader reader;

                sqlDoReport.CommandText = command;

                reader = sqlDoReport.ExecuteReader();

                sqlConn.Close();

                // alert user that item was successfully added to DB - this needs an if statement!
                if (reader.RecordsAffected > 0)
                {
                    SuccessTextBox.Text = "Item successfully added to your budget!";
                }
                else
                {
                    SuccessTextBox.Text = "There has been an error in adding your item.";
                }
                // reset window
                dateTimePicker1.ResetText();
                CategoryMenu.ResetText();
                DescriptionTextBox.ResetText();
                AmountTextBox.ResetText();
                CategoryMenu.ClearSelected();
            }
        }
示例#27
0
        private bool ValidateForm()
        {
            if (MarketComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select market");
                return(false);
            }

            if (!Regex.Match(AmountTextBox.Text, @"^[0-9]*(?:\,[0-9]*)?$").Success)
            {
                MessageBox.Show("Invalid amount! Check the data you've entered!");
                AmountTextBox.Focus();
                return(false);
            }

            double totalAmount = 0;

            foreach (var currentDeliveryShipmentDto in CurrentDeliveryShipmentDtos)
            {
                totalAmount += currentDeliveryShipmentDto.Amount ?? 0;
            }

            totalAmount += Convert.ToDouble(AmountTextBox.Text);
            if (totalAmount > _currentConsignment.Amount)
            {
                MessageBox.Show("Invalid amount! You're trying to distribute more goods than actually ordered!");
                AmountTextBox.Focus();
                return(false);
            }

            if (!DateTime.TryParse(shipmentDateTextBox.Text, out _))
            {
                MessageBox.Show("Invalid shipment date! Check the data you've entered!");
                shipmentDateTextBox.Focus();
                return(false);
            }


            return(true);
        }
        public BatchRepaymentView()
        {
            InitializeComponent();
            _principalColumn.AspectToStringConverter     =
                _interestColumn.AspectToStringConverter  =
                    _totalColumn.AspectToStringConverter = v => ((decimal)v).ToString("N0");
            _totalColumn.AspectPutter        = TotalAspectPutter;
            _loansListView.RowFormatter      = ItemRowFormatter;
            _loansListView.ItemChecked      += OnItemChecked;
            _loansListView.CellEditStarting += OnCellEditStarting;

            ObjectListView.EditorRegistry.Register(typeof(decimal), delegate
            {
                var textBox = new AmountTextBox {
                    AllowDecimalSeparator = false
                };
                return(textBox);
            });

            _totalItem.FirstName      = "TOTAL";
            _loansListView.CheckBoxes = true;
        }
示例#29
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);
     }
 }
示例#30
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("Неккоректные данные");
            }
        }