static void AddDeviceTables(WordprocessingDocument Certificate, UserSession Session, TablesCreator Creator, string DeviceType, CardData DeviceCard, DateTime StartDateOfService) { //WordprocessingDocument CalibrationProtocol = GetDocument(Session, DeviceCard, StartDateOfService, CalibrationProtocolCategoryID); //XtraMessageBox.Show("DeviceType = " + DeviceType); IEnumerable <CertificateTableLook> TablesCollection = Creator.CertificateDeviceTablesCollection.Where(r => r.DeviceTypes.Any(s => s == DeviceType)); if (TablesCollection.Count() == 0) { XtraMessageBox.Show("Для прибра '" + DeviceType + "' не найден шаблон таблицы. Обратитесь к системному администратору."); } else { Dictionary <String, Table> TablesList = new Dictionary <String, Table>(); foreach (CertificateTableLook CurrentTable in TablesCollection) { WordprocessingDocument ParentDocument; string TempPath = ""; switch (CurrentTable.ParentDocumentCategory) { case CertificateTableLook.DocumentCategory.AcceptanceTestingProtocol: ParentDocument = CalibrationLib.GetDocument(Session, DeviceCard, CalibrationLib.AcceptanceTestingProtocolCategoryID, out TempPath); break; case CertificateTableLook.DocumentCategory.CalibrationProtocol: ParentDocument = CalibrationLib.GetDocument(Session, DeviceCard, CalibrationLib.CalibrationProtocolCategoryID, out TempPath); break; case CertificateTableLook.DocumentCategory.MeasuringData: ParentDocument = CalibrationLib.GetDocument(Session, DeviceCard, CalibrationLib.MeasuringDataCategoryID, out TempPath); break; default: ParentDocument = null; break; } if (TablesList.Any(r => r.Key == CurrentTable.TableName)) { CurrentTable.AdditionDeviceTable(ParentDocument, TablesList.First(r => r.Key == CurrentTable.TableName).Value); } else { TablesList.Add(CurrentTable.TableName, CurrentTable.GetDeviceTable(ParentDocument)); } //Certificate.MainDocumentPart.Document.Body.Append(CurrentTable.GetDeviceTable(ParentDocument)); //Certificate.MainDocumentPart.Document.Body.Append(CalibrationLib.NewParagraph(0, 0, JustificationValues.Left, 10)); if (ParentDocument != null) { ParentDocument.Close(); File.Delete(TempPath); } } foreach (KeyValuePair <String, Table> T in TablesList) { Certificate.MainDocumentPart.Document.Body.Append(T.Value); } } }
public ECTAnalysis CreateNewECTAnalysis(string name, string description) { ECTAnalysis ectAnalysis = new ECTAnalysis(this.ParentDocument, _analysis, this); _ectAnalyses.Add(ectAnalysis); AddDependancy(ectAnalysis); ParentDocument.Modify(); return(ectAnalysis); }
/// <summary> /// Creates new truck analysis based on solution /// This method used when loading truck analysis from file /// </summary> /// <param name="name"></param> /// <param name="description"></param> /// <param name="truckProperties"></param> /// <param name="constraintSet"></param> /// <param name="solutions"></param> /// <returns></returns> public TruckAnalysis CreateNewTruckAnalysis(string name, string description, TruckProperties truckProperties, TruckConstraintSet constraintSet, List <TruckSolution> solutions) { TruckAnalysis truckAnalysis = new TruckAnalysis(this.ParentDocument, _analysis, this, truckProperties, constraintSet); truckAnalysis.ID.SetNameDesc(name, description); truckAnalysis.Solutions = solutions; _truckAnalyses.Add(truckAnalysis); AddDependancy(truckAnalysis); ParentDocument.Modify(); return(truckAnalysis); }
public void UnSelectSolution(SelPackPalletSolution selSolution) { if (selSolution == null) { return; // this solution not selected } // remove from list _selectedSolutions.Remove(selSolution); ParentDocument.RemoveItem(selSolution); // fire event SolutionSelectionRemoved?.Invoke(this, selSolution); // set document modified (not analysis, otherwise selected solutions are erased) ParentDocument.Modify(); }
/// <summary> /// Creates a new truck analysis based on solution /// </summary> /// <param name="name">Analysis name</param> /// <param name="description">Description</param> /// <param name="truckProperties">Truck</param> /// <param name="constraintSet">ConstraintSet</param> /// <param name="solver">Solver to use to generate solutions</param> /// <returns></returns> public TruckAnalysis CreateNewTruckAnalysis(string name, string description, TruckProperties truckProperties, TruckConstraintSet constraintSet, ITruckSolver solver) { TruckAnalysis truckAnalysis = new TruckAnalysis(this.ParentDocument, _analysis, this, truckProperties, constraintSet); truckAnalysis.Name = name; truckAnalysis.Description = description; _truckAnalyses.Add(truckAnalysis); AddDependancy(truckAnalysis); solver.ProcessAnalysis(truckAnalysis); ParentDocument.NotifyOnNewTruckAnalysisCreated(_analysis, this, truckAnalysis); ParentDocument.Modify(); return(truckAnalysis); }
public void SelectSolutionBySol(PackPalletSolution sol) { if (HasSolutionSelected(sol)) { return; } // instantiate new SelSolution var selSolution = new SelPackPalletSolution(ParentDocument, this, sol); // insert in list _selectedSolutions.Add(selSolution); // fire event SolutionSelected?.Invoke(this, selSolution); // set document modified (not analysis, otherwise selected solutions are erased) ParentDocument.Modify(); }
static void AddSensorTables(WordprocessingDocument Protocol, UserSession Session, TablesCreator Creator, string SensorType, CardData SensorCard, DateTime StartDateOfService, string DeviceTypeName) { string SensorNumber = SensorCard.GetDeviceNumber(); IEnumerable <VerificationProtocolTableLook> TablesCollection = Creator.VerificationProtokolSensorTablesCollection.Where(r => r.DeviceTypes.Any(s => s == SensorType)); if (TablesCollection.Count() == 0) { XtraMessageBox.Show("Для датчика '" + SensorType + "' не найден шаблон таблицы. Обратитесь к системному администратору."); } else { foreach (VerificationProtocolTableLook CurrentTable in TablesCollection) { WordprocessingDocument ParentDocument; string TempPath = ""; switch (CurrentTable.ParentDocumentCategory) { case VerificationProtocolTableLook.DocumentCategory.AcceptanceTestingProtocol: ParentDocument = CalibrationLib.GetDocument(Session, SensorCard, CalibrationLib.AcceptanceTestingProtocolCategoryID, out TempPath); break; case VerificationProtocolTableLook.DocumentCategory.CalibrationProtocol: ParentDocument = CalibrationLib.GetDocument(Session, SensorCard, CalibrationLib.CalibrationProtocolCategoryID, out TempPath); break; case VerificationProtocolTableLook.DocumentCategory.MeasuringData: ParentDocument = CalibrationLib.GetDocument(Session, SensorCard, CalibrationLib.MeasuringDataCategoryID, out TempPath); break; default: ParentDocument = null; break; } Table NewSensorTable = CurrentTable.GetSensorsTable(ParentDocument, SensorNumber, DeviceTypeName); AddNewTable(Protocol, NewSensorTable, Protocol.GetTable("Заключение:").ElementsBefore().Last()); if (ParentDocument != null) { ParentDocument.Close(); File.Delete(TempPath); } } } return; }
public void UnSelectSolution(SelHCylinderPalletSolution selSolution) { if (null == selSolution) { return; // this solution not selected } // remove from list _selectedSolutions.Remove(selSolution); ParentDocument.RemoveItem(selSolution); // fire event if (null != SolutionSelectionRemoved) { SolutionSelectionRemoved(this, selSolution); } // set document modified (not analysis, otherwise selected solutions are erased) ParentDocument.Modify(); }
public JObject TaskInfoToJSON() { var jsonTaskInfo = new JObject { { "TaskId", Id }, { "Kind", Kind }, { "Desc", Description }, { "Name", GetMainFieldValueString("Name") }, { "State", State }, { "EndDate", GetMainFieldValueFormattedDateTime("EndDate") }, { "PerformerGroup", PerformerGroup }, { "PerformerEmployee", PerformerEmployee }, { "Notice", "" }, { "Document", ParentDocument.ToJSON() } }; return(jsonTaskInfo); }
static void AddSensorTables(WordprocessingDocument Certificate, UserSession Session, TablesCreator Creator, string DeviceType, string DeviceNumber, CardData DeviceCard, DateTime StartDateOfService) { IEnumerable <CertificateTableLook> TablesCollection = Creator.CertificateSensorTablesCollection.Where(r => r.DeviceTypes.Any(s => s == DeviceType)); if (TablesCollection.Count() == 0) { XtraMessageBox.Show("Для датчика '" + DeviceType + "' не найден шаблон таблицы. Обратитесь к системному администратору."); } else { foreach (CertificateTableLook CurrentTable in TablesCollection) { WordprocessingDocument ParentDocument; string TempPath = ""; switch (CurrentTable.ParentDocumentCategory) { case CertificateTableLook.DocumentCategory.AcceptanceTestingProtocol: ParentDocument = CalibrationLib.GetDocument(Session, DeviceCard, CalibrationLib.AcceptanceTestingProtocolCategoryID, out TempPath); break; case CertificateTableLook.DocumentCategory.CalibrationProtocol: ParentDocument = CalibrationLib.GetDocument(Session, DeviceCard, CalibrationLib.CalibrationProtocolCategoryID, out TempPath); break; case CertificateTableLook.DocumentCategory.MeasuringData: ParentDocument = CalibrationLib.GetDocument(Session, DeviceCard, CalibrationLib.MeasuringDataCategoryID, out TempPath); break; default: ParentDocument = null; break; } Certificate.MainDocumentPart.Document.Body.Append(CurrentTable.GetSensorsTable(ParentDocument, DeviceNumber)); //Certificate.MainDocumentPart.Document.Body.Append(CalibrationLib.NewParagraph(0, 0, JustificationValues.Left, 10)); if (ParentDocument != null) { ParentDocument.Close(); File.Delete(TempPath); } } } }
public void SelectSolutionByIndex(int index) { if (index < 0 || index > _solutions.Count) { return; // no solution with this index } if (HasSolutionSelected(index)) { return; } // instantiate new SelSolution var selSolution = new SelPackPalletSolution(ParentDocument, this, _solutions[index]); // insert in list _selectedSolutions.Add(selSolution); // fire event SolutionSelected?.Invoke(this, selSolution); // set document modified (not analysis, otherwise selected solutions are erased) ParentDocument.Modify(); }
public void SelectSolutionByIndex(int index) { if (index < 0 || index >= _caseSolutions.Count) { return; } if (HasSolutionSelected(index)) { return; } // instantiate new SelCaseSolution SelBoxCasePalletSolution selCaseSolution = new SelBoxCasePalletSolution(ParentDocument, this, _caseSolutions[index]); // insert in list _selectedSolutions.Add(selCaseSolution); // fire event if (null != SolutionSelected) { SolutionSelected(this, selCaseSolution); } // set document modified ParentDocument.Modify(); }
public void SelectSolutionByIndex(int index) { if (index < 0 || index > _solutions.Count) { return; // no solution with this index } if (HasSolutionSelected(index)) { return; // solution already selected } // instantiate new SelSolution SelBoxCaseSolution selSolution = new SelBoxCaseSolution(ParentDocument, this, _solutions[index]); // insert in list _selectedSolutions.Add(selSolution); // fire event if (null != SolutionSelected) { SolutionSelected(this, selSolution); } // set document modified (not analysis, otherwise selected solutions are erased) ParentDocument.Modify(); }
/// <summary> /// Removes a truck analysis /// </summary> /// <param name="truckAnalysis">Removed truck analysis</param> public void RemoveTruckAnalysis(TruckAnalysis truckAnalysis) { ParentDocument.RemoveItem(truckAnalysis); _truckAnalyses.Remove(truckAnalysis); }
/// <summary> /// Removes an ect analysis /// </summary> /// <param name="ectAnalysis"></param> public void RemoveECTAnalysis(ECTAnalysis ectAnalysis) { ParentDocument.RemoveItem(ectAnalysis); _ectAnalyses.Remove(ectAnalysis); }
/// <summary> /// Добавить в протокол таблицу с данными измерений датчика. /// </summary> /// <param name="Protocol">Документ протокола</param> /// <param name="Session">пользовательская сессия.</param> /// <param name="Creator">Объект создателя таблиц.</param> /// <param name="SensorType">Тип датчика.</param> /// <param name="SensorCard">Карточка датчика.</param> /// <param name="StartDateOfService">Дата начала сервисного обслуживания.</param> static void AddSensorTables(WordprocessingDocument Protocol, UserSession Session, TablesCreator Creator, string SensorType, CardData SensorCard, DateTime StartDateOfService) { string SensorNumber = SensorCard.GetDeviceNumber(); IEnumerable <ProtocolTableLook> TablesCollection = Creator.ProtokolSensorTablesCollection.Where(r => r.DeviceTypes.Any(s => s == SensorType)); if (TablesCollection.Count() == 0) { XtraMessageBox.Show("Для датчика '" + SensorType + "' не найден шаблон таблицы. Обратитесь к системному администратору."); } else { foreach (ProtocolTableLook CurrentTable in TablesCollection) { WordprocessingDocument ParentDocument; string TempPath = ""; switch (CurrentTable.ParentDocumentCategory) { case ProtocolTableLook.DocumentCategory.AcceptanceTestingProtocol: ParentDocument = CalibrationLib.GetDocument(Session, SensorCard, CalibrationLib.AcceptanceTestingProtocolCategoryID, out TempPath); break; case ProtocolTableLook.DocumentCategory.CalibrationProtocol: ParentDocument = CalibrationLib.GetDocument(Session, SensorCard, CalibrationLib.CalibrationProtocolCategoryID, out TempPath); break; case ProtocolTableLook.DocumentCategory.MeasuringData: ParentDocument = CalibrationLib.GetDocument(Session, SensorCard, CalibrationLib.MeasuringDataCategoryID, out TempPath); break; default: ParentDocument = null; break; } Table NewSensorTable = CurrentTable.GetSensorsTable(ParentDocument, SensorNumber); /*if (Protocol.MainDocumentPart.Document.Body.Elements<Table>().Count() > 0) * { * List<OpenXmlElement> NewList = Protocol.MainDocumentPart.Document.Body.Elements().ToList(); * int Index = NewList.Count - 4; * NewList.Insert(Index, CalibrationLib.NewParagraph(-113, -133, JustificationValues.Left, 11)); * NewList.Insert(Index, (OpenXmlElement)NewSensorTable); * Protocol.MainDocumentPart.Document.Body.RemoveAllChildren(); * foreach (OpenXmlElement Element in NewList) * { Protocol.MainDocumentPart.Document.Body.Append(Element); } * } * else * { * SdtBlock Block = Protocol.MainDocumentPart.Document.Body.Elements<SdtBlock>().First(); * SdtContentBlock ContentBlock = Block.Elements<SdtContentBlock>().First(); * List<OpenXmlElement> NewList = ContentBlock.Elements().ToList(); * int Index = NewList.Count - 4; * NewList.Insert(Index, CalibrationLib.NewParagraph(-113, -133, JustificationValues.Left, 11)); * NewList.Insert(Index, (OpenXmlElement)NewSensorTable); * ContentBlock.RemoveAllChildren(); * foreach (OpenXmlElement Element in NewList) * { ContentBlock.Append(Element); } * }*/ AddNewTable(Protocol, NewSensorTable, Protocol.GetTable("Дата").ElementsBefore().Last()); if (ParentDocument != null) { ParentDocument.Close(); File.Delete(TempPath); } } } return; }