public async Task <IActionResult> PutSeniority(int id, Seniority seniority) { if (id != seniority.SeniorityId) { return(BadRequest()); } _context.Entry(seniority).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SeniorityExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public UserEntity[] GetBySeniorityAndJobTitle(SPWeb web, Seniority seniority, string jobTitle) { var jobTitleFilter = new Filter(FilterType.Contains, "JobTitle", jobTitle, FilterValueType.Text); var seniorityFilter = new Filter(FilterType.Contains, "Seniority", seniority.ToString(), FilterValueType.Text); return(GetEntities(web, jobTitleFilter * seniorityFilter, false)); }
public async Task <ActionResult <Seniority> > PostSeniority(Seniority seniority) { _context.Seniority.Add(seniority); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSeniority", new { id = seniority.SeniorityId }, seniority)); }
public override string ToString() { if (Seniority != null) { return(Seniority.ToString()); } return(null); }
public int CompareTo(User other) { int firstBetter = 1; if (Seniority.CompareTo(other.Seniority) <= 0) { firstBetter = -1; } return(firstBetter); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public override string ToString() { return( "Tester's name: " + FirstName + " " + LastName + "\n" + "Gender: " + Gender.ToString() + "\n" + "Tester's ID: " + ID.ToString() + "\n" + "Seniority: " + Seniority.ToString() + " years\n" + "Vehicle type: " + CarType.ToString() + "\n" + "Address: " + Address.ToString() + "\n" + "Phone: " + Phone); }
private void ValidateSeniorityModel(Seniority seniority) { if (_seniorityService.IsNameDuplicated(seniority.Company_Id, seniority.Name)) { ModelState.AddModelError(ViewRes.Controllers.Shared.Name, ViewRes.Controllers.Shared.NameText); } if (_seniorityService.IsLevelDuplicated(seniority.Company_Id, seniority.Level.Value)) { ModelState.AddModelError(ViewRes.Controllers.Shared.Level, ViewRes.Controllers.Shared.LevelText); } }
private static string GetDisplayText(Seniority seniority) { switch (seniority) { case Seniority.EntryLevel: return("Entry level"); default: Assert.Fail(); return(null); } }
public ActionResult Create(Seniority seniority) { seniority.Company_Id = (int)new UsersServices().GetByUserName(User.Identity.Name.ToString()).Company_Id; ValidateSeniorityModel(seniority); if (ModelState.IsValid) { if (_seniorityService.Add(seniority)) { return(RedirectToAction("Index")); } } InitializeViews(null); return(View(_seniorityViewModel)); }
private void InitializeViews(int?seniority_id) { Seniority seniority; User user = new UsersServices().GetByUserName(User.Identity.Name.ToString()); if (seniority_id != null) { seniority = _seniorityService.GetById((int)seniority_id); } else { seniority = new Seniority(); } _seniorityViewModel = new SeniorityViewModel(seniority); }
static void Main(string[] args) { Seniority s1 = Seniority.EntryLevel; Console.WriteLine(s1); Employee e1 = new Employee("Ariel", 20, Seniority.Experienced); Employee e2 = new Employee("Zork", 15, Seniority.EntryLevel); Employee e3 = new Employee("Dan", 55, Seniority.Experienced); Console.WriteLine(e1); Console.WriteLine("Employee: {0:N}", e1); Console.WriteLine("Employee: {0:A}", e1); Console.WriteLine("Employee: {0:S}", e1); Department dep = new Department(3); dep.addEmployee(e1); dep.addEmployee(e2); dep.addEmployee(e3); foreach (Employee emp in dep) { Console.WriteLine(emp); } // Sort using IComparer dep.sort(new EmployeeComByName()); // Isn't this easier? Using delegates dep.Sort((e11,e12) => e11.Age - e12.Age)); Console.WriteLine(dep); Console.WriteLine(dep); try { Console.WriteLine(dep[5]); } catch (EmpDepException e) { Console.WriteLine("Error! wrong index is: " + e.Index); } finally { Console.ReadLine(); } }
private void CreateSeniorityRanges() { SenioritiesServices srs = new SenioritiesServices(); foreach (Seniority range in srs.GetByCompany(1117)) { Seniority newRange = new Seniority(); newRange.Company_Id = Company.Id; newRange.Name = range.Name; newRange.ShortName = range.ShortName; newRange.Level = range.Level; if (!srs.Add(newRange)) { this.Ok = false; } } }
static void Main(string[] args) { Seniority s1 = Seniority.EntryLevel; Console.WriteLine(s1); Employee e1 = new Employee("Ariel", 20, Seniority.Experienced); Employee e2 = new Employee("Zork", 15, Seniority.EntryLevel); Employee e3 = new Employee("Dan", 55, Seniority.Experienced); Console.WriteLine(e1); Console.WriteLine("Employee: {0:N}", e1); Console.WriteLine("Employee: {0:A}", e1); Console.WriteLine("Employee: {0:S}", e1); Department dep = new Department(3); dep.addEmployee(e1); dep.addEmployee(e2); dep.addEmployee(e3); dep.sort(); //foreach (Employee emp in dep) //{ // Console.WriteLine(emp); //} //dep.sort(new EmployeeComByName()); //Console.WriteLine(dep); Console.WriteLine(dep); //try //{ // Console.WriteLine(dep[5]); //} //catch (EmpDepException e) //{ // Console.WriteLine("Error! wrong index is: " + e.Index); //} //finally //{ // Console.ReadLine(); //} }
public int CompareTo(Developer other) { // int intSeniority = (int)Seniority; int firstIsbetter = 1; if (Seniority.CompareTo(other.Seniority) <= 0) { if (Seniority.CompareTo(other.Seniority) < 0) { firstIsbetter = -1; } else if (Salary.CompareTo(other.Salary) < 0) { firstIsbetter = 1; } } return(firstIsbetter); }
public ActionResult Edit(int id, FormCollection collection) { if (GetAuthorization(_seniorityService.GetById(id))) { try { Seniority seniority = _seniorityService.GetById(id); UpdateModel(seniority, "Seniority"); _seniorityService.SaveChanges(); return(RedirectToAction("Index")); } catch { InitializeViews(id); return(View(_seniorityViewModel)); } } else { return(RedirectToLogOn()); } }
/// <summary> /// Returns true if SeniorityViewModel instances are equal /// </summary> /// <param name="other">Instance of SeniorityViewModel to be compared</param> /// <returns>Boolean</returns> public bool Equals(SeniorityViewModel other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( EquipmentType == other.EquipmentType || EquipmentType != null && EquipmentType.Equals(other.EquipmentType) ) && ( OwnerName == other.OwnerName || OwnerName != null && OwnerName.Equals(other.OwnerName) ) && ( OwnerId == other.OwnerId || OwnerId != null && OwnerId.Equals(other.OwnerId) ) && ( SeniorityString == other.SeniorityString || SeniorityString != null && SeniorityString.Equals(other.SeniorityString) ) && ( Seniority == other.Seniority || Seniority != null && Seniority.Equals(other.Seniority) ) && ( Make == other.Make || Make != null && Make.Equals(other.Make) ) && ( Model == other.Model || Model != null && Model.Equals(other.Model) ) && ( Size == other.Size || Size != null && Size.Equals(other.Size) ) && ( EquipmentCode == other.EquipmentCode || EquipmentCode != null && EquipmentCode.Equals(other.EquipmentCode) ) && ( LastCalled == other.LastCalled || LastCalled != null && LastCalled.Equals(other.LastCalled) ) && ( YearsRegistered == other.YearsRegistered || YearsRegistered != null && YearsRegistered.Equals(other.YearsRegistered) ) && ( YtdHours == other.YtdHours || YtdHours != null && YtdHours.Equals(other.YtdHours) ) && ( HoursYearMinus1 == other.HoursYearMinus1 || HoursYearMinus1 != null && HoursYearMinus1.Equals(other.HoursYearMinus1) ) && ( HoursYearMinus2 == other.HoursYearMinus2 || HoursYearMinus2 != null && HoursYearMinus2.Equals(other.HoursYearMinus2) ) && ( HoursYearMinus3 == other.HoursYearMinus3 || HoursYearMinus3 != null && HoursYearMinus3.Equals(other.HoursYearMinus3) ) && ( SenioritySortOrder == other.SenioritySortOrder || SenioritySortOrder.Equals(other.SenioritySortOrder) )); }
public Developer(string firstName, string lastName, Hometown hometown, EmployeeClassification classification, Seniority seniorityLevel) : base(firstName, lastName, hometown, classification) { SeniorityLevel = seniorityLevel; }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + Id.GetHashCode(); hash = hash * 59 + StartDate.GetHashCode(); hash = hash * 59 + EndDate.GetHashCode(); if (LocalArea != null) { hash = hash * 59 + LocalArea.GetHashCode(); } if (Equipment != null) { hash = hash * 59 + Equipment.GetHashCode(); } if (BlockNumber != null) { hash = hash * 59 + BlockNumber.GetHashCode(); } if (Owner != null) { hash = hash * 59 + Owner.GetHashCode(); } if (OwnerOrganizationName != null) { hash = hash * 59 + OwnerOrganizationName.GetHashCode(); } if (Seniority != null) { hash = hash * 59 + Seniority.GetHashCode(); } if (ServiceHoursLastYear != null) { hash = hash * 59 + ServiceHoursLastYear.GetHashCode(); } if (ServiceHoursTwoYearsAgo != null) { hash = hash * 59 + ServiceHoursTwoYearsAgo.GetHashCode(); } if (ServiceHoursThreeYearsAgo != null) { hash = hash * 59 + ServiceHoursThreeYearsAgo.GetHashCode(); } if (IsSeniorityOverridden != null) { hash = hash * 59 + IsSeniorityOverridden.GetHashCode(); } if (SeniorityOverrideReason != null) { hash = hash * 59 + SeniorityOverrideReason.GetHashCode(); } return(hash); } }
/// <summary> /// Returns true if SeniorityAudit instances are equal /// </summary> /// <param name="other">Instance of SeniorityAudit to be compared</param> /// <returns>Boolean</returns> public bool Equals(SeniorityAudit other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( StartDate == other.StartDate || StartDate.Equals(other.StartDate) ) && ( EndDate == other.EndDate || EndDate.Equals(other.EndDate) ) && ( LocalArea == other.LocalArea || LocalArea != null && LocalArea.Equals(other.LocalArea) ) && ( Equipment == other.Equipment || Equipment != null && Equipment.Equals(other.Equipment) ) && ( BlockNumber == other.BlockNumber || BlockNumber != null && BlockNumber.Equals(other.BlockNumber) ) && ( Owner == other.Owner || Owner != null && Owner.Equals(other.Owner) ) && ( OwnerOrganizationName == other.OwnerOrganizationName || OwnerOrganizationName != null && OwnerOrganizationName.Equals(other.OwnerOrganizationName) ) && ( Seniority == other.Seniority || Seniority != null && Seniority.Equals(other.Seniority) ) && ( ServiceHoursLastYear == other.ServiceHoursLastYear || ServiceHoursLastYear != null && ServiceHoursLastYear.Equals(other.ServiceHoursLastYear) ) && ( ServiceHoursTwoYearsAgo == other.ServiceHoursTwoYearsAgo || ServiceHoursTwoYearsAgo != null && ServiceHoursTwoYearsAgo.Equals(other.ServiceHoursTwoYearsAgo) ) && ( ServiceHoursThreeYearsAgo == other.ServiceHoursThreeYearsAgo || ServiceHoursThreeYearsAgo != null && ServiceHoursThreeYearsAgo.Equals(other.ServiceHoursThreeYearsAgo) ) && ( IsSeniorityOverridden == other.IsSeniorityOverridden || IsSeniorityOverridden != null && IsSeniorityOverridden.Equals(other.IsSeniorityOverridden) ) && ( SeniorityOverrideReason == other.SeniorityOverrideReason || SeniorityOverrideReason != null && SeniorityOverrideReason.Equals(other.SeniorityOverrideReason) )); }
public void Print() { Console.WriteLine($"Name: { Name } - Surname: { Surname } - Type: { Type.ToString() } - Seniority: { Seniority.ToString() } - Technology: { Technology.ToString() }"); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + Id.GetHashCode(); if (EquipmentType != null) { hash = hash * 59 + EquipmentType.GetHashCode(); } if (OwnerName != null) { hash = hash * 59 + OwnerName.GetHashCode(); } if (OwnerId != null) { hash = hash * 59 + OwnerId.GetHashCode(); } if (SeniorityString != null) { hash = hash * 59 + SeniorityString.GetHashCode(); } if (Seniority != null) { hash = hash * 59 + Seniority.GetHashCode(); } if (Make != null) { hash = hash * 59 + Make.GetHashCode(); } if (Model != null) { hash = hash * 59 + Model.GetHashCode(); } if (Size != null) { hash = hash * 59 + Size.GetHashCode(); } if (LastCalled != null) { hash = hash * 59 + LastCalled.GetHashCode(); } if (YearsRegistered != null) { hash = hash * 59 + YearsRegistered.GetHashCode(); } if (YtdHours != null) { hash = hash * 59 + YtdHours.GetHashCode(); } if (HoursYearMinus1 != null) { hash = hash * 59 + HoursYearMinus1.GetHashCode(); } if (HoursYearMinus2 != null) { hash = hash * 59 + HoursYearMinus2.GetHashCode(); } if (HoursYearMinus3 != null) { hash = hash * 59 + HoursYearMinus3.GetHashCode(); } hash = hash * 59 + SenioritySortOrder.GetHashCode(); return(hash); } }
public Engineer(string name, Seniority seniority, Responsibility responsibility) { Name = name; this.Seniority = seniority; this.Responsibility = responsibility; }
public Employee(Seniority seniority, string name, int id) { Seniority = seniority; Name = name; Id = id; }
public Employee(string name, int age, Seniority sen) { Name = name; Age = age; Seniority = sen; }
private bool GetAuthorization(Seniority seniority) { return(new SharedAdminAuthorization(new UsersServices().GetByUserName(User.Identity.Name), new CompaniesServices().GetById(seniority.Company_Id)).isAuthorizated()); }
public Skill(string title, Seniority level) { Title = title; Level = level; }
public SeniorityViewModel(Seniority seniority) { this.seniority = seniority; }