Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            int         factoryID = Convert.ToInt32(comboBox1.Text);
            string      name      = comboBox2.Text;
            string      address   = comboBox3.Text;
            FactoryInfo factory   = new FactoryInfo(factoryID, name, address);

            parent.DeleteFactory(factory);
        }
        public void DeleteFactory(User user, FactoryInfo info)
        {
            List <byte> buffer = new List <byte>();

            buffer.Add((byte)Operations.DeleteFactory);
            buffer.AddRange(info.serialise());
            SendToClient(buffer.ToArray());
            ReceiveForClient();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int factoryID = Convert.ToInt32(comboBox2.Text);
            int userID    = Convert.ToInt32(comboBox1.Text);

            FactoryInfo info = new FactoryInfo(factoryID, "", "");
            User        user = new User(false, 1, userID);

            parent.AddFactoryUser(info, user);
        }
        public void AddFactory(User user, FactoryInfo info)
        {
            List <byte> buffer = new List <byte>();

            buffer.Add((byte)Operations.AddFactory);
            buffer.AddRange(BitConverter.GetBytes(user.userType));
            buffer.AddRange(BitConverter.GetBytes(user.factoryID));
            buffer.AddRange(info.serialise());
            SendToClient(buffer.ToArray());
            ReceiveForClient();
        }
Beispiel #5
0
        private void comboBoxesSelected(object sender, EventArgs e)
        {
            comboBox1.SelectedIndexChanged -= comboBoxesSelected;
            comboBox2.SelectedIndexChanged -= comboBoxesSelected;
            comboBox3.SelectedIndexChanged -= comboBoxesSelected;
            ComboBox box = (ComboBox)sender;

            currentFactory         = factories[box.SelectedIndex];
            comboBox1.SelectedItem = currentFactory.predprID;
            comboBox2.SelectedItem = currentFactory.name;
            comboBox3.SelectedItem = currentFactory.address;

            comboBox1.SelectedIndexChanged += comboBoxesSelected;
            comboBox2.SelectedIndexChanged += comboBoxesSelected;
            comboBox3.SelectedIndexChanged += comboBoxesSelected;
        }
        public List <FactoryInfo> GetFactories()
        {
            List <byte> bytes = new List <byte>();

            bytes.Add((byte)Operations.GetFactories);
            SendToClient(bytes.ToArray());
            List <byte> answer         = ReceiveForClient().ToList();
            Int32       FactoriesCount = BitConverter.ToInt32(answer.ToArray(), 0);

            answer.RemoveRange(0, sizeof(Int32));

            List <FactoryInfo> factories = new List <FactoryInfo>();

            for (int i = 0; i < FactoriesCount; i++)
            {
                factories.Add(FactoryInfo.deserialise(answer));
            }

            return(factories);
        }
 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {
     currentDestinationPlace = LoadedFactories[comboBox3.SelectedIndex];
 }
 public void AddFactoryUser(FactoryInfo info, User user)
 {
     client.AddFactoryUser(user, info);
 }
 public void DeleteSotrFactory(User user, FactoryInfo info)
 {
     client.DeleteUserFactory(user, info);
 }
 public void DeleteFactory(FactoryInfo info)
 {
     client.DeleteFactory(user, info);
 }
 public void AddFactory(FactoryInfo info)
 {
     client.AddFactory(user, info);
 }