private void frmOccupationalHistory_Load(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); HistoryBL objHistoryBL = new HistoryBL(); LoadTreeDangers(145); LoadTreeEPP(146); dtpDateTimeStar.Value = dtpDateTimeStar.Value.AddMonths(-1); if (_Mode == "New") { // Additional logic here. } else if (_Mode == "Edit") { _objhistoryDto = new historyDto(); _objhistoryDto = _objHistoryBL.GetHistory(ref objOperationResult, _HistoryId); dtpDateTimeStar.Value = _objhistoryDto.d_StartDate.Value; dptDateTimeEnd.Value = _objhistoryDto.d_EndDate.Value; txtOrganization.Text = _objhistoryDto.v_Organization; txtTypeActivity.Text = _objhistoryDto.v_TypeActivity; txtOccupation.Text = _objhistoryDto.v_workstation; ddlTypeOperationId.SelectedValue = _objhistoryDto.i_TypeOperationId.ToString(); txtGeographicalHeight.Text = _objhistoryDto.i_GeografixcaHeight.ToString(); _TempWorkstationDangersList = objHistoryBL.GetWorkstationDangersagedAndFiltered(ref objOperationResult, 0, null, "v_ParentName ASC", "", _HistoryId); grdDataDangers.DataSource = _TempWorkstationDangersList; _TempTypeOfEEPList = objHistoryBL.GetTypeOfEEPPagedAndFiltered(ref objOperationResult, 0, null, "v_TypeofEEPName ASC", "", _HistoryId); grdDataEPP.DataSource = _TempTypeOfEEPList; } }
protected void btnAdd_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); typeofeepDto objtypeofeepDto = new typeofeepDto(); HistoryBL oHistoryBL = new HistoryBL(); if (Session["v_TypeofEEPId"] == null) { objtypeofeepDto.i_TypeofEEPId = int.Parse(ddlEpps.SelectedValue.ToString()); objtypeofeepDto.v_HistoryId = Session["v_HistoryId"].ToString(); objtypeofeepDto.r_Percentage = txtPorcentaje11.Text == ""? (float?)null :int.Parse(txtPorcentaje11.Text); oHistoryBL.AddTypeOfEEPP(ref objOperationResult, objtypeofeepDto, ((ClientSession)Session["objClientSession"]).GetAsList()); Session["v_TypeofEEPId"] = null; } else { objtypeofeepDto.v_TypeofEEPId = Session["v_TypeofEEPId"].ToString(); objtypeofeepDto.i_TypeofEEPId = int.Parse(ddlEpps.SelectedValue.ToString()); objtypeofeepDto.v_HistoryId = Session["v_HistoryId"].ToString(); objtypeofeepDto.r_Percentage = int.Parse(txtPorcentaje11.Text); oHistoryBL.UpdateTypeOfEEPP(ref objOperationResult, objtypeofeepDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } ddlEpps.SelectedValue = "-1"; txtPorcentaje11.Text = ""; ActualizarGrilla(); }
void ActualizarGrilla() { HistoryBL oHistoryBL = new HistoryBL(); OperationResult objOperationResult = new OperationResult(); grd.DataSource = oHistoryBL.GetTypeOfEEPPagedAndFiltered(ref objOperationResult, 0, null, "", "", Session["v_HistoryId"].ToString()); grd.DataBind(); }
protected void grd_RowCommand(object sender, GridCommandEventArgs e) { HistoryBL oHistoryBL = new HistoryBL(); OperationResult objOperationResult = new OperationResult(); if (e.CommandName == "DeleteRegistro") { string v_TypeofEEPId = grd.DataKeys[grd.SelectedRowIndex][0].ToString(); oHistoryBL.DeleteTypeOfEEPP(ref objOperationResult, v_TypeofEEPId, ((ClientSession)Session["objClientSession"]).GetAsList()); ActualizarGrilla(); } }
public void CreateHistory(SiteBL site) { var history = new HistoryBL { Date = DateTime.Now, MaxResponseTime = site.MaxResponseTime, MinResponseTime = site.MinResponseTime, SiteId = site.Id, SiteURL = site.Url }; var historyToCreate = _mapper.Map <History>(history); _historyRepository.Create(historyToCreate); }
private void frmOccupationalHistory_Load(object sender, EventArgs e) { #region Mayusculas - Normal var _EsMayuscula = int.Parse(Common.Utils.GetApplicationConfigValue("EsMayuscula")); if (_EsMayuscula == 1) { SearchControlAndSetEvents(this); } #endregion OperationResult objOperationResult = new OperationResult(); HistoryBL objHistoryBL = new HistoryBL(); LoadTreeDangers(145); LoadTreeEPP(146); dtpDateTimeStar.Value = dtpDateTimeStar.Value.AddMonths(-1); DateTime now = DateTime.Now; dtpDateTimeStar.Value = now.AddDays(1 - now.Day); DateTime now2 = DateTime.Now; dptDateTimeEnd.Value = now2.AddDays(1 - now2.Day); if (_Mode == "New") { // Additional logic here. } else if (_Mode == "Edit") { _objhistoryDto = new historyDto(); _objhistoryDto = _objHistoryBL.GetHistory(ref objOperationResult, _HistoryId); dtpDateTimeStar.Value = _objhistoryDto.d_StartDate.Value; dptDateTimeEnd.Value = _objhistoryDto.d_EndDate.Value; txtOrganization.Text = _objhistoryDto.v_Organization; txtTypeActivity.Text = _objhistoryDto.v_TypeActivity; txtOccupation.Text = _objhistoryDto.v_workstation; ddlTypeOperationId.SelectedValue = _objhistoryDto.i_TypeOperationId.ToString(); txtGeographicalHeight.Text = _objhistoryDto.i_GeografixcaHeight == 0 ? "" : _objhistoryDto.i_GeografixcaHeight.ToString(); if (_objhistoryDto.i_TrabajoActual != null) { if (_objhistoryDto.i_TrabajoActual == 1) { chkPuestoActual.Checked = true; } else { chkPuestoActual.Checked = false; } } _TempWorkstationDangersList = objHistoryBL.GetWorkstationDangersagedAndFiltered(ref objOperationResult, 0, null, "v_ParentName ASC", "", _HistoryId); grdDataDangers.DataSource = _TempWorkstationDangersList; _TempTypeOfEEPList = objHistoryBL.GetTypeOfEEPPagedAndFiltered(ref objOperationResult, 0, null, "v_TypeofEEPName ASC", "", _HistoryId); grdDataEPP.DataSource = _TempTypeOfEEPList; } }
private void btnSave_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); _workstationdangersListDto = new List <workstationdangersDto>(); _typeofeepListDto = new List <typeofeepDto>(); _workstationdangersListDtoDelete = new List <workstationdangersDto>(); _typeofeepListDtoDelete = new List <typeofeepDto>(); _typeofeepListUpdate = new List <typeofeepDto>(); _workstationdangersListDtoUpdate = new List <workstationdangersDto>(); HistoryBL objHistoryBL = new HistoryBL(); if (ultraValidator1.Validate(true, false).IsValid) { if (txtOrganization.Text.Trim() == string.Empty) { MessageBox.Show("Por favor ingrese un nombre apropiado para Organización.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtTypeActivity.Text.Trim() == string.Empty) { MessageBox.Show("Por favor ingrese un nombre apropiado para Tipo de Actividad.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtOccupation.Text.Trim() == string.Empty) { MessageBox.Show("Por favor ingrese un nombre apropiado para Puesto de Trabajo.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //if (txtGeographicalHeight.Text.Trim() == string.Empty) //{ // MessageBox.Show("Por favor ingrese un nombre apropiado para Altura Geográfica", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} if (_Mode == "New") { _objhistoryDto = new historyDto(); _objhistoryDto.v_PersonId = _PacientId; _objhistoryDto.d_StartDate = dtpDateTimeStar.Value.Date; _objhistoryDto.d_EndDate = dptDateTimeEnd.Value.Date; _objhistoryDto.v_Organization = txtOrganization.Text; _objhistoryDto.v_TypeActivity = txtTypeActivity.Text; _objhistoryDto.v_workstation = txtOccupation.Text; _objhistoryDto.i_TrabajoActual = chkPuestoActual.Checked == true? 1 :0; _objhistoryDto.i_TypeOperationId = int.Parse(ddlTypeOperationId.SelectedValue.ToString()); _objhistoryDto.i_GeografixcaHeight = txtGeographicalHeight.Text == "" ? 0 : int.Parse(txtGeographicalHeight.Text.ToString()); _HistoryId = objHistoryBL.AddHistory(ref objOperationResult, _TempWorkstationDangersList, _TempTypeOfEEPList, _objhistoryDto, Globals.ClientSession.GetAsList()); } else if (_Mode == "Edit") { _objhistoryDto.v_PersonId = _PacientId; _objhistoryDto.d_StartDate = dtpDateTimeStar.Value.Date; _objhistoryDto.d_EndDate = dptDateTimeEnd.Value.Date; _objhistoryDto.v_Organization = txtOrganization.Text; _objhistoryDto.v_TypeActivity = txtTypeActivity.Text; _objhistoryDto.v_workstation = txtOccupation.Text; _objhistoryDto.i_TrabajoActual = chkPuestoActual.Checked == true ? 1 : 0; _objhistoryDto.i_TypeOperationId = int.Parse(ddlTypeOperationId.SelectedValue.ToString()); _objhistoryDto.i_GeografixcaHeight = txtGeographicalHeight.Text == "" ? 0 : int.Parse(txtGeographicalHeight.Text.ToString()); //Temporal Peligros foreach (var item in _TempWorkstationDangersList) { //Add if (item.i_RecordType == (int)RecordType.Temporal && item.i_RecordStatus == (int)RecordStatus.Agregado) { workstationdangersDto workstationdangersDto = new workstationdangersDto(); workstationdangersDto.i_DangerId = item.i_DangerId; workstationdangersDto.v_TimeOfExposureToNoise = item.v_TimeOfExposureToNoise; workstationdangersDto.i_NoiseLevel = item.i_NoiseLevel; workstationdangersDto.i_NoiseSource = item.i_NoiseSource; _workstationdangersListDto.Add(workstationdangersDto); } // Update if (item.i_RecordType == (int)RecordType.NoTemporal && (item.i_RecordStatus == (int)RecordStatus.Modificado || item.i_RecordStatus == (int)RecordStatus.Grabado)) { workstationdangersDto workstationdangersDto = new workstationdangersDto(); workstationdangersDto.v_WorkstationDangersId = item.v_WorkstationDangersId; workstationdangersDto.i_DangerId = item.i_DangerId; workstationdangersDto.v_TimeOfExposureToNoise = item.v_TimeOfExposureToNoise; workstationdangersDto.i_NoiseLevel = item.i_NoiseLevel; workstationdangersDto.i_NoiseSource = item.i_NoiseSource; _workstationdangersListDtoUpdate.Add(workstationdangersDto); } //Delete if (item.i_RecordType == (int)RecordType.NoTemporal && item.i_RecordStatus == (int)RecordStatus.EliminadoLogico) { workstationdangersDto workstationdangersDto = new workstationdangersDto(); workstationdangersDto.v_WorkstationDangersId = item.v_WorkstationDangersId; workstationdangersDto.i_DangerId = item.i_DangerId; _workstationdangersListDtoDelete.Add(workstationdangersDto); } } //Temporal EPP foreach (var item in _TempTypeOfEEPList) { //Add if (item.i_RecordType == (int)RecordType.Temporal && item.i_RecordStatus == (int)RecordStatus.Agregado) { typeofeepDto typeofeepDto = new typeofeepDto(); typeofeepDto.i_TypeofEEPId = item.i_TypeofEEPId; typeofeepDto.r_Percentage = item.r_Percentage; _typeofeepListDto.Add(typeofeepDto); } // Update if (item.i_RecordType == (int)RecordType.NoTemporal && (item.i_RecordStatus == (int)RecordStatus.Modificado || item.i_RecordStatus == (int)RecordStatus.Grabado)) { typeofeepDto typeofeepDto = new typeofeepDto(); typeofeepDto.v_TypeofEEPId = item.v_TypeofEEPId; typeofeepDto.r_Percentage = item.r_Percentage; _typeofeepListUpdate.Add(typeofeepDto); } //Delete if (item.i_RecordType == (int)RecordType.NoTemporal && item.i_RecordStatus == (int)RecordStatus.EliminadoLogico) { typeofeepDto typeofeepDto = new typeofeepDto(); typeofeepDto.v_TypeofEEPId = item.v_TypeofEEPId; //typeofeepDto.i_TypeofEEPId = item.i_TypeofEEPId; _typeofeepListDtoDelete.Add(typeofeepDto); } } _objHistoryBL.UpdateHistory(ref objOperationResult, _workstationdangersListDto, _workstationdangersListDtoDelete, _workstationdangersListDtoUpdate, _typeofeepListDto, _typeofeepListUpdate, _typeofeepListDtoDelete, _objhistoryDto, Globals.ClientSession.GetAsList()); } //// Analizar el resultado de la operación if (objOperationResult.Success == 1) // Operación sin error { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else // Operación con error { MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); // Se queda en el formulario. } } else { MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }