/// <summary> /// Resim bilgisi null gelirse resim alanını güncellemez. /// </summary> /// <param name="ptKategori"></param> /// <returns></returns> public short DuzenleKategori(TBLKATEGORILER ptKategori) { try { DbCommand dbcommand; if (ptKategori.KATEGORI_RESMI.IsNull()) { dbcommand = db.GetSqlStringCommand("UPDATE TBLKATEGORILER SET NODEID=@NODEID, ADI=@ADI, SIRANO=@SIRANO, AKTIF=@AKTIF WHERE ID=@ID"); } else { dbcommand = db.GetSqlStringCommand("UPDATE TBLKATEGORILER SET NODEID=@NODEID, ADI=@ADI, SIRANO=@SIRANO, KATEGORI_RESMI=@KATEGORI_RESMI, AKTIF=@AKTIF WHERE ID=@ID"); } db.AddInParameter(dbcommand, "ID", DbType.Int16, ptKategori.ID); db.AddInParameter(dbcommand, "NODEID", DbType.Int16, ptKategori.NODEID); db.AddInParameter(dbcommand, "ADI", DbType.String, ptKategori.ADI); db.AddInParameter(dbcommand, "SIRANO", DbType.Int16, ptKategori.SIRANO); if (!ptKategori.KATEGORI_RESMI.IsNull()) { db.AddInParameter(dbcommand, "KATEGORI_RESMI", DbType.String, ptKategori.KATEGORI_RESMI); } db.AddInParameter(dbcommand, "AKTIF", DbType.Int16, (short)ptKategori.AKTIF); return(db.ExecuteNonQuery(dbcommand).ToShort(0)); } catch (Exception ex) { cLog.Write(ex, _iKullaniciID); return(0); } }
public short EkleKategoriler(TBLKATEGORILER ptKategori) { try { DbCommand dbcommand = db.GetSqlStringCommand("INSERT INTO TBLKATEGORILER(NODEID, ADI, SIRANO, KATEGORI_RESMI, AKTIF) VALUES(@NODEID, @ADI, @SIRANO, @KATEGORI_RESMI, @AKTIF) SELECT @@IDENTITY"); db.AddInParameter(dbcommand, "NODEID", DbType.Int16, ptKategori.NODEID); db.AddInParameter(dbcommand, "ADI", DbType.String, ptKategori.ADI); db.AddInParameter(dbcommand, "SIRANO", DbType.Int16, ptKategori.SIRANO); db.AddInParameter(dbcommand, "KATEGORI_RESMI", DbType.String, ptKategori.KATEGORI_RESMI); db.AddInParameter(dbcommand, "AKTIF", DbType.Int16, (short)ptKategori.AKTIF); return(db.ExecuteScalar(dbcommand).ToShort(0)); } catch (Exception ex) { cLog.Write(ex, _iKullaniciID); return(0); } }