Esempio n. 1
0
        public string UpdateTopicaMark(string infomation)
        {
            var log = new TmpLogServiceInfo
            {
                Time        = DateTime.Now,
                Description = infomation,
                CallType    = (int)CallType.UpdateTopicaMark,
            };

            try
            {
                var input = JsonConvert.DeserializeObject <UpdateTopicaMark>(infomation);

                var f          = input.tuVung + input.dienDat + input.ngheHieu + input.chinhTa;
                int levelCasec = 0;
                if (f >= 0 && f <= 219)
                {
                    levelCasec = 1;                    //basic 100
                }
                else if (f >= 220 && f <= 239)
                {
                    levelCasec = 3;                           //basic 200
                }
                else if (f >= 330 && f <= 449)
                {
                    levelCasec = 4;                           //basic 300
                }
                else if (f >= 450 && f <= 549)
                {
                    levelCasec = 32;                           //inter 100
                }
                else if (f >= 550 && f <= 654)
                {
                    levelCasec = 33;                           //inter 200
                }
                else if (f >= 655 && f <= 759)
                {
                    levelCasec = 34;                           //inter 300
                }
                else if (f >= 760 && f <= 849)
                {
                    levelCasec = 35;                           //adv 100
                }
                else if (f >= 850 && f <= 909)
                {
                    levelCasec = 36;                           //adv 200
                }
                else if (f >= 909 && f <= 1000)
                {
                    levelCasec = 37;                            //adv 300
                }
                var result = CheckInputUpdateTopicaMark(input);

                if (result.Code == 0)
                {
                    TestResultRepository.InsertTopicaMark(input.userName, input.tuVung, input.dienDat, input.ngheHieu, input.chinhTa, levelCasec);
                    result.Code = 0;
                }
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
            catch (Exception ex)
            {
                var result = new Result();
                result.Code        = 1;
                result.Description = "Hệ thống " + infomation;
                var output = JsonConvert.SerializeObject(result);
                log.Description = result.Description + "_" + infomation;
                log.Status      = result.Code;
                TmpLogServiceRepository.Create(log);
                return(output);
            }
        }