コード例 #1
0
ファイル: RentCar.cs プロジェクト: dina200/RC
        private void createButton_Click(object sender, EventArgs e)
        {
            string passport = ClientComboBox.SelectedValue.ToString();
            string carId    = numCarComboBox.SelectedValue.ToString();
            int    duration = Convert.ToInt32(durationComboBox.Value);
            string from     = fromTextBox.Text;
            string to       = toTextBox.Text;

            if (db.createRent(passport, carId, user, from, to, duration))
            {
                MessageBox.Show("Rent is created");
                ClientComboBox.Text    = "";
                numCarComboBox.Text    = "";
                clientTeltextBox.Text  = "";
                clientNameTextBox.Text = "";
                brandCarTextBox.Text   = "";
                modelCarTextBox.Text   = "";
                locationTextBox.Text   = "";
                durationComboBox.Value = 0;
                priceTextBox.Text      = "";
                fromTextBox.Text       = "";
                toTextBox.Text         = "";
            }
            else
            {
                MessageBox.Show("Rent doesn't create");
            }
            this.Validate();
            RCTableAdapterManager.UpdateAll(this.myDbDataSet);
        }
コード例 #2
0
ファイル: User.cs プロジェクト: dina200/RC
        public void rentCar(dbHelper db)
        {
            string passport = Console.ReadLine();
            string fullName = Console.ReadLine();
            string phone    = Console.ReadLine();

            db.addClient(passport, fullName, phone);
            string carId = Console.ReadLine();
            int    duration;

            try
            {
                duration = Convert.ToInt32(Console.ReadLine());
            }
            catch (Exception e)
            {
                duration = 0;
            }
            string from = Console.ReadLine();
            string to   = Console.ReadLine();

            db.createRent(passport, carId, this, from, to, duration);
        }