コード例 #1
0
ファイル: FormCarAdd.cs プロジェクト: SerdarTprk/CarRental
        private void BtnKaydet_Click(object sender, EventArgs e)
        {
            var dto = new CarDTO()
            {
                Id                   = Guid.NewGuid(),
                Plate                = txtPlate.Text,
                CarClassEnum         = (CarClassEnum)cmbCarClass.SelectedItem,
                EngineCapacity       = txtSilindirHac.Text,
                CylindeerVolume      = txtSilindirHac.Text,
                DailyPrice           = txtDailyPrice.Text,
                DriverLicenceType    = (DriverLicenceTypeEnum)cmbLicenceType.SelectedItem,
                InsuranceExpiryDate  = dtpsigorta.Value,
                InspectionExpiryDate = dtpkasko.Value,
                CarColorEnum         = (CarColorEnum)cmbColor.SelectedItem,
                DateOfPurchase       = dtpSatinAlmaTar.Value,
                FuelType             = (FuelTypeEnum)cmbFuelType.SelectedItem,
                IsRented             = false,
                ModelId              = (Guid)cmbModel.SelectedValue
            };
            var result = _cc.CarAdd(dto);

            result.NotificationShow();
            if (result.State == ResultState.Success)
            {
                txtPlate.Text         = "";
                dtpkasko.Value        = DateTime.Today;
                dtpSatinAlmaTar.Value = DateTime.Today;
                dtpsigorta.Value      = DateTime.Today;
            }
        }