Kod:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace OtelGP.v1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection baglanti = new SqlConnection();
DataTable tablo = new DataTable();
SqlDataAdapter adaptor = new SqlDataAdapter();
SqlCommand komut = new SqlCommand();
string baglantiParametresi = @"Data Source=*********;Initial Catalog=OtelGP v.1;Integrated Security=**********";
private **** btn_kyt_Click(object sender, EventArgs e)
{
if (txt_ad.Text == "") {MessageBox.Show("Ad Alanı Boş Geçilemez" , "Hatalı Kayıt",MessageBoxButtons.OK, MessageBoxIcon.Error);}
else if (txt_soy.Text == "") {MessageBox.Show("Soyad Alanı Boş Geçilemez", "Hatalı Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error);}
else if (txt_tc.Text == "") {MessageBox.Show("TC NO Alanı Boş Geçilemez", "Hatalı Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error);}
else if (txt_dyer.Text == "") {MessageBox.Show("Doğum Yeri Alanı Boş Geçilemez", "Hatalı Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error);}
else if (txt_oda.Text == "") { MessageBox.Show("Oda Seçimi Alanı Boş Geçilemez", "Hatalı Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); }
else if (txt_tel.Text == "") { MessageBox.Show("Telefon Seçimi Alanı Boş Geçilemez", "Hatalı Kayıt", MessageBoxButtons.OK, MessageBoxIcon.Error); }
//else
//{
// tablo.Clear();
// baglanti.ConnectionString = baglantiParametresi;
// baglanti.Open();
// komut.Connection = baglanti;
// string mus_ekle;
// mus_ekle = "select * from ODA";
// komut.CommandText = mus_ekle;
// adaptor.SelectCommand = komut;
// adaptor.Fill(tablo);
// baglanti.Close();
// MessageBox.Show("Kayıt Yapıldı");
//}
}
private **** btn_tmz_Click(object sender, EventArgs e)
{
txt_ad.Text = "";
txt_soy.Text = "";
txt_tc.Text = "";
txt_dyer.Text = "";
txt_oda.Text = "";
txt_tel.Text = "";
}
private **** standartOdaToolStripMenuItem_Click(object sender, EventArgs e)
{
txt_oda.Text = "Tek-Stndrt";
}
private **** manzaralıToolStripMenuItem_Click(object sender, EventArgs e)
{
txt_oda.Text = "Tek-Mnzrl";
}
private **** standartToolStripMenuItem_Click(object sender, EventArgs e)
{
txt_oda.Text = "Cift-Stndrt";
}
private **** manzaralıOdaToolStripMenuItem_Click(object sender, EventArgs e)
{
txt_oda.Text = "Cift-Mnzrl";
}
private **** standartOdaToolStripMenuItem1_Click(object sender, EventArgs e)
{
txt_oda.Text = "3-Stndrt";
}
private **** manzaralıOdaToolStripMenuItem1_Click(object sender, EventArgs e)
{
txt_oda.Text = "3-Mnzrl";
}
private **** standartOdaToolStripMenuItem2_Click(object sender, EventArgs e)
{
txt_oda.Text = "4-Stndrt";
}
private **** manzaralıOdaToolStripMenuItem2_Click(object sender, EventArgs e)
{
txt_oda.Text = "4-Mnzrl";
}
private **** standartOdaToolStripMenuItem3_Click(object sender, EventArgs e)
{
txt_oda.Text = "Aile-Stndrt";
}
private **** manzaralıOdaToolStripMenuItem3_Click(object sender, EventArgs e)
{
txt_oda.Text = "Aile-Mnzrl";
}
private **** standartSuitToolStripMenuItem_Click(object sender, EventArgs e)
{
txt_oda.Text = "Suit-Stndrt";
}
private **** manzaralıSuitToolStripMenuItem_Click(object sender, EventArgs e)
{
txt_oda.Text = "Suit-Mnzrl";
}
private **** kralDaireleriToolStripMenuItem_Click(object sender, EventArgs e)
{
txt_oda.Text = "KRAL";
}
private **** sbar_fiyat_Scroll(object sender, ScrollEventArgs e)
{
lbl_fiyat.Text = Convert.ToString(sbar_fiyat.Value) + " $";
}
private **** hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
lbl_kat.Text = Convert.ToString(sbar_kat.Value) + ". KAT";
}
private **** btn_temiz_Click(object sender, EventArgs e)
{
cbox_aile.Checked = false;
cbox_cift.Checked = false;
cbox_dort.Checked = false;
cbox_kral.Checked = false;
cbox_suit.Checked = false;
cbox_tek.Checked = false;
cbox_tip1.Checked = false;
cbox_tip2.Checked = false;
cbox_uc.Checked = false;
sbar_kat.Value = 1;
sbar_fiyat.Value = 25;
lbl_fiyat.Text = "0";
lbl_kat.Text = "0";
}
private **** btn_hepsi_Click(object sender, EventArgs e)
{
Form2 oda_getir = new Form2();
oda_getir.Show();
btn_hepsi.Visible = false;
btn_temiz.Visible = false;
btn_secili.Visible = false;
Class1.izin = 0;
}
//private **** button1_Click(object sender, EventArgs e)
//{
// baglanti.ConnectionString = baglantiParametresi;
// baglanti.Open();
// MessageBox.Show("Bağlantı Sağlandı");
// baglanti.Close();
// MessageBox.Show("Balantı Kesildi");
//}
public MouseEventHandler ESC { get; set; }
private **** Form1_MouseMove(object sender, MouseEventArgs e)
{
if(Class1.izin == 1)
btn_hepsi.Visible = true;
}
private **** btn_secili_Click(object sender, EventArgs e)
{
}
}
}
Kod:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OtelGP.v1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private **** Form2_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the '_OtelGP_v_1DataSet.ODA' table. You can move, or remove it, as needed.
this.oDATableAdapter.Fill(this._OtelGP_v_1DataSet.ODA);
}
private **** fillToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.oDATableAdapter.Fill(this._OtelGP_v_1DataSet.ODA);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private **** Form2_FormClosed(object sender, FormClosedEventArgs e)
{
Class1.izin = 1;
}
}
}