Example #1
0
        private void SendTestResult(string testName, UserTest userTest, int?companyId)
        {
            var courseName = DictionaryUtils.GetValueNotDefaultKey(
                CourseService.GetAllActiveCourseNames(), userTest.Course_TC);
            var userTestLink = Url.UserTestLink(userTest, courseName ?? testName).AbsoluteHref();

            if (companyId.HasValue)
            {
                var email = UserService.GetAll(x => x.CompanyID == companyId).Select(x => x.Email).First();
                MailService.Send(Services.Common.MailService.info, new MailAddress(email),
                                 userTestLink.ToString(), "Результат тестирования " + User.FullName);
            }
            if (!userTest.IsPass || !userTest.NormalTest)
            {
                return;
            }


            var courseTC = RecomendCourseTCs(userTest).ToList();

            if (courseTC.Any())
            {
                var courseLink = CourseService.GetCourseLinkList(courseTC);
                if (courseLink.Any())
                {
                    MailService.TestResult(AuthService.CurrentUser,
                                           userTestLink,
                                           courseLink.Select(cl =>
                                                             Html.CourseLinkAnchor(cl.UrlName, cl.GetName()).AbsoluteHref()).ToList(), userTest);
                }
            }
        }
Example #2
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            //信息提取
            Dictionary <byte, object> parameter = operationRequest.Parameters;
            String userName = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.UserName);
            String password = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.Password);

            Application.logger.Info("===================" + userName + " " + password + "尝试登录===========================");

            //检查注册结果
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();
            int result = UserInfoServices.register(userName, password);

            if (result == 0)
            {
                responseParameter.Add((byte)ParameterCode.RegisterResult, 0);
                Application.logger.Info("===================" + userName + " " + password + "注册失败===========================");
            }
            else if (result == 1)
            {
                responseParameter.Add((byte)ParameterCode.RegisterResult, 1);
                Application.logger.Info("===================" + userName + " " + password + "注册成功===========================");
            }
            else
            {
                responseParameter.Add((byte)ParameterCode.RegisterResult, 2);
                Application.logger.Info("===================" + userName + " " + password + "注册失败===========================");
            }

            //响应客户端
            OperationResponse operationResponse = new OperationResponse((byte)OPCode.Register, responseParameter);

            peer.SendOperationResponse(operationResponse, sendParameters);
        }
Example #3
0
        public ActionResult Result(int userTestId)
        {
            UserTestService
            .LoadWith(c => c.Load(x => x.Test, x => x.TestPassRule));
            var userTest = UserTestService.GetByPK(userTestId);

            if (userTest == null)
            {
                return(null);
            }
            var isEnglishTest = TestRecomendations.IsEnglishTest(userTest.TestId);
            var courseTCs     = RecomendCourseTCs(userTest);

            var courseTC = userTest.Test.CourseTCSplitList.FirstOrDefault();
            var isTrack  = !courseTC.IsEmpty() && CourseService.IsTrack(courseTC);


            var courses    = CourseService.GetCourseLinkList(courseTCs).ToList();
            var modules    = TestModuleService.GetForTest(userTest.TestId).ToList();
            var courseName = DictionaryUtils.GetValueNotDefaultKey(
                CourseService.GetAllActiveCourseNames(), userTest.Course_TC);
            var model = new TestResultVM {
                UserTest        = userTest,
                RecCourses      = courses,
                IsOwned         = User != null && User.UserID == userTest.UserId,
                IsPrivatePerson = User != null && !User.IsCompany,
                Modules         = modules,
                IsTrack         = isTrack,
                Stats           = EntityUtils.GetStats(userTest),
                IsEnglish       = isEnglishTest,
                CourseName      = courseName
            };

            return(BaseView(new PagePart(PartialViewNames.Result, model)));
        }
Example #4
0
        public static AccountConfig GetByName(string name)
        {
            var keys = WebConfigurationManager.AppSettings.AllKeys;

            AccountConfig res;

            // Get from appSettings or the dictionary
            if (keys.Where(x => x.StartsWith(Constants.AppSettings.Prefix)).Any())
            {
                // Try appSettings first
                res = new AccountConfig(WebConfigurationManager.AppSettings, name);
            }
            else
            {
                // Try the dictionary
                DictionaryUtils uDic      = new DictionaryUtils();
                var             dictItems = uDic
                                            .GetDictionaryItemsSimple()
                                            .Where(x => x.Key.StartsWith(Constants.AppSettings.Prefix));
                NameValueCollection nvc = dictItems
                                          .Aggregate(new NameValueCollection(),
                                                     (seed, current) =>
                {
                    seed.Add(current.Key, current.Value);
                    return(seed);
                });

                res = new AccountConfig(nvc, name);
            }

            return(res);
        }
Example #5
0
        public static IEnumerable <AccountConfig> GetAll()
        {
            var prefix = Constants.AppSettings.Prefix + ":";
            var keys   = WebConfigurationManager.AppSettings.AllKeys;
            var names  = new HashSet <string>();

            if (!keys.Where(x => x.StartsWith(Constants.AppSettings.Prefix)).Any())
            {
                // Probably need to try the dictionary
                DictionaryUtils uDic      = new DictionaryUtils();
                var             dictItems = uDic.GetDictionaryItemsSimple();
                keys = dictItems.Where(x => x.Key.StartsWith(Constants.AppSettings.Prefix)).Select(x => x.Key).ToArray();
            }

            foreach (var key in keys)
            {
                if (!key.StartsWith(prefix))
                {
                    continue;
                }
                var parts = key.Split(':');
                if (parts.Length == 2)
                {
                    names.Add(string.Empty);
                }
                else if (parts.Length == 3)
                {
                    names.Add(parts[1]);
                }
            }

            return(names.Select(GetByName).Where(x => !string.IsNullOrEmpty(x.GoogleProfileId)));
        }
Example #6
0
        private void Validate()
        {
            if (Columns.Count > 0)
            {
                if (DataSource is null)
                {
                    throw new NullReferenceException("未指定資料來源。");
                }

                if (DataSource.Count() == 0)
                {
                    return;
                }

                IDictionary <string, object> firstData = DictionaryUtils.ConvertFrom(DataSource.First());

                foreach (DataColumn <T> col in Columns.DataSourceColumns)
                {
                    if (!string.IsNullOrWhiteSpace(col.DataKey) && !firstData.ContainsKey(col.DataKey))
                    {
                        throw new ArgumentException($"資料來源未包含Property「{col.DataKey}」。");
                    }
                }
            }
        }
Example #7
0
        private static bool CheckUnitsStringContains(string fractionUnitCode, string fractionUnitsString)
        {
            var unitsMap = new Dictionary <string, string>();

            DictionaryUtils.BindUnitsString(unitsMap, string.Empty, fractionUnitsString);
            return(unitsMap.ContainsKey(fractionUnitCode));
        }
        public void EqualsTest()
        {
            IDictionary <string, JobParameter> myJobP = new Dictionary <string, JobParameter>
            {
                { "p1", new JobParameter("param1") },
                { "p2", new JobParameter(2) },
                { "p3", new JobParameter(3.0) },
                { "p4", new JobParameter(DateTime.Parse("1970-07-31")) }
            };

            JobParameters jp = new JobParameters(myJobP);

            //NOTE : ORDER DOES NOT COUNT ON EQUALS COMPARISON, ONLY <KEY,VALUES>
            //SAME BEHAVIOUR AS LinkedHashMap
            IDictionary <string, JobParameter> myJobP2 = new Dictionary <string, JobParameter>
            {
                { "p2", new JobParameter(2) },
                { "p1", new JobParameter("param1") },
                { "p3", new JobParameter(3.0) },
                { "p4", new JobParameter(DateTime.Parse("1970-07-31")) }
            };

            JobParameters jp2 = new JobParameters(myJobP2);
            JobParameters jp3 = new JobParameters();

            Assert.IsTrue(DictionaryUtils <string, JobParameter> .AreEqual(myJobP, myJobP2));
            Assert.IsTrue(jp.Equals(jp2));
            Assert.IsFalse(jp.Equals(jp3));
        }
    private static IEnumerable <string> GetLegalTextIds(SiteConfigurationData siteConfig, string ageBandKey, bool registration)
    {
        LegalGroup legalGroup = DictionaryUtils.TryGetValue(siteConfig.legal, ageBandKey);

        return(UseCreate(registration, legalGroup) ? (from proxy in legalGroup.CREATE
                                                      select CreateTextId(proxy)) : legalGroup.documents.Keys.Distinct());
    }
Example #10
0
        public ActionResult OrgCatalogPost(OrgCatalogFormVM model)
        {
            var data =
                SimpleUtils.FluentAttributes.Utils.EntityUtils.ToStrings(model,
                                                                         x => x.CompanyName,
                                                                         x => x.FullName,
                                                                         x => x.Position,
                                                                         x => x.Index,
                                                                         x => x.Address,
                                                                         x => x.Email,
                                                                         x => x.Phone,
                                                                         x => x.Count
                                                                         );
            var data2 =
                SimpleUtils.FluentAttributes.Utils.EntityUtils.ToStrings(model,
                                                                         x => x.SmFullName,
                                                                         x => x.SmEmail,
                                                                         x => x.SmPhone
                                                                         );
            var message = DictionaryUtils.ToHtml(data) +
                          (model.IamStudyManager ? "<br/>Решение по обучению принимаю я" : DictionaryUtils.ToHtml(data2));

            MailService.Send(Services.Common.MailService.info,
                             Services.Common.MailService.corporatedepartment, message, "Заказ каталога курсов");
            return(Content("ok"));
        }
    private static void GetDefaultAgeBand(SiteConfigurationData siteConfig, out ConfigurationAgeBand configurationAgeBand, out string configurationAgeBandKey)
    {
        Compliance compliance = siteConfig.compliance;

        configurationAgeBand    = DictionaryUtils.TryGetValue(compliance.ageBands, compliance.defaultAgeBand);
        configurationAgeBandKey = compliance.defaultAgeBand;
    }
Example #12
0
        //重新封装卡组
        public static bool disassembleCardSetsInfo(String userName, SerializableDictionary <int, CardsSet> dict)
        {
            String path = Path.Combine(DataRootPath, "UserInfo\\" + userName + "\\CardSetsInfo.txt");

            try
            {
                File.WriteAllText(path, String.Empty);
                using (StreamWriter writer = new StreamWriter(new FileStream(path, FileMode.Open), Encoding.GetEncoding("gb2312")))
                {
                    foreach (int cardSetNumber in dict.Keys)
                    {
                        CardsSet cardsSet = DictionaryUtils.getValue <int, CardsSet>(dict, cardSetNumber);
                        writer.WriteLine("CardsSet" + " " + cardsSet.Name + " " + (byte)cardsSet.profession + " " + (byte)cardsSet.gameMode);
                        for (int i = 0; i < cardsSet.CardCapable; i++)
                        {
                            if (cardsSet.cards[i] != null && cardsSet.cards[i] != "")
                            {
                                writer.WriteLine(cardsSet.cards[i] + " " + cardsSet.isGolden[i]);
                            }
                            else
                            {
                                break;
                            }
                        }
                        writer.WriteLine("*CardsSet");
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                Application.logger.Info(e.ToString());
                return(false);
            }
        }
Example #13
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取并查询用户
                Dictionary <byte, object> parameters = operationRequest.Parameters;
                String userName   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
                int    cardsSetId = (int)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSetId);

                //用户卡组变化
                User user = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                user.CardSets.Remove(cardsSetId);

                //将变化保存到文件数据库
                UserManager.disassembleCardSetsInfo(user.UserName, user.CardSets);

                //保存用户
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装信息
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 1);
            }
            catch (Exception e)
            {
                Application.logger.Info(e.ToString());
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 0);
            }

            OperationResponse response = new OperationResponse((byte)OPCode.DeleteCardsSet, responseParameter);

            peer.SendOperationResponse(response, sendParameters);
        }
Example #14
0
 /// <summary>
 /// Tries to get the value in dictionary by key. If it does not exist it will return
 /// default value.
 /// </summary>
 /// <typeparam name="TKey">Dictionary key type.</typeparam>
 /// <typeparam name="TValue">Dictionary value type.</typeparam>
 /// <param name="target">Target dictionary.</param>
 /// <param name="key">Key.</param>
 /// <param name="defaultValue">Default value.</param>
 public static TValue GetValueOrDefault <TKey, TValue>(
     this IDictionary <TKey, TValue> target,
     TKey key,
     TValue defaultValue = default(TValue))
 {
     return(DictionaryUtils.GetValueOrDefault(target, key, defaultValue));
 }
Example #15
0
        public void GetValueThrowsArgumentNullException()
        {
            Func <string> func = null;

            Assert.Throws <ArgumentNullException>(() => DictionaryUtils.GetValue(null, "B", string.Empty));
            Assert.Throws <ArgumentNullException>(() => DictionaryUtils.GetValue(new Dictionary <string, string>(), "B", func));
        }
Example #16
0
        public ActionResult SeminarRegistrationPost(decimal groupId,
                                                    SeminarRegisterFormVM model)
        {
            var gr   = GroupService.GetByPK(groupId);
            var data =
                SimpleUtils.FluentAttributes.Utils.EntityUtils.ToStrings(model,
                                                                         x => x.FullName,
                                                                         x => x.CompanyName,
                                                                         x => x.Email,
                                                                         x => x.Phone,
                                                                         x => x.Position,
                                                                         x => x.Region,
                                                                         x => x.StudyManger,
                                                                         x => x.Section,
                                                                         x => x.Courses,
                                                                         x => x.HowMany,
                                                                         x => x.WhereAbout
                                                                         );

            data.Add("Семинар", gr.Title);
            data.Add("Дата", gr.DateBeg.DefaultString());
            var message = DictionaryUtils.ToHtml(data);

            MailService.SendSeminarRegistration(message);
            return(Content("ok"));
        }
        internal virtual CellStyle GetDataCellStyle(T valueObject)
        {
            IDictionary <string, object> data = DictionaryUtils.ConvertFrom(valueObject);
            object value = string.IsNullOrWhiteSpace(DataKey) ? null : data[DataKey];

            return(ItemStyleFunctor is null ? ItemStyle : ItemStyleFunctor(value, valueObject));
        }
    private static IEnumerable <string> GetMarketingTextIds(SiteConfigurationData siteConfig, string ageBandKey, bool registration)
    {
        ConfigurationMarketingAgeBand ageBand = DictionaryUtils.TryGetValue(siteConfig.marketing, ageBandKey);
        Dictionary <string, ConfigurationMarketingItem> configuration = GetConfiguration(ageBand, registration);

        return(GetKeysOrEmpty(configuration).Distinct());
    }
Example #19
0
 /// <summary>
 /// Adds a key/value pair to the <see cref="IDictionary{TKey,TValue}" /> if the key does not already
 /// exist, or updates a key/value pair in the <see cref="IDictionary{TKey,TValue}" /> if the key
 /// already exists. The default value will be used if key is missed to the <see cref="IDictionary{TKey,TValue}" />.
 /// </summary>
 /// <typeparam name="TKey">Key type.</typeparam>
 /// <typeparam name="TValue">Value type.</typeparam>
 /// <param name="target">Target dictionary.</param>
 /// <param name="key">The key to be added or whose value should be updated.</param>
 /// <param name="updateFunc">The function used to generate a new value for an existing key based on
 /// the key's existing value.</param>
 /// <param name="defaultValue">The value to be used for an absent key.</param>
 /// <returns>The new or updated value for the key.</returns>
 public static TValue AddOrUpdate <TKey, TValue>(
     this IDictionary <TKey, TValue> target,
     TKey key,
     Func <TKey, TValue, TValue> updateFunc,
     TValue defaultValue = default(TValue))
 {
     return(DictionaryUtils.AddOrUpdate(target, key, updateFunc, defaultValue));
 }
Example #20
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取并查询用户
                Dictionary <byte, object> parameters = operationRequest.Parameters;
                String   userName   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
                String   cardString = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardName);
                String[] info       = cardString.Split(' ');
                Card     card       = new Card((Series)int.Parse(info[0]), (Profession)int.Parse(info[1]), (Rarity)int.Parse(info[2]), (CardType)int.Parse(info[3])
                                               , int.Parse(info[4]), info[5], info[6], int.Parse(info[7]), int.Parse(info[8]), (Species)int.Parse(info[9]));
                bool isgolden = (bool)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.IsColden);

                //用户卡牌变化
                User user       = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                int  cardNumber = DictionaryUtils.getValue <String, int>(user.MyCards, card.Name);
                user.MyCards.Remove(card.Name);
                if (isgolden)
                {
                    cardNumber -= 1000;
                }
                else
                {
                    cardNumber -= 1;
                }
                if (cardNumber != 0)
                {
                    user.MyCards.Add(card.Name, cardNumber);
                }

                //将变化保存到文件数据库
                UserManager.disassembleCardInfo(user.UserName, user.MyCards);

                //用户奥术之尘变化
                user.ArcaneDust += DataUtils.getNumberOfArcaneDustWhenDecompose(card.Rarity, isgolden);

                //将变化保存到数据库
                UserManager.Update(user);

                //保存用户
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装信息
                responseParameter.Add((byte)ParameterCode.CardOperationResult, 1);
            }
            catch (Exception e)
            {
                Application.logger.Info(e.ToString());
                responseParameter.Add((byte)ParameterCode.CardOperationResult, 0);
            }

            OperationResponse response = new OperationResponse((byte)OPCode.DecomposeCard, responseParameter);

            peer.SendOperationResponse(response, sendParameters);
        }
Example #21
0
 public StoredProcQuery(string procName, object parameters)
 {
     StoredProcName = procName;
     Parameters     = new List <SqlParameter>();
     foreach (var param in DictionaryUtils.AnonToDictionary(parameters))
     {
         Parameters.Add(new SqlParameter(param.Key, param.Value ?? DBNull.Value));
     }
 }
Example #22
0
        protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
        {
            BaseHandler handler = DictionaryUtils.getValue <OPCode, BaseHandler>(Application.handlerDict, (OPCode)operationRequest.OperationCode);

            if (handler != null)
            {
                handler.doResponse(operationRequest, sendParameters, this);
            }
        }
Example #23
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取并查询用户
                Dictionary <byte, object> parameters = operationRequest.Parameters;
                String   userName    = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
                String   newCardsSet = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSet);
                int      cardsSetId  = (int)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSetId);
                String[] info        = newCardsSet.Split(' ');
                CardsSet set         = new CardsSet();
                set.Name       = info[0];
                set.profession = (Profession)int.Parse(info[1]);
                set.gameMode   = (GameMode)int.Parse(info[2]);

                //用户卡组变化
                User       user = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                List <int> list = new List <int>();
                foreach (int i in user.CardSets.Keys)
                {
                    if (DictionaryUtils.getValue <int, CardsSet>(user.CardSets, i) == null)
                    {
                        list.Add(i);
                    }
                }

                foreach (int i in list)
                {
                    user.CardSets.Remove(i);
                }

                user.CardSets.Add(cardsSetId, set);

                //将变化保存到文件数据库
                UserManager.disassembleCardSetsInfo(user.UserName, user.CardSets);

                //保存用户
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装信息
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 1);
            }
            catch (Exception e)
            {
                Application.logger.Info(e.ToString());
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 0);
            }

            OperationResponse response = new OperationResponse((byte)OPCode.NewCardsSet, responseParameter);

            peer.SendOperationResponse(response, sendParameters);
        }
Example #24
0
        public ActionResult OrderPaperCatalogPost(PaperCatalogFormVM model)
        {
            var data =
                SimpleUtils.FluentAttributes.Utils.EntityUtils.ToStrings(model,
                                                                         x => x.FullName,
                                                                         x => x.Email);
            var message = DictionaryUtils.ToHtml(data);

            MailService.SendOrderPaperCatalog(message);
            return(Content("ok"));
        }
Example #25
0
 protected override void TransformHeaders(IDictionary <string, object> headers)
 {
     foreach (KeyValuePair <string, object> entry in _headersToAdd)
     {
         string key = entry.Key;
         if (_overwrite || DictionaryUtils.Get(headers, key) == null)
         {
             DictionaryUtils.Put(headers, key, entry.Value);
         }
     }
 }
Example #26
0
        public static SeifApplication AsProvider(string hostDomain, string protocol, string serializeMode, IDictionary <string, string> dictionary)
        {
            SeifApplication.AppEnv.GlobalConfiguration.ProviderConfiguration.ApiDomain    = hostDomain;
            SeifApplication.AppEnv.GlobalConfiguration.ProviderConfiguration.ApiIpAddress =
                UriUtils.GetIpAddressByDomainName(hostDomain);
            SeifApplication.AppEnv.GlobalConfiguration.ProviderConfiguration.SerializeMode   = serializeMode;
            SeifApplication.AppEnv.GlobalConfiguration.ProviderConfiguration.AddtionalFields =
                DictionaryUtils.ToConfig(dictionary);

            return(SeifApplication.AppEnv);
        }
        internal virtual object GetContentValue(T valueObject)
        {
            IDictionary <string, object> data = DictionaryUtils.ConvertFrom(valueObject);

            if (string.IsNullOrWhiteSpace(DataKey))
            {
                return(ContentRender is null ? "" : ContentRender(null, valueObject));
            }
            object value = data[DataKey];

            return(ContentRender is null ? value : ContentRender(value, valueObject));
        }
Example #28
0
        private bool CheckUnitsStringContains(string fractionUnitCode, string fractionUnitsString)
        {
            var unitsMap = new Dictionary <string, string>();

            DictionaryUtils.BindUnitsString(unitsMap, "", fractionUnitsString);
            if (unitsMap.ContainsKey(fractionUnitCode))
            {
                return(true);
            }

            return(false);
        }
Example #29
0
 public override bool Equals(Object obj)
 {
     if (!(obj is ConcreteInstance))
     {
         return(false);
     }
     if (declaration != ((ConcreteInstance)obj).declaration)
     {
         return(false);
     }
     return(DictionaryUtils.AreEqual(this.values, ((ConcreteInstance)obj).values));
 }
Example #30
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取并查询用户
                Dictionary <byte, object> parameters = operationRequest.Parameters;
                String   userName   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
                String   cardsSet   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSet);
                int      cardsSetId = (int)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSetId);
                String[] info       = cardsSet.Split(' ');
                CardsSet set        = new CardsSet();
                set.Name        = info[0];
                set.CardCapable = int.Parse(info[1]);
                set.Changeable  = bool.Parse(info[2]);
                set.Number      = int.Parse(info[3]);
                set.profession  = (Profession)int.Parse(info[4]);
                set.gameMode    = (GameMode)int.Parse(info[5]);
                for (int i = 0; i < set.Number; i++)
                {
                    set.cards[i]    = info[6 + 2 * i];
                    set.isGolden[i] = bool.Parse(info[7 + 2 * i]);
                }

                Application.logger.Info(cardsSetId + set.ToString());

                //用户卡组变化
                User user = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                user.CardSets.Remove(cardsSetId);
                user.CardSets.Add(cardsSetId, set);

                //将变化保存到文件数据库
                UserManager.disassembleCardSetsInfo(user.UserName, user.CardSets);

                //保存用户
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装信息
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 1);
            }
            catch (Exception e)
            {
                Application.logger.Info(e.ToString());
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 0);
            }

            OperationResponse response = new OperationResponse((byte)OPCode.ChangeCardsSet, responseParameter);

            peer.SendOperationResponse(response, sendParameters);
        }