Esempio n. 1
0
        /// <summary>
        /// Load a character death record. Make sure to set CharacterDeathID to the record to load.  Use this if you have a connection open.
        /// </summary>
        /// <param name="connPortal">SQL Connection to the portal.</param>
        public void Load(string sUserID)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            if (CampaignID > 0)
            {
                SortedList sParam = new SortedList();
                sParam.Add("@CampaignID", CampaignID.ToString());
                DataTable dtRaceList = new DataTable();

                try
                {
                    dtRaceList = cUtilities.LoadDataTable("uspGetCampaignRaces", sParam, "LARPortal", sUserID, lsRoutineName);
                }
                catch (Exception ex)
                {
                    string t = ex.Message;
                }
                foreach (DataRow dRace in dtRaceList.Rows)
                {
                    int iCampaignRaceID;
                    int iGameSystemID;
                    int iCampaignID;

                    if ((int.TryParse(dRace["CampaignRaceID"].ToString(), out iCampaignRaceID)) &&
                        (int.TryParse(dRace["GameSystemID"].ToString(), out iGameSystemID)) &&
                        (int.TryParse(dRace["CampaignID"].ToString(), out iCampaignID)))
                    {
                        cRace NewRace = new cRace();
                        NewRace.CampaignRaceID     = iCampaignRaceID;
                        NewRace.GameSystemID       = iGameSystemID;
                        NewRace.CampaignID         = iCampaignID;
                        NewRace.RaceName           = dRace["RaceName"].ToString();
                        NewRace.SubRace            = dRace["SubRace"].ToString();
                        NewRace.Description        = dRace["Description"].ToString();
                        NewRace.MakeupRequirements = dRace["MakeupRequirements"].ToString();
                        NewRace.Photo    = dRace["Photo"].ToString();
                        NewRace.Comments = dRace["Comments"].ToString();
                        RaceList.Add(NewRace);
                    }
                }
            }
        }
Esempio n. 2
0
        private int _LoadCharacter(DataSet dsCharacterInfo)
        {
            int iNumCharacterRecords = 0;

            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            int      iTemp;
            bool     bTemp;
            DateTime dtTemp;
            double   dTemp;

            Places          = new List <cCharacterPlace>();
            Deaths          = new List <cCharacterDeath>();
            Actors          = new List <cActor>();
            Relationships   = new List <cRelationship>();
            Pictures        = new List <cPicture>();
            CharacterSkills = new List <cCharacterSkill>();
            Descriptors     = new List <cDescriptor>();
            CharacterItems  = new List <cCharacterItems>();

            Race       = new cRace();
            CharType   = new cCharacterType();
            Status     = new cCharacterStatus();
            SkillPools = new List <cSkillPool>();
            Teams      = new List <cTeamInfo>();

            DateTime?dtDateCharacterCreated = null;

            Dictionary <int, string> TableInfo = new Dictionary <int, string>();

            for (int i = 0; i < dsCharacterInfo.Tables.Count; i++)
            {
                if (dsCharacterInfo.Tables[i].Rows.Count > 0)
                {
                    if (dsCharacterInfo.Tables[i].Columns["TableName"] != null)
                    {
                        TableInfo.Add(i, dsCharacterInfo.Tables[i].Rows[0]["TableName"].ToString());
                    }
                    else
                    {
                        TableInfo.Add(i, "Unknown");
                    }
                }
                else
                {
                    TableInfo.Add(i, "No Rows");
                }
            }

            dsCharacterInfo.Tables[0].TableName  = "CHCharacters";
            dsCharacterInfo.Tables[1].TableName  = "CHCharacterActors";
            dsCharacterInfo.Tables[2].TableName  = "CHCharacterSkillSets";
            dsCharacterInfo.Tables[3].TableName  = "CHCharacterPlaces";
            dsCharacterInfo.Tables[4].TableName  = "CHCharacterStaffComments";
            dsCharacterInfo.Tables[5].TableName  = "CHCharacterRelationships";
            dsCharacterInfo.Tables[6].TableName  = "CHCharacterPictures";
            dsCharacterInfo.Tables[7].TableName  = "CHCharacterDeaths";
            dsCharacterInfo.Tables[8].TableName  = "CHCampaignRaces";
            dsCharacterInfo.Tables[9].TableName  = "CHCharacterTypes";
            dsCharacterInfo.Tables[10].TableName = "MDBStatus";
            dsCharacterInfo.Tables[11].TableName = "CurrentCharacterUser";
            dsCharacterInfo.Tables[12].TableName = "PlotUser";
            dsCharacterInfo.Tables[13].TableName = "CharacterSkills";
            dsCharacterInfo.Tables[14].TableName = "Descriptors";
            dsCharacterInfo.Tables[15].TableName = "CharacterItems";
            dsCharacterInfo.Tables[16].TableName = "ProfilePicture";
            dsCharacterInfo.Tables[17].TableName = "CampaignInfo";
            dsCharacterInfo.Tables[18].TableName = "CHCharacterSkillsPoints";
            dsCharacterInfo.Tables[19].TableName = "CMTeamMemberInfo";
            dsCharacterInfo.Tables[20].TableName = "SkillCost";

            iNumCharacterRecords = dsCharacterInfo.Tables["CHCharacters"].Rows.Count;

            foreach (DataRow dRow in dsCharacterInfo.Tables["CHCharacters"].Rows)
            {
                if (int.TryParse(dRow["CharacterID"].ToString(), out iTemp))
                {
                    CharacterID = iTemp;
                }

                if (int.TryParse(dRow["CurrentUserID"].ToString(), out iTemp))
                {
                    CurrentUserID = iTemp;
                }

                if (int.TryParse(dRow["CharacterStatus"].ToString(), out iTemp))
                {
                    CharacterStatusID = iTemp;
                }

                FirstName  = dRow["CharacterFirstName"].ToString();
                MiddleName = dRow["CharacterMiddleName"].ToString();
                LastName   = dRow["CharacterLastName"].ToString();
                AKA        = dRow["CharacterAKA"].ToString();
                Title      = dRow["CharacterTitle"].ToString();

                if (int.TryParse(dRow["CharacterType"].ToString(), out iTemp))
                {
                    CharacterType = iTemp;
                }
                else
                {
                    CharacterType = -1;
                }

                if (int.TryParse(dRow["PlotLeadPerson"].ToString(), out iTemp))
                {
                    PlotLeadPerson = iTemp;
                }
                else
                {
                    PlotLeadPerson = -1;
                }

                if (bool.TryParse(dRow["RulebookCharacter"].ToString(), out bTemp))
                {
                    RulebookCharacter = bTemp;
                }
                else
                {
                    RulebookCharacter = false;
                }

                CharacterHistory = dRow["CharacterHistory"].ToString();
                DateOfBirth      = dRow["DateOfBirth"].ToString();
                WhereFrom        = dRow["WhereFrom"].ToString();
                CurrentHome      = dRow["CurrentHome"].ToString();
                CardPrintName    = dRow["CardPrintName"].ToString();
                HousingListName  = dRow["HousingListName"].ToString();

                if (DateTime.TryParse(dRow["StartDate"].ToString(), out dtTemp))
                {
                    StartDate = dtTemp;
                }
                else
                {
                    StartDate = null;
                }

                if (DateTime.TryParse(dRow["DateHistorySubmitted"].ToString(), out dtTemp))
                {
                    DateHistorySubmitted = dtTemp;
                }
                else
                {
                    DateHistorySubmitted = null;
                }

                if (DateTime.TryParse(dRow["DateHistoryApproved"].ToString(), out dtTemp))
                {
                    DateHistoryApproved = dtTemp;
                }
                else
                {
                    DateHistoryApproved = null;
                }

                CharacterEmail = dRow["CharacterEmail"].ToString();

                if (double.TryParse(dRow["TotalCP"].ToString(), out dTemp))
                {
                    TotalCP = dTemp;
                }
                else
                {
                    TotalCP = 0.0;
                }

                CharacterPhoto = dRow["CharacterPhoto"].ToString();
                Costuming      = dRow["Costuming"].ToString();

                Weapons        = dRow["Weapons"].ToString();
                Accessories    = dRow["Accessories"].ToString();
                Items          = dRow["Items"].ToString();
                Treasure       = dRow["Treasure"].ToString();
                Makeup         = dRow["Makeup"].ToString();
                PlayerComments = dRow["PlayerComments"].ToString();
                StaffComments  = dRow["Comments"].ToString();

                if (int.TryParse(dRow["CampaignID"].ToString(), out iTemp))
                {
                    CampaignID = iTemp;
                }
                //CampaignName = dRow["CampaignName"].ToString();

                //if (int.TryParse(dRow["CharacterSkillSetID"].ToString(), out iTemp))
                //    CharacterSkillSetID[0] = iTemp;

                if (int.TryParse(dRow["PrimaryTeamID"].ToString(), out iTemp))
                {
                    TeamID   = iTemp;
                    TeamName = dRow["TeamName"].ToString();
                }
                else
                {
                    TeamName = "";
                }

                if (int.TryParse(dRow["PlayerID"].ToString(), out iTemp))
                {
                    PlayerID    = iTemp;
                    PlayerName  = dRow["PlayerName"].ToString();
                    PlayerEMail = dRow["PlayerEMail"].ToString();
                }

                if (DateTime.TryParse(dRow["LatestEventDate"].ToString(), out dtTemp))
                {
                    LatestEventDate = dtTemp;
                }
                else
                {
                    LatestEventDate = null;
                }

                if (bool.TryParse(dRow["VisibleToPCs"].ToString(), out bTemp))
                {
                    VisibleToPCs = bTemp;
                }
                else
                {
                    VisibleToPCs = true;
                }

                // J.Bradshaw  7/10/2016  Request #1293
                //if (bool.TryParse(dRow["AllowCharacterRebuild"].ToString(), out bTemp))
                //    AllowCharacterRebuild = bTemp;
                if (DateTime.TryParse(dRow["AllowSkillRebuildToDate"].ToString(), out dtTemp))
                {
                    AllowCharacterRebuildToDate = dtTemp;
                }

                if (DateTime.TryParse(dRow["DateAdded"].ToString(), out dtTemp))
                {
                    dtDateCharacterCreated = dtTemp;
                }

                if (int.TryParse(dRow["CharacterSkillSetID"].ToString(), out iTemp))
                {
                    SkillSetID = iTemp;
                }

                SkillSetName = dRow["SkillSetName"].ToString();
                CampaignName = dRow["CampaignName"].ToString();
            }

            //foreach (DataRow dSkillSet in dsCharacterInfo.Tables["CHCharacterSkillSets"].Rows)
            //{
            //	if (!(CharacterSkillSetID.HasValue) ||
            //		((CharacterSkillSetID.HasValue) && (CharacterSkillSetID.Value.ToString() == dSkillSet["CharacterSkillSetID"].ToString())))
            //	{
            //		cCharacterSkillSet cSkillSet = new cCharacterSkillSet()
            //		{
            //			SkillSetName = dSkillSet["SkillSetName"].ToString(),
            //			CampaignName = dSkillSet["CampaignName"].ToString(),
            //			PlayerComments = dSkillSet["PlayerComments"].ToString(),
            //			Comments = dSkillSet["Comments"].ToString()
            //		};

            //		if (int.TryParse(dSkillSet["CharacterSkillSetID"].ToString(), out iTemp))
            //			cSkillSet.CharacterSkillSetID = iTemp;

            //		if (int.TryParse(dSkillSet["CharacterID"].ToString(), out iTemp))
            //			cSkillSet.CharacterID = iTemp;

            //		if (int.TryParse(dSkillSet["CampaignID"].ToString(), out iTemp))
            //			cSkillSet.CampaignID = iTemp;
            //		if (int.TryParse(dSkillSet["SkillSetStatusID"].ToString(), out iTemp))
            //			cSkillSet.SkillSetStatusID = iTemp;

            //		if (int.TryParse(dSkillSet["SkillSetTypeID"].ToString(), out iTemp))
            //			cSkillSet.SkillSetTypeID = iTemp;

            //		if (DateTime.TryParse(dSkillSet["AllowSkillRebuildToDate"].ToString(), out dtTemp))
            //			cSkillSet.AllowSkillRebuildToDate = dtTemp;
            //		else
            //			cSkillSet.AllowSkillRebuildToDate = null;

            //		if (DateTime.TryParse(dSkillSet["DateAdded"].ToString(), out dtTemp))
            //			cSkillSet.DateAdded = dtTemp;
            //		else
            //			cSkillSet.DateAdded = null;

            //		if (DateTime.TryParse(dSkillSet["DateChanged"].ToString(), out dtTemp))
            //			cSkillSet.DateChanged = dtTemp;
            //		else
            //			cSkillSet.DateChanged = null;

            //		SkillSet.Add(cSkillSet);
            //	}
            //}

            if (SkillSet.Count == 1)
            {
                this.SingleSkillSet = true;
            }
            else
            {
                this.SingleSkillSet = false;
            }



            foreach (DataRow dItems in dsCharacterInfo.Tables["CharacterItems"].Rows)
            {
                int CharacterItemID;
                int CharacterID;
                int?ItemPictureID;

                if ((int.TryParse(dItems["CharacterItemID"].ToString(), out CharacterItemID)) &&
                    (int.TryParse(dItems["CharacterID"].ToString(), out CharacterID)))
                {
                    ItemPictureID = null;
                    if (!dItems.IsNull("ItemPictureID"))
                    {
                        if (int.TryParse(dItems["ItemPictureID"].ToString(), out iTemp))
                        {
                            ItemPictureID = iTemp;
                        }
                    }
                    cCharacterItems NewItem = new cCharacterItems(CharacterItemID, CharacterID, dItems["ItemDescription"].ToString(), ItemPictureID);
                    CharacterItems.Add(NewItem);
                }
            }

            foreach (DataRow dPicture in dsCharacterInfo.Tables["CHCharacterPictures"].Rows)
            {
                cPicture NewPicture = new cPicture()
                {
                    PictureID       = -1,
                    PictureFileName = dPicture["PictureFileName"].ToString(),
                    CreatedBy       = dPicture["CreatedBy"].ToString(),
                    RecordStatus    = RecordStatuses.Active
                };

                string sPictureType = dPicture["PictureType"].ToString();
                NewPicture.PictureType = (cPicture.PictureTypes)Enum.Parse(typeof(cPicture.PictureTypes), sPictureType);

                if (int.TryParse(dPicture["MDBPictureID"].ToString(), out iTemp))
                {
                    NewPicture.PictureID = iTemp;
                }

                if (int.TryParse(dPicture["CharacterID"].ToString(), out iTemp))
                {
                    NewPicture.CharacterID = iTemp;
                }

                Pictures.Add(NewPicture);
            }

            foreach (DataRow dPlaces in dsCharacterInfo.Tables["CHCharacterPlaces"].Rows)
            {
                cCharacterPlace NewPlace = new cCharacterPlace()
                {
                    CharacterPlaceID = -1,
                    CharacterID      = CharacterID,
                    CampaignPlaceID  = -1,
                    LocaleID         = -1,
                    PlaceName        = dPlaces["PlaceName"].ToString(),
                    Comments         = dPlaces["PlayerComments"].ToString(),
                    RecordStatus     = RecordStatuses.Active
                };

                if (int.TryParse(dPlaces["CharacterPlaceID"].ToString(), out iTemp))
                {
                    NewPlace.CharacterPlaceID = iTemp;
                }

                if (int.TryParse(dPlaces["CharacterID"].ToString(), out iTemp))
                {
                    NewPlace.CharacterID = iTemp;
                }

                if (int.TryParse(dPlaces["PlaceID"].ToString(), out iTemp))
                {
                    NewPlace.CampaignPlaceID = iTemp;
                }

                if (int.TryParse(dPlaces["LocaleID"].ToString(), out iTemp))
                {
                    NewPlace.LocaleID = iTemp;
                }

                Places.Add(NewPlace);
            }

            foreach (DataRow dDeaths in dsCharacterInfo.Tables["CHCharacterDeaths"].Rows)
            {
                cCharacterDeath NewDeath = new cCharacterDeath()
                {
                    CharacterDeathID = -1,
                    CharacterID      = CharacterID,
                    StaffComments    = dDeaths["StaffComments"].ToString(),
                    Comments         = dDeaths["Comments"].ToString(),
                    RecordStatus     = RecordStatuses.Active
                };

                if (int.TryParse(dDeaths["CharacterDeathID"].ToString(), out iTemp))
                {
                    NewDeath.CharacterDeathID = iTemp;
                }

                if (bool.TryParse(dDeaths["DeathPermanent"].ToString(), out bTemp))
                {
                    NewDeath.DeathPermanent = bTemp;
                }

                if (DateTime.TryParse(dDeaths["DeathDate"].ToString(), out dtTemp))
                {
                    NewDeath.DeathDate = dtTemp;
                }

                Deaths.Add(NewDeath);
            }

            foreach (DataRow dActors in dsCharacterInfo.Tables["CHCharacterActors"].Rows)
            {
                cActor NewActor = new cActor()
                {
                    CharacterActorID = -1,
                    UserID           = -1,
                    StartDate        = null,
                    EndDate          = null,
                    loginUserName    = dActors["loginUserName"].ToString(),
                    ActorFirstName   = dActors["FirstName"].ToString(),
                    ActorMiddleName  = dActors["MiddleName"].ToString(),
                    ActorLastName    = dActors["LastName"].ToString(),
                    ActorNickName    = dActors["NickName"].ToString(),
                    StaffComments    = dActors["StaffComments"].ToString(),
                    Comments         = dActors["Comments"].ToString(),
                    RecordStatus     = RecordStatuses.Active
                };

                NewActor.CharacterID = CharacterID;

                if (int.TryParse(dActors["CharacterActorID"].ToString(), out iTemp))
                {
                    NewActor.CharacterActorID = iTemp;
                }

                if (int.TryParse(dActors["UserID"].ToString(), out iTemp))
                {
                    NewActor.UserID = iTemp;
                }

                if (DateTime.TryParse(dActors["StartDate"].ToString(), out dtTemp))
                {
                    NewActor.StartDate = dtTemp;
                }

                if (DateTime.TryParse(dActors["EndDate"].ToString(), out dtTemp))
                {
                    NewActor.EndDate = dtTemp;
                }

                Actors.Add(NewActor);
            }

            foreach (DataRow dRelationship in dsCharacterInfo.Tables["CHCharacterRelationships"].Rows)
            {
                cRelationship NewRelationship = new cRelationship()
                {
                    CharacterRelationshipID = -1,
                    CharacterID             = CharacterID,
                    Name = dRelationship["Name"].ToString(),
                    RelationDescription              = dRelationship["RelationDescription"].ToString(),
                    OtherDescription                 = dRelationship["OtherDescription"].ToString(),
                    RelationTypeID                   = -1,
                    RelationCharacterID              = -1,
                    PlayerAssignedStatus             = -1,
                    ListedInHistory                  = false,
                    RulebookCharacter                = false,
                    RulebookCharacterID              = -1,
                    PlayerComments                   = dRelationship["PlayerComments"].ToString(),
                    HideFromPC                       = false,
                    StaffAssignedRelationCharacterID = -1,
                    StaffAssignedStatus              = -1,
                    StaffComments                    = dRelationship["StaffComments"].ToString(),
                    Comments     = dRelationship["Comments"].ToString(),
                    RecordStatus = RecordStatuses.Active
                };

                if (int.TryParse(dRelationship["CharacterRelationshipID"].ToString(), out iTemp))
                {
                    NewRelationship.CharacterRelationshipID = iTemp;
                }

                if (int.TryParse(dRelationship["RelationTypeID"].ToString(), out iTemp))
                {
                    NewRelationship.RelationTypeID = iTemp;
                }

                if (int.TryParse(dRelationship["RelationCharacterID"].ToString(), out iTemp))
                {
                    NewRelationship.RelationCharacterID = iTemp;
                }

                if (int.TryParse(dRelationship["PlayerAssignedStatus"].ToString(), out iTemp))
                {
                    NewRelationship.PlayerAssignedStatus = iTemp;
                }

                if (int.TryParse(dRelationship["RulebookCharacterID"].ToString(), out iTemp))
                {
                    NewRelationship.RulebookCharacterID = iTemp;
                }
                //       StaffAssignedRelationCharacterID
                if (int.TryParse(dRelationship["StaffAssignedRelationCharacterID"].ToString(), out iTemp))
                {
                    NewRelationship.StaffAssignedRelationCharacterID = iTemp;
                }

                if (int.TryParse(dRelationship["StaffAssignedStatus"].ToString(), out iTemp))
                {
                    NewRelationship.StaffAssignedStatus = iTemp;
                }

                if (bool.TryParse(dRelationship["ListedInHistory"].ToString(), out bTemp))
                {
                    NewRelationship.ListedInHistory = bTemp;
                }

                if (bool.TryParse(dRelationship["RulebookCharacter"].ToString(), out bTemp))
                {
                    NewRelationship.RulebookCharacter = bTemp;
                }

                if (bool.TryParse(dRelationship["HideFromPC"].ToString(), out bTemp))
                {
                    NewRelationship.HideFromPC = bTemp;
                }

                Relationships.Add(NewRelationship);
            }

            foreach (DataRow dRace in dsCharacterInfo.Tables["CHCampaignRaces"].Rows)
            {
                if (int.TryParse(dRace["CampaignRaceID"].ToString(), out iTemp))
                {
                    Race.CampaignRaceID = iTemp;
                }
                if (int.TryParse(dRace["GameSystemID"].ToString(), out iTemp))
                {
                    Race.GameSystemID = iTemp;
                }
                if (int.TryParse(dRace["CampaignID"].ToString(), out iTemp))
                {
                    Race.CampaignID = iTemp;
                }
                Race.RaceName           = dRace["RaceName"].ToString();
                Race.SubRace            = dRace["SubRace"].ToString();
                Race.Description        = dRace["Description"].ToString();
                Race.MakeupRequirements = dRace["MakeupRequirements"].ToString();
                Race.Photo    = dRace["Photo"].ToString();
                Race.Comments = dRace["Comments"].ToString();
            }

            foreach (DataRow dCharType in dsCharacterInfo.Tables["CHCharacterTypes"].Rows)
            {
                if (int.TryParse(dCharType["CharacterTypeID"].ToString(), out iTemp))
                {
                    CharType.CharacterTypeID = iTemp;
                }
                CharType.Description = dCharType["Description"].ToString();
                CharType.Comments    = dCharType["Comments"].ToString();
            }

            foreach (DataRow dStatus in dsCharacterInfo.Tables["MDBStatus"].Rows)
            {
                if (int.TryParse(dStatus["StatusID"].ToString(), out iTemp))
                {
                    Status.StatusID = iTemp;
                }
                Status.StatusType = dStatus["StatusType"].ToString();
                Status.StatusName = dStatus["StatusName"].ToString();
                Status.Comments   = dStatus["Comments"].ToString();
            }

            foreach (DataRow dSkill in dsCharacterInfo.Tables["CharacterSkills"].Rows)
            {
                cCharacterSkill NewSkill = new cCharacterSkill()
                {
                    CharacterSkillSetID     = -1,
                    SkillSetName            = dSkill["SkillSetName"].ToString(),
                    StatusName              = dSkill["SkillName"].ToString(),
                    SkillSetTypeDescription = dSkill["SkillSetTypeDescription"].ToString(),
                    SkillName                      = dSkill["SkillName"].ToString(),
                    SkillShortDescription          = dSkill["SkillShortDescription"].ToString(),
                    CampaignSkillsStandardComments = dSkill["CampaignSkillsStandardComments"].ToString(),
                    SkillTypeComments              = dSkill["SkillTypeComments"].ToString(),
                    PlayerDescription              = dSkill["PlayerDescription"].ToString(),
                    PlayerIncant                   = dSkill["PlayerIncant"].ToString(),
                    SkillCardDescription           = dSkill["SkillCardDescription"].ToString(),
                    SkillCardIncant                = dSkill["SkillIncant"].ToString(),
                    AddInfoValue                   = dSkill["AddInfoValue"].ToString(),
                    AddInfoType                    = (int)enumAddInfoType.None
                };


                //if (int.TryParse(dSkill["CharacterSkillsStandardID"].ToString(), out iTemp))
                //    NewSkill.CharacterSkillsStandardID = iTemp;

                if (int.TryParse(dSkill["CharacterID"].ToString(), out iTemp))
                {
                    NewSkill.CharacterID = iTemp;
                }

                if (int.TryParse(dSkill["CharacterSkillSetStatusID"].ToString(), out iTemp))
                {
                    NewSkill.CharacterSkillSetStatusID = iTemp;
                }

                if (int.TryParse(dSkill["CharacterSkillSetID"].ToString(), out iTemp))
                {
                    NewSkill.CharacterSkillSetID = iTemp;
                }

                if (int.TryParse(dSkill["StatusType"].ToString(), out iTemp))
                {
                    NewSkill.StatusType = iTemp;
                }

                //if (int.TryParse(dSkill["CharacterSkillSetTypeID"].ToString(), out iTemp))
                //    NewSkill.CharacterSkillSetTypeID = iTemp;

                if (int.TryParse(dSkill["CharacterSkillID"].ToString(), out iTemp))
                {
                    NewSkill.CharacterSkillID = iTemp;
                }

                if (int.TryParse(dSkill["CampaignSkillNodeID"].ToString(), out iTemp))
                {
                    NewSkill.CampaignSkillNodeID = iTemp;
                }

                //if (int.TryParse(dSkill["CampaignSkillsStandardID"].ToString(), out iTemp))
                //    NewSkill.CampaignSkillsStandardID = iTemp;

                if (int.TryParse(dSkill["SkillTypeID"].ToString(), out iTemp))
                {
                    NewSkill.SkillTypeID = iTemp;
                }

                //                if (int.TryParse(dSkill["SkillHeaderTypeID"].ToString(), out iTemp))
                //                    NewSkill.SkillHeaderTypeID = iTemp;

                if (int.TryParse(dSkill["CharacterSkillSetID"].ToString(), out iTemp))
                {
                    NewSkill.CharacterSkillSetID = iTemp;
                }

                //if (int.TryParse(dSkill["HeaderAssociation"].ToString(), out iTemp))
                //    NewSkill.HeaderAssociation = iTemp;

                //if (int.TryParse(dSkill["SkillCostFixed"].ToString(), out iTemp))
                //    NewSkill.SkillCostFixed = iTemp;

                if (int.TryParse(dSkill["DisplayOrder"].ToString(), out iTemp))
                {
                    NewSkill.DisplayOrder = iTemp;
                }

                if (double.TryParse(dSkill["SkillCPCost"].ToString(), out dTemp))
                {
                    NewSkill.SkillCPCost = dTemp;
                }

                if (double.TryParse(dSkill["CPCostPaid"].ToString(), out dTemp))
                {
                    NewSkill.CPCostPaid = dTemp;
                }

                if (bool.TryParse(dSkill["CanBeUsedPassively"].ToString(), out bTemp))
                {
                    NewSkill.CanBeUsedPassively = bTemp;
                }

                if (bool.TryParse(dSkill["AllowPassiveUse"].ToString(), out bTemp))
                {
                    NewSkill.AllowPassiveUse = bTemp;
                }

                if (bool.TryParse(dSkill["OpenToAll"].ToString(), out bTemp))
                {
                    NewSkill.OpenToAll = bTemp;
                }

                if (bool.TryParse(dSkill["CardDisplayDescription"].ToString(), out bTemp))
                {
                    NewSkill.CardDisplayDescription = bTemp;
                }

                if (bool.TryParse(dSkill["CardDisplayIncant"].ToString(), out bTemp))
                {
                    NewSkill.CardDisplayIncant = bTemp;
                }

                if (bool.TryParse(dSkill["CardDisplayDescription"].ToString(), out bTemp))
                {
                    NewSkill.CardDisplayDescription = bTemp;
                }

                if (bool.TryParse(dSkill["CardDisplayIncant"].ToString(), out bTemp))
                {
                    NewSkill.CardDisplayIncant = bTemp;
                }

                NewSkill.AddInfoValue = "";
                if (int.TryParse(dSkill["AddInfoType"].ToString(), out iTemp))
                {
                    switch (iTemp)
                    {
                    case (int)enumAddInfoType.DropDown:
                        NewSkill.AddInfoType  = enumAddInfoType.DropDown;
                        NewSkill.AddInfoValue = dSkill["AddInfoValue"].ToString();
                        SortedList sSkillAddValues = new SortedList();
                        sSkillAddValues.Add("@CharacterSkillID", NewSkill.CharacterSkillID);
                        //DataTable dtValues = cUtilities.LoadDataTable("uspGetCharacterSkillAddValuesList", sSkillAddValues, "LARPortal",
                        //	"GeneralUser", lsRoutineName + ".GetAvailValues");
                        //foreach (DataRow dRow in dtValues.Rows)
                        //{
                        //	cCharacterSkillAddValues NewValue = new cCharacterSkillAddValues();
                        //	NewValue.Value = dRow["DisplayValue"].ToString();
                        //	if (int.TryParse(dRow["SortOrder"].ToString(), out iTemp))
                        //		NewValue.SortOrder = iTemp;
                        //	else
                        //		NewValue.SortOrder = 1;
                        //	NewSkill.AddAvailableValues.Add(NewValue);
                        //}
                        break;

                    case (int)enumAddInfoType.FreeText:
                        NewSkill.AddInfoType        = enumAddInfoType.FreeText;
                        NewSkill.AddInfoValue       = dSkill["AddInfoValue"].ToString();
                        NewSkill.AddAvailableValues = new List <cCharacterSkillAddValues>();
                        break;
                    }
                    ;
                }

                NewSkill.RecordStatus = RecordStatuses.Active;

                CharacterSkills.Add(NewSkill);
            }

            foreach (DataRow dRow in dsCharacterInfo.Tables["Descriptors"].Rows)
            {
                cDescriptor NewDesc = new cDescriptor();
                NewDesc.SkillSetName        = dRow["SkillSetName"].ToString();
                NewDesc.DescriptorValue     = dRow["DescriptorValue"].ToString();
                NewDesc.CharacterDescriptor = dRow["CharacterDescriptor"].ToString();
                NewDesc.PlayerComments      = dRow["PlayerComments"].ToString();

                int iValue;

                if (int.TryParse(dRow["CharacterSkillSetID"].ToString(), out iValue))
                {
                    NewDesc.CharacterSkillSetID = iValue;
                }
                else
                {
                    NewDesc.CharacterSkillSetID = 0;
                }

                if (int.TryParse(dRow["CharacterAttributesBasicID"].ToString(), out iValue))
                {
                    NewDesc.CharacterAttributesBasicID = iValue;
                }
                else
                {
                    NewDesc.CharacterAttributesBasicID = 0;
                }

                if (int.TryParse(dRow["CampaignAttributeStandardID"].ToString(), out iValue))
                {
                    NewDesc.CampaignAttributeStandardID = iValue;
                }
                else
                {
                    NewDesc.CampaignAttributeStandardID = 0;
                }

                if (int.TryParse(dRow["CampaignAttributeDescriptorID"].ToString(), out iValue))
                {
                    NewDesc.CampaignAttributeDescriptorID = iValue;
                }
                else
                {
                    NewDesc.CampaignAttributeDescriptorID = 0;
                }

                Descriptors.Add(NewDesc);
            }

            ProfilePicture = null;

            foreach (DataRow dRow in dsCharacterInfo.Tables["ProfilePicture"].Rows)
            {
                if (int.TryParse(dRow["MDBPictureID"].ToString(), out iTemp))
                {
                    ProfilePicture                 = new cPicture();
                    ProfilePicture.PictureID       = iTemp;
                    ProfilePictureID               = iTemp;
                    ProfilePicture.PictureFileName = dRow["PictureFileName"].ToString();
                    ProfilePicture.PictureType     = cPicture.PictureTypes.Profile;
                    ProfilePicture.RecordStatus    = RecordStatuses.Active;
                }
            }

            foreach (DataRow dRow in dsCharacterInfo.Tables["CHCharacterSkillsPoints"].Rows)
            {
                Classes.cSkillPool NewPool = new cSkillPool();
                NewPool.PoolDescription  = dRow["PoolDescription"].ToString();
                NewPool.PoolDisplayColor = dRow["DisplayColor"].ToString();

                if (int.TryParse(dRow["PoolID"].ToString(), out iTemp))
                {
                    NewPool.PoolID = iTemp;
                }

                if (bool.TryParse(dRow["DefaultPool"].ToString(), out bTemp))
                {
                    NewPool.DefaultPool = bTemp;
                }
                else
                {
                    NewPool.DefaultPool = false;
                }

                if (double.TryParse(dRow["TotalPoints"].ToString(), out dTemp))
                {
                    NewPool.TotalPoints = dTemp;
                }
                else
                {
                    NewPool.TotalPoints = 0.0;
                }

                SkillPools.Add(NewPool);
            }

            // The only teams we want to do are teams where the person is an actual member.
            DataView dvTeams = new DataView(dsCharacterInfo.Tables["CMTeamMemberInfo"], "Approval or Member", "", DataViewRowState.CurrentRows);

            foreach (DataRowView dRow in dvTeams)
            {
                Classes.cTeamInfo NewTeam = new cTeamInfo();
                NewTeam.TeamName        = dRow["TeamName"].ToString();
                NewTeam.RoleDescription = dRow["RoleDescription"].ToString();
                if (int.TryParse(dRow["TeamID"].ToString(), out iTemp))
                {
                    NewTeam.TeamID = iTemp;
                }
                if (int.TryParse(dRow["CharacterID"].ToString(), out iTemp))
                {
                    NewTeam.CharacterID = iTemp;
                }
                if (int.TryParse(dRow["RoleID"].ToString(), out iTemp))
                {
                    NewTeam.RoleID = iTemp;
                }
                if (bool.TryParse(dRow["Approval"].ToString(), out bTemp))
                {
                    NewTeam.Approval = bTemp;
                }
                if (bool.TryParse(dRow["Member"].ToString(), out bTemp))
                {
                    NewTeam.Member = bTemp;
                }
                if (bool.TryParse(dRow["Requested"].ToString(), out bTemp))
                {
                    NewTeam.Requested = bTemp;
                }
                if (bool.TryParse(dRow["Invited"].ToString(), out bTemp))
                {
                    NewTeam.Invited = bTemp;
                }
                Teams.Add(NewTeam);
            }

            foreach (DataRow dRow in dsCharacterInfo.Tables["SkillCost"].Rows)
            {
                Classes.cCharacterSkillCost skillCost = new cCharacterSkillCost();
                if (int.TryParse(dRow["CharacterSkillCostID"].ToString(), out iTemp))
                {
                    skillCost.CharacterSkillCostID = iTemp;
                }
                if (int.TryParse(dRow["CharacterSkillID"].ToString(), out iTemp))
                {
                    skillCost.CharacterSkillID = iTemp;
                }
                if (int.TryParse(dRow["CampaignSkillPoolID"].ToString(), out iTemp))
                {
                    skillCost.CampaignSkillPoolID = iTemp;
                }
                if (double.TryParse(dRow["CPCostPaid"].ToString(), out dTemp))
                {
                    skillCost.CPCostPaid = dTemp;
                }
                if (DateTime.TryParse(dRow["WhenPurchased"].ToString(), out dtTemp))
                {
                    skillCost.WhenPurchased = dtTemp;
                }
                skillCost.PoolDescription = dRow["PoolDescription"].ToString();
                skillCost.DisplayColor    = dRow["DisplayColor"].ToString();
            }

            return(iNumCharacterRecords);
        }