private void lboxAlignment_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (bs_sysAlignment.Current == null)
            {
                return;
            }
            if (bs_nwChar.Current == null)
            {
                return;
            }
            hostChar c = bs_nwChar.Current as hostChar;

            if (c.Alignment == null)
            {
                return;
            }
            if (c.Alignment != bs_sysAlignment.Current)
            {
                SetMessage("Alignments dont match");
                c.Alignment = bs_sysAlignment.Current as sysBaseAlignment;
            }
            else
            {
                SetMessage("Alignment matches:" + c.Alignment.Name);
            }
        }
        private void btnJoin_Click(object sender, EventArgs e)
        {
            bool     bExists;
            hostChar me = bs_nwChar.Current as hostChar;

            if (me == null)
            {
                return;
            }

            IList <nwdbDataType> campaigns = sess.QueryOver <campCampaign>().List <nwdbDataType>();

            campaigns = FrmSelectsysDataType.Select(campaigns, "Select campaign", this);
            foreach (campCampaign camp in campaigns)
            {
                Debug.Print("Selected" + camp.ToString());
                bExists = false;
                foreach (campCharCampaign c in bs_nwCharCampaign.List)
                {
                    if (c.Campaign == camp)
                    {
                        SetMessage("Skipping " + campaigns.ToString() + "Already a participant");
                        bExists = true;
                    }
                }

                if (!bExists)
                {
                    // add as doesnt exists
                    campCharCampaign newc = new campCharCampaign(camp, me, false);
                    camp.Characters.Add(newc);
                    SetMessage("Applied to join :" + camp.ToString());
                }
            }
        }
        private void bs_sysTreeStatistic_CurrentChanged(object sender, EventArgs e)
        {
            sysTreeStatistic     n        = bs_sysTreeStatistic.Current as sysTreeStatistic;
            hostChar             nw       = bs_nwChar.Current as hostChar;
            IList <hostCharStat> filtered = new List <hostCharStat>();

            foreach (hostCharStat c in bs_nwCharStat.List)
            {
                if (c.stat.StatisticGroup == n)
                {
                    filtered.Add(c);
                    Debug.Print("Filtered in" + c.ToString());
                }
                else
                {
                    Debug.Print("Filtered out" + c.ToString());
                }
            }
            dataGridView1.DataSource = filtered;

            //bs_sysStatistic.DataSource = n.Statistics;
            //bs_nwCharStat.DataSource = sess.QueryOver<hostCharStat>( )
            //                            .WithSubquery.WhereExists(QueryOver.Of<sysStatistic>()
            //                                    .Where(tx => tx.StatisticGroup = n ))
            //                            .And(x => x.character == nw)
            //                            .List();
        }
 public campXPGained(string n, string nl, campAdventure adv, hostChar ch, int xp, int gold, bool approved) : base(n, nl)
 {
     this.Adventure  = adv;
     this.Character  = ch;
     this.XP         = xp;
     this.Gold       = gold;
     this.GMApproved = approved;
 }
Exemple #5
0
 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 nwChar_DeleteIfExistsWhenExists()
        {
            hostChar c = new hostChar("Brian", "Brian Walter", null);

            Debug.Print("Creating char record");
            repo.Add(c);
            bool res = repo.DeleteByLongName(typeof(hostChar), "Brian Walter");

            Assert.AreEqual(res, false);
        }
        public void nwChar_AddAndFindByID()
        {
            hostChar c = new hostChar("Brian", "Brian Walter", null);

            Debug.Print("Creating char record");
            repo.Add(c);
            Assert.Greater(repo.FindIDByLongName(typeof(hostChar), "Brian Walter"), 0);

            //Now delete
            repo.Delete(c);
        }
        private void nwCharBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            hostChar n = bs_nwChar.Current as hostChar;

            if (n == null)
            {
                return;
            }
            bs_nwItem.DataSource         = n.Items;
            bs_nwCharStat.DataSource     = n.CharStats;
            bs_nwCharCampaign.DataSource = n.Campaigns;
            lboxAlignment.SelectedItem   = n.Alignment;
            SetMessage("Set Items to " + n.LongName);
        }
        public void nwChar_CreateOwnedItem()
        {
            hostChar c  = new hostChar("God", "God is a DJ", null);
            nwItem   i1 = new nwItem("+1 dagger", "+1 Dagger");
            nwItem   i2 = new nwItem("+1 dagger", "+4 LongBow");

            i2.Description = "This is a mega bow created by the elven lords";
            c.Items.Add(i1);
            c.Items.Add(i2);
            repo.Add(c);


            //now delete
            repo.Delete(c);
        }
        public void nwChar_FindOrCreateWhenExists()
        {
            hostChar c = new hostChar("Barry", "Barry Manilow", null);

            Debug.Print("Creating char record");
            repo.Add(c);

            //Find Record
            Debug.Print("Calling Find or Create on Char created");
            var Character = repo.FindOrCreate(typeof(hostChar), "Barry", "Barry Manilow");

            Assert.AreEqual(Character.LongName, "Barry Manilow");

            //Now delete
            repo.Delete(Character);
        }
Exemple #11
0
        private void LoadSelectedChar(object sender, EventArgs e)
        {
            SetMessage("Sender" + sender.ToString());
            SetMessage("Events" + e.ToString());
            CheckedListBox clb = sender as CheckedListBox;
            hostChar       c   = clb.SelectedItem as hostChar;

            if (c != null)
            {
                SetMessage("loaded Character" + c.ToString());
                frmCharacters frmChar = new frmCharacters();
                frmChar.Character  = c;
                frmChar.Database   = this.Database;
                frmChar.Repository = this.Repository;
                frmChar.initData();
                frmChar.ShowDialog(this);
                frmChar.Dispose();
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            hostChar ch = bs_nwChar.Current as hostChar;

            //Flush Pending changes
            SetMessage("Delete called on " + ch.LongName);
            btnSave_Click(null, null);

            SetMessage("Deleting:" + ch.LongName);
            using (sess.BeginTransaction())
            {
                sess.Delete(ch);
                sess.Transaction.Commit();
                SetMessage("Deleted " + ch.LongName);
            }


            SetMessage("Reloading List");
            LoadCharacters();
        }
Exemple #13
0
        private void btnDeleteComment_Click(object sender, EventArgs e)
        {
            hostChar c = chkListBoxRejected.SelectedItem as hostChar;

            if (c != null)
            {
                bs_nwCharCampaign.SuspendBinding();
                foreach (campCharCampaign nwc in bs_nwCharCampaign.List)
                {
                    if (nwc.Character == c)
                    {
                        nwc.RejectComment   = null;
                        nwc.Approved        = false;
                        tboxRejectText.Text = "";
                        break;
                    }
                }

                bs_nwCharCampaign.ResumeBinding();
                LoadCharacters();
            }
        }
        public void nwChar_CreateTwoRecordsAndList()
        {
            Debug.Print("Calling Add x 2");
            hostChar c1 = new hostChar("Steve", "Steve Dangerfield", null);
            hostChar c2 = new hostChar("Gary", "Gary Barlow", null);

            repo.Add(c1);
            Assert.Greater(repo.FindIDByLongName(typeof(hostChar), "Steve Dangerfield"), 0);
            repo.Add(c2);
            Assert.Greater(repo.FindIDByLongName(typeof(hostChar), "Gary Barlow"), 0);
            Debug.Print("Calling List of hostChar");
            IList <nwdbDataType> il = repo.asList(typeof(hostChar));

            foreach (nwdbDataType item in il)
            {
                Debug.Print(item.ToString());
            }
            Assert.Greater(il.Count, 1);

            //Now delete
            repo.Delete(c1);
            repo.Delete(c2);
        }
Exemple #15
0
        private void chkListBoxRejected_SelectedIndexChanged(object sender, EventArgs e)
        {
            hostChar c = chkListBoxRejected.SelectedItem as hostChar;

            if (c != null)
            {
                bs_nwCharCampaign.SuspendBinding();
                foreach (campCharCampaign nwc in bs_nwCharCampaign.List)
                {
                    if (nwc.Character == c)
                    {
                        tboxRejectText.Text = nwc.RejectComment;
                        break;
                    }
                }

                bs_nwCharCampaign.ResumeBinding();
            }
            else
            {
                tboxRejectText.Text = "";
            }
        }
        public virtual bool SeedMockData()
        {
            //NEW FEDERATED Initialisations

            //libMapping Create Base;
            this.CreateLibMapping();

            //libHosting Create Base
            this.CreateLibHosting();

            //libRuleSet Create Base
            this.CreateLibRuleset();

            //libRuleSet Create Base
            this.CreateLibCampaign();


            try
            {
                //Seed Characters
                hostUser steve = this.Find((typeof(hostUser)), "unclemessy") as hostUser;
                hostUser lewis = this.Find((typeof(hostUser)), "lewis") as hostUser;
                hostUser matt  = this.Find((typeof(hostUser)), "matsly") as hostUser;

                if (FindIDByLongName(typeof(hostChar), "Messy da Anti Hero") == 0)
                {
                    hostChar c = new hostChar("Messy", "Messy da Anti Hero", steve);
                    c.RefreshCharacterStats(i);

                    //Chuck in some items
                    nwItem i1 = new nwItem("+1 Dagger", "+1 Dagger");
                    i1.Owner = c;
                    c.Items.Add(i1);
                    nwItem i2 = new nwItem("+4 LongBow", "+4 LongBow");
                    i2.Description = "This is a mega bow created by the elven lords";
                    i2.Owner       = c;
                    c.Items.Add(i2);
                    Add(c);

                    //i.SaveOrUpdate(new campCharCampaign(traitPBEM, c, false));
                    //traitPBEM.Characters.Add(c);
                    //i.SaveOrUpdate(c);
                }
                if (FindIDByLongName(typeof(hostChar), "Sabbath") == 0)
                {
                    hostChar c = new hostChar("Sabbath", "Sabbath", matt);
                    c.RefreshCharacterStats(i);

                    //Chuck in some items
                    nwItem i1 = new nwItem("+5 Vorpal", "+5 Vorpal Sword");
                    i1.Owner = c;
                    c.Items.Add(i1);
                    Add(c);
                }

                if (FindIDByLongName(typeof(hostChar), "Muttley") == 0)
                {
                    hostChar c = new hostChar("Muttley", "Muttley", lewis);
                    c.RefreshCharacterStats(i);
                    this.Add(c);
                    //i.SaveOrUpdate(new campCharCampaign(traitPBEM, c, false));
                    //i.SaveOrUpdate(c);
                }


                this.Save(steve);
                this.Save(matt);
                //this.Save(traitPBEM);


                return(true);
            }
            catch (GenericADOException ex)
            {
                var sql = ex.InnerException as SqlException;
                if (sql != null)
                {
                    Debug.Print("Caught GenericADO:" + ex.ToString());
                    Debug.Print("Caught Inner:" + sql.ToString());
                    Debug.Print("SQL ErrorNumber:" + sql.Number.ToString());
                    throw;
                }
                return(false);
            }
        }
Exemple #17
0
 public campCharCampaign(campCampaign camp, hostChar ch, bool bApproved) : this()
 {
     this.Campaign  = camp;
     this.Character = ch;
     this.Approved  = bApproved;
 }