static void Main (string[] args) { //For FreshMan FreshMan newFreshMan = new FreshMan ("John Doe"); newFreshMan.Greet (); newFreshMan.Display (); //For Sophomore Sophomore newSophomore = new Sophomore ("John Smith"); newSophomore.Greet (); newSophomore.Display (); //For Junior Junior newJunior = new Junior ("Harihar"); newJunior.Greet (); newJunior.Display (); //For Senior Senior newSenior = new Senior ("Kale"); newSenior.Greet (); newSenior.Display (); //For DoctoralStudent DoctoralStudent newDoctoralStudent = new DoctoralStudent ("Hari Ray"); newDoctoralStudent.Greet (); newDoctoralStudent.Display (); //For MastersStudent MastersStudent newMastersStudent = new MastersStudent ("Ab De Villiers"); newMastersStudent.Greet (); newMastersStudent.Display (); Console.ReadKey (); }
static (List <FuncionarioPadrao>, List <CargoAcessoPermitido>) CriarFuncionarios() { List <FuncionarioPadrao> funcionarios = new List <FuncionarioPadrao>(); List <CargoAcessoPermitido> superiores = new List <CargoAcessoPermitido>(); try { var fun1 = new Estagiario("Rodrigo", 1); var fun2 = new Trainee("Sergio", 2); var fun3 = new Junior("Soely", 3); var fun4 = new Senior("Marina", 4); var fun5 = new Socio("José", 5); var fun6 = new Diretor("Rosa", 6); var fun7 = new ChefeDepartamento("Luke", 7); funcionarios.AddRange(new FuncionarioPadrao[] { fun1, fun2, fun3, fun4, fun5 }); superiores.AddRange(new CargoAcessoPermitido[] { fun6, fun7 }); foreach (var funcioanrio in funcionarios) { funcioanrio.ImprimirInformacoesFuncionario(); } foreach (var superior in superiores) { superior.ImprimirInformacoesFuncionario(); } } catch (ArgumentException e) { Console.WriteLine(e.Message); } return(funcionarios, superiores); }
/// <summary> /// Récupère une Senior à partir d'un identifiant de client /// </summary> /// <param name="Identifiant">Identifant de Senior</param> /// <returns>Un Senior </returns> public static Senior Get(Int32 identifiant) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"SELECT IdentifiantEntretien, PAS, DIF, BilanCompetence, TempsTravail, TransfertCompetence FROM Senior WHERE Identifiant = @Identifiant"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("Identifiant", identifiant); //Execution connection.Open(); SqlDataReader dataReader = commande.ExecuteReader(); dataReader.Read(); //1 - Création du Senior Senior senior = new Senior(); senior.Identifiant = dataReader.GetInt32(0); senior.PAS = dataReader.GetChar(1); senior.DIF = dataReader.GetChar(2); senior.BilanCompetence = dataReader.GetChar(3); senior.TempsTravail = dataReader.GetChar(4); senior.TransfertCompetence = dataReader.GetChar(5); dataReader.Close(); connection.Close(); return senior; }
public void Create_SeniorWithInvalidValues_ArgumentException() { // arrange int[] data = ReadData(); // act var res = new Senior(data[0], data[1]); }
public SeniorProjectsView(Senior mySenior) { InitializeComponent(); MySenior = mySenior; Unit = new UnityOfWork(new ProjectTracerEntities()); LoadProjects(); }
/// <summary> /// The problem of integer programming: /// Selection employees necessary to minimize the total cost /// for given parameters of the cash amount and fixed productivity. /// </summary> /// <param name="selector">Contains cash amount and productivity</param> /// <returns>Possible solutions for the composition of the team of employees</returns> public override List <Dictionary <FellowWorker, int> > Select(StaffSelector selector) { SolverContext context = SolverContext.GetContext(); Model model = context.CreateModel(); // init fellow workers Junior junior = selector.Staffs.Junior; Middle middle = selector.Staffs.Middle; Senior senior = selector.Staffs.Senior; Lead lead = selector.Staffs.Lead; // init decisions - counts of number of employees of different qualifications Decision juniorDecision = new Decision(Domain.IntegerNonnegative, junior.GetQualificationString()); Decision middleDecision = new Decision(Domain.IntegerNonnegative, middle.GetQualificationString()); Decision seniorDecision = new Decision(Domain.IntegerNonnegative, senior.GetQualificationString()); Decision leadDecision = new Decision(Domain.IntegerNonnegative, lead.GetQualificationString()); model.AddDecisions(juniorDecision, middleDecision, seniorDecision, leadDecision); // constraint of fixed productivity model.AddConstraints("fixProductivity", junior.Productivity * juniorDecision + middle.Productivity * middleDecision + senior.Productivity * seniorDecision + lead.Productivity * leadDecision == selector.Productivity); // constraint of max cash amount model.AddConstraints("maxAmount", junior.Salary * juniorDecision + middle.Salary * middleDecision + senior.Salary * seniorDecision + lead.Salary * leadDecision <= selector.Amount); // criterion of optimization - total cost model.AddGoal("cost", GoalKind.Minimize, junior.Salary * juniorDecision + middle.Salary * middleDecision + senior.Salary * seniorDecision + lead.Salary * leadDecision); Solution solution = context.Solve(new ConstraintProgrammingDirective()); // packing results List <Dictionary <FellowWorker, int> > solutionsList = new List <Dictionary <FellowWorker, int> >(); while (solution.Quality != SolverQuality.Infeasible) { solutionsList.Add(PackSolutionInDictionary(new Decision[] { juniorDecision, middleDecision, seniorDecision, leadDecision }, selector.Staffs)); solution.GetNext(); } context.ClearModel(); return(solutionsList); }
public Staffs(Junior junior, Middle middle, Senior senior, Lead lead) { this.Junior = junior; this.Middle = middle; this.Senior = senior; this.Lead = lead; this.staffsArray = new FellowWorker[] { junior, middle, senior, lead }; }
public void Set_SeniorInvalidProductivity_ArgumentException() { // arrange Senior res = new Senior(10, 10); // act res.Salary = Convert.ToInt32(TestContext.DataRow[Productivity]); }
static void Main(string[] args) { Junior Jack = new Junior(new Person("Jack", 45)); Senior Chris = new Senior(new Person("Chris", 95)); Jack.SetSenior(Chris); Jack.Handle(); }
public Form1() { InitializeComponent(); using (var context = new Model1Container()) { var teen = new Teen { Name = "Steven Keller", Age = 17, Phone = "817 867-5309" }; var adult = new Adult { Name = "Margret Jones", Age = 53, Phone = "913 294-6059" }; var senior = new Senior { Name = "Roland Park", Age = 71, Phone = "816 353-4458" }; context.Members.Add(teen); context.Members.Add(adult); context.Members.Add(senior); context.SaveChanges(); } using (var context = new Model1Container()) { Console.WriteLine("Club Members"); Console.WriteLine("============"); foreach (var member in context.Members) { bool printPhone = true; string str = string.Empty; if (member is Teen) { str = " a Teen"; printPhone = false; } else if (member is Adult) { str = "an Adult"; } else if (member is Senior) { str = "a Senior"; } Console.WriteLine("{0} is {1} member, phone: {2}", member.Name, str, printPhone ? member.Phone : "unavailable"); } } }
public SeniorTasksView(Senior mySenior) { InitializeComponent(); MySenior = mySenior; Unit = new UnityOfWork(new ProjectTracerEntities()); SelectedProject = new Project(); SelectedTask = new Task(); LoadTasks(); LoadProjects(); }
public SeniorDevelopersView(Senior mySenior) { InitializeComponent(); MySenior = mySenior; Unit = new UnityOfWork(new ProjectTracerEntities()); SelectedTeam = new Team(); SelectedDeveloper = new Developer(); LoadTeams(); LoadDevelopers(); }
public static void LaunchFifth() { var jun = new Junior("Ivan", 300); var mid = new Mid("Bob", 1000); var sen = new Senior("Stef", 1100); jun.Set_Successor(mid); mid.Set_Successor(sen); jun.Process_Invoices(1200); }
public void Create_SeniorWithValidValues_IsSenior() { // arrange int[] data = ReadData(); // act var res = new Senior(data[0], data[1]); // assert Assert.IsInstanceOfType(res, typeof(Senior)); }
private void AddSenior(GoldenHandContext context, string address, string name, string phone) { Senior s = new Senior(); s.Address = address; s.Name = name; s.PhoneNumber = phone; s.SeniorShortcut = name + ", " + address; context.Seniors.AddOrUpdate(s); }
public static List <Motion> GetAllMotions(Board board, bool isWhite) { List <List <Point> > moves = new List <List <Point> >(); List <KillItem> kills = new List <KillItem>(); Func <int, int, bool> colorValidator; if (isWhite) { colorValidator = board.IsWhite; } else { colorValidator = board.IsBlack; } for (int i = 0; i < Board.SIZE; i++) { for (int j = 0; j < Board.SIZE; j++) { if (colorValidator(i, j)) { var kill = new KillItem(); if (board.IsSenior(i, j)) { Senior.FindMotions(board, isWhite, i, j, ref moves, ref kill); } else { Pawn.FindMotions(board, isWhite, i, j, ref moves, ref kill); } if (kill.Move != null) // значит кого-то убили { kills.Add(kill); } } } } var resultKills = new List <List <Point> >(); kills.ForEach(pk => { resultKills.AddRange(pk.SplitToBranches()); pk.Dispose(); }); var list = resultKills.Count > 0 ? resultKills : moves; var ret = list.Select(m => new Motion(m.ToArray())).ToList(); return(ret); }
public void TestSenior_ExceptionThrown() { Player a = new Player { id = 1, fName = "Joe", lName = "Rogan", team = "AAA" }; List <Player> players = new List <Player>(); players.Add(a); Senior senior = new Senior(players); }
public ActionResult Senior() { try { Senior SeniorTeam = new Senior(db.Players.ToList()); return(View(SeniorTeam.seniorTeam.ToList())); } catch (InvalidTeamException) { Console.Write("Team Name Not Valid"); } return(View()); }
protected override void Save() { Senior newSenior = GoldenHandContext.Instance.Seniors.Where(x => x.SeniorId == senior.SeniorId).FirstOrDefault(); newSenior.Name = txtName.Text; newSenior.Address = txtAddress.Text; newSenior.PhoneNumber = txtPhoneNumber.Text; GoldenHandContext.Instance.SaveChanges(); MessageBox.Show("Zapisano zmiany."); ReloadSeniors?.Invoke(btnSave, new SeniorEventArgs(newSenior)); Close(); }
private void PrepareSeniorData(Senior senior) { txtName.Text = senior.Name; txtAddress.Text = senior.Address; txtPhoneNumber.Text = senior.PhoneNumber; formsViewModel = MappingHelper.MapFormModelToFormViewModel(GoldenHandContext.Instance.Forms.Where(x => x.SeniorId == senior.SeniorId).ToList()); var formsSorted = formsViewModel.OrderByDescending(x => x.RegistrationDate).ToList(); bsSeniorForms.DataSource = new BindingList <FormViewModel>(formsSorted); dgForms.DataSource = bsSeniorForms; Style.StyleDataGrid(dgForms); }
protected override void Save() { Senior s = new Senior(); s.Name = txtName.Text; s.Address = txtAddress.Text; s.PhoneNumber = txtPhoneNumber.Text; s.SeniorShortcut = s.Name + ", " + s.Address; GoldenHandContext.Instance.Seniors.Add(s); GoldenHandContext.Instance.SaveChanges(); MessageBox.Show("Dodano seniora."); ReloadSeniors?.Invoke(btnSave, new SeniorEventArgs(s)); Close(); }
public static LogInView GetLogIn(String User) { var logIn = new LogInView(new Client()); switch (User) { case "Client": var myClient = new Client(); logIn = new LogInView(myClient); break; case "Developer": var myDeveloper = new Developer(); logIn = new LogInView(myDeveloper); break; case "Senior": var mySenior = new Senior(); logIn = new LogInView(mySenior); break; case "Administrator": var myAdmin = new Administrator(); logIn = new LogInView(myAdmin); break; default: throw new NullReferenceException(); } return(logIn); }
static void Main(string[] args) { Junior junior = new Junior(); Practicante practicante = new Practicante(); Senior senior = new Senior(); junior.Nombre = "Max"; practicante.Nombre = "Yordy"; senior.Nombre = "Arthur"; Console.WriteLine("El salario de " + junior.Nombre + " es: " + junior.ObtenerSalario()); Console.WriteLine("El salario de " + practicante.Nombre + " es: " + practicante.ObtenerSalario()); Console.WriteLine("El salario de " + senior.Nombre + " es: " + senior.ObtenerSalario()); Console.WriteLine(junior.Nombre + " tiene un desuento de: " + junior.ObtenerDescuento()); Console.WriteLine(senior.Nombre + " tiene un desuento de: " + senior.ObtenerDescuento()); Console.Read(); }
public void TestSeniorListCorrect() { Player a = new Player { id = 1, fName = "Joe", lName = "Rogan", team = "Junior" }; Player b = new Player { id = 2, fName = "Sarah", lName = "Lewis", team = "Junior" }; Player c = new Player { id = 3, fName = "fred", lName = "Flintstone", team = "Senior" }; Player d = new Player { id = 4, fName = "Dylan", lName = "Mckaig", team = "Senior" }; Player e = new Player { id = 5, fName = "Joseph", lName = "Stalin", team = "Senior" }; Player f = new Player { id = 6, fName = "Karen", lName = "Robinson", team = "Junior" }; Player g = new Player { id = 7, fName = "Harry", lName = "Corry", team = "Junior" }; List <Player> players = new List <Player>(); players.Add(a); players.Add(b); players.Add(c); players.Add(d); players.Add(e); players.Add(f); players.Add(g); Senior senior = new Senior(players); int expected = 3; int actual = senior.seniorTeam.Count(); Assert.AreEqual(expected, actual); }
public void CreateSeniorDeveloperSkillset_ShouldSucceed() { //Arrange var junior = new Senior(false, true, 2, false, "Graupner") { Languages = new Dictionary <string, int>() }; //Act junior.Languages.Add("AngularJS", 5); junior.Languages.Add("CSharp", 8); var expectedLanguages = new Dictionary <string, int> { { "AngularJS", 5 }, { "CSharp", 8 } }; var actualLanguages = junior.Languages; //Assert CollectionAssert.AreEqual(expectedLanguages, actualLanguages); }
public static void Insert(Senior Senior) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"INSERT INTO Senior (IdentifiantEntretien, PAS, DIF, BilanCompetence, TempsTravail, TransfertCompetence) VALUES (@IdentifiantEntretien, @PAS, @DIF, @BilanCompetence, @TempsTravail, @TransfertCompetence)"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("IdentifiantEntretien", Senior.Identifiant); commande.Parameters.AddWithValue("PAS", Senior.PAS); commande.Parameters.AddWithValue("DIF", Senior.DIF); commande.Parameters.AddWithValue("BilanCompetence", Senior.BilanCompetence); commande.Parameters.AddWithValue("TempsTravail", Senior.TempsTravail); commande.Parameters.AddWithValue("TransfertCompetence", Senior.TransfertCompetence); //Execution connection.Open(); commande.ExecuteNonQuery(); connection.Close(); }
/* private async void FindMatches(Senior selectedSenior) { var results = await seniorsTable.Where(Senior => Senior.IsSenior == false). Where(Senior => Senior.Requirement == selectedSenior.Requirement).ToListAsync(); Volunteers = new ObservableCollection<Senior>(results); //int finished; } */ private async void AddSenior(Senior newSenior) { await seniorsTable.InsertAsync(newSenior); //items.add(newSenior); for adding to the observablecollection, so we don't have to pull from azure }
private static void FindKills(Board board, bool isWhite, int x, int y, ref KillItem kills) { int[,] _whiteDirections = new int[, ] { { -1, -1 }, { 1, -1 } }; int[,] _blackDirections = new int[, ] { { 1, 1 }, { -1, 1 } }; var dir = isWhite ? _whiteDirections : _blackDirections; for (int i = 0; i < 2; i++) { int xN = x + dir[i, 0]; int yN = y + dir[i, 1]; int xN2 = x + 2 * dir[i, 0]; int yN2 = y + 2 * dir[i, 1]; if (!InBounds(xN) || !InBounds(yN) || !InBounds(xN2) || !InBounds(yN2)) { continue; } if (board[xN2, yN2] != FigureEnum.NONE) { continue; } if (CheckersHasDifferentColor(board, x, y, xN, yN) && !board.IsSenior(xN, yN)) { var killed = new Point(xN, yN); if (kills.BranchContaintsValue(killed)) { continue; } if (kills.Move == null) { kills.Move = new Point(x, y); } var beat = new KillItem { Move = new Point(xN2, yN2), Killed = killed }; kills.AddChild(ref beat); var boardCopy = (Board)board.Clone(); boardCopy[xN2, yN2] = boardCopy[x, y]; boardCopy[x, y] = FigureEnum.NONE; if (ShouldBecomeSenior(yN2, isWhite)) { Senior.FindKills(boardCopy, isWhite, xN2, yN2, ref beat); } else { FindKills(boardCopy, isWhite, xN2, yN2, ref beat); } } } }
public void Visit(Senior s) { System.Console.WriteLine("[senior-test]"); }
private async void AttachRequirement(Requirement theRequirement, Senior theSenior = null, Volunteer theVolunteer = null, string additionalInformation = null) { //first we check to see who is getting the requirement bool isSenior; if (theSenior == null) isSenior = true; else if (theVolunteer == null) isSenior = false; else return; if (isSenior) { SeniorRequirements req = new SeniorRequirements(); req.RequirementID = theRequirement.ID; req.SeniorID = theSenior.ID; req.AdditionalInformation = additionalInformation; await _seniorRequirements.InsertAsync(req); } else { VolunteerRequirements req = new VolunteerRequirements(); req.RequirementID = theRequirement.ID; req.VolunteerID = theVolunteer.ID; await _volunteerRequirements.InsertAsync(req); } }
public static void Update(Senior Senior) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"UPDATE Senior SET , PAS = @PAS, DIF = @DIF, BilanCompetence = @BilanCompetence, TempsTravail = @TempsTravail, TransfertCompetence = @TransfertCompetence WHERE IdentifiantEntretien = @IdentifiantEntretien"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("IdentifiantEntretien", Senior.Identifiant); commande.Parameters.AddWithValue("PAS", Senior.PAS); commande.Parameters.AddWithValue("DIF", Senior.DIF); commande.Parameters.AddWithValue("BilanCompetence", Senior.BilanCompetence); commande.Parameters.AddWithValue("TempsTravail", Senior.TempsTravail); commande.Parameters.AddWithValue("TransfertCompetence", Senior.TransfertCompetence); //Execution connection.Open(); commande.ExecuteNonQuery(); connection.Close(); }
/// <summary> /// Récupère une liste de Senior à partir de la base de données /// </summary> /// <returns>Une liste de client</returns> public static List<Senior> List() { //Récupération de la chaine de connexion //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = "SELECT IdentifiantEntretien, PAS, DIF, BilanCompetence, TempsTravail, TransfertCompetence FROM Senior"; connection.Open(); SqlCommand commande = new SqlCommand(requete, connection); //execution SqlDataReader dataReader = commande.ExecuteReader(); List<Senior> list = new List<Senior>(); while (dataReader.Read()) { Senior senior = new Senior(); senior.Identifiant = dataReader.GetInt32(0); senior.PAS = dataReader.GetChar(1); senior.DIF = dataReader.GetChar(2); senior.BilanCompetence = dataReader.GetChar(3); senior.TempsTravail = dataReader.GetChar(4); senior.TransfertCompetence = dataReader.GetChar(5); //2 - Ajouter ce Senior à la list de client list.Add(senior); } dataReader.Close(); connection.Close(); return list; }
private void PrepareSeniorData(Senior senior) { txtName.Text = senior.Name; txtAddress.Text = senior.Address; txtPhoneNumber.Text = senior.PhoneNumber; }
public SeniorEventArgs(Senior s) { this.senior = s; }
public void Visit(Senior j) { System.Console.WriteLine("[senior-develop]"); }
public SeniorEditForm(int seniorId) { senior = GetSenior(seniorId); InitializeComponent(); PrepareSeniorData(senior); }