/// <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)); }
/// <summary>Копіювати без посилань на комплектуюче</summary> /// <returns>Нове комплектуюче (ще без ІД)</returns> public Accessory CopyWithoutLinks() { dbObject copyObj = base.Copy(); Accessory accessoryCopy = (copyObj as Accessory); if (accessoryCopy != null) { accessoryCopy.Id = 0; accessoryCopy.BarCode = string.Empty; } Cases caseObj = copyObj as Cases; //BarCode = string.Empty; if (caseObj != null) { caseObj.Lamp = 0; caseObj.ElectronicUnit = 0; return(caseObj); } ElectronicUnits unitObj = copyObj as ElectronicUnits; if (unitObj != null) { unitObj.Case = 0; return(unitObj); } Lamps lampObj = copyObj as Lamps; if (lampObj != null) { lampObj.Case = 0; return(lampObj); } return((Accessory)copyObj); }
/// <summary>Отримати назву таблиці комплектуючого за типом</summary> /// <param name="type">Тип комплектуючого</param> /// <returns>Назва таблиці комплектуючого</returns> public static string GetTableNameForAccessory(TypeOfAccessories type) { Accessory accessory = null; switch (type) { case TypeOfAccessories.Lamp: accessory = new Lamps(); break; case TypeOfAccessories.ElectronicUnit: accessory = new ElectronicUnits(); break; case TypeOfAccessories.Case: accessory = new Cases(); break; } if (accessory == null) { throw new Exception("Не знайдено тип комплектуючого!"); } return accessory.GetType().Name; }
/// <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); }
private void startGroupRegistration() { currentCase = accessory as Cases; if (currentCase.Lamp == 0 || currentCase.ElectronicUnit == 0) { ShowMessage("����� ��������� ����� � ��. ����!"); return; } if (!(accessory is Cases)) { return; } currentLamp = new Lamps(); currentLamp.Read(currentCase.Lamp); currentUnit = new ElectronicUnits(); currentUnit.Read(currentCase.ElectronicUnit); if (!string.IsNullOrEmpty(currentLamp.BarCode) || !string.IsNullOrEmpty(currentUnit.BarCode)) { ShowMessage("��� ������� ��������� ����� �� ���� ����� ���� ��� �����-����"); return; } if (isMainDataEntered && warrantlyDataIsValid()) { accessory.Write(); } else { showWriteErrorMessage(); return; } groupRegistration = true; currentCase = new Cases(); currentCase.Read(accessory.Id); groupRegistrationButton.Hide(); groupSizeLabel = MainProcess.CreateLabel("", 5, 283, 230, MobileFontSize.Normal, MobileFontPosition.Left, MobileFontColors.Info, FontStyle.Bold); groupSize = 0; }
/// <summary>�������� ����� ������� �������������� �� �����</summary> /// <param name="type">��� ��������������</param> /// <returns>����� ������� ��������������</returns> public static string GetTableNameForAccessory(TypeOfAccessories type) { Accessory accessory = null; switch (type) { case TypeOfAccessories.Lamp: accessory = new Lamps(); break; case TypeOfAccessories.ElectronicUnit: accessory = new ElectronicUnits(); break; case TypeOfAccessories.Case: accessory = new Cases(); break; } if (accessory == null) { throw new Exception("�� �������� ��� ��������������!"); } return accessory.GetType().Name; }