Beispiel #1
0
        /// <summary>
        /// Base constructor.
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="guid"></param>
        private CCPCharacter(CharacterIdentity identity, Guid guid)
            : base(identity, guid)
        {
            QueryMonitors           = new QueryMonitorCollection();
            SkillQueue              = new SkillQueue(this);
            Standings               = new StandingCollection(this);
            Assets                  = new AssetCollection(this);
            WalletJournal           = new WalletJournalCollection(this);
            WalletTransactions      = new WalletTransactionsCollection(this);
            CharacterMarketOrders   = new MarketOrderCollection(this);
            CorporationMarketOrders = new MarketOrderCollection(this);
            CharacterContracts      = new ContractCollection(this);
            CorporationContracts    = new ContractCollection(this);
            CharacterIndustryJobs   = new IndustryJobCollection(this);
            CorporationIndustryJobs = new IndustryJobCollection(this);
            ResearchPoints          = new ResearchPointCollection(this);
            EVEMailMessages         = new EveMailMessageCollection(this);
            EVEMailingLists         = new EveMailingListCollection(this);
            EVENotifications        = new EveNotificationCollection(this);
            Contacts                = new ContactCollection(this);
            CharacterMedals         = new MedalCollection(this);
            CorporationMedals       = new MedalCollection(this);
            UpcomingCalendarEvents  = new UpcomingCalendarEventCollection(this);
            KillLog                 = new KillLogCollection(this);
            PlanetaryColonies       = new PlanetaryColonyCollection(this);
            LoyaltyPoints           = new LoyaltyCollection(this);

            m_endedOrdersForCharacter   = new List <MarketOrder>();
            m_endedOrdersForCorporation = new List <MarketOrder>();

            m_endedContractsForCharacter   = new List <Contract>();
            m_endedContractsForCorporation = new List <Contract>();

            m_jobsCompletedForCharacter = new List <IndustryJob>();
            m_allianceName    = EveIDToName.GetIDToName(AllianceID);
            m_corporationName = EveIDToName.GetIDToName(CorporationID);

            EveMonClient.CharacterAssetsUpdated           += EveMonClient_CharacterAssetsUpdated;
            EveMonClient.CharacterMarketOrdersUpdated     += EveMonClient_CharacterMarketOrdersUpdated;
            EveMonClient.CorporationMarketOrdersUpdated   += EveMonClient_CorporationMarketOrdersUpdated;
            EveMonClient.CharacterContractsUpdated        += EveMonClient_CharacterContractsUpdated;
            EveMonClient.CorporationContractsUpdated      += EveMonClient_CorporationContractsUpdated;
            EveMonClient.CharacterIndustryJobsUpdated     += EveMonClient_CharacterIndustryJobsUpdated;
            EveMonClient.CorporationIndustryJobsUpdated   += EveMonClient_CorporationIndustryJobsUpdated;
            EveMonClient.CharacterIndustryJobsCompleted   += EveMonClient_CharacterIndustryJobsCompleted;
            EveMonClient.CorporationIndustryJobsCompleted += EveMonClient_CorporationIndustryJobsCompleted;
            EveMonClient.CharacterPlaneteryPinsCompleted  += EveMonClient_CharacterPlaneteryPinsCompleted;
            EveMonClient.ESIKeyInfoUpdated  += EveMonClient_ESIKeyInfoUpdated;
            EveMonClient.EveIDToNameUpdated += EveMonClient_EveIDToNameUpdated;
            EveMonClient.TimerTick          += EveMonClient_TimerTick;
        }
Beispiel #2
0
        private void DeleteMedals(List <int> medalIDs)
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            MedalCollection medals = new MedalCollection();

            int i = 0;

            foreach (Medal medal in MedalList)
            {
                if (medalIDs.Contains(medal.ID) == false)
                {
                    medals.Add(medal);
                }
            }

            MedalSettings setting = new MedalSettings();

            setting.Medals     = medals;
            setting.MaxMedalID = AllSettings.Current.MedalSettings.MaxMedalID;

            try
            {
                if (!SettingManager.SaveSettings(setting))
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    UserBO.Instance.RemoveAllUserCache();

                    m_MedalList = null;
                    _Request.Clear(Method.Post);
                    Logs.LogManager.LogOperation(
                        new Medal_DeleteMedalByIDs(MyUserID, My.Name, _Request.IpAddress, medalIDs)
                        );
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
Beispiel #3
0
        public static void ConvertMedals()
        {

            MedalSettings medalSetting = new MedalSettings();
            MedalCollection medals = new MedalCollection();

            string sql = @"
IF EXISTS(SELECT * FROM sysobjects WHERE [type]=N'TR' AND [name]=N'bx_UserMedals_AfterUpdate')
	DROP TRIGGER bx_UserMedals_AfterUpdate;

--GO
";
            using (SqlConnection connection = new SqlConnection(Settings.Current.IConnectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sql, connection);
                command.CommandTimeout = 60;
                try
                {
                    command.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    CreateLog(ex);
                    throw new Exception("ɾ��������bx_UserMedals_AfterUpdateʧ��" + ex.Message + sql);
                }
                finally
                {
                    connection.Close();
                }
            }



            sql = @"

IF EXISTS (SELECT * FROM sysobjects WHERE [type] = N'U' AND [name] = N'Max_Medals') AND EXISTS (SELECT * FROM [sysobjects] WHERE [type]='U' AND [name]='Max_UserMedals') BEGIN
    SELECT * FROM Max_Medals;
END
ELSE
    SELECT -9999 AS MedalID;
";
            using (SqlConnection connection = new SqlConnection(Settings.Current.IConnectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sql, connection);
                command.CommandTimeout = 60;
                try
                {
                    bool hasCreateErrorLog = false;
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            int medalID = reader.GetInt32(reader.GetOrdinal("MedalID"));

                            if (medalID == -9999)
                                return;

                            Medal tempMedal = new Medal();
                            tempMedal.Condition = string.Empty;
                            tempMedal.Enable = reader.GetBoolean(reader.GetOrdinal("IsEnabled"));
                            tempMedal.IsCustom = true;
                            tempMedal.ID = medalID;
                            tempMedal.MaxLevelID = 1;
                            tempMedal.Name = reader.GetString(reader.GetOrdinal("MedalName"));
                            tempMedal.SortOrder = 0;

                            tempMedal.Levels = new MedalLevelCollection();
                            MedalLevel tempLevel = new MedalLevel();
                            tempLevel.Condition = string.Empty;

                            string iconUrl = reader.GetString(reader.GetOrdinal("LogoUrl")).Replace("\\", "/");

                            int i = iconUrl.LastIndexOf("/") + 1;

                            string iconName = string.Empty;
                            if (iconUrl.Length > i)
                                iconName = iconUrl.Substring(i, iconUrl.Length - i);
                            else
                                continue;

                            string targetDir = MaxLabs.bbsMax.UrlUtil.JoinUrl(MaxLabs.bbsMax.Globals.ApplicationPath, "/max-assets/icon-medal/");
                            string targetIconUrl = targetDir + iconName;

                            iconUrl = MaxLabs.bbsMax.UrlUtil.JoinUrl(MaxLabs.bbsMax.Globals.ApplicationPath, iconUrl);
                            if (File.Exists(iconUrl))
                            {
                                if (File.Exists(targetIconUrl))
                                {
                                }
                                else
                                {
                                    try
                                    {
                                        if (Directory.Exists(targetDir) == false)
                                            Directory.CreateDirectory(targetDir);
                                        File.Move(iconUrl, targetIconUrl);
                                    }
                                    catch
                                    {
                                        if (hasCreateErrorLog == false)
                                        {
                                            hasCreateErrorLog = true;
                                            ErrorMessages.Add("�ƶ�ѫ��ͼ��ʧ��,���ֶ��ѡ�/Images/Medals/��Ŀ¼�µ�����ͼ�긴�Ƶ���/max-assets/icon-medal/��Ŀ¼��");
                                        }
                                    }
                                }
                            }

                            tempLevel.IconSrc = "~/max-assets/icon-medal/" + iconName;

                            tempLevel.Name = string.Empty;
                            tempLevel.ID = 1;
                            tempMedal.Levels.Add(tempLevel);

                            medals.Add(tempMedal);

                            if (medalSetting.MaxMedalID < tempMedal.ID)
                                medalSetting.MaxMedalID = tempMedal.ID;
                        }
                    }

                    foreach (Medal medal in new MedalSettings().Medals)
                    {
                        medal.ID = medalSetting.MaxMedalID + 1;
                        medals.Add(medal);
                        medalSetting.MaxMedalID += 1;
                    }

                    medalSetting.Medals = medals;


                    sql = @"
UPDATE bx_Settings SET [Value] = @MedalString WHERE TypeName = 'MaxLabs.bbsMax.Settings.MedalSettings' AND [Key] = '*';
IF @@ROWCOUNT = 0
    INSERT INTO bx_Settings ([Key], [Value], [TypeName]) VALUES ('*', @MedalString, 'MaxLabs.bbsMax.Settings.MedalSettings');

IF EXISTS (SELECT * FROM [sysobjects] WHERE [type]='U' AND [name]='Max_UserMedals') BEGIN
	truncate table [bx_UserMedals];
	INSERT INTO [bx_UserMedals]
           ([UserID]
           ,[MedalID]
           ,[MedalLevelID]
           ,[EndDate]
           ,[CreateDate])
     SELECT 
           UserID
           ,MedalID
           ,1
           ,ExpiresDate
           ,CreateDate
		FROM Max_UserMedals WITH (NOLOCK);

	DROP TABLE Max_UserMedals;
END

DROP TABLE Max_Medals;
";

                    command.CommandText = sql;
                    command.CommandTimeout = 3600;
                    //command.Parameters.AddWithValue("@MedalString", medalSetting.ToString());


                    SqlParameter param = new SqlParameter("@MedalString", SqlDbType.NText);
                    param.Value = medalSetting.ToString();
                    command.Parameters.Add(param);

                    command.ExecuteNonQuery();
                    //AllSettings.Current.MedalSettings = medalSetting;

                }
                catch (Exception ex)
                {
                    CreateLog(ex);
                    throw new Exception("����ѫ������ʧ��" + ex.Message + sql);
                }
                finally
                {
                    connection.Close();
                }


            }
        }
Beispiel #4
0
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("name", "levelname", "iconsrc", "condition");

            MedalCollection medals = new MedalCollection();

            int i = 0;

            foreach (Medal medal in MedalList)
            {
                Medal tempMedal = new Medal();
                tempMedal.SortOrder = _Request.Get <int>("sortorder_" + medal.ID, Method.Post, 0);
                tempMedal.Name      = _Request.Get("name_" + medal.ID, Method.Post, string.Empty).Trim();

                if (tempMedal.Name == string.Empty)
                {
                    msgDisplay.AddError("name", i, "勋章名称不能为空");
                }

                tempMedal.Enable   = _Request.Get <bool>("enable_" + medal.ID, Method.Post, false);
                tempMedal.IsHidden = _Request.Get <bool>("isHidden_" + medal.ID, Method.Post, false);

                tempMedal.Levels = new MedalLevelCollection();

                tempMedal.Condition = medal.Condition;
                //if (medal.IsCustom)
                //{
                //    //tempMedal.Condition = _Request.Get("condition_" + medal.ID, Method.Post, string.Empty).Trim();
                //    //msgDisplay.AddError("condition", i, "点亮规则不能为空");
                //}
                //else
                //{
                List <int> values = new List <int>();
                foreach (MedalLevel level in medal.Levels)
                {
                    MedalLevel tempLevel = new MedalLevel();

                    tempLevel.Name      = level.Name;
                    tempLevel.Value     = level.Value;
                    tempLevel.IconSrc   = level.IconSrc;
                    tempLevel.Condition = level.Condition;
                    //tempLevel.Name = _Request.Get("levelName_" + medal.ID + "_" + level.ID, Method.Post, string.Empty).Trim();
                    //if (tempLevel.Name == string.Empty)
                    //{
                    //    msgDisplay.AddError("levelname", i, "等级名称不能为空");
                    //}
                    //tempLevel.Value = _Request.Get<int>("levelValue_" + medal.ID + "_" + level.ID, Method.Post, 0);

                    //if (values.Contains(tempLevel.Value))
                    //{
                    //    msgDisplay.AddError("Condition",i,"不同等级的点亮规则必须不同");
                    //}
                    //values.Add(tempLevel.Value);

                    //tempLevel.IconSrc = _Request.Get("iconSrc_" + medal.ID + "_" + level.ID, Method.Post, string.Empty).Trim();
                    //if (tempLevel.IconSrc == string.Empty)
                    //{
                    //    msgDisplay.AddError("iconSrc", i, "等级图标不能为空");
                    //}

                    tempLevel.ID = level.ID;

                    tempMedal.Levels.Add(tempLevel);
                }
                //}

                tempMedal.ID         = medal.ID;
                tempMedal.IsCustom   = medal.IsCustom;
                tempMedal.MaxLevelID = medal.MaxLevelID;

                medals.Add(tempMedal);

                i++;
            }

            if (msgDisplay.HasAnyError())
            {
                return;
            }

            MedalSettings setting = new MedalSettings();

            setting.Medals     = medals;
            setting.MaxMedalID = AllSettings.Current.MedalSettings.MaxMedalID;

            try
            {
                if (!SettingManager.SaveSettings(setting))
                {
                    CatchError <ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    UserBO.Instance.RemoveAllUserCache();
                    m_MedalList = null;
                    _Request.Clear(Method.Post);
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
        private void SaveSetting()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("name", "levelname", "iconsrc", "condition");

            MedalCollection medals = new MedalCollection();

            int i = 0;
            foreach (Medal medal in MedalList)
            {
                Medal tempMedal = new Medal();
                tempMedal.SortOrder = _Request.Get<int>("sortorder_" + medal.ID, Method.Post, 0);
                tempMedal.Name = _Request.Get("name_" + medal.ID, Method.Post, string.Empty).Trim();

                if (tempMedal.Name == string.Empty)
                {
                    msgDisplay.AddError("name", i, "勋章名称不能为空");
                }

                tempMedal.Enable = _Request.Get<bool>("enable_" + medal.ID, Method.Post, false);
                tempMedal.IsHidden = _Request.Get<bool>("isHidden_" + medal.ID, Method.Post, false);

                tempMedal.Levels = new MedalLevelCollection();

                tempMedal.Condition = medal.Condition;
                //if (medal.IsCustom)
                //{
                //    //tempMedal.Condition = _Request.Get("condition_" + medal.ID, Method.Post, string.Empty).Trim();
                //    //msgDisplay.AddError("condition", i, "点亮规则不能为空");
                //}
                //else
                //{
                    List<int> values = new List<int>();
                    foreach (MedalLevel level in medal.Levels)
                    {
                        MedalLevel tempLevel = new MedalLevel();

                        tempLevel.Name = level.Name;
                        tempLevel.Value = level.Value;
                        tempLevel.IconSrc = level.IconSrc;
                        tempLevel.Condition = level.Condition;
                        //tempLevel.Name = _Request.Get("levelName_" + medal.ID + "_" + level.ID, Method.Post, string.Empty).Trim();
                        //if (tempLevel.Name == string.Empty)
                        //{
                        //    msgDisplay.AddError("levelname", i, "等级名称不能为空");
                        //}
                        //tempLevel.Value = _Request.Get<int>("levelValue_" + medal.ID + "_" + level.ID, Method.Post, 0);

                        //if (values.Contains(tempLevel.Value))
                        //{
                        //    msgDisplay.AddError("Condition",i,"不同等级的点亮规则必须不同");
                        //}
                        //values.Add(tempLevel.Value);

                        //tempLevel.IconSrc = _Request.Get("iconSrc_" + medal.ID + "_" + level.ID, Method.Post, string.Empty).Trim();
                        //if (tempLevel.IconSrc == string.Empty)
                        //{
                        //    msgDisplay.AddError("iconSrc", i, "等级图标不能为空");
                        //}

                        tempLevel.ID = level.ID;

                        tempMedal.Levels.Add(tempLevel);
                    }
                //}

                tempMedal.ID = medal.ID;
                tempMedal.IsCustom = medal.IsCustom;
                tempMedal.MaxLevelID = medal.MaxLevelID;

                medals.Add(tempMedal);

                i++;
            }

            if (msgDisplay.HasAnyError())
                return;

            MedalSettings setting = new MedalSettings();
            setting.Medals = medals;
            setting.MaxMedalID = AllSettings.Current.MedalSettings.MaxMedalID;

            try
            {
                if (!SettingManager.SaveSettings(setting))
                {
                    CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    UserBO.Instance.RemoveAllUserCache();
                    m_MedalList = null;
                    _Request.Clear(Method.Post);
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
        private void DeleteMedals(List<int> medalIDs)
        {
            MessageDisplay msgDisplay = CreateMessageDisplay();

            MedalCollection medals = new MedalCollection();

            int i = 0;
            foreach (Medal medal in MedalList)
            {
                if (medalIDs.Contains(medal.ID) == false)
                    medals.Add(medal);
            }

            MedalSettings setting = new MedalSettings();
            setting.Medals = medals;
            setting.MaxMedalID = AllSettings.Current.MedalSettings.MaxMedalID;

            try
            {
                if (!SettingManager.SaveSettings(setting))
                {
                    CatchError<ErrorInfo>(delegate(ErrorInfo error)
                    {
                        msgDisplay.AddError(error);
                    });
                }
                else
                {
                    UserBO.Instance.RemoveAllUserCache();

                    m_MedalList = null;
                    _Request.Clear(Method.Post);
                    Logs.LogManager.LogOperation(
                        new Medal_DeleteMedalByIDs(MyUserID, My.Name, _Request.IpAddress, medalIDs)
                    );
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
Beispiel #7
0
        public MedalSettings()
        {
            Medals = new MedalCollection();
            MaxMedalID = 3;

            Medal medal = new Medal();

            medal.ID = 1;
            medal.IsCustom = false;
            medal.IsHidden = false;
            medal.Enable = true;
            medal.Condition = "point_1";
            medal.Name = "大富翁";
            medal.MaxLevelID = 5;

            MedalLevel level = new MedalLevel();
            level.IconSrc = "~/max-assets/icon-medal/gold1.gif";
            level.ID = 1;
            level.Name = "万元户";
            level.Value = 10000;

            medal.Levels.Add(level);

            level = new MedalLevel();
            level.IconSrc = "~/max-assets/icon-medal/gold2.gif";
            level.ID = 2;
            level.Name = "暴发户";
            level.Value = 100000;
            medal.Levels.Add(level);


            level = new MedalLevel();
            level.IconSrc = "~/max-assets/icon-medal/gold3.gif";
            level.ID = 3;
            level.Name = "百万富翁";
            level.Value = 1000000;
            medal.Levels.Add(level);


            level = new MedalLevel();
            level.IconSrc = "~/max-assets/icon-medal/gold4.gif";
            level.ID = 4;
            level.Name = "千万富翁";
            level.Value = 10000000;
            medal.Levels.Add(level);

            level = new MedalLevel();
            level.IconSrc = "~/max-assets/icon-medal/gold5.gif";
            level.ID = 5;
            level.Name = "亿万富翁";
            level.Value = 100000000;
            medal.Levels.Add(level);

            Medals.Add(medal);

            medal = new Medal();

            medal.ID = 2;
            medal.IsCustom = true;
            medal.IsHidden = false;
            medal.Enable = true;
            medal.Condition = "";
            medal.Name = "忠实用户";
            medal.MaxLevelID = 1;

            level = new MedalLevel();
            level.IconSrc = "~/max-assets/icon-medal/medal15.gif";
            level.ID = 1;
            level.Name = "一级";
            level.Condition = "参与“领取每日积分大礼包”任务可获得此图标";
            medal.Levels.Add(level);

            Medals.Add(medal);


            medal = new Medal();

            medal.ID = 3;
            medal.IsCustom = true;
            medal.IsHidden = true;
            medal.Enable = true;
            medal.Condition = "";
            medal.Name = "开国元老";
            medal.MaxLevelID = 1;

            level = new MedalLevel();
            level.IconSrc = "~/max-assets/icon-medal/medal11.gif";
            level.ID = 1;
            level.Name = "一级";
            level.Condition = "需要管理员点亮";
            medal.Levels.Add(level);

            Medals.Add(medal);
        }
Beispiel #8
0
        /// <summary>
        /// Base constructor.
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="guid"></param>
        private CCPCharacter(CharacterIdentity identity, Guid guid)
            : base(identity, guid)
        {
            QueryMonitors = new QueryMonitorCollection();
            SkillQueue = new SkillQueue(this);
            Standings = new StandingCollection(this);
            Assets = new AssetCollection(this);
            WalletJournal = new WalletJournalCollection(this);
            WalletTransactions = new WalletTransactionsCollection(this);
            CharacterMarketOrders = new MarketOrderCollection(this);
            CorporationMarketOrders = new MarketOrderCollection(this);
            CharacterContracts = new ContractCollection(this);
            CorporationContracts = new ContractCollection(this);
            CharacterContractBids = new ContractBidCollection(this);
            CorporationContractBids = new ContractBidCollection(this);
            CharacterIndustryJobs = new IndustryJobCollection(this);
            CorporationIndustryJobs = new IndustryJobCollection(this);
            ResearchPoints = new ResearchPointCollection(this);
            EVEMailMessages = new EveMailMessageCollection(this);
            EVEMailingLists = new EveMailingListCollection(this);
            EVENotifications = new EveNotificationCollection(this);
            Contacts = new ContactCollection(this);
            CharacterMedals = new MedalCollection(this);
            CorporationMedals = new MedalCollection(this);
            UpcomingCalendarEvents = new UpcomingCalendarEventCollection(this);
            KillLog = new KillLogCollection(this);
            PlanetaryColonies = new PlanetaryColonyCollection(this);

            m_endedOrdersForCharacter = new List<MarketOrder>();
            m_endedOrdersForCorporation = new List<MarketOrder>();

            m_endedContractsForCharacter = new List<Contract>();
            m_endedContractsForCorporation = new List<Contract>();

            m_jobsCompletedForCharacter = new List<IndustryJob>();

            EveMonClient.CharacterAssetsUpdated += EveMonClient_CharacterAssetsUpdated;
            EveMonClient.CharacterMarketOrdersUpdated += EveMonClient_CharacterMarketOrdersUpdated;
            EveMonClient.CorporationMarketOrdersUpdated += EveMonClient_CorporationMarketOrdersUpdated;
            EveMonClient.CharacterContractsUpdated += EveMonClient_CharacterContractsUpdated;
            EveMonClient.CorporationContractsUpdated += EveMonClient_CorporationContractsUpdated;
            EveMonClient.CharacterIndustryJobsUpdated += EveMonClient_CharacterIndustryJobsUpdated;
            EveMonClient.CorporationIndustryJobsUpdated += EveMonClient_CorporationIndustryJobsUpdated;
            EveMonClient.CharacterIndustryJobsCompleted += EveMonClient_CharacterIndustryJobsCompleted;
            EveMonClient.CorporationIndustryJobsCompleted += EveMonClient_CorporationIndustryJobsCompleted;
            EveMonClient.CharacterPlaneteryPinsCompleted += EveMonClient_CharacterPlaneteryPinsCompleted;
            EveMonClient.APIKeyInfoUpdated += EveMonClient_APIKeyInfoUpdated;
            EveMonClient.TimerTick += EveMonClient_TimerTick;
        }