/// <summary> /// Marka bilgilerini günceller. /// Logo verisi NULL gelirse logo alanı güncellenmez. /// </summary> /// <param name="ptMarkalar"></param> /// <returns></returns> public short DuzenleMarka(TBLMARKALAR ptMarkalar) { try { DbCommand dbcommand; if (ptMarkalar.LOGO.IsNull()) { dbcommand = db.GetSqlStringCommand("UPDATE TBLMARKALAR SET KODU=@KODU, ADI=@ADI, LOGO=@LOGO, ACIKLAMA=@ACIKLAMA WHERE ID=@ID"); } else { dbcommand = db.GetSqlStringCommand("UPDATE TBLMARKALAR SET KODU=@KODU, ADI=@ADI, ACIKLAMA=@ACIKLAMA WHERE ID=@ID"); } db.AddInParameter(dbcommand, "ID", DbType.Int32, ptMarkalar.ID); db.AddInParameter(dbcommand, "KODU", DbType.String, ptMarkalar.KODU); db.AddInParameter(dbcommand, "ADI", DbType.String, ptMarkalar.ADI); if (!ptMarkalar.LOGO.IsNull()) { db.AddInParameter(dbcommand, "LOGO", DbType.String, ptMarkalar.LOGO); } db.AddInParameter(dbcommand, "ACIKLAMA", DbType.String, ptMarkalar.ACIKLAMA); return(1); } catch (Exception ex) { cLog.Write(ex, _iKullaniciID); return(0); } }
public int EkleMarka(TBLMARKALAR ptMarkalar) { try { DbCommand dbcommand = db.GetSqlStringCommand("INSERT INTO TBLMARKALAR(KODU,ADI,LOGO,ACIKLAMA) VALUES(@KODU, @ADI,@LOGO,@ACIKLAMA) SELECT @@IDENTITY"); db.AddInParameter(dbcommand, "KODU", DbType.String, ptMarkalar.KODU); db.AddInParameter(dbcommand, "ADI", DbType.String, ptMarkalar.ADI); db.AddInParameter(dbcommand, "LOGO", DbType.String, ptMarkalar.LOGO); db.AddInParameter(dbcommand, "ACIKLAMA", DbType.String, ptMarkalar.ACIKLAMA); return(db.ExecuteScalar(dbcommand).ToInt(0)); } catch (Exception ex) { cLog.Write(ex, _iKullaniciID); return(0); } }