public ActionResult <OperationsTypeDTO> PostOperationsType(OperationsTypeDTO operationsTypeDTO) { OperationsType opType = new OperationsType(new Designation(operationsTypeDTO.designation)); _IOperationsTypeRepository.Insert(opType); return(CreatedAtAction(nameof(GetAllOperationsType), new { id = opType.Id }, opType)); }
/// <summary> /// API for read KB9000. /// Usage: /// Call this function from frmMain window /// </summary> /// <param name="strTemplate">the template data readed from KB9000.</param> public KB9API.KB9API_ERROR read_kb9000(ref string strData) { try { #if _DEBUG_ME #else if (!FindKB9000()) { return(KB9API.KB9API_ERROR.FUNC_NODEVICE_DRIVER); } #endif this.KB9Error = KB9API.KB9API_ERROR.FUNC_SUCCESSFUL; //start_operation(_ThreadParam); m_operationType = OperationsType.Read; m_strData = ""; KB9API.StartReadingKB9(KB9API.m_PortType); DialogResult result = show_progress("Reading KB9000 ..."); //blocked #if _DEBUG_ME return(KB9API.KB9API_ERROR.FUNC_SUCCESSFUL); #else if (result == DialogResult.Cancel) { return(KB9API.KB9API_ERROR.FUNC_UNKOWN_ERROR); } else { if (this.KB9Error != KB9API.KB9API_ERROR.FUNC_SUCCESSFUL) { return(this.KB9Error); } else { KB9API.ReadKB9Data(ref m_strData); strData = m_strData; return(KB9API.KB9API_ERROR.FUNC_SUCCESSFUL); } } #endif } catch (System.Exception ex) { return(KB9API.KB9API_ERROR.FUNC_UNHANDLED_EXCEPTION); } }
/// <summary> /// API for write template data to KB9000. /// Usage: /// Call it in frmMain window /// </summary> /// <param name="strTemplate">the data structure to write to kb9k</param> public KB9API.KB9API_ERROR write_kb9000(string strTemplate) { try { #if _DEBUG_ME #else if (!FindKB9000()) { return(KB9API.KB9API_ERROR.FUNC_NODEVICE_DRIVER); } #endif this.KB9Error = KB9API.KB9API_ERROR.FUNC_SUCCESSFUL; m_operationType = OperationsType.Write; KB9API.StartWriting(KB9API.m_PortType, strTemplate); DialogResult result = show_progress("Writing KB9000 ..."); #if _DEBUG_ME return(KB9API.KB9API_ERROR.FUNC_SUCCESSFUL); #endif if (result == DialogResult.Cancel) { return(KB9API.KB9API_ERROR.FUNC_UNKOWN_ERROR); } else { if (this.KB9Error != KB9API.KB9API_ERROR.FUNC_SUCCESSFUL) { return(this.KB9Error); } else { //uint nwriten = KB9API.GetWritingResult(); //MessageBox.Show("Writen len = " + nwriten.ToString()); return(KB9API.KB9API_ERROR.FUNC_SUCCESSFUL); } } } catch (System.Exception ex) { return(KB9API.KB9API_ERROR.FUNC_UNHANDLED_EXCEPTION); } }
public bool Update(OperationsType operationsType) { _context.Entry(operationsType).State = EntityState.Modified; try { _context.SaveChanges(); return(true); } catch (DbUpdateConcurrencyException) { if (operationsType.Id.Equals(-1)) { throw new Exception("No operationsType with that id"); } else { throw; } } }
public async Task <TryInsert> TryInsertNewOperationAsync(int computerId, OperationsType operationType) { using (MagicUpdaterEntities context = new MagicUpdaterEntities()) { try { context.Operations.Add(new Operation { ComputerId = computerId, OperationType = (int)operationType, CreationDate = System.DateTime.UtcNow, CreatedUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name }); await context.SaveChangesAsync(); return(new TryInsert(true, null)); } catch (Exception ex) { return(new TryInsert(false, ex.Message)); } } }
public IAsyncResult BeginOnOperationCompleted(OperationsType operationType, int resultsCount, string log, bool skipped, AsyncCallback callback, object asyncState) { throw new NotImplementedException(); }
public void OnOperationCompleted(OperationsType operationType, int resultsCount, string log, bool skipped) { _syncContext.Post(new SendOrPostCallback(OnOperationCompletedEvent), new OnOperationCompletedEventArgs(operationType, resultsCount, log, skipped)); }
public OnOperationCompletedEventArgs(OperationsType operationType, int count, string log, bool skipped) : base(log, skipped) { _operationType = operationType; _resultsCount = count; }
private void btnAddConversion_Click(object sender, EventArgs e) { if (cmbAddConversion.SelectedItem == null) { return; } TaskListCompleted(false); string taskItem = (string)cmbAddConversion.SelectedItem; var selected = _conversionTypes[taskItem]; OperationsType operationsType = selected.Item1; var tolerance = (double)numTolerance.Value; switch (operationsType) { case OperationsType.ConvertToDwg: var dwgVersion = (WriteAutodeskversionType)selected.Item2; taskItem = String.Format("{0} (Tol. {1})", taskItem, tolerance); _client.ConvertToDwg(new[] { dwgVersion }, chkAciColors.Checked, tolerance); break; case OperationsType.ConvertToDxf: var dxfVersion = (WriteAutodeskversionType)selected.Item2; var dxfTol = (double)numTolerance.Value; taskItem = String.Format("{0} (Tol. {1})", taskItem, dxfTol); _client.ConvertToDxf(new[] { dxfVersion }, chkAciColors.Checked, dxfTol); break; case OperationsType.ConvertToIges: _client.ConvertToIges(); break; case OperationsType.ConvertToObj: taskItem = String.Format("{0} (Tol. {1})", taskItem, tolerance); _client.ConvertToObj(tolerance); break; case OperationsType.ConvertToStep: _client.ConvertToStep(); break; case OperationsType.ConvertToStl: taskItem = String.Format("{0} (Tol. {1})", taskItem, tolerance); _client.ConvertToStl(tolerance); break; case OperationsType.ConvertToXml: _client.ConvertToXml(); break; case OperationsType.ConvertToWebGL: taskItem = String.Format("{0} (Tol. {1})", taskItem, tolerance); _client.ConvertToWebGL(tolerance, btnHtmlBodyColor.BackColor); break; case OperationsType.ConvertTo3DPdf: _client.ConvertTo3DPdf(); break; } lstBoxTasks.Items.Add(taskItem); }
public bool Insert(OperationsType operationsType) { _context.OperationsType.Add(operationsType); _context.SaveChanges(); return(true); }
public static OperationsTypeDTO generateDto(OperationsType operationsType) { OperationsTypeDTO p = new OperationsTypeDTO(operationsType.Id, operationsType.designation.designation); return(p); }
public bootstrap(MasterContext context) { _context = context; if (_context.OperationsType.Count() == 0) { OperationsType opType1 = new OperationsType { designation = new Designation { designation = "operationsType1" } }; OperationsType opType2 = new OperationsType { designation = new Designation { designation = "operationsType2" } }; _context.OperationsType.Add(opType1); _context.OperationsType.Add(opType2); _context.SaveChanges(); } if (_context.Operations.Count() == 0) { Operations op1 = new Operations { designation = new Designation { designation = "operations1" }, ToolDetails = new Details { Det = "details1" }, Dur = new Duration { dur = 1111 }, operationsType = _context.OperationsType.Find(1) }; Operations op2 = new Operations { designation = new Designation { designation = "operations2" }, ToolDetails = new Details { Det = "details1" }, Dur = new Duration { dur = 2222 }, operationsType = _context.OperationsType.Find(2) }; _context.Operations.Add(op1); _context.Operations.Add(op2); _context.SaveChanges(); } if (_context.MachineType.Count() == 0) { List <Operations> lista1 = new List <Operations>(); List <Operations> lista2 = new List <Operations>(); lista1.Add(_context.Operations.Find(1)); lista2.Add(_context.Operations.Find(2)); _context.MachineType.Add(new MachineType(new Designation("machineType1"), lista1)); _context.MachineType.Add(new MachineType(new Designation("machineType2"), lista2)); _context.SaveChanges(); } if (_context.Machine.Count() == 0) { _context.Machine.Add(new Machine(new Designation("machine1"), _context.MachineType.Find(1), new Model("model1"), new Location("factory1", "floor1", "section1"), new Position(1), new Capacity(10))); _context.Machine.Add(new Machine(new Designation("machine2"), _context.MachineType.Find(2), new Model("model2"), new Location("factory2", "floor2", "section2"), new Position(2), new Capacity(20))); _context.SaveChanges(); } if (_context.ProductionLine.Count() == 0) { List <Machine> lista1 = new List <Machine>(); List <Machine> lista2 = new List <Machine>(); lista1.Add(_context.Machine.Find(1)); lista2.Add(_context.Machine.Find(2)); _context.ProductionLine.Add(new ProductionLine(lista1)); _context.ProductionLine.Add(new ProductionLine(lista2)); _context.SaveChanges(); } }