public JsonResult GetTimeBProjecty(long project_id) { try { var times = _timeRepository.getTimeByProject(project_id); if (times != null) { List <TimeDTO> timesDTO = new List <TimeDTO>(); foreach (var item in times) { var timeDTO = new TimeDTO(item.Id, item.Project, item.User, item.Started_at, item.Ended_at); timesDTO.Add(timeDTO); } return(Json(times)); } return(Json("not found")); } catch (Exception ex) { return(new JsonResult(BadRequest()) { StatusCode = 400, Value = new GenericCommandResult(false, ex.Message, null) }); } }
public static Time Map(TimeDTO dto, Time time) { time.Amount = dto.Amount; time.Category = dto.Category; time.Date = dto.Date; return(time); }
private void btnAlterar_Click(object sender, EventArgs e) { TimeDTO dto = new TimeDTO(); dto.br_bairro = txtbairro.Text; dto.cd_cidade = txtcidade.Text; dto.cp_cep = Convert.ToInt32(mktcep.Text); dto.cn_cnpj = Convert.ToInt32(mktrg.Text); dto.cp_complemento_endereco = txtcomplemento.Text; dto.dt_data_cadastro = dtpdatacadastro.Text; dto.em_email = txtapelido.Text; dto.so_site_oficial = txtaltura.Text; dto.tf_telefone_fixo = mkttelefone.Text; dto.tl_celular = Convert.ToInt32(mktcelular.Text); dto.fd_fundadores = txtposicao.Text; dto.lg_logo = ImagemPlugin.ConverterParaString(pbfotoTime.Image); dto.nm_estadio = txtpedo.Text; dto.nm_nomeclube = txtnome.Text; dto.nm_nome_mascara = txtcidade.Text; dto.nr_numero = txtnumerocasa.Text; dto.obs_onservacoes = txtobservacoes.Text; dto.ps_pais = txtpais.Text; dto.ra_rua = txtrua.Text; TimeBusiness business = new TimeBusiness(); business.Alterar(dto); }
public HttpResponseMessage GetProjectTimeRecords([FromBody] int projectId) { if (projectId != 0) { var records = repo.GetProjectTimeRecords(projectId); List <TimeDTO> ProjectTimeRecords = new List <TimeDTO>(); if (records == null || records.Count() == 0) { return(Request.CreateResponse(HttpStatusCode.NotFound, "No Records were found.")); } else { EntityToDTO etd = new EntityToDTO(); foreach (var r in records) { r.TimeSpent = CalculateProjectHours(r); TimeDTO timeDTO = etd.TimeEntityToDTO(r); if (timeDTO != null) { ProjectTimeRecords.Add(timeDTO); } } ; return(Request.CreateResponse(HttpStatusCode.OK, ProjectTimeRecords)); } } else { return(Request.CreateResponse(HttpStatusCode.BadRequest, "An error Occured")); } }
private void button3_Click(object sender, EventArgs e) { try { TimeDTO dto = new TimeDTO(); dto.br_bairro = txtbairro.Text; dto.cd_cidade = txtcidade.Text; dto.cp_cep = mktcep.Text; dto.cn_cnpj = mktrg.Text; dto.cp_complemento_endereco = txtcomplemento.Text; dto.dt_data_cadastro = dtpdatacadastro.Text; dto.em_email = txtapelido.Text; dto.so_site_oficial = txtaltura.Text; dto.tf_telefone_fixo = mkttelefone.Text; dto.tl_celular = mktcelular.Text; dto.fd_fundadores = txtposicao.Text; dto.lg_logo = ImagemPlugin.ConverterParaString(pbfotoTime.Image); dto.nm_estadio = txtpedo.Text; dto.nm_nomeclube = txtnome.Text; dto.nm_nome_mascara = txtcidade.Text; dto.nr_numero = txtnumerocasa.Text; dto.obs_onservacoes = txtobservacoes.Text; dto.ps_pais = txtpais.Text; dto.ra_rua = txtrua.Text; dto.tf_telefone_fixo = mkttelefone.Text; TimeBusiness business = new TimeBusiness(); business.Salvar(dto); MessageBox.Show("Time cadastrado com sucesso", "vem pro fut", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (ArgumentException ex) { } }
public async Task <IActionResult> Put(int timeId, TimeDTO model) { try { var time = await this._repo.GetTimeById(timeId, false); if (time == null) { return(NotFound()); } this._mapper.Map(model, time); this._repo.Update(time); if (await this._repo.SaveChangesAsync()) { return(Created($"api/time/{model.TimeId}", this._mapper.Map <TimeDTO>(time))); } } catch (Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } return(BadRequest()); }
public static Time Map(TimeDTO timeDto) { if (timeDto is null) { new Time(); } return(new Time(timeDto.Hours, timeDto.Minutes)); }
private Weather GetWeather(WeatherDTO weatherDTO, TimeDTO timeDTO) { Weather weather = new Weather(); weather.WeatherState = weatherDTO.WeatherState; weather.DayTime = this._dayTimeService.GetDayTime(weatherDTO.SunriseTime, weatherDTO.SunsetTime, timeDTO.Time); return(weather); }
public IcrmTaskPage AddTimeToTask(TimeDTO timeEntryData) { var tabElement = TabRowClick("Tasks"); SelectMenuByRightClickingOnTab("Tasks", tabElement, "Add Time"); //WaitForAsyncPostbackIndicator(); TimeEntry(timeEntryData); return(new IcrmTaskPage(myDriver)); }
public CampeonatoInfoDb(TimeDTO rodadaInfo) { nome = rodadaInfo.nome; nome_cartola = rodadaInfo.nome_cartola; patrimonio = rodadaInfo.patrimonio; ranking = rodadaInfo.ranking.campeonato; pontos = rodadaInfo.pontos.campeonato; slug = rodadaInfo.slug; }
public TimeDTO Map(WorldTimeDTO mapEntity) { long unixTime = DateTimeUtils.GetUnixTimeFromDateTime(mapEntity.datetime); TimeDTO timeDTO = new TimeDTO(); timeDTO.Time = DateTimeUtils.GetDateTimeFromUnixSeconds(unixTime); return(timeDTO); }
public void Icrm_SelectATaskAndAddTime_TimeForTheTaskShouldBeAdded() { var taskPage = new IcrmTaskPage(currentPage.myDriver); var timeEntryData = new TimeDTO { Location = "office", ServiceCategory = "Emergency Work", Consultant = "Lee Hogan", Duration = "2", BillingComments = "This is to test the time entry in timesheet through automation" }; currentPage = taskPage.AddTimeToTaskInTimeGrid("Project/Task", "Tag.Ltd", expectedProjectId, timeEntryData); }
public void Icrm_AddTimeToATask_TimeShouldBeAddedToTheTask() { var taskPage = new IcrmTaskPage(currentPage.myDriver); var timeEntryData = new TimeDTO { Location = "office", ServiceCategory = "Emergency Work", Consultant = "Lee Hogan", Duration = "2", BillingComments = "This is to test the time entry through automation" }; currentPage = taskPage.AddTimeToTask(timeEntryData); }
public HttpResponseMessage UpdateTime([FromBody] TimeDTO time) { if (time != null) { DTOToEntity dte = new DTOToEntity(); var entity = dte.TimeDTOToEntity(time); repo.UpdateTime(entity); return(Request.CreateResponse(HttpStatusCode.OK, "Time changed successfully.")); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest, "An error Occured")); } }
public async Task <IActionResult> Post(TimeDTO model) { try { var time = this._mapper.Map <Time>(model); this._repo.Add(time); if (await this._repo.SaveChangesAsync()) { return(Created($"api/time/{model.TimeId}", this._mapper.Map <TimeDTO>(time))); } } catch (Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } return(BadRequest()); }
public HttpResponseMessage AddTime([FromBody] TimeDTO newTime) { if (newTime != null) { DTOToEntity dte = new DTOToEntity(); newTime.Date = DateTime.Now; newTime.IsInvoiced = false; var entity = dte.TimeDTOToEntity(newTime); repo.AddTime(entity); return(Request.CreateResponse(HttpStatusCode.OK, "Time uploaded successfully.")); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest, "An error Occured")); } }
public void TimeDTOToEntityValid() { DTOToEntity dte = new DTOToEntity(); TimeDTO expected = new TimeDTO { Id = 1, Project_Id = 1, Date = DateTime.Now, TimeStart = new DateTime(2017, 08, 26, 08, 00, 00), TimeEnd = new DateTime(2017, 08, 26, 10, 00, 00), IsInvoiced = false, Description = "Test description" }; var actual = dte.TimeDTOToEntity(expected); Assert.AreEqual(expected.Id, actual.Id); Assert.AreEqual(expected.Project_Id, actual.Project_Id); Assert.AreEqual(expected.Description, actual.Description); Assert.AreEqual(expected.Date, actual.Date); Assert.AreEqual(expected.TimeStart, actual.TimeStart); Assert.AreEqual(expected.TimeEnd, actual.TimeEnd); Assert.AreEqual(expected.IsInvoiced, actual.IsInvoiced); }
public Time TimeDTOToEntity(TimeDTO newtime) { Time time = new Time(); if (newtime != null) { time.Id = newtime.Id; time.Project_Id = newtime.Project_Id; time.Date = newtime.Date; time.TimeStart = newtime.TimeStart; time.TimeEnd = newtime.TimeEnd; time.Description = newtime.Description; time.IsInvoiced = newtime.IsInvoiced; } return(time); }
public async Task <TimeDTO> GetTimeFromIp(string ip) { try { string fullUrl = _worldTimeAPIUrl + ip; WorldTimeDTO worldTimeDTO = await this._genericRestService.Get <WorldTimeDTO>(fullUrl); if (!this.IsValid(worldTimeDTO)) { throw new NoTimeFoundException(); } TimeDTO timeDTO = this._worldTimeMapper.Map(worldTimeDTO); return(timeDTO); } catch (NotFoundException) { throw new NoTimeFoundException(); } }
public void TimeEntry(TimeDTO timeEntryData) { WaitForElementToBeVisible(By.Id("dijit_Dialog_0")); var dijitContainer = myDriver.FindElement(By.CssSelector("div[class*='dijitDialogPaneContent dijitAlignCenter']")); WaitForLoader(); myDriver.SwitchTo().Frame(dijitContainer.FindElement(By.TagName("iFrame"))); var elementContainer = myDriver.FindElement(By.Id("uniqName_1_0")); DropDownTypeableFieldInput(elementContainer.FindElement(By.Id("pklLocation")), timeEntryData.Location); DropDownTypeableFieldInput(elementContainer.FindElement(By.Id("txtStartTime")), DateTime.Now.Hour.ToString()); DropDownTypeableFieldInput(elementContainer.FindElement(By.Id("pklServiceTaskCategory")), timeEntryData.ServiceCategory); DropDownTypeableFieldInput(elementContainer.FindElement(By.Id("txtActualDuration")), timeEntryData.Duration); DropDownTypeableFieldInput(elementContainer.FindElement(By.Id("selConsultant")), timeEntryData.Consultant); elementContainer.FindElement(By.Id("txtBillingComments")).SendKeys(timeEntryData.BillingComments); elementContainer.FindElement(By.Id("txtInternalComments")).Click(); ClickButton("dijit_form_Button_0"); WaitForLoader(); // myDriver.FindElement(By.CssSelector("span[class='dijitReset dijitInline dijitButtonNode']")).Click(); myDriver.SwitchTo().DefaultContent(); }
public TimeDTO TimeEntityToDTO(Time entity) { if (entity != null) { TimeDTO dto = new TimeDTO { Id = entity.Id, Project_Id = entity.Project_Id, Date = entity.Date, TimeStart = entity.TimeStart, TimeEnd = entity.TimeEnd, HoursSpent = entity.TimeSpent, Description = entity.Description, IsInvoiced = (bool)entity.IsInvoiced }; return(dto); } else { return(null); } }
public List <TimeDTO> removeTime(VenueDTO v) { TimeDTO t = new TimeDTO(); t = v.times.Last(); using (var db = new GG.Models.GGModelContainer()) { Venue VenueTbl = new Venue(); var existingTime = (from x in db.Times where x.Id == t.id select x).FirstOrDefault(); var existingVenue = (from x in db.Venues where x.Id == v.id select x).FirstOrDefault(); existingVenue.Times.Remove(existingTime); db.SaveChanges(); var l = (from x in existingVenue.Times .Select(b => new TimeDTO { id = b.Id, timeText = b.Text }) select x).ToList(); return(l); } }
private void ReadExcel() { try { // reset variables _result.SuccessfullyRead = false; _result.Warnings = new List <string>(); _result.Errors = new List <Exception>(); _result.TimesInserted = new List <TimeDTO>(); // open xls file var book = Workbook.Load(FileName); var sheet = book.Worksheets[0]; #region Discipline if (!int.TryParse(sheet.Cells[0, 0].StringValue, out _disciplineId)) { throw new InvalidDataException($"Could not read discipline id in (r1/c1)"); } #endregion // Worksheet dimensions var rowIndex = sheet.Cells.LastRowIndex; var colIndex = sheet.Cells.LastColIndex; for (var col = FirstDataCol; col <= colIndex; col++) { #region Date DateTime date = sheet.Cells[1, col].DateTimeValue; // check if it is an empty Date if (date.Ticks == 0) { break; } #endregion for (var row = FirstDataRow; row <= rowIndex; row++) { #region Person int personId; if (!int.TryParse(sheet.Cells[row, 0].StringValue, out personId)) { _result.Warnings.Add($"Could not read person id in (r{row + 1}/c1)!"); continue; } #endregion #region Seconds decimal seconds; // do not insert empty values if (!decimal.TryParse(sheet.Cells[row, col].StringValue, out seconds)) { _result.Warnings.Add($"Could not read time in (r{row + 1}/c{col + 1})!"); continue; } #endregion var newTime = new TimeDTO() { FK_P = personId, FK_D = _disciplineId, Seconds = seconds, Date = date }; _result.TimesInserted.Add(newTime); } } _result.SuccessfullyRead = true; } catch (Exception e) { _result.SuccessfullyRead = false; _result.Errors.Add(e); } }
private void yesBtn_Click(object sender, RoutedEventArgs e) { if (txtPatient.Text.Equals("")) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati pacijenta!"; okMbx.ShowDialog(); return; } if (cmbDoctor.SelectedItem == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati doktora!"; okMbx.ShowDialog(); return; } if (cmbTypeOfExamination.SelectedItem == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati vrstu pregleda!"; okMbx.ShowDialog(); } if (cmbNumberOfRoom.SelectedItem == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati sobu!"; okMbx.ShowDialog(); return; } if (dpDate.SelectedDate == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati datum!"; okMbx.ShowDialog(); return; } if (tpTime.SelectedItem == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Morate odabrati vrijeme!"; okMbx.ShowDialog(); return; } DateTime selectedDate = (DateTime)dpDate.SelectedDate; Room selectedRoom = (Room)cmbNumberOfRoom.SelectedItem; Doctor selectedDoctor = (Doctor)cmbDoctor.SelectedItem; TimeDTO timeDTO = (TimeDTO)tpTime.SelectedItem; DateTime date = Convert.ToDateTime(selectedDate.ToShortDateString() + " " + timeDTO.Time, CultureInfo.InvariantCulture); string[] partsPatient = examination.Patient.Split(' '); PatientCard selectedPatientCard = patientCardController.ViewPatientCard(partsPatient[partsPatient.Length - 1]); TypeOfExamination type; TypeOfExaminationDTO selectedType = (TypeOfExaminationDTO)cmbTypeOfExamination.SelectedItem; if (selectedType.Type.Equals("Opšti pregled")) { type = TypeOfExamination.Opsti; } else if (selectedType.Type.Equals("Specijalistički pregled")) { type = TypeOfExamination.Specijalisticki; } else { type = TypeOfExamination.Operacija; } if (parent.GetType() == typeof(CanceledExaminationsView)) { if (examinationController.ScheduleExamination(new Examination(examination.Id, type, date, selectedDoctor, selectedRoom, selectedPatientCard)) == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Došlo je do greške, doktor ili soba su zauzeti u odabranom terminu!"; okMbx.ShowDialog(); return; } else { int lastId = notificationController.getLastId(); string message = "Ponovo zakazan otkazani pregled\n" + "Doktor: " + selectedDoctor.Name + " " + selectedDoctor.Surname + "\nBroj sobe: " + selectedRoom.Number + "\nDatum:" + date.ToShortDateString() + "\nVrijeme: " + date.ToShortTimeString(); notificationController.SendNotification(new Notification(++lastId, TypeOfNotification.Pregled, message, selectedPatientCard.patient.Jmbg)); var okMb = new OKMessageBox(this, 0); okMb.titleMsgBox.Text = "Obavještenje"; okMb.textMsgBox.Text = "Uspješno ste zakazali pregled koji je bio otkazan. Pacijent je obaviješten o izmjeni."; okMb.ShowDialog(); this.Close(); } foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(MainWindow)) { (window as MainWindow).Main.Content = new CanceledExaminationsView(); } } } else if (parent.GetType() == typeof(ExaminationViewByDoctor)) { if (examinationController.EditExamination(new Examination(examination.Id, type, date, selectedDoctor, selectedRoom, selectedPatientCard)) == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Došlo je do greške, doktor ili soba su zauzeti u odabranom terminu!"; okMbx.ShowDialog(); return; } else { int lastId = notificationController.getLastId(); string message = "Pregled izmijenjen\n" + "Doktor: " + selectedDoctor.Name + " " + selectedDoctor.Surname + "\nBroj sobe: " + selectedRoom.Number + "\nDatum:" + date.ToShortDateString() + "\nVrijeme: " + date.ToShortTimeString(); notificationController.SendNotification(new Notification(++lastId, TypeOfNotification.Pregled, message, selectedPatientCard.patient.Jmbg)); var okMb = new OKMessageBox(this, 0); okMb.titleMsgBox.Text = "Obavještenje"; okMb.textMsgBox.Text = "Uspješno ste izmijenili pregled. Pacijent je obaviješten o izmjeni."; okMb.ShowDialog(); this.Close(); } foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(MainWindow)) { (window as MainWindow).Main.Content = new ExaminationViewByDoctor(selectedDoctor.Jmbg); } } } else if (parent.GetType() == typeof(SearchExaminations)) { if (examinationController.EditExamination(new Examination(examination.Id, type, date, selectedDoctor, selectedRoom, selectedPatientCard)) == null) { var okMbx = new OKMessageBox(this, 4); okMbx.titleMsgBox.Text = "Greška"; okMbx.textMsgBox.Text = "Došlo je do greške, doktor ili soba su zauzeti u odabranom terminu!"; okMbx.ShowDialog(); return; } else { int lastId = notificationController.getLastId(); string message = "Pregled izmijenjen\n" + "Doktor: " + selectedDoctor.Name + " " + selectedDoctor.Surname + "\nBroj sobe: " + selectedRoom.Number + "\nDatum:" + date.ToShortDateString() + "\nVrijeme: " + date.ToShortTimeString(); notificationController.SendNotification(new Notification(++lastId, TypeOfNotification.Pregled, message, selectedPatientCard.patient.Jmbg)); var okMb = new OKMessageBox(this, 0); okMb.titleMsgBox.Text = "Obavještenje"; okMb.textMsgBox.Text = "Uspješno ste izmijenili pregled. Pacijent je obaviješten o izmjeni."; okMb.ShowDialog(); this.Close(); } foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(MainWindow)) { (window as MainWindow).Main.Content = new SearchExaminations(); } } } }