private void button_Click(object sender, EventArgs e) { if (((Button)sender) == btn_sil) { silmeIslemi(); } if (((Button)sender) == btn_list) { listelemeIslemi(); } if (((Button)sender) == btn_kayit) { if (radioButton1.Checked == true)//sale { if (textBox_alan.Text != " " && comboBox_ilce.SelectedItem != null && textBox_kat.Text != " " && textBox_oda.Text != " " && comboBox_tur.SelectedItem != null && ((textBox_kira.Text != " " && textBox_deposit.Text != " ") || textBox_fiyat.Text != " ")) { ClassLibrary.Sale sale = new ClassLibrary.Sale(); sale.ActiveStatus = true; sale.AreaOfHome = Convert.ToInt32(textBox_alan.Text); sale.DateOfConstruct = dateTimePicker1.Value; sale.CalculateDate = 0; sale.NumberOfEstate = 1; sale.NumberOfFloors = Convert.ToInt32(textBox_kat.Text); sale.NumberOfRooms = Convert.ToInt32(textBox_oda.Text); sale.SalePrice = Convert.ToInt32(textBox_fiyat.Text); sale.ProbableRent = Convert.ToInt32(textBox_oda.Text); sale.HomeKindOf(comboBox_tur.SelectedItem); sale.Province = comboBox_il.SelectedItem.ToString(); sale.District = comboBox_ilce.SelectedItem.ToString(); db.HouseRegister(sale.homeInformation(), "satilik"); MessageBox.Show("Kayıt Başarılı", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Kayıt Başarısız", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (radioButton2.Checked == true)//rent { if (textBox_alan.Text != " " && comboBox_ilce.SelectedItem != null && textBox_kat.Text != " " && textBox_oda.Text != " " && comboBox_tur.SelectedItem != null && ((textBox_kira.Text != " " && textBox_deposit.Text != " ") || textBox_fiyat.Text != " ")) { ClassLibrary.Rent rent = new ClassLibrary.Rent(); rent.ActiveStatus = true; rent.AreaOfHome = Convert.ToInt32(textBox_alan.Text); rent.DateOfConstruct = dateTimePicker1.Value; rent.CalculateDate = 0; rent.NumberOfEstate = 1; rent.NumberOfFloors = Convert.ToInt32(textBox_kat.Text); rent.NumberOfRooms = Convert.ToInt32(textBox_oda.Text); rent.RentPrice = Convert.ToInt32(textBox_kira.Text); rent.Deposit = Convert.ToInt32(textBox_deposit.Text); rent.ProbableRent = Convert.ToInt32(textBox_oda.Text); rent.HomeKindOf(comboBox_tur.SelectedItem); rent.Province = comboBox_il.SelectedItem.ToString(); rent.District = comboBox_ilce.SelectedItem.ToString(); db.HouseRegister(rent.homeInformation(), "kiralik"); MessageBox.Show("Kayıt Başarılı", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Kayıt Başarısız", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Kayıt Başarısız", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (((Button)sender) == btn_guncelle) { update.Show(); if (rBtn_sale.Checked == true) { update.DoDataGrid(dataGridView1, true); } else if (rBtn_rent.Checked == true) { update.DoDataGrid(dataGridView1, false); } silmeIslemi(); } }
private void btn_kayit_Click(object sender, EventArgs e) { if (rBtn_sale.Checked == true)//sale { if (textBox_alan.Text != " " && comboBox_ilce.SelectedItem != null && textBox_kat.Text != " " && textBox_oda.Text != " " && comboBox_tur.SelectedItem != null && ((textBox_kira.Text != " " && textBox_deposit.Text != " ") || textBox_fiyat.Text != " ")) { ClassLibrary.Sale sale = new ClassLibrary.Sale(); if (rBtn_aktif.Checked == true) { sale.ActiveStatus = true; } else if (rBtn_pasif.Checked == true) { sale.ActiveStatus = false; } sale.AreaOfHome = Convert.ToInt32(textBox_alan.Text); sale.DateOfConstruct = dateTimePicker1.Value; sale.CalculateDate = 0; sale.NumberOfEstate = 1; sale.NumberOfFloors = Convert.ToInt32(textBox_kat.Text); sale.NumberOfRooms = Convert.ToInt32(textBox_oda.Text); sale.SalePrice = Convert.ToInt32(textBox_fiyat.Text); sale.ProbableRent = Convert.ToInt32(textBox_oda.Text); sale.HomeKindOf(comboBox_tur.SelectedItem); sale.Province = comboBox_il.SelectedItem.ToString(); sale.District = comboBox_ilce.SelectedItem.ToString(); db.HouseRegister(sale.homeInformation(), "satilik"); MessageBox.Show("Güncelleme Başarılı", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Information); Form1 form1 = new Form1(); form1.listelemeIslemi(); this.Hide(); } else { MessageBox.Show("Güncelleme Başarısız", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (rBtn_rent.Checked == true)//rent { if (textBox_alan.Text != " " && comboBox_ilce.SelectedItem != null && textBox_kat.Text != " " && textBox_oda.Text != " " && comboBox_tur.SelectedItem != null && ((textBox_kira.Text != " " && textBox_deposit.Text != " ") || textBox_fiyat.Text != " ")) { ClassLibrary.Rent rent = new ClassLibrary.Rent(); if (rBtn_aktif.Checked == true) { rent.ActiveStatus = true; } else if (rBtn_pasif.Checked == true) { rent.ActiveStatus = false; } rent.AreaOfHome = Convert.ToInt32(textBox_alan.Text); rent.DateOfConstruct = dateTimePicker1.Value; rent.CalculateDate = 0; rent.NumberOfEstate = 1; rent.NumberOfFloors = Convert.ToInt32(textBox_kat.Text); rent.NumberOfRooms = Convert.ToInt32(textBox_oda.Text); rent.RentPrice = Convert.ToInt32(textBox_kira.Text); rent.Deposit = Convert.ToInt32(textBox_deposit.Text); rent.ProbableRent = Convert.ToInt32(textBox_oda.Text); rent.HomeKindOf(comboBox_tur.SelectedItem); rent.Province = comboBox_il.SelectedItem.ToString(); rent.District = comboBox_ilce.SelectedItem.ToString(); db.HouseRegister(rent.homeInformation(), "kiralik"); MessageBox.Show("Güncelleme Başarılı", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Information); Form1 form1 = new Form1(); //form1.silmeIslemi(); this.Hide(); } else { MessageBox.Show("Güncelleme Başarısız", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Güncelleme Başarısız", "Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); } }