public void Save(Expertise expertise)
        {
            if (expertise.Id == 0)
                _dataContext.Expertise.Add(expertise);

            _dataContext.SaveChanges();
        }
        public async Task <bool> DeleteExpertise(ExpertiseContext expertisectx)
        {
            if (null == expertisectx)
            {
                return(false);
            }
            Expertise expertise = expertisectx.ConvertToExpertise(false);
            var       result    = await ExpertiseEntityService.Delete(expertisectx.Id.ToString());

            return(result);
        }
        public async Task <ExpertiseContext> UpdateExpertise(ExpertiseContext expetriseCtx)
        {
            if (null == expetriseCtx)
            {
                return(null);
            }
            Expertise expertise = expetriseCtx.ConvertToExpertise(false);
            var       result    = await ExpertiseEntityService.Update(expertise);

            return(result.ConvertToExpertiseContext());
        }
        public async Task <bool> CreateExpertise(ExpertiseContext expertiseCtx)
        {
            if (null == expertiseCtx)
            {
                return(false);
            }
            Expertise expertise = expertiseCtx.ConvertToExpertise(true);
            var       result    = await ExpertiseEntityService.CreateExpertise(expertise);

            return(result);
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "ExpertiseID, Field, Department, LinkedEmail, ContactEmail, Validated")] Expertise expertise)
 {
     if (ModelState.IsValid)
     {
         //expertise.Validated = true;
         db.Entry(expertise).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(expertise));
 }
Esempio n. 6
0
        public ActionResult Create([Bind(Include = "ExpertiseID,Speciality")] Expertise expertise)
        {
            if (ModelState.IsValid)
            {
                db.Expertises.Add(expertise);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(expertise));
        }
Esempio n. 7
0
        public async Task <bool> CreateExpertise(Expertise expertise)
        {
            expertise.Created = DateTime.Now;
            var   result = Expertises.MongoCollection.InsertOneAsync(expertise);
            await result;

            if (result.IsCompleted)
            {
                return(true);
            }
            return(false);
        }
 public ActionResult AddEngineer(Expertise expertise, int EngineerId)
 {
     if (EngineerId != 0)
     {
         _db.EngineerExpertise.Add(new EngineerExpertise()
         {
             EngineerId = EngineerId, ExpertiseId = expertise.ExpertiseId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Esempio n. 9
0
 public void ExpertiseIsStable()
 {
     Assert.DoesNotThrow(delegate {
         var expertise = new Expertise
         {
             Area  = "Engineering",
             Level = Level.High
         };
         expertise.Level = Level.Low;
         expertise.Level = Level.Medium;
     });
 }
Esempio n. 10
0
 public void InsertAndRemove()
 {
     Assert.DoesNotThrow(delegate
     {
         Expertise expertise = new Expertise();
         ExpertiseCollection expertiseCollection = new ExpertiseCollection();
         expertiseCollection.Add(expertise);
         expertise = expertiseCollection[0];
         expertiseCollection[0] = expertise;
         expertiseCollection.Remove(expertise);
     });
 }
Esempio n. 11
0
        public ActionResult DeleteExpertise(int expertiseId)
        {
            using (HospitalEntities2 entities = new HospitalEntities2())
            {
                Expertise expertise = (from c in entities.Expertises
                                       where c.ExpertiseID == expertiseId
                                       select c).FirstOrDefault();
                entities.Expertises.Remove(expertise);
                entities.SaveChanges();
            }

            return(new EmptyResult());
        }
        public async Task <IActionResult> Create([Bind("Id,Name,SpecialityId,UserId")] Expertise expertise)
        {
            if (ModelState.IsValid)
            {
                _context.Add(expertise);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SpecialityId"] = new SelectList(_context.Specialities, "Id", "Name", expertise.SpecialityId);
            ViewData["UserId"]       = _userManager.GetUserId(User);
            return(View(expertise));
        }
Esempio n. 13
0
        public ActionResult Create([Bind(Include = "ExpertiseID,ContactEmail,Department,Field,Validated")] Expertise expertise)
        {
            if (ModelState.IsValid)
            {
                expertise.LinkedEmail = User.Identity.Name;
                expertise.Validated   = false;
                db.Expertises.Add(expertise);
                db.SaveChanges();
                return(RedirectToAction("Index", "Manage"));
            }

            return(View(expertise));
        }
        public static Expertise ConvertToExpertise(this ExpertiseContext context, bool generateId = false)
        {
            Expertise expertise = new Expertise();

            if (null == context)
            {
                return(expertise);
            }
            expertise.Id            = generateId ? ObjectId.GenerateNewId() : ObjectId.Parse(context.Id);
            expertise.ExpertiseName = context.ExpertiseName;

            return(expertise);
        }
Esempio n. 15
0
 public decimal GetExpertiseWeight(Expertise expertise)
 {
     switch (expertise)
     {
         case Expertise.Novice:
             return 1;
         case Expertise.MidLevel:
             return 2;
         case Expertise.Expert:
             return 5;
         default:
             return 0;
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Print the object's XML to the XmlWriter.
 /// </summary>
 /// <param name="objWriter">XmlTextWriter to write with.</param>
 /// <param name="objCulture">Culture in which to print.</param>
 /// <param name="strLanguageToPrint">Language in which to print.</param>
 public void Print(XmlTextWriter objWriter, CultureInfo objCulture, string strLanguageToPrint)
 {
     if (objWriter == null)
     {
         return;
     }
     objWriter.WriteStartElement("skillspecialization");
     objWriter.WriteElementString("guid", InternalId);
     objWriter.WriteElementString("name", DisplayName(strLanguageToPrint));
     objWriter.WriteElementString("free", Free.ToString(GlobalSettings.InvariantCultureInfo));
     objWriter.WriteElementString("expertise", Expertise.ToString(GlobalSettings.InvariantCultureInfo));
     objWriter.WriteElementString("specbonus", SpecializationBonus.ToString(objCulture));
     objWriter.WriteEndElement();
 }
Esempio n. 17
0
 internal Melee(MainHand mainHand,
     OffHand offHand,
     AttackPower attackPower,
     Hit hit,
     Crit crit,
     Expertise expertise)
 {
     MainHand = mainHand;
     OffHand = offHand;
     AttackPower = attackPower;
     Hit = hit;
     Crit = crit;
     Expertise = expertise;
 }
        // GET: Expertises/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Expertise expertise = db.Expertises.Find(id);

            if (expertise == null)
            {
                return(HttpNotFound());
            }
            return(View(expertise));
        }
Esempio n. 19
0
        public decimal GetHours(Priority priority, Expertise expertise)
        {
            if (this.PriorityHours().ContainsKey(priority))
            {
                var x = this.PriorityHours()[priority];

                if (this.GetRelativeWorkloads().ContainsKey(expertise))
                {
                     var weight = this.GetExpertiseSize(expertise);
                    return x * weight;
                }
                return 0;
            }
            return 0;
        }
Esempio n. 20
0
        public ActionResult UpdateExpertise(Expertise expertise)
        {
            using (HospitalEntities2 entities = new HospitalEntities2())
            {
                Expertise updatedExpertise = (from c in entities.Expertises
                                              where c.ExpertiseID == expertise.ExpertiseID
                                              select c).FirstOrDefault();

                updatedExpertise.Speciality = expertise.Speciality;

                entities.SaveChanges();
            }

            return(new EmptyResult());
        }
Esempio n. 21
0
        private int GetSkillModifier(Ability ability, Skill skill)
        {
            var proficiencyBonus = 0;

            if (Skills.Contains(skill))
            {
                proficiencyBonus = Proficiency;
            }
            if (Expertise.Contains(skill))
            {
                proficiencyBonus = Proficiency * 2;
            }

            return(AbilityScores[ability].Modifier + proficiencyBonus);
        }
Esempio n. 22
0
        public void InsertAndRemoveNonExistentIndices()
        {
            ExpertiseCollection expertiseCollection = new ExpertiseCollection();

            Assert.Throws <IndexOutOfRangeException>(delegate
            {
                var expertise_ = expertiseCollection[0];
            });
            var expertise = new Expertise();

            Assert.Throws <IndexOutOfRangeException>(delegate
            {
                expertiseCollection[0] = expertise;
            });
        }
Esempio n. 23
0
        public async Task <ActionResult <Expertise> > UpdateExpertiseAsync(int id, Expertise expertise)
        {
            if (id != expertise.Id)
            {
                return(BadRequest());
            }

            var updateReturn = await _expertiseRepository.Update(id, expertise);

            if (updateReturn != null)
            {
                return(Ok(expertise));
            }

            return(BadRequest());
        }
        public async Task <IActionResult> CreateUpdate(ExpertiseCreateUpdateViewModel model)
        {
            string message;

            if (model.Id != null)
            {
                var expertise = await _expertiseService.GetByIdAsync(model.Id.Value);

                if (expertise == null)
                {
                    throw new Exception("Expertise Not Found");
                }

                expertise.Name                = model.Name;
                expertise.Name_Ku             = model.Name_Ku;
                expertise.Name_Ar             = model.Name_Ar;
                expertise.ExpertiseCategoryId = model.CategoryId;
                expertise.Description         = model.Description;
                expertise.Description_Ar      = model.Description_Ar;
                expertise.Description_Ku      = model.Description_Ku;

                _expertiseService.UpdateExpertise(expertise);

                message = Messages.ItemUpdatedSuccessFully;
            }
            else
            {
                var expertise = new Expertise
                {
                    Name                = model.Name,
                    Name_Ku             = model.Name_Ku,
                    Name_Ar             = model.Name_Ar,
                    ExpertiseCategoryId = model.CategoryId,
                    Description         = model.Description,
                    Description_Ku      = model.Description_Ku,
                    Description_Ar      = model.Description_Ar,
                    CreatedAt           = DateTime.Now
                };

                _expertiseService.InsertExpertise(expertise);

                message = Messages.ItemAddedSuccessFully;
            }

            return(Json(new { success = true, message }));
        }
Esempio n. 25
0
        public JsonResult InsertExpertise(Expertise expertise)
        {
            int value = -1;

            using (HospitalEntities2 entities = new HospitalEntities2())
            {
                value = int.Parse(entities.Expertises
                                  .OrderByDescending(p => p.ExpertiseID)
                                  .Select(r => r.ExpertiseID)
                                  .First().ToString());
                expertise.ExpertiseID = value + 1;
                expertise.Speciality  = expertise.Speciality.Trim();
                entities.Expertises.Add(expertise);
                entities.SaveChanges();
            }

            return(Json(expertise));
        }
Esempio n. 26
0
 public bool CreateExpertise(Expertise expertise, string userId)
 {
     try
     {
         if (!Expertises.Items.Any(x => x.Name == expertise.Name.Trim() && x.Shortname == expertise.Shortname.Trim()))
         {
             expertise.Name        = expertise.Name.Trim();
             expertise.Shortname   = expertise.Shortname.Trim();
             expertise.UserCreated = userId;
             Expertises.Add(expertise);
             return(true);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 27
0
        public IActionResult Edit(int id)
        {
            Expertise expertise = expertiseService.GetById(id);

            if (expertise == null)
            {
                return(RedirectToIndex());
            }

            EditExpertiseViewModel vm = new EditExpertiseViewModel
            {
                Id          = id,
                Title       = expertise.Title,
                Description = expertise.Description,
                Icon        = expertise.Icon
            };

            return(View(vm));
        }
Esempio n. 28
0
        private void opslaanButton_Click(object sender, EventArgs e)
        {
            Expertise expertise = (Expertise)expertiseComboBox.SelectedItem;

            if (DataExpertiseDomein.BestaatDomein(expertise.ID, domeinLimietTextBox.Text) == false)
            {
                DataExpertiseDomein.DomeinToevoegen(expertise.ID, domeinLimietTextBox.Text, nieuwDomeinBechrijvingRichTextBox.Text.Trim());

                MessageBox.Show("Domein is toegevoegd", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (DomeinToegevoegd != null)
                {
                    DomeinToegevoegd();
                }
            }

            else
            {
                MessageBox.Show("Domein bestaat al", "Opgepast", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 public void Initialize()
 {
     medicalCondition = new MedicalCondition
     {
         Name = "Depresion",
         Id   = 1,
     };
     psychologist = new Psychologist
     {
         Name        = "Mauro",
         Id          = 1,
         MeetingType = meetingType.Virtual,
     };
     Expertise = new Expertise
     {
         IdMedicalCondition = medicalCondition.Id,
         MedicalCondition   = medicalCondition,
         Psychologist       = psychologist,
         IdPsychologist     = psychologist.Id,
     };
 }
Esempio n. 30
0
        // GET: Employees/Details/5
        public async Task <IActionResult> Details(int id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var      context  = new SqlLiteContext();
            Employee employee = await context.Employees
                                .FirstOrDefaultAsync(m => m.EmployeeId == id);

            if (employee == null)
            {
                return(NotFound());
            }

            CvViewModel CompleteCv      = new CvViewModel();
            Assigment   assigment       = new Assigment();
            Assigment   focusassingment = new Assigment();

            Expertise  expertise  = new Expertise();
            Middleware middelware = new Middleware();
            Training   training   = new Training();
            Trade      trade      = new Trade();
            Technique  tech       = new Technique();


            CompleteCv.Employee        = employee.GetEmployeeView(employee);
            CompleteCv.Expertises      = expertise.GetExpertiseView(id);
            CompleteCv.Middlewares     = middelware.GetMiddlewareView(id);
            CompleteCv.Techniques      = tech.GetTechniqueView(id);
            CompleteCv.Trades          = trade.GetTradeView(id);
            CompleteCv.DegreeTraining  = training.GetDegreeTrainingView(id);
            CompleteCv.Trainings       = training.GetTrainingView(id);
            CompleteCv.Assigments      = assigment.GetAllNonFocusAssignments(id);
            CompleteCv.FocusAssigments = focusassingment.GetAllFocusAssignments(id);

            return(View(CompleteCv));
        }
Esempio n. 31
0
        public static string EnumToString(this Expertise valueOfExpertise)
        {
            switch (valueOfExpertise)
            {
            case Expertise.Designer:
                return("Designer");

            case Expertise.Advertise:
                return("Advertise");

            case Expertise.Analyzer:
                return("Analyzer");

            case Expertise.Developer:
                return("Developer");

            case Expertise.Engineering:
                return("Engineering");

            case Expertise.Management:
                return("Management");

            case Expertise.Sales:
                return("Sales");

            case Expertise.ScrumMaster:
                return("Scrum Master");

            case Expertise.Support:
                return("Support");

            case Expertise.Tester:
                return("Tester");

            default: throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 32
0
        /// <summary>
        /// Non-default constructor for a review.
        /// </summary>
        /// <param name="reviewer">Reviewer of the submission.</param>
        /// <param name="submission">Submission that is reviewed.</param>
        /// <param name="recommendation">Recommendation of the reviewer for the submission.</param>
        /// <param name="expertise">Expertise of the reviewer for this recommendation.</param>
        public Review(Reviewer reviewer, Submission submission, int recommendation, int expertise)
        {
            Reviewer   = reviewer;
            Submission = submission;
            switch (recommendation)
            {
            case 1: Recommendation = Recommendation.StrongReject; break;

            case 2: Recommendation = Recommendation.Reject; break;

            case 3: Recommendation = Recommendation.WeakReject; break;

            case 4: Recommendation = Recommendation.WeakAccept; break;

            case 5: Recommendation = Recommendation.Accept; break;

            case 6: Recommendation = Recommendation.StrongAccept; break;

            default:
                throw new ArgumentException(
                          "recommendation",
                          "Recommendations have to be in the range {1,2,3,4,5,6}.");
            }
            switch (expertise)
            {
            case 1: Expertise = Expertise.InformedOutsider; break;

            case 2: Expertise = Expertise.Knowledgeable; break;

            case 3: Expertise = Expertise.Expert; break;

            default:
                throw new ArgumentException(
                          "expertise",
                          "Expertise have to be in the range {1,2,3}.");
            }
        }
Esempio n. 33
0
        public decimal GetExpertiseSize(Expertise expertise)
        {
            var x = this.GetRelativeWorkloads();

            decimal totalSize = 0;
            decimal totalSpecific = 0;
            foreach (var workload in x)
            {
                totalSize += workload.Value;
                if (workload.Key == expertise)
                {
                    totalSpecific = workload.Value;
                }
            }

            try
            {
                return totalSpecific / totalSize;
            }
            catch (Exception)
            {
                return 0;
            }
        }
 public void Delete(Expertise expertise)
 {
     _dataContext.Expertise.Remove(expertise);
     _dataContext.SaveChanges();
 }
 public override string ToString()
 {
     return(base.ToString() + "\nExpertise: " + Expertise.ToString() + "\nMaxTestWeekly: " + MaxTestWeekly +
            "\nMaxDistance: " + MaxDistance + "\nLuz: " + Luz.ToString());
 }
Esempio n. 36
0
 public ExpertEmployee(string name, string lastname, double sallary, Expertise expertise):base(name,lastname,sallary)
 {
     this.expertise = expertise;
 }
Esempio n. 37
0
 public Experts(string name, string lastName, double payCheck, Expertise expertise)
     : base(name, lastName, payCheck)
 {
     this.expertise = expertise;
     this.expertId=ID++;
 }
 public decimal GetRate(Expertise expertise)
 {
     switch (expertise)
     {
         case Expertise.Expert:
             return 100;
             break;
         case Expertise.Novice:
             return 25;
             break;
         default:
             return 35;
     }
 }
Esempio n. 39
0
        public void Initialize()
        {
            Expertise expertise = new Expertise();

            medicalCondition = new MedicalCondition()
            {
                Id        = 1,
                Name      = "Depresion",
                Expertise = new List <Expertise>(),
            };

            psychologist = new Psychologist()
            {
                Id          = 1,
                Name        = "PEPE",
                MeetingType = meetingType.Virtual,
                Meeting     = new List <Meeting>(),
                Expertise   = new List <Expertise>()
                {
                    new Expertise()
                    {
                        MedicalCondition   = medicalCondition,
                        IdMedicalCondition = 1,
                        Psychologist       = psychologist,
                        IdPsychologist     = 1
                    },
                }
            };
            expertise.MedicalCondition   = medicalCondition;
            expertise.IdMedicalCondition = 1;
            expertise.IdPsychologist     = 1;
            expertise.Psychologist       = psychologist;
            medicalCondition.Expertise.Add(expertise);


            user = new User()
            {
                Id               = 1,
                Name             = "Rodrigo",
                Surname          = "Hirigoyen",
                Cellphone        = "099925927",
                Email            = "*****@*****.**",
                Meeting          = new List <Meeting>(),
                Birthday         = new DateTime(2000, 01, 01),
                MedicalCondition = medicalCondition,
                Discount         = discount.Zero
            };

            userList = new List <User>();
            listMedical.Add(medicalCondition);
            listPsychologist.Add(psychologist);
            userList.Add(user);

            repositoryUser         = new Mock <IData <User> >();
            repositoryPsychologist = new Mock <IData <Psychologist> >();
            repositoryMedical      = new Mock <IData <MedicalCondition> >();

            repositoryUser.Setup(r => r.GetAll()).Returns(userList);
            repositoryPsychologist.Setup(r => r.Add(psychologist));
            repositoryMedical.Setup(r => r.GetAll()).Returns(listMedical);
            repositoryMedical.Setup(r => r.Get(medicalCondition.Id)).Returns(medicalCondition);
            repositoryPsychologist.Setup(r => r.GetAll()).Returns(listPsychologist);
            repositoryPsychologist.Setup(r => r.Get(psychologist.Id)).Returns(psychologist);
            repositoryUser.Setup(r => r.Add(user));
            repositoryUser.Setup(r => r.Get(1)).Returns(user);


            psychologistLogic = new PsychologistLogic(repositoryPsychologist.Object, repositoryMedical.Object);
            userLogic         = new UserLogic(repositoryUser.Object, repositoryMedical.Object, repositoryPsychologist.Object);
        }
Esempio n. 40
0
 public decimal GetWeight(Workload workload, Expertise expertise)
 {
     var retValue = this.GetWorkloadValue(workload) * this.GetExpertiseWeight(expertise);
     return retValue;
 }
Esempio n. 41
0
 public Expert(string firstName, string lastName, int payCheck, Expertise expertise):base
     (firstName,lastName,payCheck)
 {
     this.expertise = expertise;
 }