public static void SetUpMocks()
        {
            _settings = new Mock<ISettings>();
            _settings.Setup(x => x.MarketFiltersDirectory).Returns(".");
            _settings.Setup(x => x.EventStateFilePath).Returns(".");
            _settings.Setup(x => x.ProcessingLockTimeOutInSecs).Returns(10);
            
            _plugin = new Mock<IAdapterPlugin>();

            _resource = new Mock<IResourceFacade>();
            _resource.Setup(r => r.Sport).Returns("FantasyFootball");
            _resource.Setup(r => r.StartStreaming()).Raises(r => r.StreamConnected += null, new EventArgs());
            _objectProvider = new Mock <IObjectProvider<Dictionary<string, FixtureOverview>>>();
            
            var stateManager = new StateManager(new Mock<ISettings>().Object,_plugin.Object);

            _supervisor = new Supervisor(_settings.Object,_objectProvider.Object);
            _supervisor.StateManager = stateManager;

            var supervisorService = new Mock<ISupervisorService>();
            supervisorService.Setup(x => x.StreamingService).Returns(new Mock<ISupervisorStreamingService>().Object);


            _supervisor.Service = supervisorService.Object;
            _supervisor.Proxy = new Mock<ISupervisorProxy>().Object;
            
            new SuspensionManager(stateManager, _plugin.Object);

        }
Exemplo n.º 2
0
 // Use this for initialization
 void Awake()
 {
     sandwiches = new List<GameObject>();
     foodInWater = new Queue<GameObject>();
     horn = GameObject.FindGameObjectWithTag("Horn").GetComponent<Horn>();
     if (onDuty == null)
     {
         onDuty = this;
     }
     orderPad = GameObject.FindGameObjectWithTag("OrderPad").GetComponent<Text>();
 }
        public StepsContext()
        {
            DependencyResolver.Reset();
            DependencyResolver.Initialize();

            Supervisor = DependencyResolver.Get<Supervisor>();
            SubscriptionBus = DependencyResolver.Get<ISubscriptionBus>();
            SendingBus = DependencyResolver.Get<ISendingBus>();
            Launcher = DependencyResolver.Get<DispatcherLauncher>();

            WorkDispatchersOffline = new List<DispatcherId>();
            WorkDispatchersOnline = new List<DispatcherId>();

            ClearAmqpResources();
        }
Exemplo n.º 4
0
        private static void Main()
        {
            var worker = new Worker("Worker Ivan", 5);
            var worker2 = new Worker("Worker Kiko", 3);
            var supervisorA = new Supervisor("Supervisor Atanas", 6);
            var supervisorB = new Supervisor("Supervisor Branimir", 7);
            var supervisorC = new Supervisor("Supervisor Ceco", 8);

            // setup relationships
            supervisorA.AddSubordinate(worker);
            supervisorB.AddSubordinate(supervisorA);
            supervisorC.AddSubordinate(supervisorB);
            supervisorC.AddSubordinate(worker2);

            supervisorC.ShowHappiness();
        }
Exemplo n.º 5
0
Arquivo: Program.cs Projeto: GAlex7/TA
        public static void Main()
        {
            Worker tom = new Worker("Worker Tom", 0);
            Supervisor mary = new Supervisor("Supervisor Mary", 50);
            Supervisor jerry = new Supervisor("Supervisor Jerry", 100);
            Supervisor bob = new Supervisor("Supervisor Bob", 50);
            Worker jimmy = new Worker("Worker Jimmy", 0);

            // set up the relationships
            mary.AddSubordinate(tom); // Tom works for Mary
            jerry.AddSubordinate(mary); // Mary works for Jerry
            jerry.AddSubordinate(bob); // Bob works for Jerry
            bob.AddSubordinate(jimmy); // Jimmy works for Bob

            // Jerry shows his happiness and asks everyone else to do the same
            jerry.ShowHappiness();
        }
        public StepsContext()
        {
            DependencyResolver.Reset();
            DependencyResolver.Initialize();

            DispatcherLifeSpan = new DispatcherLifeSpan
            {
                Mode = DispatcherLifeSpanMode.UntilTimedOut,
                Timeout = TimeSpan.FromSeconds(15)
            };
            BootstrapSettings = new BootstrapSettings();

            WorkDispatchersOnline = new List<DispatcherId>();
            WorkDispatchersRestarted = new List<DispatcherId>();

            SubscriptionBus = DependencyResolver.Get<ISubscriptionBus>();
            SendingBus = DependencyResolver.Get<ISendingBus>();
            Supervisor = DependencyResolver.Get<Supervisor>();

            ClearAmqpResources();
        }
Exemplo n.º 7
0
        public Supervisor readSupervisor(Guid id)
        {
            var retList = new List <Supervisor>();
            var retVal  = new Supervisor();

            try {
                using (var context = new ArchaeologyContext()) {
                    retList = context.Supervisor
                              .Include(supervisor => supervisor.Team)
                              .Where(supervisor => supervisor.Id == id)
                              .ToList();
                }
            }
            catch (Exception ex) {
                throw new Exception(ex.Message, ex.InnerException);
            }
            if (retList.Count > 0)
            {
                retVal = retList[0];
            }
            return(retVal);
        }
Exemplo n.º 8
0
 public List <_Meeting> GetMeetingsByThesisId(long?id)
 {
     using (var db = new TESDataContext())
     {
         var log = (from t in db.Thesis
                    join m in db.Meetings on t.student_id equals m.student_id
                    where t.thesis_id == id
                    select new _Meeting
         {
             MeetingId = m.meeting_id,
             MeetingMin = m.meeting_min,
             MeetingTime = m.meeting_time,
             Supervisor = Supervisor.GetById(m.supervisor_id),
             Student = Student.GetById(m.student_id)
         }).ToList();
         if (log != null)
         {
             return(log);
         }
         return(null);
     }
 }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            Supervisor ITManager = new Supervisor();

            //ISupervisor ITManager = new Supervisor();
            //ISupervisor ITManager = new Executive();
            ITManager.FirstName = "Mia";
            ITManager.LastName  = "Terry";
            ITManager.CalculateSalary(6);

            //Employee employee = new Employee();
            //ISupervisee employee = new Employee();
            Employee employee = new Supervisor();

            employee.FirstName = "Sue";
            employee.LastName  = "Cameron";
            employee.CalculateSalary(4);
            employee.AssignSupervisor(ITManager);

            Console.WriteLine($"{ employee.FirstName }'s salary is ${ employee.Salary }/Hour with supervisor { ITManager.FirstName }");
            Console.ReadLine();
        }
Exemplo n.º 10
0
        public async Task AddAgentWithManagerAndStop()
        {
            var supervisor = new Supervisor();

            var manager = new Supervisor();

            supervisor.Add(manager);

            var provocateur = new Agent();

            manager.Add(provocateur);

            manager.SetReady();
            supervisor.SetReady();
            provocateur.SetReady();

            await supervisor.Ready;

            await supervisor.Stop();

            await supervisor.Completed;
        }
Exemplo n.º 11
0
    private int[] counter;    //list of int to play the animation of the bar-> it goes bigger relatively to the player's score

    // Use this for initialization
    void Start()
    {
        textJ1 = GameObject.Find("scoreJ1").GetComponent <Text> ();
        textJ2 = GameObject.Find("scoreJ2").GetComponent <Text> ();
        textJ3 = GameObject.Find("scoreJ3").GetComponent <Text> ();
        textJ4 = GameObject.Find("scoreJ4").GetComponent <Text> ();

        bar1 = GameObject.Find("barJ1");
        bar2 = GameObject.Find("barJ2");
        bar3 = GameObject.Find("barJ3");
        bar4 = GameObject.Find("barJ4");

        supervisor = GameObject.Find("Supervisor").GetComponent <Supervisor> ();
        counter    = new int[supervisor.playerNbr];

        J1 = GameObject.Find("ImageJ1").GetComponent <Image> ();
        J2 = GameObject.Find("ImageJ2").GetComponent <Image> ();
        J3 = GameObject.Find("ImageJ3").GetComponent <Image> ();
        J4 = GameObject.Find("ImageJ4").GetComponent <Image> ();

        J1.sprite = supervisor.listOfAvatar [0].GetComponent <SpriteRenderer> ().sprite;
        J2.sprite = supervisor.listOfAvatar [1].GetComponent <SpriteRenderer> ().sprite;
        if (supervisor.playerNbr >= 3)
        {
            J3.sprite = supervisor.listOfAvatar [2].GetComponent <SpriteRenderer> ().sprite;
        }
        else
        {
            J3.gameObject.SetActive(false);
        }
        if (supervisor.playerNbr == 4)
        {
            J4.sprite = supervisor.listOfAvatar [3].GetComponent <SpriteRenderer> ().sprite;
        }
        else
        {
            J4.gameObject.SetActive(false);
        }
    }
Exemplo n.º 12
0
    public List <Supervisor> Read(string conString, string tableName)
    {
        SqlConnection     con = null;
        List <Supervisor> lc  = new List <Supervisor>();

        try
        {
            con = connect(conString); // create a connection to the database using the connection String defined in the web config file

            String     selectSTR = "SELECT * FROM " + tableName;
            SqlCommand cmd       = new SqlCommand(selectSTR, con);

            // get a reader
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); // CommandBehavior.CloseConnection: the connection will be closed after reading has reached the end

            while (dr.Read())
            {   // Read till the end of the data into a row
                Supervisor s = new Supervisor();
                s.sup_id    = Convert.ToInt32(dr["sup_id"]);
                s.sup_name  = (string)dr["sup_name"];
                s.sup_phone = (string)dr["sup_phone"];
                lc.Add(s);
            }

            return(lc);
        }
        catch (Exception ex)
        {
            // write to log
            throw (ex);
        }
        finally
        {
            if (con != null)
            {
                con.Close();
            }
        }
    }
Exemplo n.º 13
0
    static void Main(string[] args)
    {
        Supervisor Jerry = new Supervisor("Jerry", 7);
        Supervisor Marry = new Supervisor("Mary", 6);
        Supervisor Bob = new Supervisor("Bob", 9);
        Worker Jimmy = new Worker("Jimmy", 8);
        Worker Tom = new Worker("Tom", 5);
        Worker Alice = new Worker("Alice", 6);

        // Set up the relationships
        Jerry.AddSubordinate(Marry);    // Mary works for Jerry
        Jerry.AddSubordinate(Bob);      // Bob works for Jerry
        Marry.AddSubordinate(Tom);      // Tom works for Marry
        Bob.AddSubordinate(Jimmy);      // Jimmy works for Bob
        Bob.AddSubordinate(Alice);      // Alice works for Bob

        // Jerry shows his happiness and asks everyone else to do the same
        if (Jerry is IEmployee)
            (Jerry as IEmployee).ShowHappiness();

        Console.ReadKey();
    }
Exemplo n.º 14
0
        public async Task <IActionResult> Approve()
        {
            List <string>      emailList   = new List <string>();
            List <SalesTarget> salesTarget = await _context.SalesTarget.Where(x => x.Status.Equals(StatusList.pending)).ToListAsync();

            if (salesTarget == null)
            {
                return(NotFound());
            }
            else
            {
                foreach (var item in salesTarget)
                {
                    item.Status = StatusList.approved;
                    _context.SalesTarget.Update(item);
                    _context.SaveChanges();
                    Salesman   salesman   = _context.Salesman.Where(x => x.SalesmanId.Equals(item.SalesmanId)).FirstOrDefault();
                    Supervisor supervisor = _context.Supervisor.Where(x => x.SupervisorId.Equals(salesman.SupervisorId)).FirstOrDefault();

                    var match = emailList.FirstOrDefault(x => x.Contains(supervisor.Email));
                    if (match == null)
                    {
                        emailList.Add(supervisor.Email);
                    }
                    match = emailList.FirstOrDefault(x => x.Contains(salesman.Email));
                    if (match == null)
                    {
                        emailList.Add(salesman.Email);
                    }
                }
                foreach (var item in emailList)
                {
                    await _emailSender.SendEmailConfirmationOnTargetAsync(item);
                }

                return(Ok(salesTarget));
            }
        }
        /// <summary>
        /// Metodo para buscar supervisor segun cuil.
        /// </summary>
        /// <param name="cuil"></param>
        /// <returns></returns>
        public Supervisor GetSupervisores(int cuil)
        {
            //Variables auxiliares
            Supervisor nuevoSupervisor = null;
            int        idSupervisor;
            string     nombre;
            string     apellido;
            string     direccion;
            string     telefono;

            using (conexion.retornarCN())
            {
                try
                {
                    conexion.abrir();
                    cmd = new MySqlCommand("Select * from supervisores where cuil=@cuil", conexion.retornarCN());
                    cmd.Parameters.AddWithValue("@cuil", cuil);
                    dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        idSupervisor    = Convert.ToInt32(dr[0]);
                        nombre          = dr[2].ToString();
                        apellido        = dr[3].ToString();
                        direccion       = dr[4].ToString();
                        telefono        = dr[5].ToString();
                        nuevoSupervisor = new Supervisor(idSupervisor, cuil, nombre, apellido, direccion, telefono);
                    }
                    dr.Close();
                    conexion.cerrar();
                }
                catch (Exception ex)
                {
                    Logger.Error("Error Buscar Supervisor {0}", ex.ToString());
                    MessageBox.Show("Error en la consulta");
                }
            }
            return(nuevoSupervisor);
        }
Exemplo n.º 16
0
        public static void Main(String[] args)
        {
            Gerente    gerente    = new Gerente("Fabio", 35, 10000);
            Supervisor supervisor = new Supervisor("Fernando", 32, 5000);
            Vendedor   vendedor   = new Vendedor("Vault", 27, 2000);

            Console.WriteLine("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
            Console.WriteLine("░Nome gerente: " + gerente.nome + "            ░" + "\n" + "░Idade gerente: " + gerente.idade + "              ░" + "\n" + "░Gerente salario: " + gerente.bonificacao() + "         " + "░");
            Console.WriteLine("░───────────────────────────────░");
            Console.WriteLine("░Nome supervisor: " + supervisor.nome + "      ░" + "\n" + "░Idade supervisor: " + supervisor.idade + "           ░" + "\n" + "░supervisor salario: " + supervisor.bonificacao() + "      " + "░");
            Console.WriteLine("░───────────────────────────────░");
            Console.WriteLine("░Nome vendedor: " + vendedor.nome + "           ░" + "\n" + "░Idade vendedor: " + vendedor.idade + "             ░" + "\n" + "░vendedor salario: " + vendedor.bonificacao() + "         ░");
            Console.WriteLine("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");

            Console.WriteLine("                         ______                    ");
            Console.WriteLine(" _________        .---------------" + "---.              ");
            Console.WriteLine(":______.-':      :  .--------------.  :             ");
            Console.WriteLine("| ______  |      | :                : |             ");
            Console.WriteLine("| ______  |      | :                : |             ");
            Console.WriteLine("|:______B:|      | |       GFT      | |             ");
            Console.WriteLine("|:______B:|      | |                | |             ");
            Console.WriteLine("|:______B:|      | |                | |             ");
            Console.WriteLine("|         |      | |                | |             ");
            Console.WriteLine("|:_____:  |      | |                | |             ");
            Console.WriteLine("|    ==   |      | :                : |             ");
            Console.WriteLine("|       O |      :  '--------------'  :             ");
            Console.WriteLine("|       o |      :'---...______...---'              ");

            Console.WriteLine("|'-.____o_|   '-.   '-...______...-'  `-._          ");
            Console.WriteLine(":_________:      `.____________________   `-.___.-. ");
            Console.WriteLine("                 .'.eeeeeeeeeeeeeeeeee.'.      :___:");
            Console.WriteLine("               .'.eeeeeeeeeeeeeeeeeeeeee.'.         ");
            Console.WriteLine("              :____________________________:");



            Console.ReadLine();
        }
Exemplo n.º 17
0
        public ActionResult ManagerApproval()
        {
            //setting up ad authentication by parsing out Domain Name
            String uName = User.Identity.Name;

            int index = uName.IndexOf("\\", 0);

            string adName = User.Identity.Name.Substring(index + 1);



            Employee employee  = new Employee();
            XElement xEmployee = employee.GPQue();
            IEnumerable <Employee> managerList = employee.MakeModel(xEmployee);

            Employee manager = (from e in managerList
                                where e.AdName == adName
                                select e).FirstOrDefault();


            Supervisor supervisor = (from s in gpdb.Supervisors
                                     where s.EmployeeId == manager.EmployeeID
                                     select s).FirstOrDefault();

            // ViewBag.Supervisor = supervisor.EmployeeId.ToString();

            //the next step after the underlings que is to que the expense reports now that we have the underlings

            IEnumerable <Employee> underlings = from e in managerList
                                                where e.SupervisorCode == "ACCT3" // supervisor.SupervisorCode
                                                select e;

            ViewBag.Underlings = underlings;



            return(View(manager));
        }
Exemplo n.º 18
0
        Supervisor AgregarSupervisores(Supervisor ptr, String nombre, String cargo, long id, int pass)
        {
            Supervisor p = new Supervisor();

            p.nombre = nombre;
            p.cargo  = cargo;
            p.id     = id;
            p.pass   = pass;
            if (ptr == null)
            {
                ptr = p;
            }
            else
            {
                Supervisor q = ptr;
                while (q.link != null)
                {
                    q = q.link;
                }
                q.link = p;
            }
            return(ptr);
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("\nWelcome to Citibank");

            Clerk      clerk      = new Clerk("Clerk 1");
            Supervisor supervisor = new Supervisor("Supervisor 1");
            Manager    manager    = new Manager("Manager 1");

            clerk.SetNext(supervisor);
            supervisor.SetNext(manager);

            State account  = new State("Ricky Ricon Bank account", 42069.69);
            State account2 = new State("Student Bank account", 0.69);
            State account3 = new State("Fer's Bank account", 123.45);

            Console.WriteLine("Chain: Clerk > Supervisor > Manager\n");
            Console.WriteLine($"Approached {clerk.name}. {clerk.Handle(1000, account)}");
            Console.WriteLine($"Approached {clerk.name}. {clerk.Handle(1000, account2)}");
            Console.WriteLine($"Approached {clerk.name}. {clerk.Handle(2000, account2)}");
            Console.WriteLine($"Approached {clerk.name}. {clerk.Handle(5000, account3)}");
            Console.WriteLine($"Approached {clerk.name}. {clerk.Handle(15000)}");
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            LeaveRequest request = new LeaveRequest {
                Employee = "john", LeaveDays = 34
            };

            ILeaveRequestHandler supervisor = new Supervisor();
            ILeaveRequestHandler manager    = new ProjectManager();
            ILeaveRequestHandler hr         = new Hr();


            // set linking supervisor -- manager -- hr // 2
            supervisor.NextHandler = manager;
            manager.NextHandler    = hr;

            supervisor.HandleRequest(request);
            request.LeaveDays = 14;
            supervisor.HandleRequest(request);
            request.LeaveDays = 4;
            supervisor.HandleRequest(request);

            Console.ReadLine();
        }
Exemplo n.º 21
0
        public ViewWorkshiftsForm(User currentUser)
        {
            InitializeComponent();

            this.BackColor           = ApplicationColors.PrimaryDark;
            this.cbWorkers.BackColor = Color.White;
            this.cbWorkers.ForeColor = ApplicationColors.PrimaryDark;
            this.checkBox.BackColor  = ApplicationColors.PrimaryDark;
            this.panel.Visible       = false;

            dateTimePicker.CustomFormat = "yyyy-MM-dd";
            dateTimePicker.Format       = DateTimePickerFormat.Custom;

            this.workShifts  = new List <WorkShift>();
            this.currentUser = currentUser;

            this.workers = Worker.GetAll();
            if (currentUser.Role == "Supervisor")
            {
                long supervisorDepartment = Supervisor.GetByUserId(currentUser.Id).DepartmentId;
                this.workers = this.workers.FindAll(w => w.DepartmentId == supervisorDepartment);
            }
        }
Exemplo n.º 22
0
 private void AddPropertySupervisor(
     string serie,
     string company,
     string model,
     string colour,
     decimal price,
     string remarks,
     Supervisor supervisor,
     PropertyType propertyType)
 {
     _context.PropertySupervisors.Add(new PropertySupervisor
     {
         Serie        = serie,
         Company      = company,
         Model        = model,
         Colour       = colour,
         Price        = price,
         IsAvailable  = true,
         Remarks      = remarks,
         PropertyType = propertyType,
         Supervisor   = supervisor,
     });
 }
Exemplo n.º 23
0
        public async Task Should_stop_and_complete_with_an_agent()
        {
            var supervisor = new Supervisor();

            var provocateur = new Agent();

            provocateur.SetReady();
            supervisor.SetReady();

            supervisor.Add(provocateur);

            Console.WriteLine("Waiting for Ready...");

            await supervisor.Ready.UntilCompletedOrTimeout(TimeSpan.FromSeconds(5));

            Console.WriteLine("Stopping");

            await supervisor.Stop().UntilCompletedOrTimeout(TimeSpan.FromSeconds(5));

            Console.WriteLine("Waiting for Completed...");

            await supervisor.Completed.UntilCompletedOrTimeout(TimeSpan.FromSeconds(5));
        }
Exemplo n.º 24
0
        public static void Main(string[] args)
        {
            InvariantArgs = args.Select(a => a.ToUpperInvariant()).ToList().AsReadOnly();

            isFirst = new Mutex(false, FirstMutexName, out bool createdNewMutex);
            if (!createdNewMutex || !isFirst.WaitOne(100))
            {
                signal.Set();
                return;
            }

            Supervisor.Initialize().Wait();

            try
            {
                var app = BuildAvaloniaApp()
                          .SetupWithoutStarting()
                          .Instance;

                if (!InvariantArgs.Contains("SILENT"))
                {
                    ShowMainWindow();
                }
                else
                {
                    _ = Supervisor.StartAsync();
                }

                RunSignalWaitingThread();

                app.Run(appShutdownToken.Token);
            }
            finally
            {
                isFirst.ReleaseMutex();
            }
        }
Exemplo n.º 25
0
        public async Task <ActionResult> AddSupervisor(string lastName, int?runwayId)
        {
            if (runwayId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (lastName == null)
            {
                ModelState.AddModelError("lastName", "Nie wybrałeś pracownika");
            }
            if (ModelState.IsValid)
            {
                Supervisor supervisor = db.Supervisors.Where(x => x.lastName == lastName).FirstOrDefault();
                Runway     runway     = await db.Runways.FindAsync(runwayId);

                runway.Supervisors.Add(supervisor);
                supervisor.Runways.Add(runway);
                db.Entry(runway).State     = EntityState.Modified;
                db.Entry(supervisor).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Details", new { id = runway.id }));
            }
            else
            {
                Runway runway = await db.Runways.FindAsync(runwayId);

                var runwaySupervisors = runway.Supervisors.Select(x => x.id).ToList();
                IEnumerable <Supervisor> availableSupervisors = db.Supervisors.
                                                                Where(x => !runwaySupervisors.
                                                                      Contains(x.id));


                ViewBag.lastName = new SelectList(availableSupervisors, "lastName", "lastName");
                return(View(runway));
            }
        }
 protected void Calcular_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.rbtnEncargado.Checked == true || this.rbtnSupervisor.Checked == true)
         {
             Empleado empleado;
             if (rbtnEncargado.Checked == true)
             {
                 empleado = new Encargado();
             }
             else
             {
                 empleado = new Supervisor(ddlCategoria.SelectedValue.ToString());
                 if (this.ddlCategoria.Text == "")
                 {
                     this.lblCategoria.Text = "No ha especificado la categoria";
                 }
             }
             empleado.Nombre          = this.tbxNombre.Text;
             empleado.Apellido        = this.tbxApellido.Text;
             empleado.AñoIngreso      = int.Parse(this.tbxAñoIngreso.Text);
             empleado.SueldoBase      = int.Parse(this.tbxSueldoBase.Text);
             empleado.HorasTrabajadas = int.Parse(this.tbxHsTrabajadas.Text);
             empleado.PagoPorHora     = int.Parse(this.tbxPrecioHora.Text);
             tbxSueldo.Text           = string.Format("El sueldo de {0} {1} es de $ {2}", this.tbxNombre.Text, this.tbxApellido.Text, empleado.CalculaSueldo());
         }
         else
         {
             this.lblTipoEmpleado.Text = "No ha especificado el tipo de empleado";
         }
     }
     catch (FormatException)
     {
         this.lblError.Text = "Alguno de los campos tiene un tipo erroneo";
     }
 }
Exemplo n.º 27
0
        private void CreateModules()
        {
            _logger = new ConsoleLogger();

            _client = new DiscordSocketClient(new DiscordSocketConfig()
            {
                AlwaysDownloadUsers = true,
                MessageCacheSize    = 200,
            });

            _client.Log += log =>
            {
                _logger.Log(log.ToString());
                return(Task.CompletedTask);
            };

            var tmpCnf = _config.Get();

            _shindenClient = new ShindenClient(new Auth(tmpCnf.Shinden.Token,
                                                        tmpCnf.Shinden.UserAgent, tmpCnf.Shinden.Marmolade), _logger);

            _helper     = new Helper(_config);
            _img        = new ImageProcessing(_shindenClient);
            _deleted    = new DeletedLog(_client, _config);
            _chaos      = new Chaos(_client, _config, _logger);
            _executor   = new SynchronizedExecutor(_logger);
            _mod        = new Moderator(_logger, _config, _client);
            _waifu      = new Waifu(_img, _shindenClient, _config);
            _daemon     = new Daemonizer(_client, _logger, _config);
            _sessions   = new SessionManager(_client, _executor, _logger);
            _supervisor = new Supervisor(_client, _config, _logger, _mod);
            _greeting   = new Greeting(_client, _logger, _config, _executor);
            _exp        = new ExperienceManager(_client, _executor, _config, _img);
            _spawn      = new Spawn(_client, _executor, _waifu, _config, _logger);
            _handler    = new CommandHandler(_client, _config, _logger, _executor);
            _profile    = new Profile(_client, _shindenClient, _img, _logger, _config);
        }
Exemplo n.º 28
0
    static void Main(string[] args)
    {
        Supervisor Jerry = new Supervisor("Jerry", 7);
        Supervisor Marry = new Supervisor("Mary", 6);
        Supervisor Bob   = new Supervisor("Bob", 9);
        Worker     Jimmy = new Worker("Jimmy", 8);
        Worker     Tom   = new Worker("Tom", 5);
        Worker     Alice = new Worker("Alice", 6);

        // Set up the relationships
        Jerry.AddSubordinate(Marry);    // Mary works for Jerry
        Jerry.AddSubordinate(Bob);      // Bob works for Jerry
        Marry.AddSubordinate(Tom);      // Tom works for Marry
        Bob.AddSubordinate(Jimmy);      // Jimmy works for Bob
        Bob.AddSubordinate(Alice);      // Alice works for Bob

        // Jerry shows his happiness and asks everyone else to do the same
        if (Jerry is IEmployee)
        {
            (Jerry as IEmployee).ShowHappiness();
        }

        Console.ReadKey();
    }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Supervisor Porter = new Supervisor("Porter", "k24lk32");
            Manager    Mark   = new Manager("Mark", "f23kh4kj32", 1111);

            List <Employee> Employees = new List <Employee>()
            {
                Porter,
                Mark
            };

            Employees.ForEach(e =>
            {
                System.Console.Write(e.Name + ": ");
                e.Discount();
                if (e is Manager)
                {
                    Manager m = (Manager)e;
                    m.Delegate();
                }
            });
        }
Exemplo n.º 30
0
 // in this function we will check if this employee can
 // process or some other action is needed
 void HR_onLeaveApplied(Employee e, Leave l)
 {
     // check if we can process this request
     if (l.NumberOfDays < MAX_LEAVES_CAN_APPROVE)
     {
         // process it on our level only
         ApproveLeave(l);
     }
     else
     {
         // if we cant process pass on to the supervisor
         // so that he can process
         if (Supervisor != null)
         {
             Supervisor.LeaveApplied(this, l);
         }
         else
         {
             // There is no one up in hierarchy so lets
             // tell the user what he needs to do now
             Console.WriteLine("Leave application suspended, Please contact HR");
         }
     }
 }
Exemplo n.º 31
0
 public CancelaVendaRequest(
     Rede rede,
     DataFiscal dataFiscal,
     HoraFiscal horaFiscal,
     CupomFiscal cupomFiscal,
     CodigoDoCliente codigoDoCliente,
     Operador operador,
     Supervisor supervisor,
     TipoDeTerminal terminal,
     TipoOperacaoDeVenda tipoOperacaoDeVenda,
     NumeroDoCartao numeroDoCartao,
     Trilha1 trilha1,
     Trilha2 trilha2,
     NSUHost nsuHost,
     Data data,
     CodigoDeSeguranca codigoDeSeguranca,
     Valor valor,
     RG identidade,
     CamposVariaveisComPrefixo camposVariaveis
     )
     : base(rede, dataFiscal, horaFiscal, cupomFiscal, codigoDoCliente, operador, supervisor, terminal, tipoOperacaoDeVenda,
            numeroDoCartao, trilha1, trilha2, nsuHost, data, codigoDeSeguranca, valor, identidade, camposVariaveis)
 {
 }
Exemplo n.º 32
0
        private void CreateEmbedService()
        {
            if (embedServiceSupervisor != null)
            {
                return; // TODO Exception
            }
            var exe = GetServiceExeFileOrNull();

            if (exe == null)
            {
                logger.Error("Не удалось найти путь к исполняемому файлу сервиса");
                return;
            }

            logger.Error($"Файл сервиса найден: {exe}");


            var parent = Process.GetCurrentProcess();

            embedServiceSupervisor = new Supervisor(new ProcessStartInfo
            {
                FileName        = exe,
                Arguments       = $"--parent-pid {parent.Id}",
                CreateNoWindow  = true,
                UseShellExecute = true,
                WindowStyle     = ProcessWindowStyle.Hidden
            });
            embedServiceSupervisor.StateChanged += (sender, args) =>
            {
                if (args.IsRejectedByUser)
                {
                    StateChanged?.Invoke(this, new ServiceStateChangedEventArgs(false));
                }
            };
            embedServiceSupervisor.Start();
        }
Exemplo n.º 33
0
        public async Task <IActionResult> updateSupervisor([FromRoute] string id, [FromBody] Supervisor supervisor)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var findSupervisor = _db.supervisors.FirstOrDefault(p => p.Id == id);

            if (findSupervisor == null)
            {
                return(NotFound());
            }
            findSupervisor.fullName         = supervisor.fullName;
            findSupervisor.UserName         = supervisor.UserName;
            findSupervisor.Email            = supervisor.Email;
            findSupervisor.PhoneNumber      = supervisor.PhoneNumber;
            findSupervisor.program          = supervisor.program;
            findSupervisor.designation      = supervisor.designation;
            findSupervisor.department       = supervisor.department;
            _db.Entry(findSupervisor).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            await _db.SaveChangesAsync();

            return(Ok(new JsonResult("Supervisor with id: " + id + "is Updated")));
        }
Exemplo n.º 34
0
        private void CreateSupervisor(Configuration configuration)
        {
            var products    = _ganttContext.GptblMaterial.Where(x => x.Info1 == "Product").ToList();
            var initialTime = configuration.GetOption <EstimatedThroughPut>().Value;

            var estimatedThroughPuts = products.Select(a => new FSetEstimatedThroughputTime(int.Parse(a.MaterialId), initialTime, a.Name))
                                       .ToList();

            ActorPaths.SetSupervisorAgent(systemAgent: _simulation.ActorSystem
                                          .ActorOf(props: Supervisor.Props(actorPaths: ActorPaths,
                                                                           time: 0,
                                                                           debug: _debugAgents,
                                                                           principal: ActorRefs.Nobody),
                                                   name: "Supervisor"));

            var behave = Agents.SupervisorAgent.Behaviour.Factory.Central(
                ganttContext: _ganttContext,
                productionDomainContext: _productionContext,
                messageHub: _messageHub,
                configuration: configuration,
                estimatedThroughputTimes: estimatedThroughPuts);

            _simulation.SimulationContext.Tell(message: BasicInstruction.Initialize.Create(target: ActorPaths.SystemAgent.Ref, message: behave));
        }
        protected Task <PersistentBenchmarkMsgs.Finished>[] StoreAllEvents()
        {
            for (int i = 0; i < PersistedMessageCount; i++)
            {
                for (int j = 0; j < PersistentActorCount; j++)
                {
                    Supervisor.Tell(new BenchmarkActorMessage(PersistentActorIds[j], new PersistentBenchmarkMsgs.Store(1)));
                }
            }

            var finished = new Task <PersistentBenchmarkMsgs.Finished> [PersistentActorCount];

            for (int i = 0; i < PersistentActorCount; i++)
            {
                var task = Supervisor
                           .Ask <PersistentBenchmarkMsgs.Finished>(new BenchmarkActorMessage(PersistentActorIds[i], PersistentBenchmarkMsgs.Finish.Instance), MaxTimeout);

                finished[i] = task;
            }

            Task.WaitAll(finished.Cast <Task>().ToArray());

            return(finished);
        }
Exemplo n.º 36
0
        public void TestGetSupervisorById()
        {
            var serv       = new SupervisorService();
            var supervisor = new Supervisor()
            {
                Name    = "Supervisor Studson",
                Address = "SupervisorRoad",
                Email   = "*****@*****.**",
                Phone   = 12345678
            };
            var supervisor2 = new Supervisor()
            {
                Name    = "Supervisor Studson2",
                Address = "SupervisorRoad2",
                Email   = "[email protected]",
                Phone   = 12345678
            };

            serv.Create(supervisor);
            serv.Create(supervisor2);
            var stud = serv.GetById(2);

            Assert.AreEqual("Supervisor Studson2", stud.Name);
        }
        Supervisor CreateConsumerSupervisor(SessionContext context, ActiveMqConsumer[] actualConsumers)
        {
            var supervisor = new Supervisor();

            foreach (var consumer in actualConsumers)
            {
                supervisor.Add(consumer);
            }

            Add(supervisor);

            void HandleException(Exception exception)
            {
                supervisor.Stop(exception.Message);
            }

            context.ConnectionContext.Connection.ExceptionListener += HandleException;

            supervisor.SetReady();

            supervisor.Completed.ContinueWith(task => context.ConnectionContext.Connection.ExceptionListener -= HandleException);

            return(supervisor);
        }
Exemplo n.º 38
0
 /// <summary>
 /// Main method which initializes the robot, and starts
 /// it running. Do not modify.
 /// </summary>
 public static void Main()
 {
     // Initialize robot
     Robot robot = new Robot("1", "COM4");
     Debug.Print("Code loaded successfully!");
     Supervisor supervisor = new Supervisor(new StudentCode(robot));
     supervisor.RunCode();
 }
Exemplo n.º 39
0
    static void Main(string[] args)
    {
        Worker a = new Worker("Worker Tom", 5);
        Supervisor b = new Supervisor("Supervisor Mary", 6);
        Supervisor c = new Supervisor("Supervisor Jerry", 7);
        Supervisor d = new Supervisor("Supervisor Bob", 9);
        Worker e = new Worker("Worker Jimmy", 8);

        //set up the relationships
        b.AddSubordinate(a); //Tom works for Mary
        c.AddSubordinate(b); //Mary works for Jerry
        c.AddSubordinate(d); //Bob works for Jerry
        d.AddSubordinate(e); //Jimmy works for Bob

        //Jerry shows his happiness and asks everyone else to do the same
        if (c is IEmployee)
        {
            (c as IEmployee).ShowHappiness();
        }
    }
Exemplo n.º 40
0
    protected void Page_Load(object sender, EventArgs e)
    {
        s=new soapservices();
        try
        {
            //assigns variables session values
            user_id = Int32.Parse(Session["user_id"].ToString());
            user_email = Session["user_email"].ToString();
            user_type = Int32.Parse(Session["user_type"].ToString());

            ClientScript.RegisterStartupScript(this.GetType(), "onclick",
               "<script language=javascript> user_type="+user_type+";</script>");

            //load profile details
            if (!Page.IsPostBack)
            {
              //  Load all user details
                user = s.LoadProfile(user_id);
                txtNational_ID.Text = user.NATIONAL_ID;
                txtScreenName.Text = user.USER_NAME;
                txtDOB.Text = user.USER_DOB;
                txtEmail.Text = user.USER_EMAIL;
                txtGender.Text = user.USER_GENDER;
                txtPhoneNumber.Text = user.PHONE_NUMBER;

                //load student details if the user is a student
                if (user_type == 0)
                {
                    st = s.LoadStudent(user_id);

                    txtRegno.Text = st.REG_NUMBER;
                    txtcourse.Text = st.COURSE;
                    txtcosYear.Text = st.YEAR_STARTED;
                }
                    //load supervisor details if the user is a aupervisor with user type=1
                else
                {
                    sup=s.GetSupervisor(user_id);
                    txtprofession.Text = sup.SUPER_PROFESION;
                    txtphysicalLocation.Text = sup.PHYSICAL_LOCATION;
                }

            }
        }
        catch (Exception ex)
        {
            //throw new Exception(ex.Message);
            Response.Redirect("index.aspx");
        }
    }