コード例 #1
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            IsEmptyKontrol();
            if (!string.IsNullOrEmpty(ddlVehicleTitle.Text.Trim()))//samet ekledi
            {
                VehicleModel model = new VehicleModel();
                model.TitleId  = ((VehicleTitle)ddlVehicleTitle.SelectedItem).Id;
                model.IsActive = true;
                if (rbCompanyVehicle.Checked)
                {
                    model.IsCompanyVehicle = true;
                    if (txtFuelOilFare.Text != "")
                    {
                        model.FuelOilFare = double.Parse(txtFuelOilFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.FuelOilFare = 0;
                    }
                    if (txtFuelOilDay.Text != "")
                    {
                        model.FuelOilDay = float.Parse(txtFuelOilDay.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.FuelOilDay = 0;
                    }
                    if (txtDriverFare.Text != "")
                    {
                        model.DriverFare = double.Parse(txtDriverFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.DriverFare = 0;
                    }

                    if (txtMaintenanceFare.Text != "")
                    {
                        model.MaintenanceFare = double.Parse(txtMaintenanceFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.MaintenanceFare = 0;
                    }
                    if (txtServiceFare.Text != "")
                    {
                        model.ServiceFare = double.Parse(txtServiceFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.ServiceFare = 0;
                    }
                    if (txtGeneralFare.Text != "")
                    {
                        model.GeneralFare = double.Parse(txtGeneralFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.GeneralFare = 0;
                    }
                    if (txtOtherFare.Text != "")
                    {
                        model.OtherFare = double.Parse(txtOtherFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.OtherFare = 0;
                    }
                }
                else
                {
                    model.IsCompanyVehicle = false;

                    if (rdHour.Checked)
                    {
                        model.RentType = IhalematikProBL.Enum.RentTypesEnum.Hour;
                    }
                    else if (rdDay.Checked)
                    {
                        model.RentType = IhalematikProBL.Enum.RentTypesEnum.Day;
                    }
                    else if (rdMonth.Checked)
                    {
                        model.RentType = IhalematikProBL.Enum.RentTypesEnum.Month;
                    }
                    if (txtRentFuelOilFare.Text != "")
                    {
                        model.FuelOilFare = double.Parse(txtRentFuelOilFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.FuelOilFare = 0;
                    }
                    if (txtRentFuelOilDay.Text != "")
                    {
                        model.FuelOilDay = float.Parse(txtRentFuelOilDay.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.FuelOilDay = 0;
                    }
                    if (txtRentDriverFare.Text != "")
                    {
                        model.DriverFare = double.Parse(txtRentDriverFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.DriverFare = 0;
                    }
                    if (txtRentFare.Text != "")
                    {
                        model.RentFare = double.Parse(txtRentFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.RentFare = 0;
                    }
                    if (txtRentGeneralFare.Text != "")
                    {
                        model.GeneralFare = double.Parse(txtRentGeneralFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.GeneralFare = 0;
                    }
                    if (txtRentOtherFare.Text != "")
                    {
                        model.OtherFare = double.Parse(txtRentOtherFare.Text.Replace("TL", string.Empty));
                    }
                    else
                    {
                        model.OtherFare = 0;
                    }
                }

                model.Save();
                LoadGrid();
                btnTemizle.PerformClick();
                //frm_MesajFormu mf = new frm_MesajFormu();
                //mf.lblMesaj.Text = "Araç kaydedildi...";
                //mf.ShowDialog();
                UIPopupManager.Instance.ShowPopup();
            }
        }
コード例 #2
0
        private void btnGuncelle_Click(object sender, EventArgs e)
        {
            IsEmptyKontrol();
            VehicleModel model = new VehicleModel(CurrentVehicle);

            model.TitleId = ((VehicleTitle)ddlVehicleTitle.SelectedItem).Id;
            if (rbCompanyVehicle.Checked)
            {
                model.IsCompanyVehicle = true;
                if (!string.IsNullOrEmpty(txtCompanyFuelOilFare.Text))
                {
                    model.FuelOilFare = double.Parse(txtCompanyFuelOilFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtCompanyFuelOilDay.Text))
                {
                    model.FuelOilDay = float.Parse(txtCompanyFuelOilDay.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtCompanyDriverFare.Text))
                {
                    model.DriverFare = double.Parse(txtCompanyDriverFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtCompanyMaintenanceFare.Text))
                {
                    model.MaintenanceFare = double.Parse(txtCompanyMaintenanceFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtCompanyServiceFare.Text))
                {
                    model.ServiceFare = double.Parse(txtCompanyServiceFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtCompanyGeneralFare.Text))
                {
                    model.GeneralFare = double.Parse(txtCompanyGeneralFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtCompanyOtherFare.Text))
                {
                    model.OtherFare = double.Parse(txtCompanyOtherFare.Text.Replace("TL", string.Empty));
                }
            }
            else
            {
                model.IsCompanyVehicle = false;

                if (rdHour.Checked)
                {
                    model.RentType = IhalematikProBL.Enum.RentTypesEnum.Hour;
                }
                else if (rdDay.Checked)
                {
                    model.RentType = IhalematikProBL.Enum.RentTypesEnum.Day;
                }
                else if (rdMonth.Checked)
                {
                    model.RentType = IhalematikProBL.Enum.RentTypesEnum.Month;
                }
                if (!string.IsNullOrEmpty(txtRentFuelOilFare.Text))
                {
                    model.FuelOilFare = double.Parse(txtRentFuelOilFare.Text.Replace("TL", string.Empty));
                }

                if (!string.IsNullOrEmpty(txtRentFuelOilDay.Text))
                {
                    model.FuelOilDay = float.Parse(txtRentFuelOilDay.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtRentDriverFare.Text))
                {
                    model.DriverFare = double.Parse(txtRentDriverFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtRentFare.Text))
                {
                    model.RentFare = double.Parse(txtRentFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtRentGeneralFare.Text))
                {
                    model.GeneralFare = double.Parse(txtRentGeneralFare.Text.Replace("TL", string.Empty));
                }
                if (!string.IsNullOrEmpty(txtRentOtherFare.Text))
                {
                    model.OtherFare = double.Parse(txtRentOtherFare.Text.Replace("TL", string.Empty));
                }
            }

            model.Save();
            this._owner.LoadGrid();
            //frm_MesajFormu mf = new frm_MesajFormu();
            //mf.lblMesaj.Text = "Güncelleme Yapıldı...";
            //mf.ShowDialog();
            UIPopupManager.Instance.ShowPopup();
            this.Close();
        }