Commits

Mario César Señoranis Ayala committed aaaddf8

Nuevos controladores y modulo de Ventas

  • Participants
  • Parent commits 02ba480

Comments (0)

Files changed (34)

File Diagramas/Base_de_datos.mwb

Binary file modified.

File Mangos.Apps/Auth/Group.cs

         {
         }
         
+        public override string ToString ()
+        {
+            return String.Format ("[Grupo: {0}]", Name);
+        }
+        
         public Group (string name)
         {
             this.name = name;

File Mangos.Apps/Auth/Permission.cs

             this.codename = codename;
         }
         
+        public override string ToString ()
+        {
+            return String.Format ("[Permission: {1}.{0}]", Name, OwnerModel.Name);
+        }
+        
         [PrimaryKey(PrimaryKeyType.Native, "id")]
         public int Id
         {

File Mangos.Apps/Auth/User.cs

             return user;
         }
         
+        public static void DeleteAll ()
+        {
+            ActiveRecordBase.DeleteAll (typeof(User));
+        }
+
+        public static User Find (int id)
+        {
+            return (User)ActiveRecordBase.FindByPrimaryKey (typeof(User), id);
+        }
+
         public bool hasPerms (string permission)
         {
             if (this.isAdmin) {

File Mangos.Apps/Inventory/Category.cs

         {
         }
         
+        public override string ToString ()
+        {
+            return String.Format ("[Category: {0}]", Name);
+        }
+        
         [PrimaryKey(PrimaryKeyType.Native, "id")]
         public int Id {
             get { return id; }

File Mangos.Apps/Inventory/Product.cs

 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 using System;
+
 using Castle.ActiveRecord;
 using System.Collections;
 using System.Collections.Generic;
         private string barcode;
         private Category category;
         private IList venues = new ArrayList ();
-
+        private IList orders = new ArrayList();
+        
         public Product ()
         {
         }
+  
+        public override string ToString ()
+        {
+            return String.Format ("[Producto: {0}]", Name);
+        }
         
         [PrimaryKey(PrimaryKeyType.Native, "id")]
         public int Id {
             set { venues = value; }
         }
         
+        [HasAndBelongsToMany(typeof(Sales.Order), Table = "sales_orders_products", ColumnKey = "inventory_product_id", ColumnRef = "sales_order_id")]
+        public IList Orders {
+            get { return orders; }
+            set { orders = value; }
+        }
+        
         public static Product FindById (int id)
         {
             return (Product)FindByPrimaryKey (typeof(Product), id);
         }
+        
+        public static Product[] SearchByName (string criteria)
+        {
+            var dis = new Disjunction ();
+            dis.Add(Expression.Like("Name", string.Format("%{0}%", criteria)));
+            dis.Add(Expression.Like("Description", string.Format("%{0}%", criteria)));
+            return (Product[])FindAll(typeof(Product), dis);
+        }
+        
+        public static Product SearchByBarcode (string barcode)
+        {
+            return (Product)FindOne (typeof(Product), Expression.Eq ("BarCode", barcode));
+        }
+        
+        public static Product[] FindAll ()
+        {
+            return (Product[])ActiveRecordBase.FindAll (typeof(Product));
+        }
+        
     }
 }

File Mangos.Apps/Inventory/Venue.cs

             set { id = value; }
         }
 
+        public override string ToString ()
+        {
+            return String.Format ("[Venue: {0}]", Name);
+        }
+        
         [Property("name")]
         public string Name
         {

File Mangos.Apps/Mangos.Apps.csproj

   <ItemGroup>
     <Folder Include="Auth\" />
     <Folder Include="Inventory\" />
-    <Folder Include="Cash\" />
-    <Folder Include="Core\" />
+    <Folder Include="Sales\" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Auth\User.cs" />
     <Compile Include="Inventory\Supplier.cs" />
     <Compile Include="Inventory\Venue.cs" />
     <Compile Include="Inventory\VenuesProducts.cs" />
+    <Compile Include="Sales\Client.cs" />
+    <Compile Include="Sales\Order.cs" />
+    <Compile Include="Sales\Invoice.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">

File Mangos.Apps/Sales/Client.cs

+//  
+//  Client.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+using System;
+using Castle.ActiveRecord;
+using System.Collections;
+using System.Collections.Generic;
+using NHibernate.Criterion;
+
+namespace Sales
+{
+    [ActiveRecord("sales_client")]
+    public class Client:ActiveRecordBase
+    {
+        private int id;
+        private string fullname;
+        private string nit;
+        private IList orders = new ArrayList ();
+
+        public Client ()
+        {
+        }
+        
+        public override string ToString ()
+        {
+            return string.Format ("{0} - {1}", fullname, nit);
+        }
+        
+        [PrimaryKey(PrimaryKeyType.Native, "id")]
+        public int Id {
+            get { return id; }
+            set { id = value; }
+        }
+        
+        [Property("full_name")]
+        public string FullName {
+            get { return fullname; }
+            set { fullname = value; }
+        }
+        
+        [Property("nit")]
+        public string Nit {
+            get { return nit; }
+            set { nit = value; }
+        }
+        
+        [HasMany(typeof(Order), Table = "sales_order", ColumnKey = "sales_client_id")]
+        public IList Orders {
+            get { return orders; }
+            set { orders = value; }
+        }
+
+    }
+}

File Mangos.Apps/Sales/Invoice.cs

+//  
+//  Invoice.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+using System;
+using Castle.ActiveRecord;
+namespace Sales
+{
+
+    public class Invoice
+    {
+        private int id;
+        private string code;
+        private float taxes;
+        private float discount_relative;
+        private float discount_fixed;
+        private float extracharge_relative;
+        private float extracharge_fixed;
+        private Order order;
+        
+        public Invoice ()
+        {
+        
+        }
+        
+        [PrimaryKey(PrimaryKeyType.Native, "id")]
+        public int Id
+        {
+            get { return id;}
+            set { id = value; }
+        }
+        
+        [BelongsTo("sales_order_id")]
+        public Order RelatedOrder {
+            get { return order; }
+            set { order = value; }
+        }
+        
+        [Property("code")]
+        public string Code 
+        {
+            get { return code; }
+            set { code = value; }
+        }
+        
+        [Property("taxes")]
+        public float Taxes
+        {
+            get { return taxes; }
+            set { taxes = value; }
+        }
+        
+        [Property("discount_relative")]
+        public float DiscountRelative
+        {
+            get { return discount_relative; }
+            set { discount_relative = value; }
+        }
+        
+        [Property("discount_fixed")]
+        public float DiscountFixed {
+            get {
+                return discount_fixed;
+            }
+            set {
+                discount_fixed = value;
+            }
+        }
+        
+        [Property("extracharge_relative")]
+        public float ExtrachargeRelative {
+            get {
+                return extracharge_relative;
+            }
+            set {
+                extracharge_relative = value;
+            }
+        }
+        
+        [Property("extracharge_fixed")]
+        public float ExtrachargeFixed {
+            get {
+                return extracharge_fixed;
+            }
+            set {
+                extracharge_fixed = value;
+            }
+        }
+
+
+    }
+}

File Mangos.Apps/Sales/Order.cs

+//  
+//  Order.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+using System;
+using System.Collections;
+using Castle.ActiveRecord;
+
+namespace Sales
+{
+
+    [ActiveRecord("sales_order")]
+    public class Order: ActiveRecordBase
+    {
+        private int id;
+        private DateTime? created_at;
+        private Client client;
+        private Invoice invoice;
+        private Auth.User user;
+        private IList products = new ArrayList();
+        
+        public Order ()
+        {
+        }
+        
+        [PrimaryKey(PrimaryKeyType.Native, "id")]
+        public int Id {
+            get { return id; }
+            set { id = value; }
+        }
+        
+        [Property("created_at")]
+        public DateTime? CreatedAt {
+            get { return created_at; }
+            set { created_at = value; }
+        }
+        
+        [BelongsTo("sales_client_id")]
+        public Client OwnerClient
+        {
+            get { return client; }
+            set { client = value; }
+        }
+        
+        [BelongsTo("auth_user_id")]
+        public Auth.User OwnerUser {
+            get { return user; }
+            set { user = value; }
+        }
+        
+        [OneToOne]
+        public Invoice RelatedInvoice {
+            get { return invoice; }
+            set { invoice = value; }
+        }
+        
+        [HasAndBelongsToMany(typeof(Inventory.Product), Table = "sales_orders_products", ColumnKey = "sales_order_id", ColumnRef = "inventory_product_id")]
+        public IList Products {
+            get { return products; }
+            set { products = value; }
+        }
+        
+    }
+}

File Mangos.Web/Controllers/CategoriesController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Inventory.Category))]
+    public class CategoriesController:Controller
+    {
+
+    }
+}

File Mangos.Web/Controllers/ClientsController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Sales.Client))]
+    public class SalesController : Controller
+    {
+        
+    }
+}

File Mangos.Web/Controllers/GroupsController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Auth.Group))]
+    public class GroupsController:Controller
+    {
+
+    }
+}

File Mangos.Web/Controllers/HomeController.cs

-using Mangos.Apps;
+
 namespace Mangos.Web.Controllers
 {
 	using System;
-
+    using Mangos.Apps;
 	using Castle.MonoRail.Framework;
 
 	[Layout("default"), Rescue("generalerror")]

File Mangos.Web/Controllers/InvoicesController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Sales.Invoice))]
+    public class InvoicesController : Controller
+    {
+        
+    }
+}

File Mangos.Web/Controllers/ModelsController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Auth.Model))]
+    public class ModelsController:Controller
+    {
+
+    }
+}

File Mangos.Web/Controllers/OrdersController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Sales.Order))]
+    public class OrdersController : Controller
+    {
+        
+    }
+}

File Mangos.Web/Controllers/PermissionsController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Auth.Permission))]
+    public class PermissionsController:Controller
+    {
+
+    }
+}

File Mangos.Web/Controllers/ProductsController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Inventory.Product))]
+    public class ProductsController:Controller
+    {
+
+    }
+}

File Mangos.Web/Controllers/UsersController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Auth.User))]
+    public class UsersController:Controller
+    {
+
+    }
+}

File Mangos.Web/Controllers/VenuesController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Inventory.Venue))]
+    public class VenuesController:Controller
+    {
+
+    }
+}

File Mangos.Web/Controllers/VenuesProductsController.cs

+//  
+//  UsersController.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace Controllers
+{
+    using System;
+    using Mangos.Apps;
+    using Castle.MonoRail.Framework;
+    using Castle.MonoRail.ActiveRecordSupport.Scaffold;
+
+    [Scaffolding(typeof(Inventory.VenuesProducts))]
+    public class VenuesproductsController:Controller
+    {
+
+    }
+}

File Mangos.Web/GlobalApplication.cs

 {
 	using System;
 	using System.Web;
-	
+	using Mangos.Apps;
 	using Castle.ActiveRecord;
 	using Castle.ActiveRecord.Framework.Config;
 	
 		{
 		}
 
-		public void Application_OnStart()
+		public void Application_OnStart ()
 		{
+            ActiveRecordStarter.Initialize (ActiveRecordSectionHandler.Instance, new Type[] {
+                typeof(Auth.User),
+                typeof(Auth.Group),
+                typeof(Auth.Permission),
+                typeof(Auth.Model),
+                typeof(Inventory.Category),
+                typeof(Inventory.Product),
+                typeof(Inventory.Venue),
+                typeof(Inventory.VenuesProducts),
+                typeof(Sales.Client),
+                typeof(Sales.Invoice),
+                typeof(Sales.Order)
+            });
 		}
 
 		public void Application_OnEnd() 

File Mangos.Web/Mangos.Web.csproj

     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Mangos.Web</RootNamespace>
     <AssemblyName>Mangos.Web</AssemblyName>
-    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\lib\ActiveRecord\Castle.MonoRail.Views.Brail.dll</HintPath>
     </Reference>
+    <Reference Include="Castle.MonoRail.TestSupport, Version=2.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\lib\ActiveRecord\Castle.MonoRail.TestSupport.dll</HintPath>
+    </Reference>
+    <Reference Include="Castle.MonoRail.TransformFilters, Version=2.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\lib\ActiveRecord\Castle.MonoRail.TransformFilters.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Content Include="Content\css\base.css" />
     <Compile Include="Controllers\HomeController.cs" />
     <Compile Include="GlobalApplication.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Controllers\UsersController.cs" />
+    <Compile Include="Controllers\ProductsController.cs" />
+    <Compile Include="Controllers\CategoriesController.cs" />
+    <Compile Include="Controllers\GroupsController.cs" />
+    <Compile Include="Controllers\PermissionsController.cs" />
+    <Compile Include="Controllers\ModelsController.cs" />
+    <Compile Include="Controllers\VenuesController.cs" />
+    <Compile Include="Controllers\VenuesProductsController.cs" />
+    <Compile Include="Controllers\OrdersController.cs" />
+    <Compile Include="Controllers\InvoicesController.cs" />
+    <Compile Include="Controllers\ClientsController.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="Views\layouts\default.vm" />
     <MonoDevelop>
       <Properties VerifyCodeBehindFields="true" VerifyCodeBehindEvents="true">
         <XspParameters Port="8000" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="true" />
+        <WebDeployTargets>
+          <Target />
+        </WebDeployTargets>
       </Properties>
     </MonoDevelop>
   </ProjectExtensions>
+  <ItemGroup>
+    <ProjectReference Include="..\Mangos.Apps\Mangos.Apps.csproj">
+      <Project>{9F867B04-D27E-4FB3-900C-27BB78DF526E}</Project>
+      <Name>Mangos.Apps</Name>
+    </ProjectReference>
+  </ItemGroup>
 </Project>

File Mangos.Web/Web.config

 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 	<configSections>
-		<section name="monorail" type="Castle.MonoRail.Framework.Configuration.MonoRailSectionHandler, Castle.MonoRail.Framework" />
+		<section
+            name="monorail"
+            type="Castle.MonoRail.Framework.Configuration.MonoRailSectionHandler, Castle.MonoRail.Framework" />
 		<section 
 			name="activerecord"
 			type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord" />
             <add key="connection.connection_string" value="Server=localhost;Database=mangos;User ID=root;Password=sudorei4eva;" />
             <add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" /> 
             <add key="dialect" value="NHibernate.Dialect.MySQL5Dialect" />
-            <add key="show_sql" value="True" />
+            <add key="show_sql" value="False" />
 		</config>
 	    
 	</activerecord>
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{0241A68F-5728-4EA1-A620-A62AC43072A0}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{0241A68F-5728-4EA1-A620-A62AC43072A0}.Debug|x86.Build.0 = Debug|Any CPU
 		{0241A68F-5728-4EA1-A620-A62AC43072A0}.Release|x86.ActiveCfg = Release|Any CPU
 		{0ED5EEEF-C2C7-468D-96C9-2A4C8B3DD759}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{0ED5EEEF-C2C7-468D-96C9-2A4C8B3DD759}.Release|x86.ActiveCfg = Release|Any CPU

File Mangos/MainWindow.cs

         product.Create ();
         */
         
-        Inventory.Product p1 = Inventory.Product.FindById(1);
-        Inventory.Product p2 = Inventory.Product.FindById (2);
-        
-        System.Console.WriteLine("{0}", p1.Name);
-        
     }
     
     protected virtual void OnPopularActionActivated (object sender, System.EventArgs e)

File Mangos/Mangos.csproj

     <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="gtk-gui\gui.stetic">
     <Compile Include="gtk-gui\Dialogs.Settings.cs" />
     <Compile Include="Views\UsersView.cs" />
     <Compile Include="gtk-gui\Views.UsersView.cs" />
+    <Compile Include="Views\OrderView.cs" />
+    <Compile Include="gtk-gui\Views.Checkout.cs" />
+    <Compile Include="Views\InvoiceView.cs" />
+    <Compile Include="gtk-gui\Views.InvoiceView.cs" />
   </ItemGroup>
   <ItemGroup>
     <Content Include="app.desktop">

File Mangos/Views/InvoiceView.cs

+//  
+//  InvoiceView.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+using System;
+
+namespace Views
+{
+
+
+    [System.ComponentModel.ToolboxItem(true)]
+    public partial class InvoiceView : Gtk.Bin
+    {
+
+        public InvoiceView ()
+        {
+            this.Build ();
+        }
+    }
+}

File Mangos/Views/OrderView.cs

+//  
+//  Checkout.cs
+//  
+//  Author:
+//       Mario César Señoranis Ayala <mariocesar.c50@gmail.com>
+// 
+//  Copyright (c) 2010 mariocesar
+// 
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+using System;
+
+namespace Views
+{
+
+
+    [System.ComponentModel.ToolboxItem(true)]
+    public partial class Checkout : Gtk.Bin
+    {
+
+        public Checkout ()
+        {
+            this.Build ();
+        }
+    }
+}

File Mangos/gtk-gui/Views.Checkout.cs

+// ------------------------------------------------------------------------------
+//  <autogenerated>
+//      This code was generated by a tool.
+//      Mono Runtime Version: 2.0.50727.1433
+// 
+//      Changes to this file may cause incorrect behavior and will be lost if 
+//      the code is regenerated.
+//  </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace Views {
+    
+    
+    public partial class Checkout {
+    }
+}

File Mangos/gtk-gui/Views.InvoiceView.cs

+// ------------------------------------------------------------------------------
+//  <autogenerated>
+//      This code was generated by a tool.
+//      Mono Runtime Version: 2.0.50727.1433
+// 
+//      Changes to this file may cause incorrect behavior and will be lost if 
+//      the code is regenerated.
+//  </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace Views {
+    
+    
+    public partial class InvoiceView {
+    }
+}

File Mangos/gtk-gui/gui.stetic

       </widget>
     </child>
   </widget>
+  <widget class="Gtk.Bin" id="Views.Checkout" design-size="669 470">
+    <property name="MemberName" />
+    <property name="Visible">False</property>
+    <child>
+      <widget class="Gtk.HBox" id="hbox1">
+        <property name="MemberName" />
+        <property name="Spacing">6</property>
+        <child>
+          <widget class="Gtk.VBox" id="vbox4">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow2">
+                <property name="MemberName" />
+                <property name="WidthRequest">400</property>
+                <property name="ShadowType">In</property>
+                <child>
+                  <widget class="Gtk.TreeView" id="treeview4">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="ShowScrollbars">True</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">0</property>
+                <property name="AutoSize">True</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Label" id="label3">
+                <property name="MemberName" />
+                <property name="HeightRequest">100</property>
+                <property name="Xpad">6</property>
+                <property name="Ypad">6</property>
+                <property name="Xalign">0</property>
+                <property name="Yalign">0</property>
+                <property name="LabelProp" translatable="yes">{{description}}</property>
+                <property name="UseMarkup">True</property>
+                <property name="Wrap">True</property>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+                <property name="AutoSize">True</property>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.HBox" id="hbox2">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <property name="BorderWidth">6</property>
+                <child>
+                  <widget class="Gtk.Button" id="button3">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="UseStock">True</property>
+                    <property name="Type">StockItem</property>
+                    <property name="StockId">gtk-delete</property>
+                    <property name="label">gtk-delete</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Button" id="button2">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="Type">TextAndIcon</property>
+                    <property name="Icon">stock:gtk-save Menu</property>
+                    <property name="Label" translatable="yes">_Facturar</property>
+                    <property name="UseUnderline">True</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Button" id="button1">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="UseStock">True</property>
+                    <property name="Type">StockItem</property>
+                    <property name="StockId">gtk-print</property>
+                    <property name="label">gtk-print</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">2</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">2</property>
+                <property name="AutoSize">True</property>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">0</property>
+            <property name="AutoSize">True</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="Gtk.Notebook" id="notebook1">
+            <property name="MemberName" />
+            <property name="WidthRequest">250</property>
+            <property name="CanFocus">True</property>
+            <property name="CurrentPage">1</property>
+            <child>
+              <widget class="Gtk.VBox" id="vbox1">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <child>
+                  <widget class="Gtk.Entry" id="entry1">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="IsEditable">True</property>
+                    <property name="InvisibleChar">•</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
+                    <property name="MemberName" />
+                    <property name="ShadowType">In</property>
+                    <child>
+                      <widget class="Gtk.TreeView" id="treeview1">
+                        <property name="MemberName" />
+                        <property name="CanFocus">True</property>
+                        <property name="ShowScrollbars">True</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="sidebar_text_product">
+                    <property name="MemberName" />
+                    <property name="HeightRequest">100</property>
+                    <property name="Xpad">6</property>
+                    <property name="Ypad">6</property>
+                    <property name="Xalign">0</property>
+                    <property name="Yalign">0</property>
+                    <property name="LabelProp" translatable="yes">{{description}}</property>
+                    <property name="UseMarkup">True</property>
+                    <property name="Wrap">True</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">2</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="Gtk.Label" id="label1">
+                <property name="MemberName" />
+                <property name="LabelProp" translatable="yes">Productos</property>
+              </widget>
+              <packing>
+                <property name="type">tab</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.VBox" id="vbox2">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <child>
+                  <widget class="Gtk.VBox" id="vbox3">
+                    <property name="MemberName" />
+                    <property name="Spacing">6</property>
+                    <child>
+                      <widget class="Gtk.HBox" id="hbox3">
+                        <property name="MemberName" />
+                        <property name="Spacing">6</property>
+                        <child>
+                          <widget class="Gtk.Entry" id="entry2">
+                            <property name="MemberName" />
+                            <property name="CanFocus">True</property>
+                            <property name="IsEditable">True</property>
+                            <property name="InvisibleChar">•</property>
+                          </widget>
+                          <packing>
+                            <property name="Position">0</property>
+                            <property name="AutoSize">True</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="Gtk.Button" id="button4">
+                            <property name="MemberName" />
+                            <property name="CanFocus">True</property>
+                            <property name="UseStock">True</property>
+                            <property name="Type">StockItem</property>
+                            <property name="StockId">gtk-add</property>
+                            <property name="label">gtk-add</property>
+                          </widget>
+                          <packing>
+                            <property name="Position">1</property>
+                            <property name="AutoSize">True</property>
+                            <property name="Expand">False</property>
+                            <property name="Fill">False</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="Position">0</property>
+                        <property name="AutoSize">True</property>
+                        <property name="Expand">False</property>
+                        <property name="Fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow1">
+                        <property name="MemberName" />
+                        <property name="ShadowType">In</property>
+                        <child>
+                          <widget class="Gtk.TreeView" id="treeview2">
+                            <property name="MemberName" />
+                            <property name="CanFocus">True</property>
+                            <property name="ShowScrollbars">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="Position">1</property>
+                        <property name="AutoSize">True</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="sidebar_text_client">
+                    <property name="MemberName" />
+                    <property name="HeightRequest">100</property>
+                    <property name="Xpad">6</property>
+                    <property name="Ypad">6</property>
+                    <property name="Xalign">0</property>
+                    <property name="Yalign">0</property>
+                    <property name="LabelProp" translatable="yes">{{description}}</property>
+                    <property name="UseMarkup">True</property>
+                    <property name="Wrap">True</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Label" id="label2">
+                <property name="MemberName" />
+                <property name="LabelProp" translatable="yes">Clientes</property>
+              </widget>
+              <packing>
+                <property name="type">tab</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">1</property>
+            <property name="AutoSize">True</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="Gtk.Bin" id="Views.InvoiceView" design-size="300 300">
+    <property name="MemberName" />
+    <property name="Visible">False</property>
+    <child>
+      <placeholder />
+    </child>
+  </widget>
 </stetic-interface>