public string GetInsertValues(ProductGateInfo info, Guid?directionId, Guid?categoryId, Guid?subCategoryId, Guid?groupId, Guid?sizeId, Guid?tradeMarkId) { return(String.Format("('{0}', '{1}', '{2}', '{3}', '{4}', GETUTCDATE(), {5}, {6}, {7}, {8}, {9}, {10}, '{11}', {12}, {13})", info.Name, info.ERPId, info.Id, info.Code, ERPDataSourceId, info.IsArchived ? "1" : "0", directionId == Guid.Empty ? "null" : String.Format("'{0}'", directionId), categoryId == Guid.Empty ? "null" : String.Format("'{0}'", categoryId), subCategoryId == Guid.Empty ? "null" : String.Format("'{0}'", subCategoryId), groupId == Guid.Empty ? "null" : String.Format("'{0}'", groupId), info.RecommendedRetailPrice.ToString().Replace(",", "."), info.Provider, sizeId == Guid.Empty ? "null" : String.Format("'{0}'", sizeId), tradeMarkId == Guid.Empty ? "null" : String.Format("'{0}'", tradeMarkId) )); }
private Insert GetInsertQuery(ProductGateInfo info, Guid?directionId, Guid?categoryId, Guid?subCategoryId, Guid?groupId, Guid?sizeId, Guid?tradeMarkId) { return(new Insert(UserConnection) .Into(_tableName) .Set("Name", Column.Parameter(info.Name)) .Set("Code", Column.Parameter(info.Code)) .Set("SmrSourceId", Column.Parameter(ERPDataSourceId)) .Set("SmrLastIntegrationDate", Column.Parameter(DateTime.UtcNow)) .Set("IsArchive", Column.Parameter(info.IsArchived)) .Set("SmrDirectionId", Column.Parameter(directionId)) .Set("CategoryId", Column.Parameter(categoryId)) .Set("TypeId", Column.Parameter(subCategoryId)) .Set("SmrGroupId", Column.Parameter(groupId)) .Set("SmrRecommendedRetailPrice", Column.Parameter(info.RecommendedRetailPrice)) .Set("SmrProvider", Column.Parameter(info.Provider)) .Set("SmrSizeId", Column.Parameter(sizeId)) .Set("TradeMarkId", Column.Parameter(tradeMarkId)) .Set("Id", Column.Parameter(info.Id)) .Set("SmrERPId", Column.Parameter(info.ERPId)) as Insert); }
private Update GetUpdateQuery(ProductGateInfo info, Guid?directionId, Guid?categoryId, Guid?subCategoryId, Guid?groupId, Guid?sizeId, Guid?tradeMarkId) { var update = new Update(UserConnection, _tableName) .Set("Name", Column.Parameter(info.Name)) .Set("Code", Column.Parameter(info.Code)) .Set("SmrSourceId", Column.Parameter(ERPDataSourceId)) .Set("SmrLastIntegrationDate", Column.Parameter(DateTime.UtcNow)) .Set("IsArchive", Column.Parameter(info.IsArchived)) .Set("SmrDirectionId", Column.Parameter(directionId)) .Set("CategoryId", Column.Parameter(categoryId)) .Set("TypeId", Column.Parameter(subCategoryId)) .Set("SmrGroupId", Column.Parameter(groupId)) .Set("SmrRecommendedRetailPrice", Column.Parameter(info.RecommendedRetailPrice)) .Set("SmrProvider", Column.Parameter(info.Provider)) .Set("TradeMarkId", Column.Parameter(tradeMarkId)) .Set("SmrSizeId", Column.Parameter(sizeId)) as Update; update.Where("SmrERPId").IsEqual(Column.Parameter(info.ERPId)); return(update); }