public short DuzenleUrunResim(TBLURUN_RESIMLERI ptUrunResimleri) { try { DbCommand dbcommand; if (ptUrunResimleri.RESIMADI.IsNull()) { dbcommand = db.GetSqlStringCommand("UPDATE TBLURUN_RESIMLERI SET URUNID=@URUNID, ANARESIM=@ANARESIM, SLIDERRESIM=@SLIDERRESIM WHERE ID=@ID"); } else { dbcommand = db.GetSqlStringCommand("UPDATE TBLURUN_RESIMLERI SET URUNID=@URUNID, RESIMADI=@RESIMADI, ANARESIM=@ANARESIM, SLIDERRESIM=@SLIDERRESIM WHERE ID=@ID"); } db.AddInParameter(dbcommand, "ID", DbType.Int32, ptUrunResimleri.ID); db.AddInParameter(dbcommand, "URUNID", DbType.Int32, ptUrunResimleri.URUNID); if (!ptUrunResimleri.RESIMADI.IsNull()) { db.AddInParameter(dbcommand, "RESIMADI", DbType.String, ptUrunResimleri.RESIMADI); } db.AddInParameter(dbcommand, "ANARESIM", DbType.Int16, (short)ptUrunResimleri.ANARESIM); db.AddInParameter(dbcommand, "SLIDERRESIM", DbType.Int16, (short)ptUrunResimleri.SLIDERRESIM); db.ExecuteNonQuery(dbcommand); return(1); } catch (Exception ex) { cLog.Write(ex, _iKullaniciID); return(0); } }
public int EkleUrunResim(TBLURUN_RESIMLERI ptUrunResimleri) { try { DbCommand dbcommand = db.GetSqlStringCommand("INSERT INTO TBLURUN_RESIMLERI(URUNID,RESIMADI,ANARESIM,SLIDERRESIM) VALUES(@URUNID,@RESIMADI,@ANARESIM,@SLIDERRESIM) SELECT @@IDENTITY"); db.AddInParameter(dbcommand, "URUNID", DbType.Int32, ptUrunResimleri.URUNID); db.AddInParameter(dbcommand, "RESIMADI", DbType.String, ptUrunResimleri.RESIMADI); db.AddInParameter(dbcommand, "ANARESIM", DbType.Int16, (short)ptUrunResimleri.ANARESIM); db.AddInParameter(dbcommand, "SLIDERRESIM", DbType.Int16, (short)ptUrunResimleri.SLIDERRESIM); return(db.ExecuteScalar(dbcommand).ToInt(0)); } catch (Exception ex) { cLog.Write(ex, _iKullaniciID); return(0); } }