
iamrommel
Thursday, January 5, 2012
Thursday, September 10, 2009
Convert the Old School Arraylist into Enumerable for it to be Linq Enable
The plain old school ArrayList for a collection can be simply casted into an Enumerable for it to do more LINQ statements
Let for example the Telerik GridDataItemCollection which was created in .NetFramework 1.1 (I think) can be casted in to enumerable as shown in the image below


Cast the GridDataItemCollection into a GridDataItem and after that you can now do your thing.
var gridItems = gridCards.MasterTableView.Items.Cast<GridDataItem>();
Tuesday, September 8, 2009
Enumeration Extension
We can extend the functionality of base class Enum to get its underlying value and convert the enumeration name as string and here is the code
The Extension
using System;
namespace ATI.Redemption.Common
{
public static class EnumerationExtension
{
public static int ToValue(this Enum enumeration)
{
return Convert.ToInt32(enumeration);
}
public static string ToName(this Enum enumeration)
{
return Enum.GetName(enumeration.GetType(), enumeration);
}
}
}
The Enumeration
namespace ATI.Redemption.Utilities
{
public enum CardStatus
{
Inactive = 1,
Deactivated =2,
Redeemed = 3,
Active = 4
}
}
The Unit Test
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using ATI.Redemption.Utilities;
namespace ATI.Redemption.Common.Test
{
[TestFixture]
[Category("Common Tests")]
public class EnumerationExtension
{
[Test]
public void TestIfReturnsValue()
{
Assert.AreEqual(3, CardStatus.Redeemed.ToValue());
}
[Test]
public void TestIfReturnsName()
{
Assert.AreEqual("Redeemed", CardStatus.Redeemed.ToName());
}
}
}
Friday, August 28, 2009
XML And SQL Server 2008
Querying XML in SQL Server is never been this easy
DECLARE @CardInfo XML;
SET @CardInfo =
N'<CARDINFO>
<CARD>
<ID>1</ID>
<ID>2</ID>
</CARD>
<STATUS>1</STATUS>
<PURPOSE>1</PURPOSE>
<CARDVALUE>120.32</CARDVALUE>
<ACTIVATIONDATE>20090101</ACTIVATIONDATE>
<EXPIRATIONDATE>20100101</EXPIRATIONDATE>
<PRODUCTID>1</PRODUCTID>
<PACKAGEID></PACKAGEID>
<SESSIONID></SESSIONID>
<SEMESTERID></SEMESTERID>
</CARDINFO>
<REASON>For A Change naman</REASON>'
select x.node.value('(.)[1]','int') CardID,
x.node.value('(/CARDINFO/STATUS)[1]','int') StatusID,
x.node.value('(/CARDINFO/PURPOSE)[1]','int') PurposeID,
x.node.value('(/CARDINFO/CARDVALUE)[1]','DECIMAL(18,2)') CardValue,
x.node.value('(/CARDINFO/ACTIVATIONDATE)[1]','DATETIME') ActivationDate,
x.node.value('(/CARDINFO/EXPIRATIONDATE)[1]','DATETIME') ExpirationDate,
x.node.value('(/CARDINFO/PRODUCTID)[1]','int') ProductID,
x.node.value('(/CARDINFO/PACKAGEID)[1]','int') PackageID,
x.node.value('(/CARDINFO/SESSIONID)[1]','int') SessionID,
x.node.value('(/CARDINFO/SEMESTERID)[1]','int') SemesterID,
x.node.value('(/REASON)[1]','NVARCHAR(MAX)') Reason
from @CardInfo.nodes('/CARDINFO/CARD/ID') x(node)
Thursday, April 2, 2009
The power of MERGE in SQL Server 2008
The common Master Detail Scenario in 1 hit is the code below
USE [Phca]
GO
/****** Object: StoredProcedure [dbo].[MergeAtRiskRiskCondition] Script Date: 04/03/2009 10:00:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Rommel Manalo
-- Create date: 2009-03-27
-- Description: Merge for AtRiskRiskCondition
-- =============================================
ALTER PROCEDURE [dbo].[MergeAtRiskRiskCondition]
-- Add the parameters for the stored procedure here
@AtRiskId INT,
@AtRiskRiskCondition xml = ''
AS
BEGIN
BEGIN TRY
BEGIN TRANSACTION
--XML FORMAT
--<Root>
-- <AtRiskRiskCondition AtRiskRiskConditionId="0" AtRiskFactorId="0" ResolvedDate="" />
-- <AtRiskRiskCondition AtRiskRiskConditionId="0" AtRiskFactorId="0" ResolvedDate="" />
--</Root>
SET NOCOUNT ON;
--temporary table for data to be deleted
DECLARE @UpdtedItems TABLE ( AtRiskRiskConditionId int NULL );
--SET THE CTE FORM AtRiskRiskCondition
;WITH xmlAtRiskRiskCondition AS (
SELECT
x.h.value('@AtRiskRiskConditionId', 'INT') AS AtRiskRiskConditionId,
x.h.value('@AtRiskConditionId', 'INT') AS AtRiskConditionId,
x.h.value('@ResolvedDate', 'DATETIME') AS ResolvedDate
FROM @AtRiskRiskCondition.nodes('/Root/AtRiskRiskCondition') AS x(h)
)
--DO A MERGE AND UPDATE THE UpdatedItems table with the AtRiskRiskConditionId
--of all inserted and updated items
INSERT INTO @UpdtedItems
SELECT AtRiskRiskConditionId
FROM
(
MERGE INTO AtRiskRiskCondition AS t
USING xmlAtRiskRiskCondition AS s
ON
(t.AtRiskRiskConditionId = s.AtRiskRiskConditionId)
WHEN MATCHED THEN
UPDATE SET
t.AtRiskConditionId = s.AtRiskConditionId,
t.ResolvedDate = s.ResolvedDate,
t.AtRiskId = @AtRiskId
WHEN NOT MATCHED THEN
INSERT (AtRiskConditionId, ResolvedDate, AtRiskId)
VALUES (s.AtRiskConditionId, s. ResolvedDate, @AtRiskId)
OUTPUT $action, inserted.AtRiskRiskConditionId
) as Changes(Action, AtRiskRiskConditionId) ;
--REMOVE THE NON EXISTING ITEM
DELETE AtRiskRiskCondition
FROM AtRiskRiskCondition t
LEFT OUTER JOIN @UpdtedItems s ON t.AtRiskRiskConditionId = s.AtRiskRiskConditionId
WHERE s.AtRiskRiskConditionId IS NULL
and t.AtRiskId = @AtRiskId
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
DECLARE @ErrorMessage NVARCHAR(4000);
SELECT @ErrorMessage = ERROR_MESSAGE();
RAISERROR (@ErrorMessage, 16, 1);
END CATCH
END
Thursday, October 23, 2008
Flexigrid, ASP.NET MVC and JQuery
Flexigrid, if only you evolve faster, you'll be the major/official grid of JQuery UI. Until now (October 23, 2008) there is no major release and I've been using you since September 1, 2008. Lot of your users are complaining for the next release.
What's In Here
-View Code for MVC
-Model Code for MVC
-Controller Code for MVC
-Extension Method
Ok, enough for the political talk, let's do the coding. This is a beta code so expect inconsistencies and need code tweaks. I implemented here deleting records method other (Add and Edit) will follow on my next blog. Here are my example codes and screenshots using the Flexigrid, ASP.NET MVC and JQuery
Here is the ASPX code for the VIEW part in MVC I used the ASP:Content (obviously there should be a Master Page).
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="TindahanNiAlengNena.Views.Product.Admin.List" %>
<%@ Import Namespace="Microsoft.Web.Mvc"%>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="<%= AngTagapamahala.Utility.UrlHelper.JavaScriptUrl("Jquery/plugins/Flexigrid/jquery.flexigrid.js") %>"></script>
<script type="text/javascript">
$(document).ready(function() {
$.include('<%= AngTagapamahala.Utility.UrlHelper.CssUrl("jquery/plugins/FlexiGrid/flexigrid/flexigrid.css") %>');
var myGrid = $("#flex1").flexigrid
(
{
url: '<%= Html.BuildUrlFromExpression<TindahanNiAlengNena.Controllers.ProductController>(c => c.JsonProductList()) %>',
dataType: 'json',
colModel: [
{ display: 'ProductId', name: 'ProductId', width: 100, sortable: true, hide: true, align: 'left' },
{ display: 'ProductName', name: 'ProductName', width: 300, sortable: true, align: 'left' },
{ display: 'QuantityPerUnit', name: 'QuantityPerUnit', width: 100, sortable: true, align: 'left' },
{ display: 'UnitPrice', name: 'UnitPrice', width: 100, sortable: true, align: 'left' },
{ display: 'Discontinued', name: 'Discontinued', width: 80, sortable: true, align: 'left' },
{ display: 'CategoryName', name: 'CategoryName', width: 200, sortable: true, align: 'left' },
{ display: 'SupplierName', name: 'SupplierName', width: 200, sortable: true, align: 'left' }
],
buttons: [
{ name: 'Add', bclass: 'addbutton', onpress: button_click },
{ name: 'Delete', bclass: 'deletebutton', onpress: button_click },
{ name: 'Edit', bclass: 'editbutton', onpress: button_click },
{ separator: true }
],
searchitems: [
{ display: 'ProductId', name: 'ProductId' },
{ display: 'ProductName', name: 'ProductName' },
{ display: 'QuantityPerUnit', name: 'QuantityPerUnit' },
{ display: 'UnitPrice', name: 'UnitPrice' },
{ display: 'Discontinued', name: 'Discontinued' },
{ display: 'CategoryName', name: 'CategoryName' },
{ display: 'SupplierName', name: 'SupplierName' }
],
sortname: "ProductId",
sortorder: "asc",
usepager: true,
title: 'Products List',
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: '100%',
height: 300,
singleSelect: true
}
); //end of flexgrid
function button_click(com, grid) {
if (com == 'Delete') {
//check if there is a selected row, remember that the grid is a SingleSelect
if ($('.trSelected', grid).length > 0) {
var result = confirm('Delete ' + $('.trSelected', grid)[0].cells[1].textContent + '?');
if (result == 1) {
$.get('/Product/Delete/' + $('.trSelected', grid)[0].cells[0].textContent);
//TODO: Get the status from the $.get() if the delete operation was successful or not
myGrid.flexReload();
}
}
}
else if (com == 'Add') {
//TODO: Add a new Item by showing and JQuery UI Dialog
alert('Add New Item');
}
else if (com == 'Edit') {
//TODO: Edit a selected Item by showing and JQuery UI Dialog
if ($('.trSelected', grid).length > 0) {
alert('Edit Item');
}
}
}
});
</script>
<table id="flex1" style="display:none"></table>
</asp:Content>
The $.include plugin should be downloaded from JQUery also(almost forgot that), this is nice tool for including adhoc JS and CSS
----------------------------
I am following the Repository Pattern here and my MODEL code in MVC and Data Access are the following.
using System.Collections;
using System.Collections.Generic;
using System.Data.Linq;
using System.Web.Mvc;
using TindahanNiAlengNena.Models.DataAccess;
using System.Linq;
using TindahanNiAlengNena.Models.DataModel;
namespace TindahanNiAlengNena.Models.DataAccess.Repository.SqlServerRepository
{
public class ProductRepository : IProductRepository
{
private readonly TnanDataContext db;
public ProductRepository(TnanDataContext context)
{
db = context;
}
public ProductRepository()
: this(new TnanDataContext())
{
}
public IQueryable<DataModel.Product> GetProducts()
{
var categories = new CategoryRepository(db);
var suppliers = new SupplierRepository(db);
return from p in db.Products
let supplier = (from s in suppliers.GetSuppliers_Basic().Where(s => s.SupplierId == p.SupplierId) select s)
let category = (from c in categories.GetCategories_Basic().Where(c => c.CategoryId == p.CategoryId) select c)
select new DataModel.Product
{
ProductId = p.ProductId,
ProductName = p.ProductName,
QuantityPerUnit = p.QuantityPerUnit,
Discontinued = p.Discontinued,
ReorderLevel = p.ReorderLevel,
UnitPrice = p.UnitPrice,
UnitsInStock = p.UnitsInStock,
UnitsOnOrder = p.UnitsOnOrder,
ShortDescription = p.ShortDescription,
Supplier = new EntityRef<DataModel.Supplier>(supplier),
Category = new EntityRef<DataModel.Category>(category)
};
}
public IList ProductList(int pageNumber, int pageSize, string sortName, string sortOrder, string filter, string query, string qtype, out int totalRow)
{
return (from p in GetProducts()
select new
{
p.ProductId,
p.ProductName,
p.QuantityPerUnit,
p.UnitPrice,
p.Discontinued,
p.Category.Entity.CategoryName,
SupplierName = p.Supplier.Entity.CompanyName
}).Page(pageNumber, pageSize, sortName, sortOrder, filter, query, qtype, out totalRow).ToList();
}
public void Delete(int productId)
{
var product = db.Products.Where(p => p.ProductId == productId).SingleOrDefault();
db.Products.DeleteOnSubmit(product);
db.SubmitChanges();
}
public void Delete(DataModel.Product product)
{
Delete(product.ProductId);
}
}
}
The Page method (red font) above is an extension I'd created so it can support the paged results in querying the database. The extensions are on the last part. I am also using the DBML, the DataContext (TnanDataContext) here that's why you can see here, db.Products, db.Products.DeleteOnSubmit(product, etc…
----------------------------
And for the Controller (MVC) are the following.
using System;
using System.Data.Linq;
using System.Web.Mvc;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using TindahanNiAlengNena.Models.DataAccess;
using Category = TindahanNiAlengNena.Models.DataModel.Category;
using Product = TindahanNiAlengNena.Models.DataModel.Product;
using ProductSpecification = TindahanNiAlengNena.Models.DataModel.ProductSpecification;
using Supplier = TindahanNiAlengNena.Models.DataModel.Supplier;
using ProductRatingsAndReview = TindahanNiAlengNena.Models.DataModel.ProductRatingsAndReview;
namespace TindahanNiAlengNena.Controllers
{
[HandleError]
public class ProductController : Controller
{
private readonly Models.DataAccess.Repository.IProductRepository repository;
public ProductController()
{
repository = new Models.DataAccess.Repository.SqlServerRepository.ProductRepository();
}
public ActionResult Browse()
{
ViewData["Title"] = "Browse All Products";
return View();
}
public JsonResult JsonProductList()
{
ViewData["Title"] = "Product List";
//read the values from the context
var f = HttpContext.Request.Form;
//get this value from the parameter
var pageNumber = (f["page"] == null) ? 1 : Int32.Parse(f["page"]);
var pageSize = (f["rp"] == null) ? 15 : Int32.Parse(f["rp"]);
var sortName = f["sortname"] ?? "ProductId";
var sortOrder = f["sortorder"] ?? "ASC";
var query = f["query"] ?? string.Empty;
var qtype = f["qtype"] ?? string.Empty;
var filter = (query == string.Empty ) ? "" : qtype + "=" + query;
var totalRow = 0;
var product = repository.ProductList(pageNumber, pageSize, sortName, sortOrder, filter, query, qtype,
out totalRow);
return product.AsQueryable().ToFlexiJsonResult(totalRow, pageNumber);
}
public ActionResult Edit(int Id)
{
return View("Admin/Edit");
}
public ActionResult List()
{
ViewData["Title"] = "Product List";
return View("Admin/List");
}
public void Delete(int Id)
{
try
{
repository.Delete(Id);
}
catch (Exception)
{
throw;
}
}
}
}
ToFlexiJsonResult (red font) is also an extension, so that all list that will be translated to FlexiGrid Jason result will handle this.
Extension Methods
using System.Linq;
using System.Linq.Dynamic;
namespace System.Linq
{
public static class PagingExtension
{
public static IQueryable<TSource> Page<TSource>(this IQueryable<TSource> source,
int pageNumber,
int pageSize,
string sortName,
string sortOrder,
string filterString,
string query,
string qType,
out int totalRows)
{
IQueryable<TSource> r;
if (filterString == string.Empty)
{
totalRows = source.Count();
r = sortName == string.Empty
? source.Skip((pageNumber - 1) * pageSize).Take(pageSize)
: source.OrderBy(sortName + " " + sortOrder).Skip((pageNumber - 1) * pageSize).Take(pageSize);
}
else
{
totalRows = source.Where(qType, query).Count();
r = sortName == string.Empty
? source.Where(qType, query).Skip((pageNumber - 1) * pageSize).Take(pageSize)
: source.Where(qType, query).OrderBy(sortName + " " + sortOrder).Skip((pageNumber - 1) * pageSize).Take(pageSize);
}
return r;
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web.Mvc;
namespace System.Linq
{
public static class FlexiGridExtension
{
public static JsonResult ToFlexiJsonResult(this IQueryable query, int total, int page, params string[] fields)
{
if (fields.Count() == 0)
{
var pInfoFields = query.ElementType.GetProperties();
var fieldCount = pInfoFields.Count();
fields = new string[fieldCount];
for (int i = 0; i < fieldCount; i++)
fields[i] = pInfoFields[i].Name;
}
var rows = new List<object>();
var nFields = fields.Count();
foreach (var obj in query)
{
var cell = new string[nFields];
var type = obj.GetType();
var id = type.InvokeMember(fields[0], BindingFlags.GetProperty, null, obj, null).ToString();
for (int j = 0; j < nFields; j++)
cell[j] = type.InvokeMember(fields[j], BindingFlags.GetProperty, null, obj, null).ToString();
rows.Add(new { id, cell });
}
var result = new JsonResult {Data = new {page, total, rows}};
return result;
}
}
}
ScreenShots
[image here]
[image here]
[image here]
[image here]
[image here]
Remember that all this code are on BETA, there will be (maybe) major tweaks on my codes, I just show here how the Flexigrid and ASP.NET get working.
Wednesday, October 15, 2008
Extensions in C# and a BUG in IEEERemainder
Topics here
--Entensions in C#
--IEEERemainder BUG
--Converting a number into a words including the negative and decimal places of a number
--Support for Filipino a language
Converting a number to a word is an old school programming knowledge, but what's new here is the use of extension to double, float, int, etc so that if you reference the class you can simple make the following code:
int number = 23;
string numberWords = number.ToWords();
And presto, 23 in words is "Twenty Three", I commonly found this in invoice.
Features
1. The conversion only supports up to hundred billion, (999,999,999,999)
2. Negative values is also supported that is -23 into words is Negative Twenty Three.
3. Decimal places is also supported, -23.34 will convert Negative Twenty Three and Thirty Four Thousandths
Review the links below about reading the decimal values in a number
http://www.math.com/school/subject1/lessons/S1U1L2DP.html
http://www.youtube.com/watch?v=iaSFUPRReow
4. Filipino Language is supported, but limited to whole numbers only. (I don't know how to read decimal numbers in Filipino language)
23 à Dalawanpu at Tatlo
I don't Google enough for IEEERemainder, but when I used this, return values are quite wrong. I then avoid using this instead I use % to get the remainder of a division. I also play Math.Div(int a, int b, out remainder) : int method so that in one line of code I can get the qoutient and the remainder.
Just copy and paste this code below
public static class ConvertionNumberToWords
{
private static string[] ones = { "Zero", "One", "Two", "Three", "Four", "Five", "Six",
"Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen",
"Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen", "Twenty" };
private static string[] onesSeparator = { "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "" };
private static string[] tens = { "", "", "Twenty", "Thirty", "Fourty", "Fifty",
"Sixty", "Seventy", "Eighty", "Ninety" };
private static string[] tensSeparator = { "", "", "", "", "", "", "", "", "", "" };
private static string[] otherNumericName = { "Hundred", "Thousand", "Million", "Billion" };
private static string negative = "Negative";
private static string otherSeparator = "";
private static bool fireLastHundredSeparator;
public static string ToWords(this double doubleNumber)
{
string rs = "";
double number = Math.Abs(doubleNumber);
if ((int)(number / 1000000000) != 0)
{
rs = HundredHelper((int)(number / 1000000000)) + " " + otherNumericName[3] + " ";
number = number % 1000000000.0;
}
if ((int)(number / 1000000) != 0)
{
rs = rs + HundredHelper((int)(number / 1000000)) + " " + otherNumericName[2] + " ";
number = number % 1000000.0;
}
if ((int)(number / 1000) != 0)
{
rs = rs + HundredHelper((int)(number / 1000)) + " " + otherNumericName[1] + " ";
number = number % 1000.0;
}
if (number / 1 != 0)
{
fireLastHundredSeparator = true;
rs = rs + HundredHelper((int)number);
fireLastHundredSeparator = false;
if (doubleNumber < 0)
rs = negative + " " + rs;
}
else if (doubleNumber == 0)
rs = ones[0];
// for decimal values
if ((number % 1.0) != 0)
rs = rs + " And " + DecimalPlacesHelper(doubleNumber);
return rs.Trim();
}
public static string ToWords(this double doubleNumber, string Culture)
{
SetTheCulture(Culture);
return doubleNumber.ToWords();
}
public static string ToWords(this float floatNumber)
{
double r = (double)floatNumber;
return r.ToWords();
}
public static string ToWords(this int intNumber)
{
double r = (double)intNumber;
return r.ToWords();
}
public static string ToWords(this long longNumber)
{
double r = (double)longNumber;
return r.ToWords();
}
public static string ToWords(this decimal decimalNumber)
{
double r = (double)decimalNumber;
return r.ToWords();
}
private static string DecimalPlacesHelper(double decimalNumber)
{
string[] pos = { "Tenths", "Hundredths", "Thousandths", "Ten-Thousandths",
"Hundred-Thousandths", "Millionths", "Ten-Millionths",
"Hundred-Millionths", "Billionths", "Ten-Billionths", "Hundred-Billionths" };
double number = decimalNumber;
//Get only the decimal value and convert the decimal into a whole number
string str = number.ToString();
int index = str.IndexOf('.') == 0 ? 0 : str.IndexOf('.') + 1;
str = str.Substring(index);
//get the decimal place
int decimalPlace = str.Length;
number = double.Parse(str);
return ToWords(number) + " " + pos[decimalPlace - 1];
}
private static string HundredHelper(int number)
{
string rs = "";
int remainderofHundreds, qoutientOfHundreds;
int remainderOfTens, qoutientOfTens;
int num = number;
if (num == 0)
return ones[0];
qoutientOfHundreds = Math.DivRem(num, 100, out remainderofHundreds);
qoutientOfTens = Math.DivRem(remainderofHundreds, 10, out remainderOfTens);
if (qoutientOfHundreds != 0)
rs = ones[qoutientOfHundreds]
+ onesSeparator[qoutientOfHundreds]
+ " "
+ otherNumericName[0] + " ";
if (remainderofHundreds <= 20 && remainderofHundreds > 0)
rs = rs
+ ((rs.Length > 0 ) ? otherSeparator + " " : "")
+ ones[remainderofHundreds]
+ (!fireLastHundredSeparator ? onesSeparator[remainderofHundreds] : "");
else if (qoutientOfTens == 0)
rs = rs + tens[qoutientOfTens]; //select the empty number
else
{
rs = rs + tens[qoutientOfTens];
//include other separator, in Filipino AT (Dalawampu AT Isa)
//in Filipino language only fire when you are in One's Number part
rs = rs
+ " "
+ otherSeparator
+ " "
+ ones[remainderOfTens]
+(!fireLastHundredSeparator ? onesSeparator[remainderOfTens] : "");
}
return rs;
}
private static void SetTheCulture(string Culture)
{
switch (Culture.ToLower())
{
case "en-ph":
ones = new[] { "Wala", "Isa", "Dalawa", "Tatlo", "Apat", "Lima", "Anim", "Pito", "Walo", "Siyam",
"Sampu", "Labin-Isa", "Labin-Dalawa", "Labin-Tatlo", "Labin-Apat", "Labin-Lima",
"Labin-Anim", "Labin-Pito", "Labin-Walo", "Labin-Siyam", "Dalawampu" };
onesSeparator = new[] { "", "ng", "ng", "ng", " na", "ng", " na", "ng", "ng", " na",
"ng", "ng", "ng", "ng", " na", "ng", " na", "ng", "ng", " na", "ng" };
tens = new[] { "", "", "Dalawampu", "Tatlumpu", "Apatnapu", "Limampu", "Animnapu",
"Pitumpu", "Walalumpu", "Siyamnapu" };
tensSeparator = new[] { "", "", "ng", "ng", "ng", "ng", "ng", "ng", "ng", "ng" };
otherNumericName = new[] { "Daan", "Libo", "Milyon", "Bilyon" };
otherSeparator = "At";
negative = "Negatibo";
break;
case "en-us":
ones = new[] { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten",
"Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen",
"Eighteen", "Nineteen", "Twenty" };
onesSeparator = new[] { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" };
tens = new[] { "", "", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };
tensSeparator = new[]{ "", "", "", "", "", "", "", "", "", "" };
otherNumericName = new[] { "Hundred", "Thousand", "Million", "Billion" };
negative = "Negative";
otherSeparator = "";
break;
}
}
}