Beispiel #1
0
        private void returnedButton_Click(object sender, EventArgs e)
        {
            if (rentalDGV.SelectedCells.Count > 0)
            {
                cContractsHire currentContract = new cContractsHire((rentalDGV.Rows[rentalDGV.SelectedCells[0].RowIndex].DataBoundItem as viewHire).id_contract_hire);
                if (currentContract.returned != 1)
                {
                    currentContract.returned = 1;
                    currentContract.save();
                    foreach (cEquipment i in currentContract.getEquipment())
                    {
                        i.addStock();
                    }

                    viewHire(currentClient.id_client);
                }
            }
        }
Beispiel #2
0
        private void saveHireButtom_Click(object sender, EventArgs e)
        {
            var a = startDateTime.Value - endDateTime.Value;

            if (rentNumeric.Value == 0 || String.IsNullOrEmpty(pledgeComboBox.Text) || a.Hours == 0 || equipmentDGV.Rows.Count == 0)
            {
                MessageBox.Show("Заполни обязательные поля", "Сохранение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                currentHire.id_client        = currentClient.id_client;
                currentHire.start_time       = (int)(startDateTime.Value - new DateTime(1970, 1, 1)).TotalSeconds;
                currentHire.end_time         = (int)(endDateTime.Value - new DateTime(1970, 1, 1)).TotalSeconds;
                currentHire.object_of_pledge = pledgeComboBox.Text;
                currentHire.rent             = (double)rentNumeric.Value;
                if (currentHire.save())
                {
                    MessageBox.Show("Сохранилось, збс", "Сохранение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    printContract.Enabled = true;
                    IsSaved = true;
                }
            }
        }