Exemple #1
0
        public string SaveCharacter(string sUserUpdating, int iUserID)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            string Timing;

            Timing = "Save character start: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt");

            SortedList sParams = new SortedList();

            sParams.Add("@UserID", iUserID);
            sParams.Add("@CharacterID", CharacterID);
            sParams.Add("@CurrentUserID", CurrentUserID);
            sParams.Add("@CharacterStatus", CharacterStatusID);
            sParams.Add("@CharacterFirstName", FirstName);
            sParams.Add("@CharacterMiddleName", MiddleName);
            sParams.Add("@CharacterLastName", LastName);
            sParams.Add("@CharacterAKA", AKA);
            sParams.Add("@CharacterTitle", Title);
            sParams.Add("@CharacterRace", Race.CampaignRaceID);
            sParams.Add("@CharacterType", CharacterType);
            sParams.Add("@PlotLeadPerson", PlotLeadPerson);
            sParams.Add("@RulebookCharacter", RulebookCharacter);
            sParams.Add("@CharacterHistory", CharacterHistory);
            sParams.Add("@DateHistorySubmitted", DateHistorySubmitted);
            sParams.Add("@DateHistoryApproved", DateHistoryApproved);
            sParams.Add("@DateOfBirth", DateOfBirth);
            sParams.Add("@WhereFrom", WhereFrom);
            sParams.Add("@CurrentHome", CurrentHome);
            sParams.Add("@CardPrintName", CardPrintName);
            sParams.Add("@HousingListName", HousingListName);
            sParams.Add("@StartDate", StartDate);
            sParams.Add("@CharacterEmail", CharacterEmail);
            sParams.Add("@TotalCP", TotalCP);
            sParams.Add("@CharacterPhoto", CharacterPhoto);
            sParams.Add("@Costuming", Costuming);
            sParams.Add("@Weapons", Weapons);
            sParams.Add("@Accessories", Accessories);
            sParams.Add("@Items", Items);
            sParams.Add("@Treasure", Treasure);
            sParams.Add("@Makeup", Makeup);
            sParams.Add("@PlayerComments", PlayerComments);
            sParams.Add("@PrimaryTeamID", TeamID);
            sParams.Add("@VisibleToPCs", VisibleToPCs);
            sParams.Add("@Comments", StaffComments);

            DataTable dtCharInfo = cUtilities.LoadDataTable("uspInsUpdCHCharacters", sParams, "LARPortal", sUserUpdating, lsRoutineName + ".uspInsUpdCHCharacters");

            Timing += ", character record update done: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt");

            sParams = new SortedList();

            sParams.Add("@UserID", iUserID);
            sParams.Add("@CharacterID", CharacterID);
            if (AllowCharacterRebuild)
            {
                sParams.Add("@CharacterRebuildDate", AllowCharacterRebuildToDate);
            }
            else
            {
                sParams.Add("@ClearDate", 1);
            }

            DataTable dtSkillSets = cUtilities.LoadDataTable("uspSetCharacterRebuildToDate", sParams, "LARPortal", sUserUpdating, lsRoutineName + ".uspSetCharacterRebuildToDate");

            foreach (cPicture Picture in Pictures)
            {
                Picture.CharacterID = CharacterID;
                if (Picture.RecordStatus == RecordStatuses.Delete)
                {
                    Picture.Delete(sUserUpdating);
                }
                else
                {
                    Picture.Save(sUserUpdating);
                }
            }

            if (ProfilePicture != null)
            {
                if (ProfilePicture.RecordStatus == RecordStatuses.Delete)
                {
                    ProfilePicture.Delete(sUserUpdating);
                }
                else
                {
                    ProfilePicture.Save(sUserUpdating);
                }
            }

            foreach (cCharacterSkill Skill in CharacterSkills)
            {
                if (Skill.RecordStatus == RecordStatuses.Delete)
                {
                    Skill.Delete(sUserUpdating, iUserID);
                }
                else
                {
                    Skill.Save(sUserUpdating, iUserID);
                }
            }

            Timing += ", skills update done: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt");

            foreach (cDescriptor Desc in Descriptors)
            {
                Desc.CharacterSkillSetID = SkillSetID;                                  // CharacterSkillSetID[0];
                if (Desc.RecordStatus == RecordStatuses.Delete)
                {
                    Desc.Delete(sUserUpdating, iUserID);
                }
                else
                {
                    Desc.Save(sUserUpdating, iUserID);
                }
            }

            foreach (cCharacterPlace Place in Places)
            {
                Place.CharacterID = CharacterID;
                Place.Save(iUserID);
            }

            foreach (cCharacterDeath Death in Deaths)
            {
                Death.Save(iUserID);
            }

            foreach (cActor Actor in Actors)
            {
                Actor.Save(iUserID);
            }

            foreach (cRelationship Relat in Relationships)
            {
                Relat.Save(sUserUpdating, iUserID);
            }

            foreach (cCharacterSkillCost cSkillCost in SkillCost)
            {
                cSkillCost.Save(sUserUpdating, iUserID);
            }

            Timing += ", character save done: " + DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt");

            return(Timing);
        }