Пример #1
0
        private void levelUp()
        {
            RemoveUpgradesAndAttributeModifiersOfCurrentLevel();
            ApplyUpgradesAndAttributeModifiersForNextLevel();

            if (_nextLevel.InformUpdateModule)
            {
                _bannerCarrierUpdate?.NotifyLevelChanged();
            }

            if (_nextLevel.SelectionDecal != null)
            {
                _gameObject.SelectionDecal = _nextLevel.SelectionDecal;
            }

            // TODO:
            // ExperienceAwardOwnGuysDie -> what is this?
            // EmotionType

            _experienceLevels.RemoveAt(0);
            if (_experienceLevels.Count > 0)
            {
                _currentLevel = _nextLevel;
                _nextLevel    = _experienceLevels.First();
                _gameObject.ExperienceRequiredForNextLevel = _nextLevel.RequiredExperience;
            }
            else
            {
                _gameObject.ExperienceRequiredForNextLevel = int.MaxValue;
            }
        }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        inputPlayer = GetComponent <InputPlayer>();
        rgb2D       = GetComponent <Rigidbody2D>();

        _transform = GetComponent <Transform>();
        _anim      = GetComponent <Animator>();
        _sprite    = GetComponent <SpriteRenderer>();

        RunHashCode = Animator.StringToHash("IsRun");
        attacker    = GetComponent <Attacker>();

        salud = GetComponent <Salud>();

        experienceLevel = GetComponent <ExperienceLevel>();

        //Inicializar texto de paneles
        PanelAttribute.Instance.UpdateTextAtributte(attributePlayer, salud, experienceLevel);

        _skill                 = GetComponent <Skill>();
        _trailRenderer         = GetComponent <TrailRenderer>();
        _trailRenderer.enabled = false;


        soundFoot = GetComponentInChildren <SoundFoot>();
    }
Пример #3
0
 public void UpdateTextAtributte(Attributes attributes, Salud salud, ExperienceLevel experienceLevel)
 {
     txtNivel.text    = experienceLevel.nivel.ToString();
     txtExp.text      = experienceLevel.exp.ToString();
     txtSalud.text    = salud.salud.ToString();
     txtAttack.text   = attributes.attack.ToString();
     txtVelocity.text = attributes.velocity.ToString();
     txtPtos.text     = experienceLevel.pointAttributes.ToString();
 }
        /// <summary>
        /// Converts an API dto objec to a business object
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IBusinessObjectEntity ToBusinessFormat(IAPIEntity entity)
        {
            ExperienceLevelAPI other = entity as ExperienceLevelAPI;
            ExperienceLevel clone = new ExperienceLevel();

            clone.Level = other.Level;
            clone.ExperienceRequired = other.ExperienceRequired;

            return clone;
        }
        public void Initialize()
        {
            storageInfo = new ExperienceLevelStorageInformation("1");

            level = new ExperienceLevel
            {
                ExperienceRequired = 100,
                Level = 1
            };
        }
Пример #6
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            ExperienceLevel levelScript = other.gameObject.GetComponent <ExperienceLevel>();

            levelScript.AddExp();               //Player adds to experience bar when collision with experience
            experienceSpawner.CmdSpawnRandom(); //Randomly spawn a new experience when one is destroyed

            Destroy(gameObject);                //Destroy this experience
        }
    }
Пример #7
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ImageButton b = (ImageButton)e.Row.Cells[4].Controls[0];
            b.CommandName     = "viewdetails";
            b.CommandArgument = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();

            e.Row.Cells[1].Text = EducationLevel.GetEducationLevelName(int.Parse(e.Row.Cells[1].Text));
            e.Row.Cells[2].Text = ExperienceLevel.GetExperienceLevelName(int.Parse(e.Row.Cells[2].Text));
        }
    }
Пример #8
0
 /// <summary>
 /// Contrutor sem parametro
 /// </summary>
 public RPGCustomCharacter()
 {
     this.name           = "";
     this.typeClass      = new Class();
     this.level          = new ExperienceLevel();
     this.life           = new Life();
     this.damage         = new Damage();
     this.armor          = new Armor();
     this.attributes     = new Attributes();
     this.inventory      = new Inventory();
     this.abilityManager = new AbilityManager();
     this.effects        = new List <Effect>();
     this.level          = new ExperienceLevel();
 }
Пример #9
0
 /// <summary>
 /// Contrutor sem parametro
 /// </summary>
 public RPGCustomCharacter()
 {
     this.name = "";
     this.typeClass = new Class();
     this.level = new ExperienceLevel();
     this.life = new Life();
     this.damage = new Damage();
     this.armor = new Armor();
     this.attributes = new Attributes();
     this.inventory = new Inventory();
     this.abilityManager = new AbilityManager();
     this.effects = new List<Effect>();
     this.level = new ExperienceLevel();
 }
Пример #10
0
        /// <summary>
        /// Metodo responsavel por calcular o score do candidato para a vaga
        /// </summary>
        /// <param name="candidateLocation">Localizacao do Candidato</param>
        /// <param name="candidateLevel">Nivel de experiencia da Candidato</param>
        /// <param name="jobLocation">Localizacao da vaga</param>
        /// <param name="jobLevel">Nivel de experiencia da vaga</param>
        /// <returns>Score do candidato</returns>
        public int CalculateCandidateScore(Location candidateLocation, ExperienceLevel candidateLevel, Location jobLocation, ExperienceLevel jobLevel)
        {
            int score = 0;
            int D     = 0;

            int NV_ND = Math.Abs(Convert.ToInt32(jobLevel) - Convert.ToInt32(candidateLevel));

            int N = 100 - (25 * NV_ND);

            D = CalculateDistanceValue(candidateLocation, jobLocation);

            score = (N + D) / 2;

            return(score);
        }
Пример #11
0
        public ExperienceLevel Get(string id)
        {
            var experienceLevel = new ExperienceLevel();

            try
            {
                experienceLevel = _experienceLevelRepository.Get(id);
                _logger.LogInformation("ExperienceLevel " + experienceLevel.Id + "retrieved");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
            }

            return(experienceLevel);
        }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Roles.IsUserInRole(ConfigurationManager.AppSettings["employerrolename"]))
        {
            Response.Redirect("~/customerrorpages/NotAuthorized.aspx");
        }

        Resume r = Resume.GetResume(int.Parse(Request.QueryString["id"]));

        ProfileCommon p = Profile.GetProfile(r.UserName);

        lblName.Text           = "Full Name : " + p.FirstName + " " + p.LastName;
        lblEducation.Text      = "Education Level : " + EducationLevel.GetEducationLevelName(r.EducationLevelID);
        lblExperience.Text     = "Experience Level : " + ExperienceLevel.GetExperienceLevelName(r.ExperienceLevelID);
        lblCoveringLetter.Text = r.CoveringLetterText.Replace("\n", "<br>");
        lblResume.Text         = r.ResumeText.Replace("\n", "<br>");
    }
Пример #13
0
    private void FillExpLevels()
    {
        ddlExpLevel.DataSource     = ExperienceLevel.GetExperienceLevels();
        ddlExpLevel.DataTextField  = "ExperienceLevelName";
        ddlExpLevel.DataValueField = "ExperienceLevelID";
        ddlExpLevel.DataBind();

        if (Profile.JobSeeker.ResumeID != -1)
        {
            ListItem li;
            li = ddlExpLevel.Items.FindByValue(r.ExperienceLevelID.ToString());
            if (li != null)
            {
                ddlExpLevel.ClearSelection();
                li.Selected = true;
            }
        }
    }
Пример #14
0
        private void Initialize(BehaviorUpdateContext context)
        {
            // not sure why the required experience for rank 1 is 1 instead of 0
            if (_gameObject.ExperienceValue == 0)
            {
                _gameObject.ExperienceValue = 1;
            }

            _experienceLevels = FindRelevantExperienceLevels(context);
            if (_experienceLevels != null && _experienceLevels.Count > 0)
            {
                _nextLevel = _experienceLevels.First();
                _gameObject.ExperienceRequiredForNextLevel = _nextLevel.RequiredExperience;
                ObjectGainsExperience = true;
            }

            _bannerCarrierUpdate = _gameObject.FindBehavior <BannerCarrierUpdate>();
            _initial             = false;
        }
Пример #15
0
        public static string Stringify(this ExperienceLevel experienceLevel)
        {
            switch (experienceLevel)
            {
            case ExperienceLevel.Basic:
                return("Basic");

            case ExperienceLevel.Intermediate:
                return("Intermediate");

            case ExperienceLevel.Advanced:
                return("Advanced");

            case ExperienceLevel.Expert:
                return("Expert");

            default:
                throw new ArgumentOutOfRangeException("experienceLevel", experienceLevel, null);
            }
        }
Пример #16
0
        /// <summary>
        /// Metodo responsavel por adicionar o candidato a lista de ranking com o score do candidato para a vaga
        /// </summary>
        /// <param name="vaga">Dados da vaga</param>
        /// <param name="pessoa">Dados do candidato</param>
        /// <returns>Status de registro da ranking do candidato a vaga</returns>
        public async Task <bool> AddRankingVaga(Vaga vaga, Pessoa pessoa)
        {
            Ranking model = new Ranking();

            CandidateScore calculate = new CandidateScore();
            JobLevelParser parser    = new JobLevelParser();

            Enum.TryParse(pessoa.Localizacao, out Location candidateLocation);
            Enum.TryParse(vaga.Localizacao, out Location jobLocation);

            ExperienceLevel candidateLevel = parser.Parse(pessoa.Nivel);
            ExperienceLevel jobLevel       = parser.Parse(vaga.Nivel);

            int score = calculate.CalculateCandidateScore(candidateLocation, candidateLevel, jobLocation, jobLevel);

            model.IdVaga      = vaga.ID;
            model.Localizacao = pessoa.Localizacao;
            model.Nivel       = pessoa.Nivel;
            model.Nome        = pessoa.Nome;
            model.Profissao   = pessoa.Profissao;
            model.Score       = score;

            return(await _repository.AddRankingVaga(model));
        }
Пример #17
0
        public static async Task <HasExperience> TryAdd(this IGremlinQuerySource querySource, string fromPersonId, string toExperienceId, ExperienceLevel experienceLevel)
        {
            var query = (await querySource
                         .V <Person>(fromPersonId)
                         .As((a, person) => a
                             .V <Experience>(toExperienceId)
                             .As((b, experience) => b
                                 .Select(person, experience))
                             .Dedup()
                             )).SingleOrDefault();

            return(await TryAdd(querySource, query.Item1, query.Item2, new HasExperience { Level = experienceLevel }));
        }
Пример #18
0
 public LevelControl(ExperienceLevel experienceLevel)
 {
     this.ExperienceLevel = experienceLevel;
     InitializeComponent();
 }
Пример #19
0
        internal override void Update(BehaviorUpdateContext context)
        {
            if (_initial && _experienceLevels == null)
            {
                Initialize(context);
            }

            if (_experienceLevels == null ||
                _experienceLevels.Count == 0 ||
                _gameObject.ExperienceValue < _nextLevel.RequiredExperience)
            {
                return;
            }

            _gameObject.ExperienceValue -= _nextLevel.RequiredExperience;
            _gameObject.Rank             = _nextLevel.Rank;

            if (_nextLevel.Upgrades != null)
            {
                foreach (var upgradeReference in _nextLevel.Upgrades)
                {
                    _gameObject.Upgrades.Add(context.GameContext.AssetLoadContext.AssetStore.Upgrades.GetByName(upgradeReference));
                }
            }

            if (_nextLevel.LevelUpFX != null)
            {
                var levelUpFx = context.GameContext.AssetLoadContext.AssetStore.FXLists.GetByName(_nextLevel.LevelUpFX);

                levelUpFx?.Execute(new FXListExecutionContext(
                                       context.GameObject.Rotation,
                                       context.GameObject.Translation,
                                       context.GameContext));
            }

            if (_nextLevel.InformUpdateModule)
            {
                _bannerCarrierUpdate?.NotifyLevelChanged();
            }

            if (_nextLevel.SelectionDecal != null)
            {
                _gameObject.SelectionDecal = _nextLevel.SelectionDecal;
            }

            // TODO:
            // ExperienceAwardOwnGuysDie -> what is this?
            // AttributeModifiers
            // EmotionType

            _experienceLevels.RemoveAt(0);
            if (_experienceLevels.Count > 0)
            {
                _nextLevel = _experienceLevels.First();
                _gameObject.ExperienceRequiredForNextLevel = _nextLevel.RequiredExperience;
            }
            else
            {
                _gameObject.ExperienceRequiredForNextLevel = int.MaxValue;
            }
        }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable data = GetAllMyResumes(Convert.ToInt32(User1.UserId));
            if (data.Rows.Count >= 3)
            {
                JavaScriptAleart("Bạn đã tạo tối đa 3 hồ sơ. Vui lòng kiểm tra lại");
                return;
            }
            var resumeTitle = txtResumeName.Text;
            var user = new User(User1.Email, User1.UserId);
            var certificate = new Certificate(ddlDegrees.SelectedValue, ddlDegrees.SelectedItem.Text);
            var salary = new JobSalaryLevel(ddlExpectedSalary.SelectedValue, ddlExpectedSalary.SelectedItem.Text);
            var langSkill = new LangSkill(ddlLangSkill.SelectedValue, ddlLangSkill.SelectedItem.Text, txtDescription.Text);
            var location = new Province(ddlRegions.SelectedValue, ddlRegions.SelectedItem.Text);
            var category = new JobIndustries(ddlCategories.SelectedValue, ddlCategories.SelectedItem.Text);
            //var curentPostion = new JobPosition(ddlCurrentPosition.SelectedValue, ddlCurrentPosition.SelectedItem.Text);
            var expectedPosition = new JobPosition(ddlExpectedPosition.SelectedValue,
                ddlExpectedPosition.SelectedItem.Text);
            var jobExperienceLevel = new ExperienceLevel(ddlExp.SelectedValue,
                ddlExp.SelectedItem.Text);
            var worktype = new WorkType(ddlworktype.SelectedValue, ddlworktype.SelectedItem.Text);
            var jobAchievement = ta1.Value;
            var careerGoal = ta2.Value;
            var experience = ta3.Value;
            var literacy = ta6.Value;
            var skill = ta5.Value;
            var reference = ta4.Value;
            var contactmail = txtContactMail.Text;
            var attachmentPath = "";
            if (this.fuResume.HasFile)
            {
                string imgThumb = "E:\\DOCUMENTS\\School\\ASP.NETWorkSpaces\\WebFindingJobsMVCmodel\\FileSticky\\" + this.fuResume.FileName;
                this.fuResume.SaveAs(imgThumb);
                attachmentPath = "/FileSticky/" + this.fuResume.FileName;
            }
            Resume1 = new Resume();

            var returnValue = false;
            var query = Request.QueryString["resumeId"];
            if (query != null)
            {
                returnValue = Resume1.SetFullResumeInfoUpdate(resumeTitle, certificate, salary, langSkill, location,
                    category, expectedPosition, jobExperienceLevel, worktype,
                    jobAchievement, careerGoal, experience, literacy, skill, reference, user, contactmail, query, attachmentPath);
            }
            else
            {
                returnValue = Resume1.SetFullResumeInfo(resumeTitle, certificate, salary, langSkill, location, category, expectedPosition, jobExperienceLevel, worktype,
               jobAchievement, careerGoal, experience, literacy, skill, reference, user, contactmail, attachmentPath);
            }
            if (returnValue)
            {
                JavaScriptAleart("Thực hiện thành công");
            }
            else
            {
                JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại");
            }
        }
        catch (Exception exception)
        {

            JavaScriptAleart(exception.Message);

        }
    }
Пример #21
0
        internal override void Update(BehaviorUpdateContext context)
        {
            if (_initial && _experienceLevels == null)
            {
                Initialize(context);
            }

            if (_experienceLevels == null ||
                _experienceLevels.Count == 0 ||
                _gameObject.ExperienceValue < _nextLevel.RequiredExperience)
            {
                return;
            }

            _gameObject.ExperienceValue -= _nextLevel.RequiredExperience;
            _gameObject.Rank             = _nextLevel.Rank;

            //remove stuff from current level
            if (_currentLevel != null)
            {
                if (_currentLevel.Upgrades != null)
                {
                    foreach (var upgrade in _currentLevel.Upgrades)
                    {
                        _gameObject.RemoveUpgrade(upgrade.Value);
                    }
                }

                if (_currentLevel.AttributeModifiers != null)
                {
                    foreach (var modifierList in _currentLevel.AttributeModifiers)
                    {
                        _gameObject.RemoveAttributeModifier(modifierList.Value.Name);
                    }
                }
            }


            if (_nextLevel.Upgrades != null)
            {
                foreach (var upgrade in _nextLevel.Upgrades)
                {
                    _gameObject.Upgrade(upgrade.Value);
                }
            }

            if (_nextLevel.AttributeModifiers != null)
            {
                foreach (var modifierList in _nextLevel.AttributeModifiers)
                {
                    var attributeModifier = new AttributeModifier(modifierList.Value);
                    _gameObject.AddAttributeModifier(modifierList.Value.Name, attributeModifier);
                }
            }

            if (_nextLevel.LevelUpFX != null)
            {
                _nextLevel.LevelUpFX.Value?.Execute(new FXListExecutionContext(
                                                        context.GameObject.Rotation,
                                                        context.GameObject.Translation,
                                                        context.GameContext));
            }

            if (_nextLevel.InformUpdateModule)
            {
                _bannerCarrierUpdate?.NotifyLevelChanged();
            }

            if (_nextLevel.SelectionDecal != null)
            {
                _gameObject.SelectionDecal = _nextLevel.SelectionDecal;
            }

            // TODO:
            // ExperienceAwardOwnGuysDie -> what is this?
            // EmotionType

            _experienceLevels.RemoveAt(0);
            if (_experienceLevels.Count > 0)
            {
                _currentLevel = _nextLevel;
                _nextLevel    = _experienceLevels.First();
                _gameObject.ExperienceRequiredForNextLevel = _nextLevel.RequiredExperience;
            }
            else
            {
                _gameObject.ExperienceRequiredForNextLevel = int.MaxValue;
            }
        }
    protected void btnSubmitRecuitmentInfo_OnClick(object sender, EventArgs e)
    {
        try
        {
            Recruitor1 = (Recruitor)Session["Recruitor"];
            var jobTitle = txtJobTitle.Text;
            var numsApplicant = txtNumsApplicant.Text;
            var recruitor = new Recruitor(Recruitor1.Email, Recruitor1.RecruitorId);
            var certificate = new Certificate(ddlDegrees.SelectedValue, ddlDegrees.SelectedItem.Text);
            var salary = new JobSalaryLevel(ddlSalary.SelectedValue, ddlSalary.SelectedItem.Text);
            var location = new Province(ddlRegions.SelectedValue, ddlRegions.SelectedItem.Text);
            var category = new JobIndustries(ddlCategories.SelectedValue, ddlCategories.SelectedItem.Text);
            var jobPostion = new JobPosition(ddlJobPosition.SelectedValue, ddlJobPosition.SelectedItem.Text);
            var jobExperienceLevel = new ExperienceLevel(ddlJobExperienceLevel.SelectedValue,
                ddlJobExperienceLevel.SelectedItem.Text);
            var worktype = new WorkType(ddlWorkType.SelectedValue, ddlWorkType.SelectedItem.Text);
            var jobDatail = txtJobDetail.Value;
            var jobDescription = txtDescription.Value;
            var deadLine = Convert.ToDateTime(tbDeadline.Value);
            Jobs1 = new Jobs();
            var jobid = Request.QueryString["jobid"];
            if (jobid != null)
            {
                  var  returnValue = Jobs1.SetFullJobInfo(jobTitle, certificate, salary, location, category, jobDatail,
                    jobDescription, deadLine, jobPostion, jobExperienceLevel, worktype, recruitor, numsApplicant, jobid);

                if (returnValue)
                {
                    Session["Job"] = Jobs1;
                    var emailContent = BuidRecommendResume(jobid);
                    SendEmailMember(emailContent, Recruitor1.EmailToSendResume);
                    JavaScriptAleart("Thực hiện thành công");
                }
                else
                {
                    JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại");
                }
            }
            else
            {
               var returnValue1 = Jobs1.SetFullJobInfo(jobTitle, certificate, salary, location, category, jobDatail,
                    jobDescription, deadLine, jobPostion, jobExperienceLevel, worktype, recruitor, numsApplicant);

               if (returnValue1>0)
               {

                   Session["Job"] = Jobs1;
                   var emailContent = BuidRecommendResume(returnValue1.ToString());
                   JavaScriptAleart(emailContent);
                   SendEmailMember(emailContent, Recruitor1.EmailToSendResume);
                   JavaScriptAleart("Thực hiện thành công");
               }
               else
               {
                   JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại");
               }
            }
        }
        catch (Exception exception)
        {
            JavaScriptAleart(exception.Message);
        }
    }
        public void TestExperienceLevel()
        {
            ExperienceLevel hero1 = new ExperienceLevel();

            //Check starting values
            Assert.AreEqual(0, hero1.GetCurrentExperience());
            Assert.AreEqual(0, hero1.GetTotalExperience());
            Assert.AreEqual(0, hero1.GetLevel());

            //Add some xp
            hero1.AddExperience(20);
            hero1.AddExperience(45);
            hero1.AddExperience(13);
            hero1.SubtractExperience(27);

            Assert.AreEqual(51, hero1.GetCurrentExperience());
            Assert.AreEqual(51, hero1.GetTotalExperience());
            Assert.AreEqual(0, hero1.GetLevel());

            //Add xp so we level-up

            hero1.AddExperience(49);
            Assert.AreEqual(0, hero1.GetCurrentExperience());
            Assert.AreEqual(100, hero1.GetTotalExperience());
            Assert.AreEqual(1, hero1.GetLevel());

            //Add more xp so we level up two levels, then drop and go back up
            hero1.AddExperience(201);
            Assert.AreEqual(3, hero1.GetLevel());
            Assert.AreEqual(1, hero1.GetCurrentExperience());
            hero1.SubtractExperience(49);
            Assert.AreEqual(-48, hero1.GetCurrentExperience());
            Assert.AreEqual(252, hero1.GetTotalExperience());
            Assert.AreEqual(3, hero1.GetLevel());
            hero1.AddExperience(48);
            //level should still be 3
            Assert.AreEqual(3, hero1.GetLevel());

            //make experience positive again
            hero1.AddExperience(27);

            //Check where we are
            Assert.AreEqual(327, hero1.GetTotalExperience());  //Currently, total experience is 327,
            Assert.AreEqual(27, hero1.GetCurrentExperience()); //           current experience is 27,
            Assert.AreEqual(3, hero1.GetLevel());              //           and level is 3

            //and some calculations
            Assert.AreEqual(173, hero1.ExperienceDelta(5));
            Assert.AreEqual(73, hero1.ExperienceTillLevelUp());
            Assert.AreEqual(27, hero1.ProgressToNextLevel());
            Assert.AreEqual(53, hero1.ExperienceToLevel(5347));

            //test ResetExperience()

            hero1.ResetExperience();
            Assert.AreEqual(0, hero1.GetCurrentExperience(), 0);
            Assert.AreEqual(3, hero1.GetLevel(), 3);

            //test SetLevel()

            hero1.SetLevel(1);
            Assert.AreEqual(0, hero1.GetCurrentExperience());
            Assert.AreEqual(100, hero1.GetTotalExperience());
            Assert.AreEqual(1, hero1.GetLevel());
        }
        protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            try
            {
                using (Entity entity = new Entity())
                {
                    var user = entity.User.Find(Convert.ToInt32(DetailsView1.DataKey.Value));
                    var CheckBoxList_Type = ((CheckBoxList)DetailsView1.FindControl("CheckBoxList_Type"));
                    user.Type = 0;
                    foreach (ListItem item in CheckBoxList_Type.Items)
                    {
                        if (item.Selected)
                        {
                            user.Type = user.Type | Convert.ToInt32(item.Value);
                        }
                    }
                    var RadioButtonList_Statet = ((RadioButtonList)DetailsView1.FindControl("RadioButtonList_State"));
                    user.State = Convert.ToInt32(RadioButtonList_Statet.SelectedValue);

                    var RadioButtonList_Banned = ((RadioButtonList)DetailsView1.FindControl("RadioButtonList_Banned"));
                    int bannedTemp             = user.UserExtend.Banned;
                    user.UserExtend.Banned = Convert.ToInt32(RadioButtonList_Banned.SelectedValue);
                    if (user.UserExtend.Banned == 1 && bannedTemp != 1)
                    {
                        new ExperienceLevelBLL().Jinyan(user.UserID);
                        user.UserExtend.BannedStartTime = DateTime.Now;
                        user.UserExtend.BannedEndTime   = user.UserExtend.BannedStartTime.Value.AddDays(3);
                        UserLetterBLL.Create(Convert.ToInt32(Session["userID"]), Convert.ToInt32(ViewState["userID"]), "您的发言被用户举报,已经被禁言三天。", 1 | 16);
                    }
                    else if (user.UserExtend.Banned == 0)
                    {
                        user.UserExtend.BannedEndTime = user.UserExtend.BannedStartTime = null;
                    }

                    if (e.NewValues["UserExtend.ExperienceLevel"] != null)
                    {
                        int level = Convert.ToInt32(e.NewValues["UserExtend.ExperienceLevel"]);
                        if (level == 0)
                        {
                            level = 1;
                        }
                        if (user.UserExtend.ExperienceLevel != level)
                        {
                            ExperienceLevel experienceLevel = entity.ExperienceLevel.Where(o => o.ExperienceLevelValue == level).FirstOrDefault();
                            if (experienceLevel == null)
                            {
                                throw new Exception("经验等级和等级不对应");
                            }
                            user.UserExtend.ExperienceLevel = experienceLevel.ExperienceLevelValue;
                            user.UserExtend.ExperienceValue = experienceLevel.ExperienceValueMin;
                            if (user.Gender == "男")
                            {
                                user.UserExtend.ExperienceName = experienceLevel.NameMan;
                            }
                            else
                            {
                                user.UserExtend.ExperienceName = experienceLevel.NameWoman;
                            }
                        }
                    }
                    entity.SaveChanges();
                }
                Response.Redirect("UserDetail.aspx?userID=" + DetailsView1.DataKey.Value);
            }
            catch (Exception exception)
            {
                string error = exception.GetErrorMessage().Replace("'", "\\'").Replace("\"", "\\\"").Replace("\r\n", "\\r\\n");
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", string.Format("<script>alert('{0}')</script>", error));
            }
        }
Пример #25
0
 public ExperienceRole GetAppropriateRoleForLevel(ExperienceLevel level, Database db)
 {
     return(db.ExperienceRoles.Where(ro => ro.Level <= level.Level).Include(ro => ro.RoleReference).OrderByDescending(ro => ro.Level).FirstOrDefault());
 }
        public async Task <User> RegisterAsync(string name, string surname, string emailAddress, string userName, string plainPassword, bool isEmailConfirmed, string emailActivationLink, ExperienceLevel experienceLevel)
        {
            try
            {
                CheckForTenant();
                CheckSelfRegistrationIsEnabled();

                var tenant = await GetActiveTenantAsync();

                var isNewRegisteredUserActiveByDefault = await SettingManager.GetSettingValueAsync <bool>(AppSettings.UserManagement.IsNewRegisteredUserActiveByDefault);

                await _userPolicy.CheckMaxUserCountAsync(tenant.Id);

                var user = new User
                {
                    TenantId         = tenant.Id,
                    Name             = name,
                    Surname          = surname,
                    EmailAddress     = emailAddress,
                    IsActive         = isNewRegisteredUserActiveByDefault,
                    UserName         = userName,
                    IsEmailConfirmed = isEmailConfirmed,
                    Roles            = new List <UserRole>(),
                    ExperienceLevel  = experienceLevel
                };

                user.SetNormalizedNames();

                user.Password = _passwordHasher.HashPassword(user, plainPassword);

                foreach (var defaultRole in await _roleManager.Roles.Where(r => r.IsDefault).ToListAsync())
                {
                    user.Roles.Add(new UserRole(tenant.Id, user.Id, defaultRole.Id));
                }

                CheckErrors(await _userManager.CreateAsync(user));
                await CurrentUnitOfWork.SaveChangesAsync();


                if (!user.IsEmailConfirmed)
                {
                    user.SetNewEmailConfirmationCode();
                    await _userEmailer.SendEmailActivationLinkAsync(user, emailActivationLink);
                }

                //Notifications
                await _notificationSubscriptionManager.SubscribeToAllAvailableNotificationsAsync(user.ToUserIdentifier());

                await _appNotifier.WelcomeToTheApplicationAsync(user);

                await _appNotifier.NewUserRegisteredAsync(user);

                return(user);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                throw;
            }
        }
Пример #27
0
        public async Task <IActionResult> AddExperience([FromQuery] string personId, [FromQuery] string experienceId, [FromQuery] ExperienceLevel experienceLevel)
        {
            var query = await _querySource
                        .TryAdd(personId, experienceId, experienceLevel);

            return(Ok(query));
        }
Пример #28
0
 public void Update(ExperienceLevel experienceLevel)
 {
     throw new NotImplementedException();
 }
Пример #29
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable data = GetAllMyResumes(Convert.ToInt32(User1.UserId));
            if (data.Rows.Count >= 3)
            {
                JavaScriptAleart("Bạn đã tạo tối đa 3 hồ sơ. Vui lòng kiểm tra lại");
                return;
            }
            var resumeTitle = txtResumeName.Text;
            var user        = new User(User1.Email, User1.UserId);
            var certificate = new Certificate(ddlDegrees.SelectedValue, ddlDegrees.SelectedItem.Text);
            var salary      = new JobSalaryLevel(ddlExpectedSalary.SelectedValue, ddlExpectedSalary.SelectedItem.Text);
            var langSkill   = new LangSkill(ddlLangSkill.SelectedValue, ddlLangSkill.SelectedItem.Text, txtDescription.Text);
            var location    = new Province(ddlRegions.SelectedValue, ddlRegions.SelectedItem.Text);
            var category    = new JobIndustries(ddlCategories.SelectedValue, ddlCategories.SelectedItem.Text);
            //var curentPostion = new JobPosition(ddlCurrentPosition.SelectedValue, ddlCurrentPosition.SelectedItem.Text);
            var expectedPosition = new JobPosition(ddlExpectedPosition.SelectedValue,
                                                   ddlExpectedPosition.SelectedItem.Text);
            var jobExperienceLevel = new ExperienceLevel(ddlExp.SelectedValue,
                                                         ddlExp.SelectedItem.Text);
            var worktype       = new WorkType(ddlworktype.SelectedValue, ddlworktype.SelectedItem.Text);
            var jobAchievement = ta1.Value;
            var careerGoal     = ta2.Value;
            var experience     = ta3.Value;
            var literacy       = ta6.Value;
            var skill          = ta5.Value;
            var reference      = ta4.Value;
            var contactmail    = txtContactMail.Text;
            var attachmentPath = "";
            if (this.fuResume.HasFile)
            {
                string imgThumb = "E:\\DOCUMENTS\\School\\ASP.NETWorkSpaces\\WebFindingJobsMVCmodel\\FileSticky\\" + this.fuResume.FileName;
                this.fuResume.SaveAs(imgThumb);
                attachmentPath = "/FileSticky/" + this.fuResume.FileName;
            }
            Resume1 = new Resume();

            var returnValue = false;
            var query       = Request.QueryString["resumeId"];
            if (query != null)
            {
                returnValue = Resume1.SetFullResumeInfoUpdate(resumeTitle, certificate, salary, langSkill, location,
                                                              category, expectedPosition, jobExperienceLevel, worktype,
                                                              jobAchievement, careerGoal, experience, literacy, skill, reference, user, contactmail, query, attachmentPath);
            }
            else
            {
                returnValue = Resume1.SetFullResumeInfo(resumeTitle, certificate, salary, langSkill, location, category, expectedPosition, jobExperienceLevel, worktype,
                                                        jobAchievement, careerGoal, experience, literacy, skill, reference, user, contactmail, attachmentPath);
            }
            if (returnValue)
            {
                JavaScriptAleart("Thực hiện thành công");
            }
            else
            {
                JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại");
            }
        }
        catch (Exception exception)
        {
            JavaScriptAleart(exception.Message);
        }
    }
Пример #30
0
    protected void btnSubmitRecuitmentInfo_OnClick(object sender, EventArgs e)
    {
        try
        {
            Recruitor1 = (Recruitor)Session["Recruitor"];
            var jobTitle           = txtJobTitle.Text;
            var numsApplicant      = txtNumsApplicant.Text;
            var recruitor          = new Recruitor(Recruitor1.Email, Recruitor1.RecruitorId);
            var certificate        = new Certificate(ddlDegrees.SelectedValue, ddlDegrees.SelectedItem.Text);
            var salary             = new JobSalaryLevel(ddlSalary.SelectedValue, ddlSalary.SelectedItem.Text);
            var location           = new Province(ddlRegions.SelectedValue, ddlRegions.SelectedItem.Text);
            var category           = new JobIndustries(ddlCategories.SelectedValue, ddlCategories.SelectedItem.Text);
            var jobPostion         = new JobPosition(ddlJobPosition.SelectedValue, ddlJobPosition.SelectedItem.Text);
            var jobExperienceLevel = new ExperienceLevel(ddlJobExperienceLevel.SelectedValue,
                                                         ddlJobExperienceLevel.SelectedItem.Text);
            var worktype       = new WorkType(ddlWorkType.SelectedValue, ddlWorkType.SelectedItem.Text);
            var jobDatail      = txtJobDetail.Value;
            var jobDescription = txtDescription.Value;
            var deadLine       = Convert.ToDateTime(tbDeadline.Value);
            Jobs1 = new Jobs();
            var jobid = Request.QueryString["jobid"];
            if (jobid != null)
            {
                var returnValue = Jobs1.SetFullJobInfo(jobTitle, certificate, salary, location, category, jobDatail,
                                                       jobDescription, deadLine, jobPostion, jobExperienceLevel, worktype, recruitor, numsApplicant, jobid);

                if (returnValue)
                {
                    Session["Job"] = Jobs1;
                    var emailContent = BuidRecommendResume(jobid);
                    SendEmailMember(emailContent, Recruitor1.EmailToSendResume);
                    JavaScriptAleart("Thực hiện thành công");
                }
                else
                {
                    JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại");
                }
            }
            else
            {
                var returnValue1 = Jobs1.SetFullJobInfo(jobTitle, certificate, salary, location, category, jobDatail,
                                                        jobDescription, deadLine, jobPostion, jobExperienceLevel, worktype, recruitor, numsApplicant);

                if (returnValue1 > 0)
                {
                    Session["Job"] = Jobs1;
                    var emailContent = BuidRecommendResume(returnValue1.ToString());
                    JavaScriptAleart(emailContent);
                    SendEmailMember(emailContent, Recruitor1.EmailToSendResume);
                    JavaScriptAleart("Thực hiện thành công");
                }
                else
                {
                    JavaScriptAleart("Thực hiện không thành công. Vui lòng load lại trang và thử lại");
                }
            }
        }
        catch (Exception exception)
        {
            JavaScriptAleart(exception.Message);
        }
    }
Пример #31
0
        /// <summary>
        /// A way to get the items into the table storage for now.
        /// @ TO DO Figure out how we actually want to do this
        /// </summary>
        public async Task StoreExperienceLevelDefintiions()
        {
            List<ExperienceLevelTableStorage> exls = new List<ExperienceLevelTableStorage>();
            ExperienceLevel exl;
            ExperienceLevelStorageInformation storageInfo;

            exl = new ExperienceLevel
            {
                Level = 1,
                ExperienceRequired = 0,
            };
            storageInfo = new ExperienceLevelStorageInformation(exl.Level.ToString());
            exls.Add((ExperienceLevelTableStorage)storageInfo.ToTableStorage(exl));

            exl = new ExperienceLevel
            {
                Level = 2,
                ExperienceRequired = 100,               
            };
            storageInfo = new ExperienceLevelStorageInformation(exl.Level.ToString());
            exls.Add((ExperienceLevelTableStorage)storageInfo.ToTableStorage(exl));

            exl = new ExperienceLevel
            {
                Level = 3,
                ExperienceRequired = 300,
            };
            storageInfo = new ExperienceLevelStorageInformation(exl.Level.ToString());
            exls.Add((ExperienceLevelTableStorage)storageInfo.ToTableStorage(exl));

            exl = new ExperienceLevel
            {
                Level = 4,
                ExperienceRequired = 700,
            };
            storageInfo = new ExperienceLevelStorageInformation(exl.Level.ToString());
            exls.Add((ExperienceLevelTableStorage)storageInfo.ToTableStorage(exl));

            AzureTableStorage storage = new AzureTableStorage();
            await storage.SetTable("ExperienceLevel");
            await storage.DeleteTable();
            await storage.SetTable("ExperienceLevel");
            await storage.InsertOrReplace<ExperienceLevelTableStorage>(exls);             
        }
        protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            try
            {
                var user     = new User();
                var file_url = (HtmlInputHidden)DetailsView1.FindControl("file_url");
                if (!string.IsNullOrEmpty(file_url.Value))
                {
                    var img_url = (HtmlImage)DetailsView1.FindControl("img_url");
                    img_url.Src       = ConfigurationManager.AppSettings["UploadUrl"] + file_url.Value;
                    user.HeadPortrait = file_url.Value;
                }

                if (e.Values["Tel"] == null)
                {
                    throw new Exception("用户电话不能为空");
                }

                if (e.Values["PassWord"] == null)
                {
                    throw new Exception("密码不能为空");
                }
                user.Tel = (e.Values["Tel"]).ToString().Trim();

                user.PassWord = CommonSecurity.SHA1MD5MD5((e.Values["PassWord"]).ToString().Trim());
                string pattern = @"^(0|86|17951)?(1[234578])[0-9]{9}$";
                Regex  rgx     = new Regex(pattern);
                if (!rgx.IsMatch(user.Tel))
                {
                    throw new Exception("电话号不正确");
                }
                if (user.PassWord.Length < 6)
                {
                    throw new Exception("密码长度不能小于6");
                }
                if (e.Values["NickName"] == null)
                {
                    user.NickName = "分享玩家";
                }
                else
                {
                    user.NickName = (e.Values["NickName"]).ToString().Trim();
                }

                user.Gender  = ((RadioButtonList)DetailsView1.FindControl("RadioButtonList_Gender")).SelectedValue;
                user.Married = ((RadioButtonList)DetailsView1.FindControl("RadioButtonList_Married")).SelectedValue;

                var CheckBoxList_Type = ((CheckBoxList)DetailsView1.FindControl("CheckBoxList_Type"));
                if (CheckBoxList_Type.Items[0].Selected)
                {
                    user.Type = user.Type | 1;
                }
                if (CheckBoxList_Type.Items[1].Selected)
                {
                    user.Type = user.Type | 2;
                }
                if (CheckBoxList_Type.Items[2].Selected)
                {
                    user.Type = user.Type | 4;
                }
                if (CheckBoxList_Type.Items[3].Selected)
                {
                    user.Type = user.Type | 8;
                }
                user.State      = Convert.ToInt32(((RadioButtonList)DetailsView1.FindControl("RadioButtonList_State")).SelectedValue);
                user.CreatTime  = DateTime.Now;
                user.UpdateTime = DateTime.Now;
                user.UserExtend = new UserExtend();
                if (e.Values["UserExtend.ExperienceLevel"] != null)
                {
                    int temp;
                    if (!int.TryParse(e.Values["UserExtend.ExperienceLevel"].ToString(), out temp))
                    {
                        throw new Exception("经验等级必须是整数");
                    }
                    if (temp == 0)
                    {
                        temp = 1;
                    }
                    user.UserExtend.ExperienceLevel = temp;
                }

                using (Entity entity = new Entity())
                {
                    ExperienceLevel experienceLevel = entity.ExperienceLevel.Where(o => o.ExperienceLevelValue == user.UserExtend.ExperienceLevel).FirstOrDefault();
                    if (experienceLevel == null)
                    {
                        throw new Exception("经验等级和等级不对应");
                    }
                    user.UserExtend.ExperienceValue = experienceLevel.ExperienceValueMin;
                    if (user.Gender == "男")
                    {
                        user.UserExtend.ExperienceName = experienceLevel.NameMan;
                    }
                    else
                    {
                        user.UserExtend.ExperienceName = experienceLevel.NameWoman;
                    }

                    user.InitBeforeSave();
                    user.SetCounterfeit();
                    entity.User.Add(user);
                    entity.SaveChanges();
                }
                Response.Redirect("UserDetail.aspx?userID=" + user.UserID);
            }
            catch (Exception exception)
            {
                string error = exception.GetErrorMessage().Replace("'", "\\'").Replace("\"", "\\\"").Replace("\r\n", "\\r\\n");
                ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", string.Format("<script>alert('{0}')</script>", error));
            }
        }