Ejemplo n.º 1
0
        /// <summary>Получить визуальное представление (с информацией о элементах на которые возможны переходы)</summary>
        /// <param name="barcode">Штрихкод</param>
        /// <param name="topic">Заголовок</param>
        /// <param name="listOfDetail">Словарь єлементов с детальной информацией</param>
        /// <returns>Список ...</returns>
        public static List <LabelForConstructor> GetVisualPresenter(string barcode, out string topic, out Dictionary <string, KeyValuePair <Type, object> > listOfDetail)
        {
            TypeOfAccessories typeOfAccessories = BarcodeWorker.GetTypeOfAccessoriesByBarcode(barcode);
            Accessory         accessory         = null;

            switch (typeOfAccessories)
            {
            case TypeOfAccessories.Lamp:
                accessory = new Lamps();
                accessory.Read <Lamps>(barcode);
                break;

            case TypeOfAccessories.Case:
                accessory = new Cases();
                accessory.Read <Cases>(barcode);
                break;

            case TypeOfAccessories.ElectronicUnit:
                accessory = new ElectronicUnits();
                accessory.Read <ElectronicUnits>(barcode);
                break;
            }

            return(GetVisualPresenter(typeOfAccessories, accessory, out topic, out listOfDetail));
        }
Ejemplo n.º 2
0
 /// <summary>Изменить статус корпуса</summary>
 /// <param name="lighterBarcode">Штрихкод корпуса</param>
 /// <param name="status">Новый статус</param>
 /// <param name="remove">Процесс демонтажа?</param>
 /// <param name="map"></param>
 /// <param name="register"></param>
 /// <param name="position"></param>
 public static void ChangeLighterState(string lighterBarcode, TypesOfLampsStatus status, bool remove, int map,
                                       int register, int position)
     {
     //Корпус
     string command = string.Format(
         "UPDATE Cases SET Map=@Map,Register=@Register,Position=@Position,Status=@Status,{0}=0,DateOfActuality=@Date{1} WHERE RTRIM(Barcode)=@Barcode",
         IS_SYNCED,
         remove ? ",DrawdownDate=@DrawdownDate" : string.Empty);
     using (SqlCeCommand query = dbWorker.NewQuery(command))
         {
         query.AddParameter("Barcode", lighterBarcode);
         query.AddParameter("Status", status);
         query.AddParameter("Map", map);
         query.AddParameter("Register", register);
         query.AddParameter("Position", position);
         query.AddParameter("Date", DateTime.Now);
         query.AddParameter("DrawdownDate", DateTime.Now);
         query.ExecuteNonQuery();
         }
     //Эл блок
     object caseId = BarcodeWorker.GetIdByBarcode(lighterBarcode);
     command = string.Format(
         "UPDATE ElectronicUnits SET Status=@Status,{0}=0,DateOfActuality=@Date{1} WHERE [Case]=@Id",
         IS_SYNCED,
         remove ? ",DrawdownDate=@DrawdownDate" : string.Empty);
     using (SqlCeCommand query = dbWorker.NewQuery(command))
         {
         query.AddParameter("Status", status);
         query.AddParameter("Id", caseId);
         query.AddParameter("Date", DateTime.Now);
         query.AddParameter("DrawdownDate", DateTime.Now);
         query.ExecuteNonQuery();
         }
     //Лампа
     command = string.Format(
         "UPDATE Lamps SET Status=@Status,{0}=0,DateOfActuality=@Date{1} WHERE [Case]=@Id",
         IS_SYNCED,
         remove ? ",DrawdownDate=@DrawdownDate" : string.Empty);
     using (SqlCeCommand query = dbWorker.NewQuery(command))
         {
         query.AddParameter("Status", status);
         query.AddParameter("Id", caseId);
         query.AddParameter("Date", DateTime.Now);
         query.AddParameter("DrawdownDate", DateTime.Now);
         query.ExecuteNonQuery();
         }
     }