Example #1
0
        private void btn_AddProduct_Click(object sender, EventArgs e)
        {
            Parameters parameters;
            var        allNud = Tools.GetAllChildControl(this, typeof(NumericUpDown));

            PropertyInfo[] properties = typeof(Product).GetProperties();


            foreach (NumericUpDown nud in allNud)
            {
                foreach (var prop in properties)
                {
                    if (nud.Name.Contains(prop.Name))
                    {
                        parameters       = (Parameters)prop.GetValue(product);
                        parameters.Value = nud.Value.ToString();
                        break;
                    }
                }
            }
            infoControls.comType         = commandType.write;
            infoControls.requestDataType = RequestDataType.products;
            DataTypeComStatus protocolAllow = dataExchange.DataExchangeProtocol(infoControls);

            if (protocolAllow == DataTypeComStatus.writeableProducts)
            {
                dataExchange.SendData <Product>(product);
            }
        }
        private void ListProducts()
        {
            infoControls.comType         = commandType.read;
            infoControls.requestDataType = RequestDataType.products;
            DataTypeComStatus allowProtocol = dataExchange.DataExchangeProtocol(infoControls);

            if (allowProtocol == DataTypeComStatus.readableProducts)
            {
                Product product = new Product();
                dataCollection = dataExchange.GetData <Product>();
                if (dataCollection != null)
                {
                    foreach (KeyValuePair <int, Product> KeyValuePairProduct in dataCollection)
                    {
                        productData = KeyValuePairProduct.Value;
                        string[] row =
                        {
                            productData.ProductName.Value,   productData.LabelName.Value, productData.Cable1Color.Value,
                            productData.Cable2Color.Value,   productData.Quantity.Value,  productData.CableSection.Value,
                            productData.CableDiameter.Value, productData.CableDirection.Value
                        };
                        var lvi = new ListViewItem(row);
                        listView_Products.Items.Add(lvi);
                    }
                }
            }
        }
        private void ListAccounts()
        {
            infoControls.comType         = commandType.read;
            infoControls.requestDataType = RequestDataType.users;
            DataTypeComStatus protocolAllow = global.dataExchange.DataExchangeProtocol(infoControls);
            ListData          listData      = new ListData();

            if (protocolAllow == DataTypeComStatus.readableAccounts)
            {
                lV_Users = listData.List <Account>(lV_Users);
            }
        }
        private void ListCables()
        {
            infoControls.comType         = commandType.read;
            infoControls.requestDataType = RequestDataType.cables;
            DataTypeComStatus allowProtocol = global.dataExchange.DataExchangeProtocol(infoControls);
            ListData          listData      = new ListData();

            if (allowProtocol == DataTypeComStatus.readableCables)
            {
                Cable cable = new Cable();

                lV_Cables = listData.List <Cable>(lV_Cables);
            }
        }
Example #5
0
        private void btn_AddCable_Click(object sender, EventArgs e)
        {
            infoControls.comType         = commandType.write;
            infoControls.requestDataType = RequestDataType.cables;
            DataTypeComStatus allowProtocol = global.dataExchange.DataExchangeProtocol(infoControls);

            if (allowProtocol == DataTypeComStatus.writeableCables)
            {
                Cable cable = new Cable();
                cable.Name.Value          = txt_CableName.Text;
                cable.Section.Value       = txt_CableSection.Text;
                cable.OuterDiameter.Value = txt_OuterDiameter.Text;
                cable.Direction.Value     = txt_Direction.Text;
                cable.Color.Value         = txt_Color.Text;
                global.dataExchange.SendData <Cable>(cable);
            }
        }
Example #6
0
        private void btn_AddAccount_Click(object sender, EventArgs e)
        {
            infoControls.comType         = commandType.write;
            infoControls.requestDataType = RequestDataType.users;
            DataTypeComStatus protocolAllow = dataExchange.DataExchangeProtocol(infoControls);

            if (protocolAllow == DataTypeComStatus.writeableAccounts)
            {
                account.UserName.Value    = txt_userName.Text;
                account.Pin.Value         = txt_Pin.Text;
                account.BarcodPin.Value   = txt_BarcodPin.Text;
                account.Level.Value       = cb_Level.Text;
                account.ProtectInfo.Value = cb_ProtecInfo.Text;
                dataExchange.SendData <Account>(account);
                MessageBox.Show("Kullanıcı başarlı bir şekilde eklendi.");
            }
            else
            {
                MessageBox.Show("Haberleşme protokolünde hata oluştu!");
            }
        }