public bool IzinGuncelle(Izin iz) { bool Sonuc = false; SqlCommand comm = new SqlCommand("Update IzinHareketleri set PersonelID=@PersonelID, IzinTipi=@IzinTipi, IzinGunSayisi=@Gun, IzinBaslangic=@Baslangic, IzinBitis=@Bitis where IzinID=@IzinID", conn); comm.Parameters.Add("@IzinID", SqlDbType.Int).Value = iz._izinID; comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value = iz._personelID; comm.Parameters.Add("@IzinTipi", SqlDbType.VarChar).Value = iz._izinTipi; comm.Parameters.Add("@Gun", SqlDbType.Int).Value = iz._izinGunSayisi; comm.Parameters.Add("@Baslangic", SqlDbType.VarChar).Value = iz._izinBaslangic; comm.Parameters.Add("@Bitis", SqlDbType.VarChar).Value = iz._izinBitis; if (conn.State == ConnectionState.Closed) { conn.Open(); } try { Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(Sonuc); }
public bool IzinEkle(Izin iz) { bool Sonuc = false; SqlCommand comm = new SqlCommand("Insert into IzinHareketleri (PersonelID, IzinTipi, IzinGunSayisi, IzinBaslangic, IzinBitis) values(@ID, @Tip, @Gun, @Baslangic, @Bitis)", conn); comm.Parameters.Add("@ID", SqlDbType.Int).Value = iz._personelID; comm.Parameters.Add("@Tip", SqlDbType.VarChar).Value = iz._izinTipi; comm.Parameters.Add("@Gun", SqlDbType.Int).Value = iz._izinGunSayisi; comm.Parameters.Add("@Baslangic", SqlDbType.VarChar).Value = iz._izinBaslangic; comm.Parameters.Add("@Bitis", SqlDbType.VarChar).Value = iz._izinBitis; if (conn.State == ConnectionState.Closed) { conn.Open(); } try { Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(Sonuc); }