예제 #1
0
        public async Task <IActionResult> PutCareerInfo([FromRoute] Guid id, [FromBody] CareerInfo careerInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != careerInfo.CareerInfoId)
            {
                return(BadRequest());
            }

            try
            {
                await _repo.CareerInfo.UpdateCareerInfoAsync(careerInfo);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CareerInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public IActionResult Details(Guid?id)
        {
            CareerInfo resume = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri($"{UriHelper.BuildAbsolute(Request.Scheme, Request.Host)}api/v1/");
                //HTTP GET
                var responseTask = client.GetAsync($"CareerInfo/{id.GetValueOrDefault()}");
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <CareerInfo>();
                    readTask.Wait();

                    resume = readTask.Result;
                }
                else //web api sent error response
                {
                    //log response status here..

                    resume = null;

                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                    //log exception
                    Response.StatusCode = 404;
                    return(View("NotFound"));
                }
            }

            return(View(resume));
        }
예제 #3
0
        public override void BuildPacket()
        {
            PushIntoStack(moreTeam.MorePlot.PlotID);
            PushIntoStack(moreTeam.MorePlot.PlotName.ToNotNullString());
            PushIntoStack(moreTeam.UserList.Count);
            PushIntoStack(PlotTeamCombat.TeamMaxPeople);
            PushIntoStack(moreTeam.MorePlot.ItemId);
            PushIntoStack(moreTeam.MorePlot.ItemName.ToNotNullString());
            PushIntoStack(moreTeam.MorePlot.ItemNum);
            PushIntoStack(moreTeam.MorePlot.ExpNum);
            PushIntoStack(moreTeam.TeamUser != null && moreTeam.TeamUser.UserId.ToNotNullString().Equals(Uid) ? 1 : 0);
            PushIntoStack(moreTeam.Status);

            PushIntoStack(moreTeam.UserList.Count);
            foreach (var teamUser in moreTeam.UserList)
            {
                var         gameUser   = new GameDataCacheSet <GameUser>().FindKey(teamUser.UserId);
                UserGeneral general    = UserGeneral.GetMainGeneral(teamUser.UserId);
                CareerInfo  careerInfo = null;
                if (general != null)
                {
                    careerInfo = new ConfigCacheSet <CareerInfo>().FindKey(general.CareerID);
                }

                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(teamUser.UserId);
                dsItem.PushIntoStack(teamUser.NickName.ToNotNullString());
                dsItem.PushIntoStack(careerInfo == null ? 0 : (int)careerInfo.CareerID);
                dsItem.PushIntoStack(careerInfo == null ? string.Empty : careerInfo.CareerName.ToNotNullString());
                dsItem.PushIntoStack(gameUser == null ? (short)0 : gameUser.UserLv);
                PushIntoStack(dsItem);
            }
        }
        public async Task <string> GetExperienceAsync(string doctorId)
        {
            CareerInfo careerInfo = await this.careerInfoRepository
                                    .All()
                                    .FirstOrDefaultAsync(x => x.DoctorId == doctorId);

            return(careerInfo.Experience);
        }
        public async Task ChangeWorkplaceAsync(string doctorId, string workplace)
        {
            CareerInfo careerInfo = await this.careerInfoRepository.All()
                                    .FirstOrDefaultAsync(x => x.DoctorId == doctorId);

            careerInfo.Workplace = workplace;
            await this.careerInfoRepository.SaveChangesAsync();
        }
        public async Task ChangeDegreesAsync(string doctorId, string degrees)
        {
            CareerInfo careerInfo = await this.careerInfoRepository.All()
                                    .FirstOrDefaultAsync(x => x.DoctorId == doctorId);

            careerInfo.Degrees = degrees;
            await this.careerInfoRepository.SaveChangesAsync();
        }
예제 #7
0
        public async Task <IActionResult> PostCareerInfo([FromBody] CareerInfo careerInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _repo.CareerInfo.CreateCareerInfoAsync(careerInfo);

            return(CreatedAtAction("GetCareerInfo", new { id = careerInfo.CareerInfoId }, careerInfo));
        }
        public async void GetCareerInfo_ShouldReturnAllItems()
        {
            var response = await _controller.GetCareerInfo();

            CareerInfo ci = response.GetEnumerator().Current;

            //CollectionAssert.AllItemsAreNotNull(response.Result, "Should have returned all Items, should not be null if there are CareerInfo items in the datastore.");
            //REMOTE: 58f21038-a7e4-46ec-b036-08d667882bcb
            //LOCAL: 21a61a6a-6554-4e7f-a974-08d663d5d19f
            Assert.True(ci.CareerInfoId.ToString().Equals("21a61a6a-6554-4e7f-a974-08d663d5d19f", StringComparison.InvariantCultureIgnoreCase), "Should have returned all Items, should not be null if there are CareerInfo items in the datastore.");
        }
예제 #9
0
 public ActionResult AddCareer(CareerInfo career)
 {
     using (TouchContext db = new TouchContext())
     {
         //db.CareerInformation.Add(career);
         //var obj = db.CareerInformation.Where(a => a.Id == career.Id).FirstOrDefault();
         db.Entry(career).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("JobApplication"));
     }
 }
예제 #10
0
        /// <summary>
        /// 创建佣兵或佣兵灵魂
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="general"></param>
        /// <param name="type"></param>
        /// <param name="num"></param>
        public static void CreateUserGeneral(string userID, GeneralInfo general, GeneralType type, int num)
        {
            var        cacheSet   = new GameDataCacheSet <UserGeneral>();
            int        generalID  = 0;
            CareerInfo careerInfo = null;

            if (type == GeneralType.YongBing)
            {
                generalID  = general.GeneralID;
                careerInfo = new ConfigCacheSet <CareerInfo>().FindKey(general.CareerID);
            }
            else if (type == GeneralType.Soul)
            {
                generalID = general.SoulID;
            }
            if (generalID > 0)
            {
                UserGeneral userGeneral = new UserGeneral();
                userGeneral.UserID            = userID;
                userGeneral.GeneralID         = generalID;
                userGeneral.GeneralName       = general.GeneralName;
                userGeneral.HeadID            = general.HeadID;
                userGeneral.PicturesID        = general.PicturesID;
                userGeneral.GeneralLv         = 1;
                userGeneral.GeneralType       = type;
                userGeneral.CareerID          = general.CareerID;
                userGeneral.PowerNum          = general.PowerNum;
                userGeneral.SoulNum           = general.SoulNum;
                userGeneral.IntellectNum      = general.IntellectNum;
                userGeneral.TrainingPower     = 0;
                userGeneral.TrainingSoul      = 0;
                userGeneral.TrainingIntellect = 0;
                userGeneral.AbilityID         = general.AbilityID;
                userGeneral.Momentum          = 0;
                userGeneral.Description       = string.Empty;
                userGeneral.HitProbability    = ConfigEnvSet.GetDecimal("Combat.HitiNum");
                userGeneral.GeneralStatus     = GeneralStatus.DuiWuZhong;
                userGeneral.CurrExperience    = 0;
                userGeneral.Experience1       = 0;
                userGeneral.Experience2       = 0;
                if (careerInfo != null)
                {
                    userGeneral.LifeNum = MathUtils.Addition(general.LifeNum, careerInfo.LifeIncreaseNum * (MathUtils.Subtraction(careerInfo.Lv, (short)1, (short)0)), int.MaxValue);
                }
                if (type == GeneralType.Soul)
                {
                    userGeneral.AtmanNum = num;
                }
                userGeneral.HeritageType = HeritageType.Normal;
                userGeneral.AbilityNum   = 3;
                cacheSet.Add(userGeneral, GameEnvironment.CacheUserPeriod);
            }
        }
예제 #11
0
        public async Task <int> CreateAsync(string doctorId)
        {
            if (await this.careerInfoRepository.All().FirstOrDefaultAsync(x => x.DoctorId == doctorId) == null)
            {
                var careerInfo = new CareerInfo
                {
                    DoctorId = doctorId,
                };

                await this.careerInfoRepository.AddAsync(careerInfo);

                await this.careerInfoRepository.SaveChangesAsync();

                return(careerInfo.Id);
            }

            return(-1);
        }
예제 #12
0
        private void CreateGeneral(CareerInfo careerInfo)
        {
            GeneralInfo        general          = new ConfigCacheSet <GeneralInfo>().FindKey(generalID);
            List <UserGeneral> userGeneralArray = new GameDataCacheSet <UserGeneral>().FindAll(Uid);

            if (userGeneralArray.Count > 0 || general == null)
            {
                return;
            }

            UserGeneral userGeneral = new UserGeneral();

            userGeneral.UserID            = Uid;
            userGeneral.GeneralID         = general.GeneralID;
            userGeneral.GeneralName       = general.GeneralName;
            userGeneral.HeadID            = general.HeadID;
            userGeneral.PicturesID        = general.PicturesID;
            userGeneral.GeneralLv         = (short)careerInfo.Lv;
            userGeneral.GeneralType       = GeneralType.YongHu;
            userGeneral.CareerID          = _careerID;
            userGeneral.PowerNum          = general.PowerNum;
            userGeneral.SoulNum           = general.SoulNum;
            userGeneral.IntellectNum      = general.IntellectNum;
            userGeneral.TrainingPower     = 0;
            userGeneral.TrainingSoul      = 0;
            userGeneral.TrainingIntellect = 0;
            userGeneral.AbilityID         = general.AbilityID;
            userGeneral.Momentum          = 0;
            userGeneral.Description       = string.Empty;
            userGeneral.HitProbability    = ConfigEnvSet.GetDecimal("Combat.HitiNum");
            userGeneral.GeneralStatus     = GeneralStatus.DuiWuZhong;
            userGeneral.CurrExperience    = 0;
            userGeneral.Experience1       = 0;
            userGeneral.Experience2       = 0;
            //userGeneral.LifeNum = MathUtils.Addition(general.LifeNum, careerInfo.LifeIncreaseNum * (MathUtils.Subtraction(careerInfo.Lv, (short)1, (short)0)), int.MaxValue);
            userGeneral.RefreshMaxLife();
            userGeneral.HeritageType = HeritageType.Normal;
            userGeneral.AbilityNum   = 3;
            var cacheSet = new GameDataCacheSet <UserGeneral>();

            cacheSet.Add(userGeneral);
            cacheSet.Update();
            UserAbilityHelper.AddUserAbility(general.AbilityID, Uid.ToInt(), generalID, 1);
        }
예제 #13
0
        private async void GetResumeData(Guid?id)
        {
            using (var client = new HttpClient())
            {
                try
                {
                    client.BaseAddress = new Uri("https://rdlsvc.azurewebsites.net/api/v1/");
                    //HTTP GET
                    var responseTask = client.GetAsync($"CareerInfo/{id.GetValueOrDefault()}");
                    responseTask.Wait();

                    var result = responseTask.Result;
                    if (result.IsSuccessStatusCode)
                    {
                        var readTask = result.Content.ReadAsStringAsync();
                        readTask.Wait();

                        _careerInfo = await Task.Run(() => JsonConvert.DeserializeObject <CareerInfo>(readTask.Result));

                        svStats.TotalEmployers = _careerInfo.WorkHistory.Count.ToString();

                        lblFullName.Text = $"{_careerInfo.FirstName} {_careerInfo.MiddleName} {_careerInfo.LastName}, {_careerInfo.Suffix}";
                        lblTitle.Text    = $"{_careerInfo.CareerInfoTitle}";
                        _contactInfo     = $"{_careerInfo.Address1}\n{_careerInfo.City}, {_careerInfo.State} {_careerInfo.PostalCode}\n"
                                           + $"{_careerInfo.EmailAddress}\nHome: {_careerInfo.Phone}\nMobile: {_careerInfo.Mobile}\n";

                        _summary = $"{_careerInfo.Summary}";
                    }
                    else //web api sent error response
                    {
                        //log response status here..

                        _careerInfo = null;

                        _errorMessage = "Server error. Please contact administrator.";
                    }
                }
                catch (Exception ex)
                {
                    _errorMessage = ex.Message;
                }
            }
        }
        public CVModel GenerateTestData()
        {
            ContactInfo contactInfo = new ContactInfo()
            {
                Items = new List <ContactInfoItem>()
                {
                    new ContactInfoItem()
                    {
                        {
                            ContactInfoItem.FirstName, new Field()
                            {
                                Id        = 1,
                                Label     = "First name",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = true
                            }
                        },
                        {
                            ContactInfoItem.LastName, new Field()
                            {
                                Id        = 2,
                                Label     = "Last name",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = true
                            }
                        },
                        {
                            ContactInfoItem.Email, new Field()
                            {
                                Id        = 4,
                                Label     = "Email",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = true
                            }
                        },
                        {
                            ContactInfoItem.Address, new Field()
                            {
                                Id        = 5,
                                Label     = "Address",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        },
                        {
                            ContactInfoItem.Phone, new Field()
                            {
                                Id        = 6,
                                Label     = "Phone",
                                Type      = FieldTypes.Tel,
                                Mandatory = true
                            }
                        },
                        {
                            ContactInfoItem.Facebook, new Field()
                            {
                                Id        = 7,
                                Label     = "Facebook",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        }
                    }
                }
            };
            PersonalInfo personalInfo = new PersonalInfo()
            {
                Items = new List <PersonalInfoItem>()
                {
                    new PersonalInfoItem()
                    {
                        {
                            PersonalInfoItem.Photo, new Field()
                            {
                                Id    = 1,
                                Label = "Nuotrauka",
                                //Reik image, bet dar neveikia
                                Type      = FieldTypes.File,
                                Mandatory = false
                            }
                        },
                        {
                            PersonalInfoItem.Summary, new Field()
                            {
                                Id    = 2,
                                Label = "Summary",
                                //Reik multilane, bet dar neveikia
                                Type      = FieldTypes.MultiLiner,
                                Mandatory = false
                            }
                        },
                        {
                            PersonalInfoItem.Interest, new Field()
                            {
                                Id    = 3,
                                Label = "Personal internals",
                                //Reik multilane, bet dar neveikia
                                Type      = FieldTypes.MultiLiner,
                                Mandatory = false
                            }
                        },
                        {
                            PersonalInfoItem.DateOfBirth, new Field()
                            {
                                Id        = 4,
                                Label     = "Date of birth",
                                Type      = FieldTypes.Date,
                                Mandatory = true
                            }
                        }
                    }
                }
            };
            CareerInfo careerInfo = new CareerInfo()
            {
                Items = new List <CareerInfoItem>()
                {
                    new CareerInfoItem()
                    {
                        //Reikia suglaovti, kaip teisingai lesiti ivesti pvz 3 darbovietes
                        {
                            CareerInfoItem.Start, new Field()
                            {
                                Id = 1,
                                //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx
                                Label     = "Year interval begining",
                                Type      = FieldTypes.Date,
                                Mandatory = false
                            }
                        },
                        {
                            CareerInfoItem.End, new Field()
                            {
                                Id = 1,
                                //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx
                                Label     = "Year interval ending",
                                Type      = FieldTypes.Date,
                                Mandatory = false
                            }
                        },
                        {
                            CareerInfoItem.CompanyName, new Field()
                            {
                                Id        = 2,
                                Label     = "Company name",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        },
                        {
                            CareerInfoItem.JobTitle, new Field()
                            {
                                Id        = 3,
                                Label     = "Job title",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        },
                        {
                            CareerInfoItem.Description, new Field()
                            {
                                Id = 4,
                                //Reik multilane, bet dar neveikia
                                Label     = "Description",
                                Type      = FieldTypes.MultiLiner,
                                Mandatory = false
                            }
                        }
                    }
                }
            };
            EducationInfo educationInfo = new EducationInfo()
            {
                Items = new List <EducationInfoItem>()
                {
                    new EducationInfoItem()
                    {
                        //Reikia vesti skaicius nuo 0 iki 100
                        {
                            EducationInfoItem.Duration, new Field()
                            {
                                Id    = 1,
                                Label = "Duration",
                                //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        },
                        {
                            EducationInfoItem.End, new Field()
                            {
                                Id    = 1,
                                Label = "Year interval ending",
                                //Jauciu, kaip Text paliksim, tik gal pasiūlysim pavyzdį duomenų įvedimo xxxx-xxxx
                                Type      = FieldTypes.Date,
                                Mandatory = false
                            }
                        },
                        {
                            EducationInfoItem.Course, new Field()
                            {
                                Id        = 2,
                                Label     = "Course",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        },
                        {
                            EducationInfoItem.Institution, new Field()
                            {
                                Id        = 3,
                                Label     = "Name of institution",
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        }
                    }
                }
            };
            SkillsInfo skillsInfo = new SkillsInfo()
            {
                Items = new List <SkillsInfoItem>()
                {
                    new SkillsInfoItem()
                    {
                        {
                            SkillsInfoItem.Skill, new Field()
                            {
                                Id    = 1,
                                Label = "Enter your skill",
                                //Reik apibrezt,kad nuo 0 iki 100
                                Type      = FieldTypes.SingleLiner,
                                Mandatory = false
                            }
                        }
                    }
                }
            };

            CVModel CV = new CVModel();

            CV.ContactInfo   = contactInfo;
            CV.CareerInfo    = careerInfo;
            CV.EducationInfo = educationInfo;
            CV.PersonalInfo  = personalInfo;
            CV.SkillsInfo    = skillsInfo;
            CV.FormTarget    = "/Builder/GenerateDocument";


            return(CV);
        }
예제 #15
0
        public override bool TakeAction()
        {
            int    currMaxLv  = GameConfigSet.CurrMaxLv;
            string lifeUserID = string.Empty;

            UserCrystalInfo[] userCrystalsArrray = new UserCrystalInfo[0];
            if (!string.IsNullOrEmpty(toUserID))
            {
                var packageCrystal = UserCrystalPackage.Get(toUserID);
                userGeneral        = new PersonalCacheStruct <UserGeneral>().FindKey(toUserID, generalID);
                userCrystalsArrray = packageCrystal.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(generalID)).ToArray();
                var package = UserItemPackage.Get(toUserID);
                userItemArray = package.ItemPackage.FindAll(
                    u => !u.IsRemove && u.GeneralID.Equals(generalID) &&
                    u.ItemStatus == ItemStatus.YongBing);
                lifeUserID = toUserID;
            }
            else
            {
                var packageCrystal = UserCrystalPackage.Get(ContextUser.UserID);
                userGeneral        = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, generalID);
                userCrystalsArrray = packageCrystal.CrystalPackage.FindAll(m => m.IsSale == 2 && m.GeneralID.Equals(generalID)).ToArray();

                var package = UserItemPackage.Get(ContextUser.UserID);
                userItemArray = package.ItemPackage.FindAll(u => !u.IsRemove && u.GeneralID.Equals(generalID) && u.ItemStatus == ItemStatus.YongBing);
                lifeUserID    = ContextUser.UserID;
            }
            UserCacheGlobal.LoadOffline(lifeUserID);
            GeneralInfo generalInfo = new ShareCacheStruct <GeneralInfo>().FindKey(generalID);

            generalQuality = generalInfo == null ? (short)0 : generalInfo.GeneralQuality;
            if (generalInfo != null && userGeneral != null)
            {
                description = generalInfo.Description;
                if (userGeneral.GeneralLv >= currMaxLv)
                {
                    genLv = (short)currMaxLv;
                    userGeneral.CurrExperience = 0;
                }
                else
                {
                    genLv = userGeneral.GeneralLv;
                }
                generalName     = userGeneral.GeneralName;
                headID          = userGeneral.HeadID;
                picturesID      = userGeneral.PicturesID;
                _battleHeadId   = generalInfo.BattleHeadID;
                _hitProbability = generalInfo.HitProbability;
                careerInfo      = new ShareCacheStruct <CareerInfo>().FindKey(userGeneral.CareerID);
                GeneralEscalateInfo generalEscalate = new ShareCacheStruct <GeneralEscalateInfo>().FindKey(genLv);
                if (generalEscalate != null)
                {
                    currExperience = userGeneral.CurrExperience;
                    maxExperience  = generalEscalate.UpExperience;
                }
                powerNum     = MathUtils.Addition(userGeneral.PowerNum, userGeneral.TrainingPower, short.MaxValue);
                soulNum      = MathUtils.Addition(userGeneral.SoulNum, userGeneral.TrainingSoul, short.MaxValue);
                intellectNum = MathUtils.Addition(userGeneral.IntellectNum, userGeneral.TrainingIntellect, short.MaxValue);
                if (!string.IsNullOrEmpty(ContextUser.MercenariesID) && generalID == LanguageManager.GetLang().GameUserGeneralID)
                {
                    //公会技能加成
                    powerNum     = MathUtils.RoundCustom(powerNum * CombatHelper.GetGuildAbilityNum(ContextUser.UserID, GuildAbilityType.PowerNum)).ToShort();
                    soulNum      = MathUtils.RoundCustom(soulNum * CombatHelper.GetGuildAbilityNum(ContextUser.UserID, GuildAbilityType.SoulNum)).ToShort();
                    intellectNum = MathUtils.RoundCustom(intellectNum * CombatHelper.GetGuildAbilityNum(ContextUser.UserID, GuildAbilityType.IntellectNum)).ToShort();
                }
                if (generalID == LanguageManager.GetLang().GameUserGeneralID)
                {
                    //法宝基础属性加成
                    powerNum     = MathUtils.Addition(powerNum, TrumpAbilityAttack.TrumpPropertyNum(ContextUser.UserID, generalID, AbilityType.PowerNum));
                    soulNum      = MathUtils.Addition(soulNum, TrumpAbilityAttack.TrumpPropertyNum(ContextUser.UserID, generalID, AbilityType.SoulNum));
                    intellectNum = MathUtils.Addition(intellectNum, TrumpAbilityAttack.TrumpPropertyNum(ContextUser.UserID, generalID, AbilityType.IntelligenceNum));

                    //法宝--技能属性转换获得的值
                    //法宝--技能属性转换获得的值
                    decimal trumpPower     = TrumpAbilityAttack.ConversionPropertyNum(ContextUser.UserID, powerNum, soulNum, intellectNum, AbilityType.PowerNum);
                    decimal trumpsoul      = TrumpAbilityAttack.ConversionPropertyNum(ContextUser.UserID, powerNum, soulNum, intellectNum, AbilityType.SoulNum);
                    decimal trumpintellect = TrumpAbilityAttack.ConversionPropertyNum(ContextUser.UserID, powerNum, soulNum, intellectNum, AbilityType.IntelligenceNum);
                    powerNum     = MathUtils.Addition(trumpPower.ToShort(), powerNum);
                    soulNum      = MathUtils.Addition(trumpsoul.ToShort(), soulNum);
                    intellectNum = MathUtils.Addition(trumpintellect.ToShort(), intellectNum);
                }
                lifeNum       = userGeneral.LifeNum;
                lifeMaxNum    = UserHelper.GetMaxLife(lifeUserID, generalID);
                genLv         = userGeneral.GeneralLv;
                generalStatus = (short)userGeneral.GeneralStatus;

                talentAbility = userGeneral.AbilityID;
                _potential    = userGeneral.Potential;
                _battleHeadID = generalInfo.BattleHeadID;
                //玩家佣兵职业名称
                userCareerName = careerInfo.CareerName;
            }
            else if (generalInfo != null)
            {
                genLv         = 1;
                generalName   = generalInfo.GeneralName;
                headID        = generalInfo.HeadID;
                picturesID    = generalInfo.PicturesID;
                _battleHeadId = generalInfo.BattleHeadID;
                careerInfo    = new ShareCacheStruct <CareerInfo>().FindKey(generalInfo.CareerID);
                GeneralEscalateInfo generalEscalate = new ShareCacheStruct <GeneralEscalateInfo>().FindKey(genLv);
                if (generalEscalate != null)
                {
                    currExperience = 0;
                    maxExperience  = generalEscalate.UpExperience;
                }
                powerNum      = generalInfo.PowerNum;
                soulNum       = generalInfo.SoulNum;
                intellectNum  = generalInfo.IntellectNum;
                lifeNum       = generalInfo.LifeNum;
                lifeMaxNum    = generalInfo.LifeNum;
                genLv         = generalInfo.GeneralLv;
                generalStatus = (short)GeneralStatus.KeZhaoMu;

                talentAbility = generalInfo.AbilityID;
            }
            AbilityInfo ability = new ShareCacheStruct <AbilityInfo>().FindKey(talentAbility);

            talentName = ability == null ? string.Empty : ability.AbilityName;

            gPropertyList = CombatHelper.GetAbility(lifeUserID, generalID, userGeneral);

            int sumCrystal = 0;

            foreach (UserCrystalInfo crystal in userCrystalsArrray)
            {
                sumCrystal = MathUtils.Addition(sumCrystal, crystal.CurrExprience, int.MaxValue);
            }
            vitalityNum  = (sumCrystal / 10);
            functionList = ViewHelper.GetFunctionList(lifeUserID);

            //佣兵魂技
            UserAbility userAbility = new PersonalCacheStruct <UserAbility>().FindKey(ContextUser.UserID);

            if (userAbility != null)
            {
                abilityList = userAbility.AbilityList.FindAll(s => s.GeneralID == generalID);
            }
            soulGrid = UserPackHelper.GetPackTypePositionNum(BackpackType.HunJi, ContextUser.UserID);

            // 缘分系统
            KarmaInfo karmaInfo = new ShareCacheStruct <KarmaInfo>().FindKey(generalID);

            if (karmaInfo != null && karmaInfo.KarmaList != null)
            {
                // 满足缘分条件显示激活状态

                // 判断佣兵
                UserMagic    userMagic            = new PersonalCacheStruct <UserMagic>().Find(ContextUser.UserID, s => s.IsEnabled);
                var          cacheSetUserEmbattle = new PersonalCacheStruct <UserEmbattle>();
                List <Karma> yongBingList         = karmaInfo.KarmaList.FindAll(s => s.KarmaType == KarmaType.YongBing);
                yongBingList.ForEach(yongBingInfo =>
                {
                    //yongBingInfo.IsActive = 1;
                    // 若阵型中存在该记录,该缘分为激活状态
                    if (yongBingInfo.ValueID.Contains(","))
                    {
                        string[] valueID = yongBingInfo.ValueID.Split(',');
                        int i            = 0;
                        foreach (var id in valueID)
                        {
                            if (cacheSetUserEmbattle.Find(ContextUser.UserID, s => s.MagicID == userMagic.MagicID && s.GeneralID == MathUtils.ToInt(id)) != null)
                            {
                                i++;
                            }
                        }
                        yongBingInfo.IsActive = i == valueID.Length ? 1 : 0;
                    }
                    else
                    {
                        if (cacheSetUserEmbattle.Find(ContextUser.UserID, s => s.MagicID == userMagic.MagicID && s.GeneralID == MathUtils.ToInt(yongBingInfo.ValueID)) != null)
                        {
                            yongBingInfo.IsActive = 1;
                        }
                        else
                        {
                            yongBingInfo.IsActive = 0;
                        }
                    }
                });
                // 判断装备
                UserItemPackage itemPackage = new PersonalCacheStruct <UserItemPackage>().FindKey(UserId.ToString());
                if (itemPackage != null)
                {
                    List <Karma> itemList = karmaInfo.KarmaList.FindAll(s => s.KarmaType == KarmaType.ZhuangBei);
                    itemList.ForEach(itemInfo =>
                    {
                        if (itemPackage.ItemPackage.Find(s => s.ItemID == MathUtils.ToInt(itemInfo.ValueID) && s.GeneralID == generalID) != null)
                        {
                            itemInfo.IsActive = 1;
                        }
                        else
                        {
                            itemInfo.IsActive = 0;
                        }
                    });
                }

                // 判断命运水晶
                UserCrystalPackage crystalPackage = new PersonalCacheStruct <UserCrystalPackage>().FindKey(UserId.ToString());
                if (itemPackage != null)
                {
                    List <Karma> crystalList = karmaInfo.KarmaList.FindAll(s => s.KarmaType == KarmaType.ShuiJing);
                    crystalList.ForEach(crystalInfo =>
                    {
                        if (crystalPackage.CrystalPackage.Find(s => s.CrystalID == MathUtils.ToInt(crystalInfo.ValueID) && s.GeneralID == generalID) != null)
                        {
                            crystalInfo.IsActive = 1;
                        }
                        else
                        {
                            crystalInfo.IsActive = 0;
                        }
                    });
                }

                // 判断技能
                UserAbility userAbilityInfo = new PersonalCacheStruct <UserAbility>().FindKey(UserId.ToString());
                if (userAbilityInfo != null)
                {
                    List <Karma> abilityList = karmaInfo.KarmaList.FindAll(s => s.KarmaType == KarmaType.JiNen);
                    abilityList.ForEach(abilityInfo =>
                    {
                        if (userAbilityInfo.AbilityList.Find(s => s.AbilityID == MathUtils.ToInt(abilityInfo.ValueID) && s.GeneralID == generalID) != null)
                        {
                            abilityInfo.IsActive = 1;
                        }
                        else
                        {
                            abilityInfo.IsActive = 0;
                        }
                    });
                }
                karmaList = karmaInfo.KarmaList;
                if (userGeneral != null)
                {
                    lifeNum    = userGeneral.TLifeNum;
                    lifeMaxNum = userGeneral.TLifeMaxNun;
                }
            }
            return(true);
        }
        public void renderV2TemplateCareer(CareerInfo careerInfo, PdfPTable career, Font simpleFont)
        {
            //Tuscias langelis
            PdfPCell empty = new PdfPCell(new Phrase(" "));

            empty.Border = Rectangle.NO_BORDER;

            foreach (var item in careerInfo.Items)
            {
                Field startDate = item[CareerInfoItem.Start];
                if (!string.IsNullOrEmpty(startDate.Value))
                {
                    PdfPCell startCell = new PdfPCell(new Phrase(startDate.Value, simpleFont));
                    startCell.Border = Rectangle.NO_BORDER;
                    career.AddCell(startCell);
                }
                //Deda tuščius dėl gero lygiavimo
                else
                {
                    career.AddCell(empty);
                }
                Field company = item[CareerInfoItem.CompanyName];
                if (!string.IsNullOrEmpty(company.Value))
                {
                    PdfPCell companyCell = new PdfPCell(new Phrase(company.Value, simpleFont));
                    companyCell.Border = Rectangle.NO_BORDER;
                    career.AddCell(companyCell);
                }
                else
                {
                    career.AddCell(empty);
                }
                Field endDate = item[CareerInfoItem.End];
                if (!string.IsNullOrEmpty(endDate.Value))
                {
                    PdfPCell endCell = new PdfPCell(new Phrase(endDate.Value, simpleFont));
                    endCell.Border = Rectangle.NO_BORDER;
                    career.AddCell(endCell);
                }
                else
                {
                    career.AddCell(empty);
                }
                Field job = item[CareerInfoItem.JobTitle];
                if (!string.IsNullOrEmpty(job.Value))
                {
                    PdfPCell jobCell = new PdfPCell(new Phrase(job.Value, simpleFont));
                    jobCell.Border = Rectangle.NO_BORDER;
                    career.AddCell(jobCell);
                }
                else
                {
                    career.AddCell(empty);
                }
                career.AddCell(empty);

                Field description = item[CareerInfoItem.Description];
                if (!string.IsNullOrEmpty(description.Value))
                {
                    PdfPCell descCell = new PdfPCell(new Phrase(description.Value, simpleFont));
                    descCell.Border = Rectangle.NO_BORDER;
                    career.AddCell(descCell);
                }
                else
                {
                    career.AddCell(empty);
                }
                //Tuščia eilutė
                career.AddCell(empty);
                career.AddCell(empty);
            }
        }
예제 #17
0
        public Contact(CareerInfo careerInfo)
        {
            InitializeComponent();
            _careerInfo = careerInfo;
            var ftTitle            = new FormattedString();
            var ftTitle2           = new FormattedString();
            var ftFullname         = new FormattedString();
            var ftAddress1         = new FormattedString();
            var ftAddress2         = new FormattedString();
            var ftEmailLabel       = new FormattedString();
            var ftEmailAddress     = new FormattedString();
            var ftHomePhoneLabel   = new FormattedString();
            var ftHomePhone        = new FormattedString();
            var ftMobilePhoneLabel = new FormattedString();
            var ftMobilePhone      = new FormattedString();
            var ftMobileSMS        = new FormattedString();

            ftTitle.Spans.Add(new Span {
                Text = $"Contact Info", ForegroundColor = Color.FromHex("ffffff"), FontSize = 12, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblTitle.FormattedText = ftTitle;

            ftTitle2.Spans.Add(new Span {
                Text = $"Mailing Address:", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblTitle2.FormattedText = ftTitle2;

            ftFullname.Spans.Add(new Span {
                Text = $"{_careerInfo.FirstName} {_careerInfo.MiddleName} {_careerInfo.LastName}", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblFullname.FormattedText = ftFullname;

            ftAddress1.Spans.Add(new Span {
                Text = $"{_careerInfo.Address1}", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblAddress1.FormattedText = ftAddress1;

            ftAddress2.Spans.Add(new Span {
                Text = $"{ _careerInfo.City}, {_careerInfo.State} {_careerInfo.PostalCode}", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblAddress2.FormattedText = ftAddress2;

            ftEmailLabel.Spans.Add(new Span {
                Text = $"Email Address: ", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblEmailLabel.FormattedText = ftEmailLabel;

            ftEmailAddress.Spans.Add(new Span {
                Text = $"{_careerInfo.EmailAddress}", ForegroundColor = Color.FromHex("9ad9ea"), FontSize = 9, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblEmailAddress.FormattedText = ftEmailAddress;

            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"mailto:{_careerInfo.EmailAddress}"));
            };
            lblEmailAddress.GestureRecognizers.Add(tapGestureRecognizer);

            ftHomePhoneLabel.Spans.Add(new Span {
                Text = $"Home: ", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblHomePhoneLabel.FormattedText = ftHomePhoneLabel;

            ftHomePhone.Spans.Add(new Span {
                Text = $"{_careerInfo.Phone}", ForegroundColor = Color.Yellow, FontSize = 9, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblHomePhone.FormattedText = ftHomePhone;

            var tapGestureRecognizerTel = new TapGestureRecognizer();

            tapGestureRecognizerTel.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"tel:{_careerInfo.Phone}"));
            };
            lblHomePhone.GestureRecognizers.Add(tapGestureRecognizerTel);

            ftMobilePhoneLabel.Spans.Add(new Span {
                Text = $"Mobile: ", ForegroundColor = Color.FromHex("ffffff"), FontSize = 9, FontAttributes = FontAttributes.Bold
            });
            lblMobilePhoneLabel.FormattedText = ftMobilePhoneLabel;

            ftMobilePhone.Spans.Add(new Span {
                Text = $"{_careerInfo.Mobile}", ForegroundColor = Color.Yellow, FontSize = 9, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblMobilePhone.FormattedText = ftMobilePhone;

            var tapGestureRecognizerMob = new TapGestureRecognizer();

            tapGestureRecognizerMob.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"tel:{_careerInfo.Mobile}"));
            };
            lblMobilePhone.GestureRecognizers.Add(tapGestureRecognizerMob);

            ftMobileSMS.Spans.Add(new Span {
                Text = $"(Send SMS/Text Msg)", ForegroundColor = Color.FromHex("9ad9ea"), FontSize = 8, FontAttributes = FontAttributes.Bold, TextDecorations = TextDecorations.Underline
            });
            lblMobileSMS.FormattedText = ftMobileSMS;

            var tapGestureRecognizerSMS = new TapGestureRecognizer();

            tapGestureRecognizerSMS.Tapped += (s, e) => {
                Device.OpenUri(new Uri($"sms:{_careerInfo.Mobile}"));
            };
            lblMobileSMS.GestureRecognizers.Add(tapGestureRecognizerSMS);
        }