Ejemplo n.º 1
0
        public static void JobExperienceUpdateMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            JobExperienceUpdateMessage msg = (JobExperienceUpdateMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            JobExperience i = msg.experiencesUpdate;

            foreach (Core.Job.Job j in account.Jobs)
            {
                if (i.jobId == j.Id)
                {
                    j.Level            = i.jobLevel;
                    j.XP               = (int)i.jobXP;
                    j.XpLevelFloor     = (int)i.jobXpLevelFloor;
                    j.XpNextLevelFloor = (int)i.jobXpNextLevelFloor;
                    break;
                }
            }
            foreach (JobUC j in account.JobsUC)
            {
                j.UpdateJob();
            }
        }
 public void Deserialize(IDataReader reader)
 {
     ExperiencesUpdate = new JobExperience[reader.ReadShort()];
     for (var i = 0; i < ExperiencesUpdate.Length; i++)
     {
         (ExperiencesUpdate[i] = new JobExperience()).Deserialize(reader);
     }
 }
        //Deletes a jobexperience based on id
        public ActionResult DeleteConfirmed(int id)
        {
            JobExperience jobExperience = db.JobExperiences.Find(id);

            db.JobExperiences.Remove(jobExperience);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        public async Task <JobExperience> AddAsync(JobExperience entity)
        {
            var res = await _uow.JobExperiences.AddAsync(entity);

            await _uow.SaveChangesAsync();

            return(res);
        }
 public JobExperienceOtherPlayerUpdateMessage(
     JobExperience experiencesUpdate,
     long playerId
     ) : base(
         experiencesUpdate
         )
 {
     PlayerId = playerId;
 }
Ejemplo n.º 6
0
 private void AssertJobExperience(JobExperience jobExperience, string company, string description, DateTime startDate,
                                  DateTime endDate, IEnumerable <string> techStack)
 {
     Assert.That(jobExperience.Company, Is.EqualTo(company));
     Assert.That(jobExperience.Description, Is.EqualTo(description));
     Assert.That(jobExperience.JobPeriod.Start, Is.EqualTo(startDate));
     Assert.That(jobExperience.JobPeriod.End, Is.EqualTo(endDate));
     CollectionAssert.AreEquivalent(techStack, jobExperience.TechStack);
 }
Ejemplo n.º 7
0
        public IActionResult JobExperiencesCreate(int id)
        {
            var jobExperience = new JobExperience
            {
                CandidateID = id
            };

            return(View(nameof(JobExperiencesCreate), jobExperience));
        }
Ejemplo n.º 8
0
        public async Task <ResponseApi> Handle(UpdateListJobExperiencesCommand request, CancellationToken cancellationToken)
        {
            try
            {
                int invalidQty = 0;

                foreach (var job in request.JobExperiences)
                {
                    job.Validate();
                    if (job.Invalid)
                    {
                        invalidQty += 1;
                    }

                    if (invalidQty > 0)
                    {
                        return(new ResponseApi(false, "Something is wrong...", job.Notifications));
                    }
                }

                List <JobExperienceViewModel> result = new List <JobExperienceViewModel>();

                for (int i = 0; i < request.JobExperiences.Count; i++)
                {
                    JobExperience jobExperience = _mapper.Map <JobExperience>(await _jobExperienceRepository.Get(request.JobExperiences[i].Id));

                    jobExperience.UpdateFields(_mapper.Map <JobExperience>(request.JobExperiences[i]));
                    await _jobExperienceRepository.Update(jobExperience);

                    var updateResult = new JobExperienceViewModel
                    {
                        Id                      = jobExperience.Id,
                        EnterpriseName          = jobExperience.EnterpriseName,
                        BeginDate               = jobExperience.BeginDate,
                        FinalDate               = jobExperience.FinalDate,
                        JobTitle                = jobExperience.JobTitle,
                        ProjectDescription      = jobExperience.ProjectDescription,
                        ProjectResponsabilities = jobExperience.ProjectResponsabilities,
                        TecnologiesUsed         = jobExperience.TecnologiesUsed,
                        Active                  = jobExperience.Active,
                        Excluded                = jobExperience.Excluded,
                        CreationDate            = jobExperience.CreationDate,
                        LastUpdate              = jobExperience.LastUpdate,
                        IdUser                  = jobExperience.IdUser
                    };

                    result.Add(updateResult);
                }

                return(new ResponseApi(true, "Job experiences updated sucessfuly", result));
            }
            catch (Exception e)
            {
                return(new ResponseApi(false, "Error...", e));
            }
        }
 public ActionResult Edit([Bind(Include = "JobExperienceId,Employer,DateOfEmployment,DateOfExit")] JobExperience jobExperience)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobExperience).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jobExperience));
 }
Ejemplo n.º 10
0
        public override void Deserialize(IDataReader reader)
        {
            var limit = reader.ReadUShort();

            experiencesUpdate = new JobExperience[limit];
            for (int i = 0; i < limit; i++)
            {
                experiencesUpdate[i] = new JobExperience();
                experiencesUpdate[i].Deserialize(reader);
            }
        }
Ejemplo n.º 11
0
 public void Update(JobExperience experience)
 {
     if (experience == null)
     {
         throw new ArgumentNullException("experience");
     }
     Level                    = experience.jobLevel;
     Experience               = experience.jobXP;
     ExperienceLevelFloor     = experience.jobXpLevelFloor;
     ExperienceNextLevelFloor = experience.jobXpNextLevelFloor;
 }
Ejemplo n.º 12
0
        public OperationResult Create(CreateJobExperience command)
        {
            var operation = new OperationResult();

            var jobExperience = new JobExperience(command.CompanyName, command.JobPosition, command.WorkDate, command.Description);

            _jobExperienceRepository.Create(jobExperience);
            _jobExperienceRepository.SaveChanges();

            return(operation.Succedded());
        }
Ejemplo n.º 13
0
        public override void Serialize(IDataWriter writer)
        {
            writer.WriteShort(((short)(m_experiencesUpdate.Count)));
            int experiencesUpdateIndex;

            for (experiencesUpdateIndex = 0; (experiencesUpdateIndex < m_experiencesUpdate.Count); experiencesUpdateIndex = (experiencesUpdateIndex + 1))
            {
                JobExperience objectToSend = m_experiencesUpdate[experiencesUpdateIndex];
                objectToSend.Serialize(writer);
            }
        }
        public override void Deserialize(IDataReader reader)
        {
            uint num = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num; ++index)
            {
                JobExperience jobExperience = new JobExperience();
                jobExperience.Deserialize(reader);
                this.experiencesUpdate.Add(jobExperience);
            }
        }
Ejemplo n.º 15
0
        public ActionResult Create([Bind(Include = "SubjectId,Name,StartTime,EndTime,PercievedLevelOfSkill")] Subject subject, int id)
        {
            if (ModelState.IsValid)
            {
                JobExperience jobExp = db.JobExperiences.FirstOrDefault(j => j.JobExperienceId == id);
                jobExp.Subjects.Add(subject);
                db.SaveChanges();
                return(RedirectToAction("SubjectList/" + id));
            }

            return(View(subject));
        }
Ejemplo n.º 16
0
        public ActionResult SaveExperience(JobExperience jobExperience)
        {
            bool isSuccess = false;


            if (_appServices.JobExperience.Save(jobExperience) > 0)
            {
                isSuccess = true;
            }

            return(Json(new { isSuccess }));
        }
        public override void Deserialize(IDataReader reader)
        {
            var experiencesUpdateCount = reader.ReadUShort();

            ExperiencesUpdate = new List <JobExperience>();
            for (var experiencesUpdateIndex = 0; experiencesUpdateIndex < experiencesUpdateCount; experiencesUpdateIndex++)
            {
                var objectToAdd = new JobExperience();
                objectToAdd.Deserialize(reader);
                ExperiencesUpdate.Add(objectToAdd);
            }
        }
        public override void Deserialize(ICustomDataInput reader)
        {
            var countExperiencesUpdate = reader.ReadShort();

            ExperiencesUpdate = new List <JobExperience>();
            for (short i = 0; i < countExperiencesUpdate; i++)
            {
                JobExperience type = new JobExperience();
                type.Deserialize(reader);
                ExperiencesUpdate.Add(type);
            }
        }
Ejemplo n.º 19
0
        public static MyJobExperience GetJobExperienceByUserDetailId(int udId)
        {
            JobExperience e = ctx.UserDetails.First(u => u.Id == udId).JobExperience;

            if (e == null)
            {
                return(null);
            }
            else
            {
                return(new MyJobExperience(e.Id, e.Company, e.City, e.Post, e.Start, e.End, e.Desc));
            }
        }
Ejemplo n.º 20
0
        public async Task <IActionResult> Update(JobExperience jobExperience)
        {
            try
            {
                await _jobExperienceService.UpdateAsync(jobExperience);

                return(StatusCode(200));
            }
            catch
            {
                return(StatusCode(500, "Internal server error"));
            }
        }
Ejemplo n.º 21
0
        //Adds jobexperience to other user from admin user.
        public ActionResult AddJobFromAdmin([Bind(Include = "JobExperienceId,Employer,DateOfEmployment,DateOfExit")] JobExperience jobExperience, string id)
        {
            jobExperience.ApplicationUser = db.Users.Where(x => x.Id == id).First();

            if (ModelState.IsValid)
            {
                db.JobExperiences.Add(jobExperience);
                db.SaveChanges();
                return(RedirectToAction("ProfileJobIndex"));
            }

            return(View(jobExperience));
        }
Ejemplo n.º 22
0
        public override void Deserialize(IDataReader reader)
        {
            int experiencesUpdateCount = reader.ReadUShort();
            int experiencesUpdateIndex;

            m_experiencesUpdate = new System.Collections.Generic.List <JobExperience>();
            for (experiencesUpdateIndex = 0; (experiencesUpdateIndex < experiencesUpdateCount); experiencesUpdateIndex = (experiencesUpdateIndex + 1))
            {
                JobExperience objectToAdd = new JobExperience();
                objectToAdd.Deserialize(reader);
                m_experiencesUpdate.Add(objectToAdd);
            }
        }
Ejemplo n.º 23
0
        public ActionResult AddTitleToJobexp(Title title, int id)
        {
            Title TitleUsed = db.Titles.FirstOrDefault(t => t.TitleName == title.TitleName);

            if (ModelState.IsValid)
            {
                JobExperience jobExp = db.JobExperiences.FirstOrDefault(j => j.JobExperienceId == id);
                jobExp.Titles.Add(TitleUsed);
                db.SaveChanges();
                return(RedirectToAction("TitlesList/" + id));
            }

            return(View(title));
        }
Ejemplo n.º 24
0
        public async Task <IActionResult> JobExperiencesCreate(int id, [Bind("Bussiness,JobPosition,InitialDate,EndDate,Salary,CandidateID")] JobExperience jobExperience)
        {
            jobExperience.CandidateID = id;

            if (ModelState.IsValid)
            {
                _context.Add(jobExperience);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(JobExperiences), new { id }));
            }

            return(View(nameof(JobExperiencesCreate), jobExperience));
        }
Ejemplo n.º 25
0
        public ActionResult AddEnvToJobexp(Models.Environment environment, int id)
        {
            Models.Environment environmentUsed = db.Environments.FirstOrDefault(e => e.EnvironmentName == environment.EnvironmentName);

            if (ModelState.IsValid)
            {
                JobExperience jobExp = db.JobExperiences.FirstOrDefault(j => j.JobExperienceId == id);
                jobExp.Environments.Add(environmentUsed);
                db.SaveChanges();
                return(RedirectToAction("EnvironmentList/" + id));
            }

            return(View(environment));
        }
Ejemplo n.º 26
0
        // GET: JobExperiences/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            JobExperience jobExperience = db.JobExperiences.Find(id);

            if (jobExperience == null)
            {
                return(HttpNotFound());
            }
            return(View(jobExperience));
        }
Ejemplo n.º 27
0
        public async Task <ResponseApi> Handle(DeleteJobExperienceCommand request, CancellationToken cancellationToken)
        {
            try
            {
                JobExperience jobExperience = _mapper.Map <JobExperience>(await _jobExperienceRepository.Get(request.IdJobExperience));

                await _jobExperienceRepository.Delete(jobExperience);

                return(new ResponseApi(true, "Job experience deleted sucessfuly", null));
            }
            catch (Exception e)
            {
                return(new ResponseApi(false, "Error...", e));
            }
        }
Ejemplo n.º 28
0
        public void AddJobExp(MyJobExperience exp)
        {
            JobExperience e = new JobExperience();

            e.Company = exp.Company;
            e.City    = exp.City;
            e.Post    = exp.Post;
            e.Start   = exp.Start;
            e.End     = exp.End;
            e.Desc    = exp.Desc;

            ctx.JobExperiences.Add(e);

            ctx.SaveChanges();
        }
Ejemplo n.º 29
0
        public ActionResult Create([Bind(Include = "JobExperienceId,Employer,DateOfEmployment,DateOfExit")] JobExperience jobExperience)
        {
            var UserId = User.Identity.GetUserId();

            jobExperience.ApplicationUser = db.Users.Where(x => x.Id == UserId).First();

            if (ModelState.IsValid)
            {
                db.JobExperiences.Add(jobExperience);
                db.SaveChanges();
                return(RedirectToAction("ProfileJobIndex"));
            }

            return(View(jobExperience));
        }
Ejemplo n.º 30
0
        public int Delete(int Id)
        {
            int           retVal        = 0;
            JobExperience jobExperience = context.JobExperience.Where(a => a.Id == Id).FirstOrDefault();

            if (jobExperience != null)
            {
                context.JobExperience.Remove(jobExperience);
                retVal = context.SaveChanges();
            }
            else
            {
                retVal = -1;
            }

            return(retVal);
        }