public async Task <ActionResult <Foreman> > PostForeman(Foreman foreman) { _context.Foremans.Add(foreman); await _context.SaveChangesAsync(); return(CreatedAtAction("GetForeman", new { id = foreman.Id }, foreman)); }
public override void Update(GameTime gameTime) { if (InConstruction) { if (Foreman != null) { if (ResourcesSpent) { Progress++; //LastGameTime += gameTime.ElapsedGameTime; //if (LastGameTime > BuildTime) if (Progress == 1000) { InConstruction = false; Foreman.Warn(EnvironmentEvent.BuildingBuilt); } } else { if (WoodCount >= NB_REQUIRED_WOOD && StoneCount >= NB_REQUIRED_STONE) { WoodCount -= NB_REQUIRED_WOOD; StoneCount -= NB_REQUIRED_STONE; ResourcesSpent = true; } } } } }
public async Task <ActionResult> DeleteConfirmed(int id) { Foreman foreman = await db.Foremen.FindAsync(id); db.Foremen.Remove(foreman); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public static void Add(Firm firm) { string name = "", surname = "", experience = ""; Console.WriteLine("Input employee data."); Console.Write("Input name: "); name = Console.ReadLine(); Console.Write("Input surname: "); surname = Console.ReadLine(); Console.Write("Input experience: "); experience = Console.ReadLine(); string role = ""; bool check = true; do { Console.WriteLine("Chose, what kind of employees you want to add.\nYour variants: employee, worker, manager, foreman.\n"); role = Console.ReadLine(); switch (role) { case "employee": firm += new Employee { Name = name, Surname = surname, Experience = experience }; check = false; break; case "worker": firm += new Worker { Name = name, Surname = surname, Experience = experience }; check = false; break; case "manager": firm += new Manager { Name = name, Surname = surname, Experience = experience }; check = false; break; case "foreman": firm += new Foreman { Name = name, Surname = surname, Experience = experience }; check = false; break; default: Console.WriteLine("Invalid input. Try next time."); check = true; break; } } while (check); }
static void Main(string[] args) { //var client = new Client(new PepsiFactory()); //client.Run(); var builder = new ConcretBuilder(); var foreman = new Foreman(builder); var home = foreman.Build(); }
public async Task <ActionResult> Edit([Bind(Include = "ForemanID,FirstName,LastName,Cell")] Foreman foreman) { if (ModelState.IsValid) { db.Entry(foreman).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(foreman)); }
public async Task <ActionResult> Edit([Bind(Include = "ForemanID,FirstName,LastName,Cell")] Foreman foreman) { if (ModelState.IsValid) { db.Entry(foreman).State = EntityState.Modified; await db.SaveChangesAsync(); AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " finished editing. New values: " + "Foreman ID: " + foreman.ForemanID + " Foreman First Name: " + foreman.FirstName + " Foreman Last Name: " + foreman.LastName + " Foreman Cell: " + foreman.Cell, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(RedirectToAction("Index")); } return(View(foreman)); }
/// <summary> /// Паттерн используется для пошагового построения сложного продукта /// </summary> /// <param name="args"></param> static void Main(string[] args) { Console.WriteLine("Hello World!"); var builder = new ConcreteBuilder(); var foreman = new Foreman(builder); var house = builder.GetResult(); Console.WriteLine("Дом построен" + house.ToString()); Console.ReadKey(); }
public async Task <ActionResult> Create([Bind(Include = "ForemanID,FirstName,LastName,Cell")] Foreman foreman) { if (ModelState.IsValid) { db.Foremen.Add(foreman); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(foreman)); }
public async Task <ActionResult> Create([Bind(Include = "ForemanID,FirstName,LastName,Cell")] Foreman foreman) { if (ModelState.IsValid) { db.Foremen.Add(foreman); await db.SaveChangesAsync(); AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " created: " + "Foreman ID: " + foreman.ForemanID + " Foreman First Name: " + foreman.FirstName + " Foreman Last Name: " + foreman.LastName + " Foreman Cell: " + foreman.Cell, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(RedirectToAction("Index")); } return(View(foreman)); }
static void Main(string[] args) { // Createing a firm Firm Sony = new Firm(); // Creating employees Employee Albert = new Manager(DateTime.Parse("05/12/2015 08:00:00")) { Name = "Albert", Surname = "Milinkovich", Patronymic = "Ivanovich" }; Employee Anton = new Worker(DateTime.Parse("05/12/2015 08:00:00")) { Name = "Anton", Surname = "Terentiev", Patronymic = "Ivanovich" }; Employee Grisha = new Foreman(DateTime.Parse("05/12/2015 08:00:00")) { Name = "Grisha", Surname = "Zaharchenko", Patronymic = "Ivanovich" }; // Adding employees to the firm Sony += Albert; Sony += Anton; Sony += Grisha; // Delete the employee from the firm Sony -= Anton; // Checking type of employee Console.WriteLine(Sony.HasEmployee(Albert)); Console.WriteLine(Sony.HasEmployee(Anton)); Console.WriteLine(Sony.HasEmployee(Grisha)); // Print all employees Sony.AllEmployees(); // Getting a list of managers List <Employee> managers = new List <Employee>(); managers = Sony.GetByType("Manager"); // Print the data of the list Console.WriteLine("-------------------------------------------------------------"); foreach (Employee emp in managers) { Console.WriteLine(emp.Name + "\t" + emp.Surname + "\t" + emp.Patronymic + "\t" + "Exp: " + emp.Experience); } Console.WriteLine("-------------------------------------------------------------"); // Print count of employees by specific type Console.WriteLine(Sony.CountByType("Manager")); }
// GET: Foremen/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Foreman foreman = await db.Foremen.FindAsync(id); if (foreman == null) { return(HttpNotFound()); } return(View(foreman)); }
internal static void Start(Foreman foreman) { Console.WriteLine("Válasszon az alábbi lehetőségek közül: "); int option = 0; while (option != (int)ForemanEnumMenu.exit) { for (int i = 0; i < ForemanStringMenu.Length; i++) { Console.WriteLine("(" + (i + 1) + ")" + ForemanStringMenu[i]); } Console.Write("Választott opció: "); option = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); switch (option) { case (int)ForemanEnumMenu.listorders: foreman.ListOrders(); break; case (int)ForemanEnumMenu.manageDailyTasks: foreman.ManageDailyTasks(); break; case (int)ForemanEnumMenu.listDeliveryNotes: foreman.ListDeliveryNotes(); break; case (int)ForemanEnumMenu.generateDeliveryNote: foreman.GenerateDeliveryNote(); break; case (int)ForemanEnumMenu.editDeliveryNote: foreman.EditDeliveryNotes(); break; case (int)ForemanEnumMenu.showStorageState: foreman.ShowStorageState(); break; case (int)ForemanEnumMenu.exit: break; default: Console.WriteLine("Ilyen menüpont nem létezik"); break; } } }
// GET: Foremen/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Foreman foreman = await db.Foremen.FindAsync(id); if (foreman == null) { return(HttpNotFound()); } AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " is attempting to edit. Previous values: " + "Foreman ID: " + foreman.ForemanID + " Foreman First Name: " + foreman.FirstName + " Foreman Last Name: " + foreman.LastName + " Foreman Cell: " + foreman.Cell, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(View(foreman)); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { registry = new Registry(); PrimitiveResources.Register(registry); weltschmerz = new Weltschmerz(); Config config = weltschmerz.GetConfig(); config.elevation.max_elevation = MAX_ELEVATION; config.elevation.min_elevation = MIN_ELEVATION; config.map.latitude = LATITUDE; config.map.longitude = LONGITUDE; if (LONGITUDE < 2) { LONGITUDE = 2; } if (LATITUDE < 2) { LATITUDE = 2; } if (MAX_ELEVATION < 2) { MAX_ELEVATION = 2; } Position boundries = new Position(); boundries.x = LONGITUDE; boundries.y = MAX_ELEVATION; boundries.z = LATITUDE; terra = new Terra(boundries, this); GodotSemaphore semaphore1 = new GodotSemaphore(); GodotSemaphore semaphore2 = new GodotSemaphore(); foreman = new Foreman(weltschmerz, registry, terra, LOAD_RADIUS); GameClient client = (GameClient)FindNode("GameClient"); GodotMesher mesher = (GodotMesher)FindNode("GameMesher"); mesher.SetRegistry(registry); client.AddServer(this, mesher); }
public async Task <ActionResult> DeleteConfirmed(int id) { try { Foreman foreman = await db.Foremen.FindAsync(id); Foreman foremanClone = foreman; db.Foremen.Remove(foreman); await db.SaveChangesAsync(); AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " deleted " + foremanClone.FirstName + " " + foremanClone.LastName, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(RedirectToAction("Index")); } catch (DbUpdateException e) { Response.Write("<script language='javascript'>alert(" + e.Message + ")</script>"); logger.Error(e); return(RedirectToAction("Index")); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Foreman) { Foreman foreman = targeted as Foreman; if (hr.IsFilled()) { foreman.Say("This house is ready to go. Here you are!"); hr.GiveDeedTo(from); } else { foreman.Say("OK. Select the Resource Item you want to give me."); from.Target = new SelectResource(hr, foreman); } } else { from.SendMessage("That is not a Foreman!"); } }
public async Task <JsonResult> PutForeman(int id, Foreman foreman) { if (id != foreman.Id) { return(new JsonResult(BadRequest())); } _context.Entry(foreman).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ForemanExists(id)) { return(new JsonResult(NotFound())); } } return(new JsonResult(NoContent())); }
/// <summary> /// Place an object unto the map based on the available areas. /// </summary> /// <param name="constructionData"></param> public void Construct(ConstructionData constructionData) { ConstructionBehaviour constructionBehaviour = Foreman.CreateConstructionBehaviour(constructionData); ObjectBehaviour objectBehaviour = constructionBehaviour.GetComponent <ObjectBehaviour>(); objectBehaviour.Initialize(); bool placed = false; List <Area> splitArea = new List <Area>(); int count = _availableAreas.Count; while (count > 0) { // Generate a random index to check if the areas is ok. int i = Random.Range(0, _availableAreas.Count); if (_availableAreas[i].ObstacleCanFitInTheArea(objectBehaviour.Obstacle, out bool rotate)) { Debug.Log("The obstacle " + objectBehaviour.Obstacle.Size + " can fit in: " + _availableAreas[i] + " with rotation: " + rotate); // If the Obstacle fits if the area is rotated, rotate it. if (rotate) { constructionBehaviour.Rotate(); } // Remove the obstacle from the area. if (Area.RemoveObstacleFromArea(_availableAreas[i], objectBehaviour.Obstacle, ref splitArea)) { Vector3 origin = Map.GetMapOriginInWorldPos(_encampment.Map, _encampment.transform.position); Vector3 objectPos = new Vector3(_availableAreas[i].Origin.x, 0, _availableAreas[i].Origin.y); Vector3 pos = objectPos + origin + (new Vector3(_availableAreas[i].Size.x, 0, _availableAreas[i].Size.y) / 2); // TODO get height at position on terrain. constructionBehaviour.transform.position = pos; if (!_encampment.Map.IsPositionValid(objectBehaviour.Obstacle, _encampment)) { break; } objectBehaviour.RegisterZone(_encampment); constructionBehaviour.StartConstruction(); _availableAreas.Remove(_availableAreas[i]); RegisterAreas(splitArea); placed = true; break; } else { throw new UnityException("It should work."); } } else { Debug.Log("The obstacle " + objectBehaviour.Obstacle.Size + " cannot fit in: " + _availableAreas[i]); } count--; } if (!placed) { Destroy(constructionBehaviour.gameObject); } }
public static void Main(String[] args) { Storage.CooledPlaces = new bool[800]; Storage.NormalPlaces = new bool[3000]; //Order o = new Order(); //o.PalletQuantity = 200; //o.Confirmed = true; //o.ID = 3; //o.Cooled = true; //Storage.Orders = new List<Order>(); //Storage.Orders.Add(o); //OrderController.AddOccupiedPlaces(o.ID, o.PalletQuantity); //o.Print(); SocketClient.StartClient(); //OrderingController.AddOrder(3, "2018-04-04", "2018-05-05", 3, true, "comment"); //OrderController.MakeSomeOrder(); //OrderingController.ListOrders(); //OrderingController.ConfirmOrder(0); //OrderingController.ListOrders(); try { Task <List <Order> > tsResponseOrders = SocketClient.LoadOrders(); OrderController.setOrders(tsResponseOrders.Result); Task <List <Customer> > tsResponseUsers = SocketClient.LoadCustomers(); CustomerController.setCustomers(tsResponseUsers.Result); Task <List <DeliveryNote> > tsResponseDeliveryNotes = SocketClient.LoadDeliveryNotes(); DeliveryNoteController.setDeliveryNotes(tsResponseDeliveryNotes.Result); //int sum=0; //int q; //Console.WriteLine(Storage.CooledCapacity + " " + Storage.NormalCapacity); //foreach(Order o in Storage.Orders) //{ // if (o.Cooled) { // Storage.CooledCapacity -= o.PalletQuantity; // } // else { Storage.NormalCapacity -= o.PalletQuantity; } //} //Console.WriteLine(Storage.CooledCapacity + " " + Storage.NormalCapacity); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } User user = LoginController.Login(); if (user != null) { Type t = user.GetType(); if (t.Equals(typeof(Customer))) { Customer customer = (Customer)user; MenuContoller.Start(customer); } else if (t.Equals(typeof(Dispatcher))) { Dispatcher dispatcher = (Dispatcher)user; MenuContoller.Start(dispatcher); } else if (t.Equals(typeof(Foreman))) { Foreman foreman = (Foreman)user; MenuContoller.Start(foreman); } } //Process process = new Process(); //process.ReadAndWrite(); //SocketClient.Close(); }
public SelectResource(HouseRecipe recipe, Foreman foreman) : base(3, false, TargetFlags.None) { hr = recipe; fm = foreman; }
public void Prepare(Camera camera, LoadMarker marker) { registry = new Registry(); PrimitiveResources.Register(registry); weltschmerz = new Weltschmerz(); Config config = weltschmerz.GetConfig(); config.elevation.max_elevation = MAX_ELEVATION; config.elevation.min_elevation = MIN_ELEVATION; config.map.latitude = LATITUDE; config.map.longitude = LONGITUDE; mesher = (GodotMesher)FindNode("GameMesher"); mesher.SetRegistry(registry); if (LONGITUDE < 2) { LONGITUDE = 2; } if (LATITUDE < 2) { LATITUDE = 2; } if (MAX_ELEVATION < 2) { MAX_ELEVATION = 2; } GD.Print("Using " + GENERATION_THREADS + " threads"); Position boundries = new Position(); boundries.x = LONGITUDE; boundries.y = MAX_ELEVATION; boundries.z = LATITUDE; terra = new Terra(boundries, this); picker = new Picker(terra, mesher); GodotSemaphore semaphore1 = new GodotSemaphore(); GodotSemaphore semaphore2 = new GodotSemaphore(); foreman = new Foreman(weltschmerz, terra, registry, mesher, VIEW_DISTANCE, camera.Fov, GENERATION_THREADS, semaphore1, semaphore2); for (int t = 0; t < GENERATION_THREADS; t++) { Thread thread = new Thread(); thread.Start(this, nameof(Generation)); } for (int t = 0; t < PROCESS_THREADS; t++) { Thread thread = new Thread(); thread.Start(this, nameof(Loading)); } foreman.SetMaterials(registry); marker.Attach(foreman); foreman.AddLoadMarker(marker); }
private void FindWorker_Click(object sender, EventArgs e) { builder = new ConcreteBuilder(); foreman = new Foreman(builder, IdentifyTypeFactory()); }
static void Main(string[] args) { var company = new CompanyModel(); var manager = new Manager() { Name = "Maxim", LastName = "Grynyuk", MiddleName = "Alexandrovich" }; var foreman = new Foreman() { Name = "Alexandr", LastName = "Ivanov", MiddleName = "Segeyevich" }; var worker = new Worker() { Name = "Alexandr", LastName = "Ivanov", MiddleName = "Danilovich" }; company.Employees.Add(manager); company.Employees.Add(foreman); company.Employees.Add(worker); var managers = company.Employees.GetAllEmployees <Manager>(); var foremans = company.Employees.GetAllEmployees <Foreman>(); var workers = company.Employees.GetAllEmployees <Worker>(); int managersCount = company.Employees.GetEmployeesCount <Manager>(); int foremansCount = company.Employees.GetEmployeesCount <Foreman>(); int workersCount = company.Employees.GetEmployeesCount <Worker>(); manager.GiveTask(foreman); foreman.CheckEmployees(); worker.Work(); manager.Work(); foreman.Work(); company.Employees += manager; company.Employees += foreman; company.Employees += worker; if (company.Employees.IsExists(manager)) { WriteLine("Exists"); } if (company.Employees.IsExists(worker)) { WriteLine("Exists"); } if (company.Employees.IsExists(foreman)) { WriteLine("Exists"); } managers.PrintEmployees(); WriteLine($" Managers count : {managersCount}"); foremans.PrintEmployees(); WriteLine($" Foremans count : {foremansCount}"); workers.PrintEmployees(); WriteLine($" Workers count : {workersCount}"); if (company.Employees - manager) { WriteLine("manager deleted"); } if (company.Employees - manager) { WriteLine("Deleted"); } if (company.Employees - foreman) { WriteLine("foreman deleted"); } if (company.Employees - worker) { WriteLine("worker deleted"); } ReadLine(); }
public void Attach(Foreman foreman) { this.foreman = foreman; }