Example #1
0
        public void ManagerPart(ref Manager.Manager m, Worker.Worker[] w, Ceo.Ceo c)
        {
            Console.Clear();
            Console.WriteLine("1) For organize something");
            Console.WriteLine("2) For Calculate Salaries");
            bool IsInt = int.TryParse(Console.ReadLine(), out int choose);

            if (IsInt)
            {
                if (choose == 1)
                {
                    Console.Clear();
                    m.Organize();
                    Thread.Sleep(3000);
                }
                else if (choose == 2)
                {
                    Console.Clear();
                    Console.Write($"Total of ");
                    foreach (var item in m.Workers)
                    {
                        Console.Write($" {item.Name}'s ,");
                    }
                    Console.WriteLine($"and {m.Ceo.Name}'s salaries: {m.CalculateSalaries()}");
                    Thread.Sleep(3000);
                    Thread.Sleep(3000);
                }
            }
            else
            {
                throw new Exception("Invalid type!");
            }
        }
Example #2
0
        public static Bank Create(IIdentity id, string address, Manager.Manager manager, List <Atm> atmList)
        {
            var bank = new Bank(id, address, manager, atmList);

            DomainEvent.OnPublished(new OnBankCreatedEventArgs(bank));

            return(bank);
        }
Example #3
0
 public void addManager(Manager.Manager resource)
 {
     Manager.Manager[] temp = new Manager.Manager[++ManagerCount];
     if (Managers != null)
     {
         Managers.CopyTo(temp, 0);
     }
     temp[temp.Length - 1] = resource;
     Managers = temp;
 }
        public void FinalState()
        {
            _list.RemoveAt(0);
            _list.RemoveAt(1);

            var  manager = new Manager.Manager(_list, 65);
            var item = manager.Get();
            var result = manager.Check(CorrectInputByWord(item.Word));

            result.State.ShouldBeEquivalentTo(CheckState.Done);
        }
Example #5
0
        // *** CONSTRUCTION *** //

        #region Constructor
        public AddMoveToGamesProgressForm(string path, int?fixedDepth, int?fixedTimeMinutes, int variation)
        {
            Manager          = Program.Manager;
            Path             = path;
            FixedDepth       = fixedDepth;
            FixedTimeMinutes = fixedTimeMinutes;
            Variation        = variation;
            currentGame      = -1;

            InitializeComponent();
        }
        public void LastIncorrectItem()
        {
            _list.RemoveAt(0);
            _list.RemoveAt(1);

            var manager = new Manager.Manager(_list, 65);
            var item = manager.Get();
            manager.Check(IncorrectInputByWord(item.Word));
            var item2 = manager.Get();

            Assert.True(item.Equals(item2));
        }
Example #7
0
        static void Main(string[] args)
        {
            // *** INITIALIZATION *** //

            Manager = new Manager.Manager();

            //	Are we running on Windows?
            RunningOnWindows = Path.DirectorySeparatorChar == '\\';

            XBoard2Interface.QueryAndSetXBoardActiveStatus();
            if (XBoard2Interface.Active)
            {
                XBoard2Interface.StartListener();
            }
        }
Example #8
0
        // *** CONSTRUCTION *** //

        #region Construction
        public MainForm()
        {
            //	initialize reference to Manager object so we don't have
            //	to use Program.Manager all over the place
            Manager = Program.Manager;

            //	initialize map of nodes in the game catalog to tab pages
            tabControlPages = new Dictionary <CatalogNode, TabPage>();

            //	basic initialization of filtering parameters for master game list
            gameListIsFiltered   = false;
            gameListRequiredTags = new List <string>();

            //	call .NET Forms Designer-generated initialization
            InitializeComponent();
        }
        public void CheckSameItemReturn()
        {
            var shouldBe = true;
            for (var i = 0; i < 1000; i++)
            {
                var manager = new Manager.Manager(_list, 65);
                var item = manager.Get();
                manager.Check(IncorrectInputByWord(item.Word));
                var item2 = manager.Get();
                shouldBe = !item2.Equals(item);
                if (!shouldBe)
                {
                    break;
                }
            }

            shouldBe.Should().BeTrue();
        }
Example #10
0
        public Bank(IIdentity id, string address, Manager.Manager manager, List <Atm> atms)
        {
            // validate instance
            if (string.IsNullOrWhiteSpace(address))
            {
                throw new ArgumentNullException(nameof(address));
            }
            if (manager == null)
            {
                throw new ArgumentNullException(nameof(manager));
            }
            if (atms == null)
            {
                throw new ArgumentNullException(nameof(atms));
            }

            // set properties
            Id      = id;
            Address = address;
            Manager = manager;
            _atms   = atms;
        }
Example #11
0
 public SaveGamesAsImagesForm()
 {
     Manager = Program.Manager;
     InitializeComponent();
 }
Example #12
0
        private void SendEmail(string Subject, string Body, string sentTo)
        {
            //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            string xClase      = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string xProceso    = MethodBase.GetCurrentMethod().Name;
            string strHostName = System.Net.Dns.GetHostName();

            var dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE    = xClase,
                STR_EVENTO   = xProceso,
                FEC_CREACION = DateTime.Now,
                STR_SERVIDOR = strHostName
            };

            var dto = new Tab_ConfigSys
            {
                llave_Config1 = "SERVICIO",
                llave_Config2 = "CONFIGURACION",
                llave_Config3 = "SERVIDOR",
                llave_Config4 = "ENVIO_EMAIL"
            };

            TwoFunTwoMe.Models.Manager.Manager manager = new Manager.Manager();
            try
            {
                var dto_config_Service = manager.CargarConfiguracionEnvioCorreos(dto);
                var smtp   = dto_config_Service.Where(x => x.llave_Config5 == "SmtpClient").Select(x => x.Dato_Char1).FirstOrDefault();
                var puerto = dto_config_Service.Where(x => x.llave_Config5 == "PUERTO").Select(x => x.Dato_Int1).FirstOrDefault().Value;
                var email  = dto_config_Service.Where(x => x.llave_Config5 == "EMAIL").Select(x => x.Dato_Char1).FirstOrDefault();
                var pass   = dto_config_Service.Where(x => x.llave_Config5 == "PASSWORD").Select(x => x.Dato_Char1).FirstOrDefault();
                var nombre = dto_config_Service.Where(x => x.llave_Config5 == "NOMBRE").Select(x => x.Dato_Char1).FirstOrDefault();

                using (MailMessage message = new MailMessage())
                {
                    message.From    = new MailAddress(email, nombre, Encoding.UTF8);
                    message.Subject = Subject;
                    message.Body    = Body;
                    if (sentTo.Contains(";"))
                    {
                        var multiSent = sentTo.Split(';');
                        for (int index = 0; index < multiSent.Length; ++index)
                        {
                            var Email = multiSent[index].ToString().Trim();
                            if (!string.IsNullOrEmpty(Email))
                            {
                                if (validarEmails(Email))
                                {
                                    message.To.Add(multiSent[index]);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (validarEmails(sentTo))
                        {
                            message.To.Add(sentTo);
                        }
                    }
                    //sendDocument
                    message.Attachments.Clear();
                    //message.Attachments.Add(new Attachment(this.generarAdjunto(pImg.Value, idDoc, copia, tipoPlantilla), "FacturaElectronica.pdf"));

                    // message.Attachments.Add(new Attachment());

                    //AlternateView alternateViewFromString1 = AlternateView.CreateAlternateViewFromString(Regex.Replace(Body, "<(.|\\n)*?>", string.Empty), (Encoding)null, "text/plain");
                    //AlternateView alternateViewFromString2 = AlternateView.CreateAlternateViewFromString(Body, (Encoding)null, "text/html");
                    //message.AlternateViews.Clear();
                    //message.AlternateViews.Add(alternateViewFromString1);
                    //message.AlternateViews.Add(alternateViewFromString2);

                    using (SmtpClient smtpClient = new SmtpClient(smtp, puerto))
                    {
                        smtpClient.EnableSsl      = true;
                        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
                        //smtpClient.UseDefaultCredentials = false;
                        smtpClient.Credentials = new NetworkCredential(email, pass);

                        smtpClient.Send(message);
                    }
                    dto_excepcion.STR_PARAMETROS = String.Format("sentTo={0}; smtp={1}; puerto={2}; email={3}; pass={4}", sentTo, smtp, puerto, email, pass);
                }
            }
            catch (Exception ex)
            {
                dto_excepcion.STR_MENSAJE = ex.Message;
                // manage.guardaExcepcion(dto_excepcion);
            }
        }
Example #13
0
        public void Starter()
        {
            Worker.Worker w1 = new Worker.Worker(Guid.NewGuid(), "Hakuna", "", 35, "Cart operations", 2123);
            Worker.Worker w2 = new Worker.Worker(Guid.NewGuid(), "Sun", "", 26, "Cart operations", 221);
            Worker.Worker w3 = new Worker.Worker(Guid.NewGuid(), "Moon", "", 37, "Cart operations", 1233);
            Worker.Worker w4 = new Worker.Worker(Guid.NewGuid(), "Sky", "", 40, "Cart operations", 223);
            w1.addOperation(new Operation.Operation(Guid.NewGuid(), "Cart Added", DateTime.Now));
            Worker.Worker[] workers = new Worker.Worker[4] {
                w1, w2, w3, w4
            };

            Manager.Manager m1 = new Manager.Manager(Guid.NewGuid(), "Matata", "", 46, "Main Manager", 98123);
            m1.addWorker(w1);
            m1.addWorker(w2);
            m1.addWorker(w3);
            m1.addWorker(w4);
            Manager.Manager m2 = new Manager.Manager(Guid.NewGuid(), "Glass", "", 19, "Manager", 2721);
            m2.addWorker(w1);
            m2.addWorker(w2);
            Manager.Manager m3 = new Manager.Manager(Guid.NewGuid(), "Light", "", 29, "Manager", 12671);
            m3.addWorker(w3);
            m3.addWorker(w4);
            Manager.Manager m4 = new Manager.Manager(Guid.NewGuid(), "Blue", "", 41, "Manager", 82342);
            m4.addWorker(w1);
            m4.addWorker(w3);
            Manager.Manager[] managers = new Manager.Manager[4] {
                m1, m2, m3, m4
            };

            Client.Client   c1      = new Client.Client(Guid.NewGuid(), "Matatata", "Nana", 22, 34324, "X street,New York", "Y street, New Jersey");
            Client.Client   c2      = new Client.Client(Guid.NewGuid(), "Last", "Glass", 56, 1434, "I don't work", "Y street, Vegas");
            Client.Client[] clients = new Client.Client[2] {
                c1, c2
            };

            Ceo.Ceo ceo = new Ceo.Ceo(Guid.NewGuid(), "Hakuna", "", 35, "Ceo", 100000);
            ceo.addWorker(w1);
            ceo.addWorker(w2);
            ceo.addWorker(w3);
            ceo.addWorker(w4);
            ceo.addManager(m1);
            ceo.addManager(m2);
            ceo.addManager(m3);
            ceo.addManager(m4);

            Credit.Credit cr1 = new Credit.Credit(Guid.NewGuid(), c1, 20013, 6);
            Credit.Credit cr3 = new Credit.Credit(Guid.NewGuid(), c1, 142, 2);
            Credit.Credit cr2 = new Credit.Credit(Guid.NewGuid(), c2, 41500, 3);

            m1.Ceo = ceo;
            m2.Ceo = ceo;
            m3.Ceo = ceo;
            m4.Ceo = ceo;

            Bank.Bank bank = new Bank.Bank("Time bank", 10000000, ceo);

            Credit.Credit[] credits = new Credit.Credit[3] {
                cr1, cr2, cr3
            };


            while (true)
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("1) Ceo");
                    Console.WriteLine("2) Worker");
                    Console.WriteLine("3) Manager");
                    Console.WriteLine("4) Client");
                    Console.WriteLine("5) Bank");
                    Choose(Console.ReadLine(), ref ceo, ref workers, ref managers, ref clients, ref credits, bank);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }