public virtual QuantityDiscountTable UpdateQuantityDiscountTable(QuantityDiscountTable entity) { if (entity.IsTransient()) { return(entity); } QuantityDiscountTable other = GetQuantityDiscountTable(entity.QuantityDiscountTableId); if (entity.Equals(other)) { return(entity); } string sql = @"Update QuantityDiscountTable set [QuantityDiscountTableGUID]=@QuantityDiscountTableGUID , [QuantityDiscountID]=@QuantityDiscountID , [LowQuantity]=@LowQuantity , [HighQuantity]=@HighQuantity , [DiscountPercent]=@DiscountPercent , [CreatedOn]=@CreatedOn where QuantityDiscountTableID=@QuantityDiscountTableID" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@QuantityDiscountTableID", entity.QuantityDiscountTableId) , new SqlParameter("@QuantityDiscountTableGUID", entity.QuantityDiscountTableGuid ?? (object)DBNull.Value) , new SqlParameter("@QuantityDiscountID", entity.QuantityDiscountId ?? (object)DBNull.Value) , new SqlParameter("@LowQuantity", entity.LowQuantity) , new SqlParameter("@HighQuantity", entity.HighQuantity) , new SqlParameter("@DiscountPercent", entity.DiscountPercent) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray); return(GetQuantityDiscountTable(entity.QuantityDiscountTableId)); }
public virtual QuantityDiscountTable QuantityDiscountTableFromDataRow(DataRow dr) { if (dr == null) { return(null); } QuantityDiscountTable entity = new QuantityDiscountTable(); entity.QuantityDiscountTableId = (System.Int32)dr["QuantityDiscountTableID"]; entity.QuantityDiscountTableGuid = dr["QuantityDiscountTableGUID"] == DBNull.Value?(System.Guid?)null : (System.Guid?)dr["QuantityDiscountTableGUID"]; entity.QuantityDiscountId = dr["QuantityDiscountID"] == DBNull.Value?(System.Int32?)null : (System.Int32?)dr["QuantityDiscountID"]; entity.LowQuantity = (System.Int32)dr["LowQuantity"]; entity.HighQuantity = (System.Int32)dr["HighQuantity"]; entity.DiscountPercent = (System.Decimal)dr["DiscountPercent"]; entity.CreatedOn = (System.DateTime)dr["CreatedOn"]; return(entity); }
public virtual QuantityDiscountTable InsertQuantityDiscountTable(QuantityDiscountTable entity) { QuantityDiscountTable other = new QuantityDiscountTable(); other = entity; if (entity.IsTransient()) { string sql = @"Insert into QuantityDiscountTable ( [QuantityDiscountTableGUID] ,[QuantityDiscountID] ,[LowQuantity] ,[HighQuantity] ,[DiscountPercent] ,[CreatedOn] ) Values ( @QuantityDiscountTableGUID , @QuantityDiscountID , @LowQuantity , @HighQuantity , @DiscountPercent , @CreatedOn ); Select scope_identity()" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@QuantityDiscountTableID", entity.QuantityDiscountTableId) , new SqlParameter("@QuantityDiscountTableGUID", entity.QuantityDiscountTableGuid ?? (object)DBNull.Value) , new SqlParameter("@QuantityDiscountID", entity.QuantityDiscountId ?? (object)DBNull.Value) , new SqlParameter("@LowQuantity", entity.LowQuantity) , new SqlParameter("@HighQuantity", entity.HighQuantity) , new SqlParameter("@DiscountPercent", entity.DiscountPercent) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray); if (identity == DBNull.Value) { throw new DataException("Identity column was null as a result of the insert operation."); } return(GetQuantityDiscountTable(Convert.ToInt32(identity))); } return(entity); }
public virtual QuantityDiscountTable DeleteQuantityDiscountTable(QuantityDiscountTable entity) { this.DeleteQuantityDiscountTable(entity.QuantityDiscountTableId); return(entity); }
public QuantityDiscountTable InsertQuantityDiscountTable(QuantityDiscountTable entity) { return(_iQuantityDiscountTableRepository.InsertQuantityDiscountTable(entity)); }
public QuantityDiscountTable UpdateQuantityDiscountTable(QuantityDiscountTable entity) { return(_iQuantityDiscountTableRepository.UpdateQuantityDiscountTable(entity)); }