User management fixed. Reports working now. Deployed
This commit is contained in:
1 parent
1400f42989
commit
d4cfa92848
51 files changed
+1990
-1358
No files matched your search
@@ -4,6 +4,8 @@ using NHibernate.Tool.hbm2ddl;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using System.Reflection;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
@@ -41,29 +43,16 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
using (var session = SessionManager.StatelessSession)
|
||||
{
|
||||
session.Insert(GetRole(1, "Sales/Checkout"));
|
||||
session.Insert(GetRole(2, "Sales/SalesBill"));
|
||||
session.Insert(GetRole(3, "Sales/SaleDetail"));
|
||||
session.Insert(GetRole(4, "Sales/VoidPrintedBill"));
|
||||
session.Insert(GetRole(5, "Sales/EditBill"));
|
||||
session.Insert(GetRole(6, "Sales/PrintKOT"));
|
||||
session.Insert(GetRole(7, "Sales/PrintBill"));
|
||||
session.Insert(GetRole(8, "Sales/EditPrintedProduct"));
|
||||
session.Insert(GetRole(9, "Sales/ChangeRate"));
|
||||
session.Insert(GetRole(10, "Master/Products"));
|
||||
session.Insert(GetRole(11, "Security/ManageRoles"));
|
||||
session.Insert(GetRole(12, "Log/View"));
|
||||
session.Insert(GetRole(13, "Master/Owner"));
|
||||
|
||||
FieldInfo[] list = typeof(RoleConstants).GetFields(BindingFlags.Public | BindingFlags.Static);
|
||||
// write method names
|
||||
foreach (var item in list)
|
||||
{
|
||||
var role = (RoleConstants)item.GetValue(null);
|
||||
session.Insert(new Role() { Name = role.Role });
|
||||
}
|
||||
}
|
||||
}
|
||||
private static Role GetRole(int roleID, string name)
|
||||
{
|
||||
return new Role()
|
||||
{
|
||||
RoleID = roleID,
|
||||
Name = name
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
#region user
|
||||
public static void InsertUser()
|
||||
@@ -91,10 +80,12 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
session.Insert(GetGroup(1, "owner"));
|
||||
session.Insert(GetGroup(2, "waiter"));
|
||||
session.Insert(GetGroup(3, "captain"));
|
||||
session.Insert(GetGroup(4, "manager"));
|
||||
session.Insert(GetGroup(5, "controller"));
|
||||
session.Insert(GetGroup(6, "accountant"));
|
||||
session.Insert(GetGroup(3, "cashier"));
|
||||
session.Insert(GetGroup(4, "captain"));
|
||||
session.Insert(GetGroup(5, "senior captain"));
|
||||
session.Insert(GetGroup(6, "manager"));
|
||||
session.Insert(GetGroup(7, "controller"));
|
||||
session.Insert(GetGroup(8, "accountant"));
|
||||
}
|
||||
}
|
||||
private static Group GetGroup(int groupID, string name)
|
||||
@@ -130,7 +121,8 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
using (var session = SessionManager.StatelessSession)
|
||||
{
|
||||
var owner = session.Get<Group>(1);
|
||||
#region owner
|
||||
var group = session.Get<Group>(1);
|
||||
var list = session.CreateCriteria<Role>()
|
||||
.List<Role>();
|
||||
foreach (var item in list)
|
||||
@@ -138,9 +130,74 @@ namespace Tanshu.Accounts.Repository
|
||||
session.Insert(new RoleGroup()
|
||||
{
|
||||
Role = item,
|
||||
Group = owner
|
||||
Group = group
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
#region waiter
|
||||
group = session.Get<Group>(2);
|
||||
var role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.PRINT_KOT.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup()
|
||||
{
|
||||
Role = role,
|
||||
Group = group
|
||||
});
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.SALES.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup()
|
||||
{
|
||||
Role = role,
|
||||
Group = group
|
||||
});
|
||||
#endregion
|
||||
#region cashier
|
||||
group = session.Get<Group>(3);
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.PRINT_BILL.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.SALES.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.SETTLE_BILL.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.DISCOUNT.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
#endregion
|
||||
#region senior captain
|
||||
group = session.Get<Group>(5);
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.EDIT_PRINTED_PRODUCT.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
#endregion
|
||||
#region manager
|
||||
group = session.Get<Group>(6);
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.CHANGE_RATE.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.VOID_BILL.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.EDIT_PRINTED_BILL.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
role = session.CreateCriteria<Role>()
|
||||
.Add(Restrictions.Eq("Name", RoleConstants.PRODUCTS.Role))
|
||||
.UniqueResult<Role>();
|
||||
session.Insert(new RoleGroup() { Role = role, Group = group });
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -360,66 +417,34 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
using (var session = SessionManager.StatelessSession)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = "1" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "2" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "3" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "4" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "5" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "6" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "7" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "8" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "9" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "10" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "11" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "12" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "13" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "14" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "15" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "16" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "17" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "18" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "19" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "20" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "21" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "22" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "23" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "24" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "25" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "26" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "27" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "28" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "29" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "30" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "31" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "32" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "33" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "34" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "35" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "36" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "37" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "38" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "39" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "40" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "41" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "42" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "43" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "44" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "45" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "46" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "47" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "48" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "49" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "50" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "51" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "52" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "53" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "54" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "55" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "56" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "57" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "58" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "59" });
|
||||
session.Insert(new FoodTable() { Location = "", Name = "60" });
|
||||
for (int i = 1; i < 34; i++)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = i.ToString() });
|
||||
}
|
||||
for (int i = 40; i < 43; i++)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = i.ToString() });
|
||||
}
|
||||
for (int i = 50; i < 52; i++)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = i.ToString() });
|
||||
}
|
||||
for (int i = 60; i < 62; i++)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = i.ToString() });
|
||||
}
|
||||
for (int i = 70; i < 91; i++)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = i.ToString() });
|
||||
}
|
||||
for (int i = 1; i < 21; i++)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = "B" + i.ToString() });
|
||||
}
|
||||
for (int i = 1; i < 11; i++)
|
||||
{
|
||||
session.Insert(new FoodTable() { Location = "", Name = "D" + i.ToString() });
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user