예제 #1
0
        public void CleanShouldReturnDataTypeString()
        {
            var func   = new Clean();
            var result = func.Execute(FunctionsHelper.CreateArgs("epplus"), _parsingContext);

            Assert.AreEqual(DataType.String, result.DataType);
        }
예제 #2
0
        public async Task <IActionResult> PostDonor([FromBody] Clean clean)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            User user = new User();

            user.email    = clean.username;
            user.password = clean.password;

            user.role = "Donor";
            _context.users.Add(user);
            await _context.SaveChangesAsync();

            Donor donor = new Donor();

            donor.fullName    = clean.name;
            donor.dateOfBirth = clean.dateOfBirth;
            donor.phoneNumber = clean.phone;
            donor.userId      = _context.users.FirstOrDefault(x => x.email == clean.username).userId;
            donor.user        = user;
            _context.donors.Add(donor);
            await _context.SaveChangesAsync();

            donor = _context.donors.Include(e => e.user).FirstOrDefault(e => e.donorId == donor.donorId);
            return(CreatedAtAction("GetDonor", new { donorId = donor.donorId }, donor));
        }
예제 #3
0
    public static void Main()
    {
        // Opens the server and sets its settings
        Console.Title = "Blackthorn Server";
        Logo();
        Console.WriteLine("[Initialize Server Startup]");

        // Checks if all directories exist, if they do not exist then create them
        Directories.Create();
        Console.WriteLine("Directories created.");

        // Clears and loads all required data
        Read.Required();
        Clean.Required();

        // Creates network devices
        Network.Start();
        Console.WriteLine("Network started.");

        // Calculates how long it took to initialize the server
        Console.WriteLine("\r\n" + "Server started. Type 'Help' to see the commands." + "\r\n");

        // Starts the ties
        Thread Comandos_Laço = new Thread(Tie.Commands);

        Comandos_Laço.Start();
        Tie.Principal();
    }
예제 #4
0
    public static void Options()
    {
        // Cria o arquivo se ele não existir
        if (!Directories.Options.Exists)
        {
            Clean.Options();
        }
        else
        {
            // Create a Timer file
            BinaryReader Arquivo = new BinaryReader(File.OpenRead(Directories.Options.FullName));

            // Load the Data
            Lists.Options.Jogo_Name     = Arquivo.ReadString();
            Lists.Options.SalvarUsuário = Arquivo.ReadBoolean();
            Lists.Options.Sons          = Arquivo.ReadBoolean();
            Lists.Options.Músicas       = Arquivo.ReadBoolean();
            Lists.Options.User          = Arquivo.ReadString();

            // Download the file
            Arquivo.Dispose();
        }

        // Adds the Data to the cache
        Markers.Locate("Sons").State          = Lists.Options.Sons;
        Markers.Locate("Músicas").State       = Lists.Options.Músicas;
        Markers.Locate("SalvarUsuário").State = Lists.Options.SalvarUsuário;
        if (Lists.Options.SalvarUsuário)
        {
            Scanners.Locate("Conectar_Usuário").Text = Lists.Options.User;
        }
    }
예제 #5
0
        public RepositoryService(
            GitRepositoryChangedEvent repositoryChangedEvent,
            GitWorkingTreeChangedEvent workingTreeChangedEvent
            )
        {
            _repositoryChangedEvent = repositoryChangedEvent;
            _workingTreeChangedEvent = workingTreeChangedEvent;
            _status = new CachedValue<StatusCollection>(
                () =>
                {
                    if (!IsGitRepository)
                        return new StatusCollection(Enumerable.Empty<Status>());

                    var clean = new Clean
                    {
                        Target = Clean.CleanTarget.Ignored,
                        IncludeDirectories = false
                    };

                    var statusResult = Git.Execute(new Git.Commands.Status());
                    var cleanResult = Git.Execute(clean);

                    return new StatusCollection(
                        statusResult.Concat(cleanResult.Select(name => new Status(System.IO.Path.Combine(BaseDirectory, name), FileStatus.Ignored)))
                    );
                }
            );
        }
예제 #6
0
        public async Task <IActionResult> PostRecepient([FromBody] Clean clean)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            User user = new User();

            user.email    = clean.username;
            user.password = clean.password;
            user.role     = "Recepient";
            _context.users.Add(user);
            await _context.SaveChangesAsync();

            Recepient recepient = new Recepient();

            recepient.name        = clean.name;
            recepient.location    = clean.location;
            recepient.phoneNumber = clean.phone;
            recepient.userId      = _context.users.FirstOrDefault(x => x.email == clean.username).userId;
            recepient.user        = user;
            _context.recepients.Add(recepient);
            await _context.SaveChangesAsync();

            recepient = _context.recepients.Include(e => e.user).FirstOrDefault(e => e.recepientId == recepient.recepientId);

            return(CreatedAtAction("GetRecepient", new { recepientId = recepient.recepientId }, recepient));
        }
예제 #7
0
        static void Main()
        {
            //Taking user's input

            Console.WriteLine("Please enter day:");
            string day = Console.ReadLine();

            Console.WriteLine("Please enter month:");
            string month = Console.ReadLine();

            Console.WriteLine("Please enter year:");
            string year = Console.ReadLine();

            //Validate the values are correct

            int number;
            int dayDigit = 0, monthDigit = 0, yearDigit = 0;

            if (Int32.TryParse(day, out number) && Int32.TryParse(month, out number) && Int32.TryParse(year, out number))     //Validate correct type
            {
                dayDigit   = int.Parse(day);
                monthDigit = int.Parse(month);
                yearDigit  = int.Parse(year);

                if (dayDigit >= 32 || monthDigit >= 13 || (yearDigit >= 2400 || yearDigit <= 1600))       //Validate conditions of the task
                {
                    Console.WriteLine("\n Not correct date. Please try again... ");
                    Clean.DoClear();
                    Main();
                }
            }
            else
            {
                Console.WriteLine("\n Not correct date. Please try again... ");
                Clean.DoClear();
                Main();
            }


            // List of varriable for building calendar table

            DateTime firstDayOfCurrentMonth = new DateTime(yearDigit, monthDigit, 1);                                                 // First day of user's month
            int      countOfDays            = System.DateTime.DaysInMonth(firstDayOfCurrentMonth.Year, firstDayOfCurrentMonth.Month); // Count of days in user's mounth
            DateTime selectedDate           = new DateTime(yearDigit, monthDigit, dayDigit);

            //Variable "newTable" contains arrays of days of week

            var newTable = TableBuilder.Build(firstDayOfCurrentMonth, countOfDays);

            //This call of method printing array to console

            Output.Print(newTable, dayDigit, monthDigit, yearDigit);

            //Try again...

            Console.WriteLine("\n To continue press enter...");
            Clean.DoClear();
            Main();
        }
예제 #8
0
        internal static ContextMenu OpenMenu(UIElement target, bool openByKey, out Clean cleaner)
        {
            cleaner = null;

            FrameworkElement owner = null;
            var tree = TreeUtilityInTarget.VisualTree(target, TreeRunDirection.Ancestors);

            foreach (var e in tree)
            {
                var f = e as FrameworkElement;
                if (f != null && f.ContextMenu != null)
                {
                    owner = f;
                    break;
                }
            }
            if (owner == null)
            {
                throw new NotSupportedException();
            }
            var menu = owner.ContextMenu;

            if (openByKey)
            {
                target.Focus();
                SendInputEx.SendKey(System.Windows.Forms.Keys.Apps);
            }
            else
            {
                int count = menu.CommandBindings.Count;

                foreach (var e in TreeUtilityInTarget.VisualTree(target, TreeRunDirection.Ancestors))
                {
                    var u = e as UIElement;
                    if (u != null && u.CommandBindings != null)
                    {
                        foreach (CommandBinding command in u.CommandBindings)
                        {
                            menu.CommandBindings.Add(command);
                        }
                    }
                }
                target.Focus();
                menu.IsOpen = true;
                InvokeUtility.DoEvents();

                //数を元に戻す
                cleaner = () =>
                {
                    while (count < menu.CommandBindings.Count)
                    {
                        menu.CommandBindings.RemoveAt(menu.CommandBindings.Count - 1);
                    }
                    menu.IsOpen = false;
                };
            }

            return(menu);
        }
예제 #9
0
        public static void Main()
        {
            var builder   = Clean.MakeBuilder();
            var container = builder.Container;
            var instance  = container.GetInstanceOf <IMySimpleSampleInterface>();

            Console.WriteLine($"The message is '{instance.Message}'");
        }
예제 #10
0
 private void SignalBuildCommandsChange()
 {
     Application.Current.Dispatcher.InvokeAsync(() =>
     {
         Clean.RaiseCanExecuteChanged();
         Build.RaiseCanExecuteChanged();
     });
 }
예제 #11
0
        private void loadComboios(object sender = null, EventArgs e = null)
        {
            if (!Connection.verifySGBDConnection())
            {
                return;
            }

            boxFabricante = textBoxSearchCombFabricante.Text;
            boxTipo       = textBoxSearchCombTipo.Text;
            boxID         = textBoxSearchCombID.Text;
            if (boxFabricante.Length == 0)
            {
                boxFabricante = "null";
            }
            if (boxTipo.Length == 0)
            {
                boxTipo = "null";
            }
            if (boxID.Length == 0)
            {
                boxID = "null";
            }

            String query = "exec getComboios @id=" + boxID + ", @tipo=" + boxTipo + ", @fabricante=" + boxFabricante;

            if (!Clean.IsClean(query))
            {
                MessageBox.Show(Clean.Err());
                return;
            }

            SqlCommand    cmd    = new SqlCommand(query, Connection.get());
            SqlDataReader reader = cmd.ExecuteReader();

            listBoxComboios.Items.Clear();

            while (reader.Read())
            {
                Comboio c = new Comboio();
                c.Carruagens = reader["num_carruagens"].ToString();
                c.Fabricante = reader["fabricante"].ToString();
                c.Id         = reader["id_comboio"].ToString();
                c.Lugares    = reader["num_lug_comboio"].ToString();
                c.Tipo       = reader["tipo"].ToString();
                listBoxComboios.Items.Add(c);
            }

            currentComboio = 0;

            if (listBoxComboios.Items.Count == 0)
            {
                listBoxComboios.Items.Add("Sem comboios a apresentar");
                currentComboio = -1;
            }

            Connection.close();
            ShowComboio();
        }
예제 #12
0
    public static void Leave(byte Index)
    {
        // Salva os dados do jogador
        Write.Player(Index);
        Clean.Player(Index);

        // Sends everyone the player disconnect
        Sending.Player_Exited(Index);
    }
예제 #13
0
        private void loadBilhetes(object sender = null, EventArgs e = null)
        {
            if (!Connection.verifySGBDConnection())
            {
                return;
            }

            String queryDate = "@data=" + datePicked;

            if (datePicked != "null")
            {
                queryDate = "@data='" + datePicked + "'";
            }

            String query = "exec getClientBilhetes @cc=" + Cliente.Escolhido.CC + "," + queryDate + ", @estacao_" +
                           "partida=" + EstacaoPartida + ", @estacao_chegada=" + EstacaoChegada;

            if (!Clean.IsClean(query))
            {
                MessageBox.Show(Clean.Err());
                return;
            }

            SqlCommand    cmd    = new SqlCommand(query, Connection.get());
            SqlDataReader reader = cmd.ExecuteReader();

            listBoxBilhetes.Items.Clear();

            while (reader.Read())
            {
                Bilhete b = new Bilhete();
                b.BilheteID      = reader["bilheteID"].ToString();
                b.Preco          = reader["preco"].ToString();
                b.Data           = reader["data"].ToString();
                b.ParagemPartida = reader["paragem_partida"].ToString();
                b.ParagemChegada = reader["paragem_chegada"].ToString();
                b.Comboio        = reader["lugar_comboio"].ToString();
                b.Carruagem      = reader["lugar_carruagem"].ToString();
                b.Lugar          = reader["lugar_n"].ToString();
                b.Partida        = reader["partida"].ToString();
                b.HoraPartida    = reader["hora_partida"].ToString();
                b.Chegada        = reader["chegada"].ToString();
                b.HoraChegada    = reader["hora_chegada"].ToString();
                listBoxBilhetes.Items.Add(b);
            }

            currentBilhete = 0;

            if (listBoxBilhetes.Items.Count == 0)
            {
                listBoxBilhetes.Items.Add("Sem bilhetes a apresentar");
                currentBilhete = -1;
            }

            Connection.close();
            ShowBilhete();
        }
예제 #14
0
        void comprarBilhete(object sender, EventArgs e)
        {
            String carr  = textBoxInfoCarruagem.Text;
            String lugar = textBoxInfoLugar.Text;

            if (carr.Length == 0 || lugar.Length == 0)
            {
                MessageBox.Show("Por favor preencha todos os campos!");
                return;
            }

            if (!Connection.verifySGBDConnection())
            {
                return;
            }

            Horario h = (Horario)listBoxHorarios.Items[currentHorario];

            String query = "declare @tmp viagem_array; insert into @tmp values(" + h.Viagem + ",'" +
                           h.Partida + "','" + h.Chegada + "'," + carr + "," + lugar + ");exec comprar_bilhete " +
                           "@cc=" + Cliente.Escolhido.CC + ",@viagens=@tmp,@latitude=40.64528,@longitude=-8.639841,@metodo='Compra com saldo'," +
                           "@data='" + DateTime.Now.ToString("yyyy-MM-dd") + "'";

            if (!Clean.IsClean(query, "-"))
            {
                MessageBox.Show(Clean.Err());
                MessageBox.Show(query);
                return;
            }

            SqlCommand cmd = new SqlCommand(query, Connection.get());
            //cmd.CommandType = System.Data.CommandType.StoredProcedure;

            var returnParameter = cmd.Parameters.Add("@ReturnVal", System.Data.SqlDbType.Int);

            returnParameter.Direction = System.Data.ParameterDirection.ReturnValue;

            cmd.ExecuteNonQuery();

            int result = (int)returnParameter.Value;

            if (result == 1)
            {
                MessageBox.Show("Lugar indisponível!");
            }
            else if (result == 2)
            {
                MessageBox.Show("Saldo insuficiente!");
            }
            else
            {
                MessageBox.Show("Bilhete comprado com sucesso!");
            }
            Connection.close();
        }
예제 #15
0
 public ChromiumFxTask(Action perform)
 {
     Task          = new CfrTask();
     Task.Execute += (sender, args) =>
     {
         perform();
         Clean?.Invoke();
         Task.Dispose();
         Task = null;
     };
 }
예제 #16
0
        public ChromiumFxTask(Action perform)
        {
            var task = new CfrTask();

            task.Execute += (sender, args) =>
            {
                perform();
                Clean?.Invoke();
            };
            Task = task;
        }
예제 #17
0
        public void TestExceptionThatIsThrowHasHierarchyInformationIfCantFullySatisfyConstructor()
        {
            var registry = new SimpleTypeRegistry();

            registry.Register <ISimpleInterface>().WithConcreteType <EmptyClassWithDefaultConstructor>();
            registry.Register <ISecondInterface>().WithConcreteType <EmptyClassWithThatOneSimpleObjectInItsConstructor>();
            registry.Register <IThirdInterface>().WithConcreteType <MoreComplicatedClassThatCantBeFullySatisfied>();
            var builder = Clean.MakeBuilder();

            builder.AddRegistry(registry);
            var container = builder.Container;

            var first = container.GetInstanceOf <ISimpleInterface>();

            Assert.That(first, Is.Not.Null);

            var second = container.GetInstanceOf <ISecondInterface>();

            Assert.That(second, Is.Not.Null);

            try {
                container.GetInstanceOf <IThirdInterface>();
            } catch (UnableToConstructException ex) {
                Assert.That(ex.AttemptedConstructors, Is.Not.Null);
                Assert.That(ex.AttemptedConstructors, Has.Count.EqualTo(1));

                Assert.That(ex.AttemptedConstructors[0].Parameters, Is.Not.Null);
                Assert.That(ex.AttemptedConstructors[0].Parameters, Has.Count.EqualTo(2));
                Assert.That(ex.AttemptedConstructors[0].Success, Is.Not.True);

                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts, Is.Not.Null);
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts, Has.Count.EqualTo(1));

                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].Outcome, Is.EqualTo(ConstructionOutcome.Success));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].Injected, Is.EqualTo(typeof(EmptyClassWithThatOneSimpleObjectInItsConstructor)));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].Declared, Is.EqualTo(typeof(ISecondInterface)));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters, Is.Not.Null);
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters, Has.Count.EqualTo(1));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Success, Is.EqualTo(ConstructionOutcome.Success));

                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters.ToList()[0].Injected, Is.EqualTo(typeof(EmptyClassWithDefaultConstructor)));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters.ToList()[0].Declared, Is.EqualTo(typeof(ISimpleInterface)));

                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters.ToList()[0].ConstructorAttempts, Is.Not.Null);
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters.ToList()[0].ConstructorAttempts, Has.Count.EqualTo(1));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters.ToList()[0].ConstructorAttempts[0].Success, Is.EqualTo(ConstructionOutcome.Success));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters, Is.Not.Null);
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters.ToList()[0].ConstructorAttempts[0].Parameters, Is.Empty);

                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[1].Injected, Is.Null);
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[1].Declared, Is.EqualTo(typeof(IFourthInterfaceActuallyDoesntHaveAnyDerivedClasses)));
                Assert.That(ex.AttemptedConstructors[0].Parameters.ToList()[1].Outcome, Is.EqualTo(ConstructionOutcome.NoMappingFound));
            }
        }
예제 #18
0
        public void TestRegistryIsFoundAutomatically()
        {
            var builder   = Clean.MakeBuilder();
            var container = builder.Container;

            var first = container.GetInstanceOf <ISimpleInterface>();

            Assert.That(first, Is.Not.Null);

            var second = container.GetInstanceOf <ISecondInterface>();

            Assert.That(second, Is.Not.Null);
        }
예제 #19
0
    private static void Entrada(NetIncomingMessage Data)
    {
        // Definir os valores que são enviados do servidor
        Player.MyIndex     = Data.ReadByte();
        Player.BiggerIndex = Data.ReadByte();

        // Limpa a Structure dos Playeres
        Lists.Player = new Lists.Structures.Player[Data.ReadByte() + 1];

        for (byte i = 1; i <= Lists.Player.GetUpperBound(0); i++)
        {
            Clean.Player(i);
        }
    }
예제 #20
0
        public void CleanShouldRemoveNonPrintableChars()
        {
            var input = new StringBuilder();

            for (var x = 1; x < 32; x++)
            {
                input.Append((char)x);
            }
            input.Append("epplus");
            var func   = new Clean();
            var result = func.Execute(FunctionsHelper.CreateArgs(input), _parsingContext);

            Assert.AreEqual("epplus", result.Result);
        }
예제 #21
0
        private void loadClientesCC(object sender, EventArgs e)
        {
            if (!Connection.verifySGBDConnection())
            {
                return;
            }

            String boxCC = textBoxSearchCcc.Text;

            String query = "exec getCliente @cc='" + boxCC + "'";

            if (!Clean.IsClean(query))
            {
                MessageBox.Show(Clean.Err());
                return;
            }

            SqlCommand    cmd    = new SqlCommand(query, Connection.get());
            SqlDataReader reader = cmd.ExecuteReader();

            listBoxClientes.Items.Clear();

            while (reader.Read())
            {
                Cliente C = new Cliente();
                C.CC           = reader["CC"].ToString();
                C.NIF          = reader["nif"].ToString();
                C.UserID       = reader["userID"].ToString();
                C.Nome_proprio = reader["nome_proprio"].ToString();
                C.Apelido      = reader["apelido"].ToString();
                C.Email        = reader["email"].ToString();
                double tmp;
                Double.TryParse(reader["saldo"].ToString(), out tmp);
                C.Saldo = tmp;
                C.Tel   = reader["contacto_telefonico"].ToString();
                listBoxClientes.Items.Add(C);
            }

            Connection.close();
            currentClient = 0;

            if (listBoxClientes.Items.Count == 0)
            {
                listBoxClientes.Items.Add("Sem clientes a apresentar");
                currentClient = -1;
            }

            ShowClient();
        }
예제 #22
0
        public void TestThatItWorksWithASimpleTypeWithADefaultConstructor()
        {
            var registry = new SimpleTypeRegistry();

            registry.Register <ISimpleInterface>().WithConcreteType <EmptyClassWithDefaultConstructor>();
            var builder = Clean.MakeBuilder();

            builder.AddRegistry(registry);
            var container = builder.Container;

            var instance = container.GetInstanceOf <ISimpleInterface>();

            Assert.That(instance, Is.Not.Null);
            Assert.That(instance, Is.TypeOf <EmptyClassWithDefaultConstructor>());
        }
예제 #23
0
        public void TestThatWithoutSettingALifetimeItIsTransient()
        {
            var registry = new SimpleTypeRegistry();

            registry.Register <ISimpleInterface>().WithConcreteType <EmptyClassWithDefaultConstructor>();
            var builder = Clean.MakeBuilder();

            builder.AddRegistry(registry);
            var container = builder.Container;

            var first  = container.GetInstanceOf <ISimpleInterface>();
            var second = container.GetInstanceOf <ISimpleInterface>();

            Assert.That(first, Is.Not.Null);
            Assert.That(second, Is.Not.Null);
            Assert.That(first, Is.Not.SameAs(second));
        }
        private void InitalizeCommandMapping()
        {
            var advanceCommand = new Advance(AppSettings.SafeGet <int>(Instructions.A.ToString()));

            CommandMapping.Add(Instructions.A, advanceCommand);
            var backCommand = new Back(AppSettings.SafeGet <int>(Instructions.B.ToString()));

            CommandMapping.Add(Instructions.B, backCommand);
            var cleanCommand = new Clean(AppSettings.SafeGet <int>(Instructions.C.ToString()));

            CommandMapping.Add(Instructions.C, cleanCommand);
            var turnLeft = new TurnLeft(AppSettings.SafeGet <int>(Instructions.TL.ToString()));

            CommandMapping.Add(Instructions.TL, turnLeft);
            var turnRight = new TurnRight(AppSettings.SafeGet <int>(Instructions.TR.ToString()));

            CommandMapping.Add(Instructions.TR, turnRight);
        }
예제 #25
0
    public static void Button_Data(byte Index)
    {
        // Limpa os valores
        Clean.Button(Index);

        // Cria um sistema Binary para a manipulação dos Data
        FileInfo     Arquivo = new FileInfo(Directories.Buttons_Data.FullName + Index + Directories.Format);
        BinaryReader Binary  = new BinaryReader(Arquivo.OpenRead());

        // Lê os Data
        Buttons.List[Index].Geral.Name       = Binary.ReadString();
        Buttons.List[Index].Geral.Position.X = Binary.ReadInt32();
        Buttons.List[Index].Geral.Position.Y = Binary.ReadInt32();
        Buttons.List[Index].Geral.Visible    = Binary.ReadBoolean();
        Buttons.List[Index].Texture          = Binary.ReadByte();

        // Fecha o sistema
        Binary.Dispose();
    }
        static int[] GetIndices(UIElement target, string[] headerTexts)
        {
            Clean cleaner = null;

            try
            {
                var   menu    = OpenMenu(target, out cleaner);
                int[] indices = new int[headerTexts.Length];
                GetIndices(SearcherInTarget.ByType <MenuItem>(TreeUtilityInTarget.VisualTree(menu)), headerTexts, indices, 0);
                return(indices);
            }
            finally
            {
                if (cleaner != null)
                {
                    cleaner();
                }
            }
        }
예제 #27
0
    private static void Character_Delete(byte Index, NetIncomingMessage Data)
    {
        byte   Character = Data.ReadByte();
        string Name      = Lists.Player[Index].Character[Character].Name;

        // Verifica se o Character existe
        if (string.IsNullOrEmpty(Name))
        {
            return;
        }

        // Deleta o Character
        Sending.Alert(Index, "The character '" + Name + "' has been deleted.", false);
        Write.Characters(Read.Characters_Names().Replace(":;" + Name + ":", ":"));
        Clean.Player_Character(Index, Character);

        // Salva o Character
        Sending.Characters(Index);
        Write.Player(Index);
    }
예제 #28
0
    public static void Scanner_Data(byte Index)
    {
        // Limpa os valores
        Clean.Scanner(Index);

        // Cria um sistema Binary para a manipulação dos Data
        FileInfo     Arquivo = new FileInfo(Directories.Scanners_Data.FullName + Index + Directories.Format);
        BinaryReader Binary  = new BinaryReader(Arquivo.OpenRead());

        // Lê os Data
        Scanners.List[Index].Geral.Name       = Binary.ReadString();
        Scanners.List[Index].Geral.Position.X = Binary.ReadInt32();
        Scanners.List[Index].Geral.Position.Y = Binary.ReadInt32();
        Scanners.List[Index].Geral.Visible    = Binary.ReadBoolean();
        Scanners.List[Index].Max_Carácteres   = Binary.ReadInt16();
        Scanners.List[Index].Width            = Binary.ReadInt16();
        Scanners.List[Index].Senha            = Binary.ReadBoolean();

        // Fecha o sistema
        Binary.Dispose();
    }
예제 #29
0
    public static void Map_Review(NetIncomingMessage Data)
    {
        bool Necessário = false;
        int  Map        = Data.ReadInt16();

        // Limpa todos os outros Playeres
        for (byte i = 1; i <= Player.BiggerIndex; i++)
        {
            if (i != Player.MyIndex)
            {
                Clean.Player(i);
            }
        }

        // Verifica se é necessário baixar os Data do Map

        Necessário = true;

        // Solicita os Data do Map
        Sending.Request_Map(Necessário);
    }
예제 #30
0
        private void InitializeControl()
        {
            LogicStatus.Instance.Logic.Init();//模块任务添加到线程池
            point = new Point();


            posmachine           = new PosMachine();
            ShowMessge.StartMsg += new ShowMessge.SendStartMsgEventHandler(ShowMessage);
            clean       = new Clean();
            model       = new model();
            data        = new parameter();
            userInfo    = new UserInfo();
            Frm_Machine = new Frm_MotorParam();
            frmLog      = new FormLog();
            frm_jog     = new XYZ_Jog();
            frm_Machine = new Frm_Machine();


            comboBox1.SelectedIndex   = 1;
            tabControl1.SelectedIndex = 0;
            tabControl1.ItemSize      = new Size(0, 1);
            tabControl1.Appearance    = TabAppearance.FlatButtons;
            tabControl1.SizeMode      = TabSizeMode.Fixed;

            data.TopLevel        = false;                //将子窗体设置成非最高层,非顶级控件
            data.FormBorderStyle = FormBorderStyle.None; //去掉窗体边框
            data.Size            = this.panel16.Size;
            data.Parent          = this.panel16;         //指定子窗体显示的容器
            data.Dock            = DockStyle.Fill;
            data.Show();
            data.Activate();

            model.TopLevel        = false;                //将子窗体设置成非最高层,非顶级控件
            model.FormBorderStyle = FormBorderStyle.None; //去掉窗体边框
            model.Size            = this.panel13.Size;
            model.Parent          = this.panel13;         //指定子窗体显示的容器
            model.Dock            = DockStyle.Fill;
            model.Show();
            model.Activate();
        }
예제 #31
0
        private void addCliente(object sender, EventArgs e)
        {
            if (fieldsCompleted())
            {
                if (!Connection.verifySGBDConnection())
                {
                    return;
                }

                String query = "exec addCliente @cc = " + boxCC.Text + ", @nome = " + boxNome.Text +
                               ", @apelido = " + boxApelido.Text + ", @genero = " + comboGenero.SelectedItem.ToString() +
                               ", @email = " + boxEmail.Text + ", @telefone = " + boxTel.Text + ", @nif = " + boxNIF.Text +
                               ", @userId = " + boxUserID.Text + ", @password = "******",@cartao = " + boxCartaoCredito.Text;
                if (!Clean.IsClean(query))
                {
                    MessageBox.Show(Clean.Err());
                    return;
                }
                SqlCommand cmd = new SqlCommand(query, Connection.get());

                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw new Exception("Failed to add client to database. \n ERROR MESSAGE: \n" + ex.Message);
                }
                finally
                {
                    MessageBox.Show("Cliente adicionado à base de dados com sucesso");
                    Connection.close();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Por favor preencha todos os campos");
            }
        }
예제 #32
0
    protected void btAdjustCln_Click(object sender, EventArgs e)
    {
        if (selectedClean == null)
            {
                DateTime date = Convert.ToDateTime(ddlDateClean.SelectedItem.Text);
                Tram tram = service.GetTram(Convert.ToInt32(tbTramNrClean.Text));
                User user = null;
                foreach (User u in service.Users)
                {
                    if (u.Name == ddlUserClean.SelectedItem.Text)
                    {
                        user = u;
                        break;
                    }
                }

                selectedClean = new Clean(0, date, " - ", tram, user);

                service.InsertClean(selectedClean);
            }
            else
            {
                int cleanId = selectedClean.Id;
                DateTime date = Convert.ToDateTime(ddlDateClean.SelectedItem.Text);
                Tram tram = service.GetTram(Convert.ToInt32(tbTramNrClean.Text));
                User user = null;
                foreach (User u in service.Users)
                {
                    if (u.Name == ddlUserClean.SelectedItem.Text)
                    {
                        user = u;
                        break;
                    }
                }

                selectedClean = new Clean(cleanId, date, " - ", tram, user);
                service.UpdateClean(selectedClean);
            }
    }
예제 #33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Service"] != null)
            {
                service = (Service)Session["Service"];
            }
            else
            {
                service = new Service();
            }

            rptClean.DataSource = service.Repairs;
            rptClean.DataBind();

            if (Request.QueryString["query"] != null)
            {
                selectedClean = service.GetClean(Convert.ToInt32(Request.QueryString["query"]));

                tbTramNrClean.Text = Convert.ToString(selectedClean.Tram.TramNr);
                ddlUserClean.SelectedItem.Text = selectedClean.User.ToString();
                ddlStatusClean.SelectedItem.Text = "SCHOONMAAK";
            }

            if (!IsPostBack)
            {
                foreach (User user in service.Users)
                {
                    ddlUserClean.Items.Add(user.Name);
                }

                for(int i = 0; i < 6; i++)
                {
                    ddlDateClean.Items.Add(DateTime.Now.AddDays(i).ToString());
                }
            }
    }
예제 #34
0
 public void UpdateClean(Clean clean)
 {
     database.UpdateClean(clean);
 }
        internal static ContextMenu OpenMenu(UIElement target, out Clean cleaner)
        {
            cleaner = null;

            FrameworkElement owner = null;
            var tree = TreeUtilityInTarget.VisualTree(target, TreeRunDirection.Ancestors);
            foreach (var e in tree)
            {
                var f = e as FrameworkElement;
                if (f != null && f.ContextMenu != null)
                {
                    owner = f;
                    break;
                }
            }
            if (owner == null)
            {
                throw new NotSupportedException();
            }
            var menu = owner.ContextMenu;
            int count = menu.CommandBindings.Count;

            foreach (var e in TreeUtilityInTarget.VisualTree(target, TreeRunDirection.Ancestors))
            {
                var u = e as UIElement;
                if (u != null && u.CommandBindings != null)
                {
                    foreach (CommandBinding command in u.CommandBindings)
                    {
                        menu.CommandBindings.Add(command);
                    }
                }
            }
            target.Focus();
            menu.IsOpen = true;
            InvokeUtility.DoEvents();

            //数を元に戻す
            cleaner = () =>
            {
                while (count < menu.CommandBindings.Count)
                {
                    menu.CommandBindings.RemoveAt(menu.CommandBindings.Count - 1);
                }
                menu.IsOpen = false;
            };

            return menu;
        }
 public override System.Web.Mvc.ActionResult Login(Clean.Models.LoginModel model, string returnUrl) {
     var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.Login);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "model", model);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "returnUrl", returnUrl);
     return callInfo;
 }
 public override System.Web.Mvc.ActionResult ChangePassword(Clean.Models.ChangePasswordModel model) {
     var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.ChangePassword);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "model", model);
     return callInfo;
 }
예제 #38
0
    public void InsertClean(Clean clean)
    {
        string sql = "INSERT INTO TRAM_ONDERHOUD(\"Medewerker_Id\", \"Tram_Id\", \"DatumTijdstip\", \"TypeOnderhoud\") VALUES (:userid, :tramid, :datetime, 'SCHOONMAAK')";
            OracleCommand command = new OracleCommand(sql, conn);

            command.Parameters.Add("userid", clean.User.Id);
            command.Parameters.Add("tramid", clean.Tram.Id);
            command.Parameters.Add("datetime", clean.Date);

            NonQueryBase(command);
    }
예제 #39
0
    public List<Clean> LoadClean()
    {
        string sql = "SELECT * FROM TRAM_ONDERHOUD WHERE \"TypeOnderhoud\" = 'SCHOONMAAK'";
            OracleCommand command = new OracleCommand(sql, conn);

            List<Clean> cleans = new List<Clean>();
            Clean clean = null;

            int id = -1;
            DateTime date;
            string type;
            Tram tram;
            int tramId;
            int userId;

            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                OracleDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    id = Convert.ToInt32(reader["ID"]);
                    userId = Convert.ToInt32(reader["Medewerker_ID"]);
                    date = Convert.ToDateTime(reader["DatumTijdstip"]);
                    type = Convert.ToString(reader["TypeOnderhoud"]);
                    tramId = Convert.ToInt32(reader["Tram_ID"]);

                    clean = new Clean(id, date, type, new Tram(tramId, tramId), new User(userId, "", "", ""));
                    cleans.Add(clean);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            foreach (Clean c in cleans)
            {
                c.Tram = GetTram(c.Tram.Id);
            }

            foreach (Clean c in cleans)
            {
                c.User = GetUser(c.User.Id);
            }

            return cleans;
    }
예제 #40
0
    public void RemoveClean(Clean clean)
    {
        string sql = "DELETE FROM TRAM_ONDERHOUD WHERE \"ID\" = :id)";
            OracleCommand command = new OracleCommand(sql, conn);

            command.Parameters.Add("id", clean.Id);

            NonQueryBase(command);
    }
예제 #41
0
    public void UpdateClean(Clean clean)
    {
        string sql = "UPDATE \"TRAM_ONDERHOUD\" SET \"Medewerker_ID\" = :userid, \"Tram_Id\" = :tramid, \"DatumTijdstip\" = :date WHERE \"ID\" = :id";
            OracleCommand command = new OracleCommand(sql, conn);

            command.Parameters.Add("id", clean.Id);
            command.Parameters.Add("userid", clean.User.Id);
            command.Parameters.Add("tramid", clean.Tram.Id);
            command.Parameters.Add("date", clean.Date);

            NonQueryBase(command);
    }
예제 #42
0
 public void CompleteClean(Clean clean)
 {
     database.RemoveClean(clean);
 }
예제 #43
0
 public void InsertClean(Clean clean)
 {
     database.InsertClean(clean);
 }