public void initData() { //Create&Drop if (this.Database == null) { this.Database = new nwdbConnection(); } sessionFactory = this.Database.Factory; if (this.Repository == null) { this.Repository = new nwdbRepository(sessionFactory.OpenSession()); } sess = this.Repository.GetSession(); stm = new sysTreeManager(); //repo.SeedMockData(); if (this.Adventure != null) { bs_nwAdventure.List.Clear(); bs_nwAdventure.List.Add(Adventure); } else { SetMessage("initData Failed no Adventure set"); } bs_sysMileStoneType.DataSource = sess.QueryOver <DataModel.libData.sysMilestoneType>().List(); }
private void initData() { //Create&Drop if (this.Database == null) { this.Database = new nwdbConnection(); } sessionFactory = this.Database.Factory; if (this.Repository == null) { this.Repository = new nwdbRepository(sessionFactory.OpenSession()); } sess = this.Repository.GetSession(); stm = new sysTreeManager(); //repo.SeedMockData() if (this.Logon != null) { isAdmin = (this.Logon.UserType.LongName == "Administrator"); SetMessage("isAdmin calulated" + isAdmin.ToString() + " for Logon" + this.Logon.LongName); } if (this.Logon == null || isAdmin) { bs_hostUser.DataSource = sess.QueryOver <hostUser>().List(); } else { bs_hostUser.DataSource = sess.QueryOver <hostUser>().Where(tx => tx.id == this.Logon.id).List(); } }
public sysDocuments(hostUser logon, hostChar ch, nwdbRepository repo, nwdbConnection nw) { this.Logon = logon; this.Character = ch; this.Repository = repo; this.Database = nw; initData(); }
public void nwDB_SeedRepo() { nwdbConnection nw2 = new nwdbConnection(true); sessionFactory = nw.Factory; repo = new nwdbRepository(sessionFactory.OpenSession()); repo.SeedMockData(); }
public void nwDB_CreateDatabase() { bool res; nwdbConnection nw2 = new nwdbConnection(); res = nw2.CreateDatabase("norwold-ui"); Assert.AreEqual(res, true); }
public virtual void InitData() { //Create&Drop if (this.Database == null) { this.Database = new nwdbConnection(); } sessionFactory = this.Database.Factory; if (this.Repository == null) { this.Repository = new nwdbRepository(sessionFactory.OpenSession()); } sess = this.Repository.GetSession(); treeman = new sysTreeManager(); }
public void initData() { //Create&Drop if (this.Database == null) { this.Database = new nwdbConnection(); } sessionFactory = this.Database.Factory; if (this.Repository == null) { this.Repository = new nwdbRepository(sessionFactory.OpenSession()); } sess = this.Repository.GetSession(); stm = new sysTreeManager(); //repo.SeedMockData(); bs_sysAlignment.DataSource = sess.QueryOver <sysBaseAlignment>().List(); if (this.Logon != null) { isAdmin = (this.Logon.UserType.LongName == "Administrator"); SetMessage("isAdmin calulated" + isAdmin.ToString() + " for Logon" + this.Logon.LongName); } if (this.Character != null) { bs_nwChar.List.Clear(); bs_nwChar.List.Add(Character); lboxLogon.Visible = false; lboxCharacters.Visible = false; btnDelete.Visible = false; btnAdd.Visible = false; nwCharBindingSource_CurrentChanged(this, null); return; } if (this.Logon == null || isAdmin) { bs_logons.DataSource = sess.QueryOver <hostUser>().List(); } else { bs_logons.DataSource = sess.QueryOver <hostUser>().Where(tx => tx.id == this.Logon.id).List(); } LoadCharacters(); bs_sysTreeStatistic.DataSource = sess.QueryOver <sysTreeStatistic>().List(); stm.FillTreeNodeCollection <sysTreeStatistic>(sess, treeStatistic.Nodes); //catch late binding controls nwCharBindingSource_CurrentChanged(this, null); }
public void initData() { //Create&Drop if (this.Database == null) { this.Database = new nwdbConnection(); } sessionFactory = this.Database.Factory; if (this.Repository == null) { this.Repository = new nwdbRepository(sessionFactory.OpenSession()); } sess = this.Repository.GetSession(); stm = new sysTreeManager(); //repo.SeedMockData(); }
public frmUserManager() { InitializeComponent(); nw = new nwdbConnection(); //Update //nw = new nwdbConnection(); sessionFactory = nw.Factory; repo = new nwdbRepository(sessionFactory.OpenSession()); sess = repo.GetSession(); stm = new sysTreeManager(); bs_hostUser.DataSource = sess.QueryOver <hostUser>().List(); bs_userType.DataSource = sess.QueryOver <hostUserType>().List(); }
private void FrmLogon_Load(object sender, EventArgs e) { Debug.Print("LOAD FIRED"); //Create&Drop if (nw == null) { nw = new nwdbConnection(); } sessionFactory = nw.Factory; if (repo == null) { repo = new nwdbRepository(sessionFactory.OpenSession()); } sess = repo.GetSession(); //this.btnLogin_Click(this, null); }
protected void DropCreateDB(string dbname, string username, string password) { nw = new nwdbConnection(true, dbname, username, password); sessionFactory = nw.Factory; repo = new nwdbRepository(sessionFactory.OpenSession()); }
static void Main() { var nw = new nwdbConnection(); var sessionFactory = nw.Factory; var repo = new nwdbRepository(sessionFactory.OpenSession()); // retreive all dmgtypes and display them //var sorttypes = session.CreateCriteria(typeof(ConstSysStatisticSortGroup)) // .List<ConstSysStatisticSortGroup>(); //campTree nwt; /* * nwdbDataType nws; * ConstSysItemFamily nwf; * ConstSysItemClass nwc; * nws = new ConstSysDmgType(); * WritePretty(nws.asList(session), "Damage Type"); * nws = new ConstSysAoeType(); * WritePretty(nws.asList(session), "Aoe Type"); * nws = new ConstSysCheckResult(); * WritePretty(nws.asList(session), "Check Result"); * nws = new ConstSysRange(); * WritePretty(nws.asList(session), "Ranges"); * nws = new ConstSysSchool(); * WritePretty(nws.asList(session), "Schools"); * nws = new ConstSysStatisticSortGroup(); * WritePretty(nws.asList(session), "Stat groups"); * nws = new ConstSysFrequency(); * WritePretty(nws.asList(session), "Frequency"); * * Debug.WriteLine("Start" ); * nwf = repo.FindOrNew(typeof(ConstSysItemFamily), "Items", "General") as ConstSysItemFamily; * * Debug.WriteLine("Armor Family returned" + nwf.toString()); * nwf.LongName = "Armor + Shields"; * session.SaveOrUpdate(nwf); * * * * // WritePretty(nwf.asList(session), "Item Family"); * nwc = repo.FindOrNew(typeof(ConstSysItemClass), "Amulets", "Amulets, Necklaces") as ConstSysItemClass; * * * var records = repo.asList(nwc); * foreach (nwdbDataType r in records) * { * Debug.Print("Amulet Report:" + r.toString()); * } * * * //WritePretty(nwc.asList(session), "Item Class"); * nwc.item_family = nwf; * //int r = nwf.FindIDByName(session, "Armor"); * //Debug.WriteLine("Armor returned" + r as string); * //Debug.WriteLine("Set ItemClass Family to" +nwc.item_family.toString()); * session.SaveOrUpdate(nwc); * */ //add a dmttype //ConstSysDmgType c = new ConstSysDmgType("Piercing","Piercing Damage"); //repo.Add(typeof(hostChar), new hostChar("Brian", "Brian Walter","*****@*****.**")); //hostChar c = repo.FindbyID(typeof(hostChar), 1) as hostChar; //Debug.WriteLine(c.ToString()); //session.SaveOrUpdate(c); //transaction.Commit(); //int did = repo.FindIDByLongName(typeof(hostChar), "Derek Willow2"); //hostChar d = repo.FindbyID(typeof(hostChar), did) as hostChar; //Debug.WriteLine(d.ToString()); Debug.Print("Calling List of hostChar"); IList <nwdbDataType> il = repo.asList(typeof(hostChar)); foreach (nwdbDataType item in il) { Debug.Print(item.ToString()); } }