Exemple #1
0
        /* Satilik Ev Güncelleme */
        private void btnSaleUpdate_Click(object sender, EventArgs e)
        {
            if (txtSaleId.Text.Length > 0)
            {
                var dialogWindow = MessageBox.Show("Satılık Ev Güncellemek İstiyor Musunuz ?", "Bilgi Kutusu", MessageBoxButtons.YesNo);
                if (dialogWindow == DialogResult.Yes)
                {
                    SaleHouse updateHouse = saleHouseOperations.GetById(txtSaleId.Text);
                    SaleHouse saleHouse   = new SaleHouse();
                    saleHouse.Id          = txtSaleId.Text;
                    saleHouse.RoomCount   = Convert.ToInt32(txtSaleRoomCount.Value);
                    saleHouse.FloorNumber = Convert.ToInt32(txtSaleFloorNumber.Value);
                    saleHouse.District    = txtSaleDistrict.Text;
                    saleHouse.Area        = txtSaleArea.Text;
                    saleHouse.CreateDate  = Convert.ToDateTime(txtSaleCreatedDate.Text);
                    saleHouse.Type        = ConvertHouseType.GetHouseType(txtSaleType.Text);
                    saleHouse.IsEnabled   = Convert.ToBoolean(txtSaleEnabled.Checked);
                    saleHouse.SalePrice   = Convert.ToDecimal(txtSalePrice.Value);

                    saleHouseOperations.Update(updateHouse, saleHouse);
                    MessageBox.Show("Satılık Ev Güncellendi.");
                    FillSaleHouseList();
                }
            }
            else
            {
                MessageBox.Show("Lütfen Bir Ev Seçiniz.");
            }
        }
        private void FrmEdit_Load(object sender, EventArgs e)
        {
            FillHouseTypesInComboboxes();

            if (type == "Kiralik")
            {
                panel1.Visible = true;

                try
                {
                    RentHouse rentHouse = rentHouseOperations.GetById(id);
                    txtId.Text          = rentHouse.Id;
                    txtRentPrice.Text   = rentHouse.RentPrice.ToString();
                    txtRentDeposit.Text = rentHouse.RentDeposit.ToString();
                    txtRoomCount.Text   = rentHouse.RoomCount.ToString();
                    txtFloorNumber.Text = rentHouse.FloorNumber.ToString();
                    txtDistrict.Text    = rentHouse.District;
                    txtArea.Text        = rentHouse.Area;
                    txtCreatedDate.Text = rentHouse.CreateDate.ToString();
                    txtType.Text        = rentHouse.Type.ToString();
                    txtEnabled.Checked  = Convert.ToBoolean(rentHouse.IsEnabled.ToString());
                }
                catch
                {
                    MessageBox.Show("Hata Oluştu");
                }
            }
            else if (type == "Satilik")
            {
                panel2.Visible = true;

                try
                {
                    SaleHouse rentHouse = saleHouseOperations.GetById(id);
                    txtId.Text          = rentHouse.Id;
                    txtSalePrice.Text   = rentHouse.SalePrice.ToString();
                    txtRoomCount.Text   = rentHouse.RoomCount.ToString();
                    txtFloorNumber.Text = rentHouse.FloorNumber.ToString();
                    txtDistrict.Text    = rentHouse.District;
                    txtArea.Text        = rentHouse.Area;
                    txtCreatedDate.Text = rentHouse.CreateDate.ToString();
                    txtType.Text        = rentHouse.Type.ToString();
                    txtEnabled.Checked  = Convert.ToBoolean(rentHouse.IsEnabled.ToString());
                }
                catch
                {
                    MessageBox.Show("Hata Oluştu");
                }
            }
        }