//private static readonly ID_Promotion dal = IDal.CreatePromotion(); /// <summary> ///添加记录 /// </summary> /// <param name="Promotion"></param> /// <returns></returns> public int GetInsert(M_Promotion promotion) { string sqlStr = "INSERT INTO [dbo].[ZL_Promotion] ([userId],[LinkUrl],[PromoUrl],[type],[AllinaceUrl]) VALUES (@userId,@LinkUrl,@PromoUrl,@type,@AllinaceUrl);select @@IDENTITY"; SqlParameter[] cmdParams = promotion.GetParameters(); return(SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sqlStr, cmdParams))); }
/// <summary> ///更新记录 /// </summary> /// <param name="Promotion"></param> /// <returns></returns> public bool GetUpdate(M_Promotion promotion) { string sqlStr = "UPDATE [dbo].[ZL_Promotion] SET [userId] = @userId,[LinkUrl] = @LinkUrl,[PromoUrl] = @PromoUrl,[type] = @type,[AllinaceUrl]=@AllinaceUrl WHERE [id] = @id"; SqlParameter[] cmdParams = promotion.GetParameters(); return(SqlHelper.ExecuteSql(sqlStr, cmdParams)); }
public int insert(M_Promotion model) { return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
/// <summary> /// 根据ID更新 /// </summary> public bool UpdateByID(M_Promotion model) { return(Sql.UpdateByIDs(strTableName, PK, model.id.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }