Ejemplo n.º 1
0
        /// <summary>Переход на другое элемент</summary>
        /// <param name="sender">Кнопка</param>
        private void button_click(object sender)
        {
            Button button  = ((Button)sender);
            string command = string.Format("SELECT {0},{1} FROM {2} WHERE {3}=@Id",
                                           dbObject.BARCODE_NAME, dbObject.IDENTIFIER_NAME,
                                           button.Name, dbObject.IDENTIFIER_NAME);
            List <object> values = null;

            using (SqlCeCommand query = dbWorker.NewQuery(command))
            {
                query.AddParameter("Id", button.Tag);
                values = query.SelectToList();
            }

            if (values != null && values.Count == 2 && values[0] != null)
            {
                string barcode = values[0].ToString().TrimEnd();

                if (!string.IsNullOrEmpty(barcode))
                {
                    showInfoByBarcode(barcode);
                }
                else
                {
                    long id = values[1] != null?Convert.ToInt64(values[1]) : 0;

                    TypeOfAccessories typeOfAccessories = button.Name == typeof(Lamps).Name
                                                              ? TypeOfAccessories.Lamp
                                                              : TypeOfAccessories.ElectronicUnit;
                    showInfoById(id, typeOfAccessories);
                }
            }
        }
Ejemplo n.º 2
0
        private List <object> getFilledPosition()
        {
            using (SqlCeCommand query =
                       dbWorker.NewQuery("SELECT c.Position FROM Cases c WHERE c.Map=@Map AND c.Register=@Register"))
            {
                query.AddParameter("Map", MapInfo.Id);
                query.AddParameter("Register", Register);

                return(query.SelectToList());
            }
        }