public void RetrieveSizeOfNoOp() { var t_DTO = new OperationDTO(0, new byte[] { }); t_DTO.TotalSize.Should().Be(1); t_DTO.DataSize.Should().Be(0); }
[HttpPost] //Always explicitly state the accepted HTTP method public IHttpActionResult Sub([FromBody] RootSubRequest rootRequest) { ContextOperation context = new ContextOperation(); RootSubResponse rootResponse = new RootSubResponse() { Difference = context.Diff(rootRequest.Minuend, rootRequest.Subtrahend) }; System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers; string XEviTrackingId = string.Empty; if (headers.Contains("XEviTrackingId")) { XEviTrackingId = headers.GetValues("XEviTrackingId").FirstOrDefault(); OperationDTO operation = new OperationDTO() { Calculation = (rootRequest.Minuend + context.BinaryOperationStrategy.OperatorCode + rootRequest.Subtrahend) + "=" + rootResponse.Difference, Id = XEviTrackingId, Date = DateTime.Now, Operation = context.BinaryOperationStrategy.Name }; this.journalDBOperations.PersistOperation(operation); } return(Ok(rootResponse)); }
[HttpPost] //Always explicitly state the accepted HTTP method public IHttpActionResult Mult([FromBody] RootMultRequest rootRequest) { ContextOperation context = new ContextOperation(); RootMultResponse rootResponse = new RootMultResponse() { Product = context.Multiply(rootRequest.Factors) }; System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers; string XEviTrackingId = string.Empty; if (headers.Contains("XEviTrackingId")) { XEviTrackingId = headers.GetValues("XEviTrackingId").FirstOrDefault(); OperationDTO operation = new OperationDTO() { Calculation = String.Join(context.MultipleArgsOperationStrategy.OperatorCode, rootRequest.Factors) + "=" + rootResponse.Product, Id = XEviTrackingId, Date = DateTime.Now, Operation = context.MultipleArgsOperationStrategy.Name }; this.journalDBOperations.PersistOperation(operation); } return(Ok(rootResponse)); }
[HttpPost] //Always explicitly state the accepted HTTP method public IHttpActionResult Div([FromBody] RootDivRequest rootRequest) { double remainder = 0; ContextOperation context = new ContextOperation(); RootDivResponse rootResponse = new RootDivResponse() { Quotient = context.Division(rootRequest.Dividend, rootRequest.Divisor, out remainder), Remainder = remainder }; System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers; string XEviTrackingId = string.Empty; if (headers.Contains("XEviTrackingId")) { XEviTrackingId = headers.GetValues("XEviTrackingId").FirstOrDefault(); OperationDTO operation = new OperationDTO() { Calculation = (rootRequest.Dividend + context.BinaryOperationStrategy.OperatorCode + rootRequest.Divisor) + "=" + rootResponse.Quotient, Id = XEviTrackingId, Date = DateTime.Now, Operation = context.BinaryOperationStrategy.Name }; this.journalDBOperations.PersistOperation(operation); } return(Ok(rootResponse)); }
[HttpPost] //Always explicitly state the accepted HTTP method public IHttpActionResult Sqrt([FromBody] RootSqrtRequest rootRequest) { ContextOperation context = new ContextOperation(); RootSqrtResponse rootResponse = new RootSqrtResponse() { Square = context.Square(rootRequest.Number), }; System.Net.Http.Headers.HttpRequestHeaders headers = this.Request.Headers; string XEviTrackingId = string.Empty; if (headers.Contains("XEviTrackingId")) { XEviTrackingId = headers.GetValues("XEviTrackingId").FirstOrDefault(); OperationDTO operation = new OperationDTO() { Calculation = (context.UnaryOperationStrategy.OperatorCode + rootRequest.Number) + "=" + rootResponse.Square, Id = XEviTrackingId, Date = DateTime.Now, Operation = context.UnaryOperationStrategy.Name }; this.journalDBOperations.PersistOperation(operation); } return(Ok(rootResponse)); }
public bool SaveMeasurement(EmployeeDTO employee, OperationDTO operation, PatientDTO patient, DAQSettingsDTO DAQ, BPDataSequenceDTO dataSequence, TransdusorDTO transdusor, string pathcomment, string pathoperation) { long OperationID_; bool saved = true; int BPdataID_; string insertStringParamOperation = @"INSERT INTO Operation(OPNurseFirstName, OPNurseLastName, OPNurseIDNumber, NumberOFAlarms, Comments, DurationOperation_hour, DurationOperation_min, DurationOperation_sec, PatientCPR, Complikations) OUTPUT INSERTED.OperationID VALUES(@OPNurseFirstName, @OPNurseLastName, @OPNurseIDNumber, @NumberOFAlarms, @Comments, @DurationOperation_hour, @DurationOperation_min, @DurationOperation_sec, @PatientCPR, @Complikations)"; using (SqlCommand cmd = new SqlCommand(insertStringParamOperation, OpenConnection)) { parameterBuilder_.AddEmployee(cmd, employee); parameterBuilder_.AddOperation(cmd, operation); parameterBuilder_.AddComments(cmd, pathcomment); parameterBuilder_.AddPatient(cmd, patient); OperationID_ = (long)cmd.ExecuteScalar(); } string insertStringParamBPDataSequence = @"INSERT INTO BPDataSequence( Raw_Data, Samplerate_hz, Interval_sec, NumberOfSequences, SequenceDuration_sec, Data_Format, Bin_or_Text, Measurement_Format_Type, ConversionConstant_mmhgprmV, ZeroPoint_mmHg, Transdusor_Identification, OperationID ) OUTPUT INSERTED.BPdataID VALUES(@Raw_Data,@Samplerate_hz, @Interval_sec, @NumberOfSequences, @SequenceDuration_sec, @Data_Format, @Bin_or_Text, @Measurement_Format_Type,@ConversionConstant_mmhgprmV,@ZeroPoint_mmHg,@Transdusor_Identification,@OperationID)"; using (SqlCommand cmd = new SqlCommand(insertStringParamBPDataSequence, OpenConnection)) { parameterBuilder_.AddRawData(cmd, Zipfolder(pathoperation)); parameterBuilder_.AddDAQ(cmd, DAQ); parameterBuilder_.AddDataSequence(cmd, dataSequence); parameterBuilder_.AddTransdusor(cmd, transdusor); cmd.Parameters.AddWithValue("@OperationID", OperationID_); BPdataID_ = (int)cmd.ExecuteScalar(); } return(saved); }
public ActionResult EditOperation(int?id) { try { EditOperationViewModel model; OperationDTO operationDTO = operationService.GetOperation(id.Value); if (operationDTO != null) { Mapper.Initialize(opt => opt.CreateMap <OperationDTO, EditOperationViewModel>()); model = Mapper.Map <OperationDTO, EditOperationViewModel>(operationDTO); List <ManagerDTO> managerDTOs = operationService.GetManagers().ToList(); model.ManagerList = new SelectList(managerDTOs, "Id", "Nickname"); List <ClientDTO> clientDTOs = operationService.GetClients().ToList(); model.ClientList = new SelectList(clientDTOs, "Id", "Nickname"); List <ProductDTO> productDTOs = operationService.GetProducts().ToList(); model.ProductList = new SelectList(productDTOs, "Id", "Name"); return(View(model)); } throw new ArgumentException("Operation not found."); } catch (Exception e) { ViewBag.ErrorInformation = e.Message; return(View("Error")); } }
public async Task <IList <OperationDTO> > GetAllOperationsByGroupAsync(int groupId) { return(await this.operationRepository.GetAll() .Where(x => x.GroupId == groupId) .Select(x => OperationDTO.FromEntity(x)) .ToListAsync()); }
public Operation(OperationDTO operationDto) { Duration = new OperationDuration(operationDto.Duration); Description = new OperationDescription(operationDto.Description); Tool = new OperationTool(operationDto.Tool); SetupTime = new OperationToolSetupTime(operationDto.SetupTime); }
// 1. arhivira procitana requested i received dokumenta // 2. čuva kreirana dokumenta // 3. šalje event za dokumenta koja ne mora da čuva (ne postoji osluškuvač) public void SaveOperation(OperationDTO operation) { //arhiviranje //foreach(DocumentDTO doc in operation.Requested) //{ //} //čuvanje // SELECTED REQUESTED AND RECEIVED DOCS operation.Requested?.ToList().ForEach(item => DocumentRepository.Update(Mapper.Map <Document>(item))); operation.Received?.ToList().ForEach(item => DocumentRepository.Update(Mapper.Map <Document>(item))); operation.OutputDocuments?.ToList().ForEach(item => DocumentRepository.Insert(Mapper.Map <Document>(item))); operation.OutputDocuments?.Where(d => d.OutputOperation == OutputOperationsDTO.Create).ToList().ForEach(item => { _bus.PublishDocumentCreated(Mapper.Map <Document>(item)); }); operation.OutputDocuments?.Where(d => d.OutputOperation == OutputOperationsDTO.Update).ToList().ForEach(item => { _bus.Publish(Mapper.Map <UpdateDocumentCommand>(item)); }); operation.OutputDocuments?.Where(d => d.OutputOperation == OutputOperationsDTO.Send).ToList().ForEach(doc => { Console.WriteLine("Sending document " + doc.Type); _bus.Publish(Mapper.Map <Document>(doc)); }); }
public OperationDTO Modifier(int id, OperationDTO op) { op.Id = id; op.Auteur = utilisateurService.TrouverUnUtilisateur(op.Auteur.Id); operations[id] = op; return(op); }
public OperationDTO AjouterUneOperation(OperationDTO op) { op.Id = operations.Count(); op.Auteur = utilisateurService.TrouverUnUtilisateur(op.Auteur.Id); operations.Add(op); return(op); }
public async Task AddOperation(OperationDTO model) { using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { var product = await uow.ProductRepository.GetItem(model.ProductId); CheckModelValidation(model, product); if (model.OperationType == OperationType.Outcome) { product.Count -= model.Amount; } else { product.Count += model.Amount; } await uow.OperationRepository.Create(mapper.Map <Operation>(model)); uow.ProductRepository.Update(product); await uow.Save(); scope.Complete(); } }
public OperationDTO Retirer(String code, double montant, int codeEmp) { //-- INSTANCIATION OperationDTO operationDTO = new OperationDTO(); //-- END INSTANTIATION try { //-- GETTING DATA Operation operation = _operationRepository.Retirer(code, montant, codeEmp); //-- END GETTING DATA //-- TRANSFER DATA TO DTO operationDTO.NumeroOperation = operation.NumeroOperation; operationDTO.Montant = operation.Montant; operationDTO.TypeO = operation.TypeO; operationDTO.DateOperation = operation.DateOperation; operationDTO.MessageResult = "Operation Withdrawal successfully"; //-- END TRANSFER DATA TO DTO } catch (NullReferenceException Exception) { operationDTO.MessageResult = Exception.Message; } return(operationDTO); }
public IEnumerable <OperationDTO> GetOperations() { //-- INSTANCIATION List <OperationDTO> operationsDTO = new List <OperationDTO>(); //-- END INSTANTIATION try { foreach (Operation operation in _operationRepository.GetOperations()) { //-- Transfering DATA TO DTO OperationDTO operationDTO = new OperationDTO(); operationDTO.NumeroOperation = operation.NumeroOperation; operationDTO.TypeO = operation.TypeO; operationDTO.Montant = operation.Montant; operationDTO.DateOperation = operation.DateOperation; operationDTO.MessageResult = "OPERATION " + operation.NumeroOperation + " WAS FOUND"; //-- ENDTransfering DATA TO DTO operationsDTO.Add(operationDTO); } } catch (NullReferenceException Exception) { System.Diagnostics.Debug.WriteLine(Exception.Message); } return(operationsDTO); }
public void Setup() { alarmDto = new AlarmDTO(); operationDto = new OperationDTO(); akutAlarmPlayer = new MuckAkutAlarmPlayer(); subAkutAlarmPlayer = new MuckSubAkutAlarmPlayer(); uut = new Alarm(alarmDto, subAkutAlarmPlayer, akutAlarmPlayer, operationDto); }
public async Task <byte[]> GenerateOperationReportAsync(int operationId) { var operation = await this.operationRepository.GetByIdAsync(operationId); var operationDto = OperationDTO.FromEntity(operation); return(Serialize <OperationDTO>(operationDto)); }
// 1. arhivira procitana requested i received dokumenta // 2. čuva kreirana dokumenta // 3. šalje event za dokumenta koja ne mora da čuva (ne postoji osluškuvač) public void SaveOperation(OperationDTO operation) { //arhiviranje //čuvanje //posalji }
public void PersistOperation(OperationDTO operationDTO) { using (JournalContext db = new JournalContext()) { db.OperationDTOes.Add(operationDTO); db.SaveChanges(); } }
public void AddOperation(SqlCommand cmd, OperationDTO operation) { cmd.Parameters.AddWithValue("@NumberOFAlarms", operation.NumberOfAlarms_); cmd.Parameters.AddWithValue("@DurationOperation_hour", operation.DurationOperation_hour_); cmd.Parameters.AddWithValue("@DurationOperation_min", operation.DurationOperation_min_); cmd.Parameters.AddWithValue("@DurationOperation_sec", operation.DurationOperation_sec_); cmd.Parameters.AddWithValue("@Complikations", operation.Complikations_); }
public async Task <Guid> Save(OperationDTO data) { var operationService = _operationFactory.GetOperation(data.Operation); var result = await operationService.Calc(data.Right, data.Left); var id = SaveToStorage(result); return(id); }
//搜索的手术ID的Json list public ActionResult OpeSea(string op_ID) { OperationService operationService = new OperationService(); OperationDTO dto = operationService.GetById(op_ID); List <OperationDTO> operationDTOs = new List <OperationDTO>(); operationDTOs.Add(dto); return(Json(operationDTOs)); }
public void EnsureTimeSpanPFailsParse() { string duration = "10,00:00"; string setupTime = "00:10:00"; OperationDTO operationDTO = new OperationDTO(new Guid(), "description", duration, "50mm", setupTime); Assert.Throws <FormatException>(() => new Operation(operationDTO)); }
public async Task UpdateOperationAsync(OperationDTO dto) { var operation = await this.operationRepository.GetByIdAsync(dto.Id); operation.Description = dto.Description; operation.Amount = dto.Amount; await this.operationRepository.UpdateAsync(operation); }
public IOperation Convert(OperationDTO DTO) { if (DTO.OpCode == 0 && DTO.TotalSize == 1) { return(new MockNoOp()); } throw new Exception("Invalid OpCode"); }
public IOperation ReadOperation(OperationDTO DTO) { return (_HasConverterForOperation(DTO.OpCode) ? _RetrieveConverter(DTO.OpCode) .Convert(DTO) : throw new UnknownOperation(DTO)); }
public void Update(OperationDTO opr) { var model = Converter.Convert <OperationEntity, OperationDTO>(opr); var item = dbaccess.Operation.Where(x => x.Id == model.Id).FirstOrDefault <OperationEntity>(); item.Id = model.Id; item.Name = model.Name; dbaccess.SaveChanges(); }
public static OperationDTO OperationToOutDTO(Operation operation) { var operationDTO = new OperationDTO { OperationId = operation.Id, OperationName = operation.OperationName, }; return(operationDTO); }
public static Operation OutDTOToOperation(OperationDTO operationDTO) { var operation = new Operation { Id = operationDTO.OperationId, OperationName = (operationDTO.OperationName), }; return(operation); }
public ActionResult <Operation> PostOperation(OperationDTO DTO) { Operation operation = new Operation(); operation.Duration = DTO.Duration; _operationRepository.Add(operation); _operationRepository.SaveChanges(); return(CreatedAtAction(nameof(GetOperation), new { id = operation.Id }, operation)); }