protected virtual void InitData() { try { Cursor = Cursors.WaitCursor; //TRAEMOS LA INFORMACION DE LA BASE DE DATOS List <TemaBE> lstTema = null; lstTema = new TemaBL().ListaTodosActivo(0, 0, Parametros.intTEMAVirtual, Parametros.intTEMAActivo, Parametros.intPeriodo); //var homesTable = VideoCatalogDataSet(); var homesTable = new FuncionBase().ToDataTable(lstTema); homesTable.Columns.Add("Image", typeof(Image)); homesTable.Columns.Add("Curso", typeof(String)); foreach (DataRow row in homesTable.Rows) { var img = DevExpress.XtraEditors.Controls.ByteImageConverter.FromByteArray(row["Logo"] as byte[]); row["Image"] = new Bitmap(img, new Size(351, 234)); row["Curso"] = row["DescSituacion"].ToString(); } gridControl1.DataSource = homesTable; Cursor = Cursors.Default; } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private string CreateNumberInvoice(int IdClient) { string strNumberInvoice = ""; try { Cursor = Cursors.WaitCursor; string strAbrevClient = ""; int intNumero = 0; string strNumero = ""; ClientBE objE_Client = null; objE_Client = new ClientBL().Selecciona(IdClient); if (objE_Client != null) { strAbrevClient = objE_Client.Certificate; } intNumero = new InvoiceBL().SeleccionaBusquedaCount(Parametros.intEmpresaId, Convert.ToInt32(cboClient.EditValue)); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 5); strNumberInvoice = strAbrevClient + Parametros.intPeriodo.ToString().Substring(2, 2) + strNumero; Cursor = Cursors.Default; return(strNumberInvoice); } catch (Exception ex) { Cursor = Cursors.Default; return(strNumberInvoice); XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { ProgramProductionBL objBL_ProgramProduction = new ProgramProductionBL(); ProgramProductionBE objProgramProduction = new ProgramProductionBE(); objProgramProduction.NumberPP = txtNumero.Text; objProgramProduction.IdClient = Convert.ToInt32(cboClient.EditValue); objProgramProduction.IdClientDepartment = Convert.ToInt32(cboDivision.EditValue); objProgramProduction.IdVendor = Convert.ToInt32(cboVendor.EditValue); objProgramProduction.IdDestination = Convert.ToInt32(cboDestination.EditValue); objProgramProduction.IdSeason = Convert.ToInt32(cboSeason.EditValue); objProgramProduction.IdStyle = IdStyle; objProgramProduction.IdTypeProduct = Convert.ToInt32(cboTypeProduct.EditValue); objProgramProduction.NumberPO = txtNumberPO.Text; objProgramProduction.NumberCommiment = txtNumberCommiment.Text; objProgramProduction.XfDate = Convert.ToDateTime(deXfDate.DateTime.ToShortDateString()); objProgramProduction.IndcDate = Convert.ToDateTime(deIndcDate.DateTime.ToShortDateString()); objProgramProduction.IdShipMode = Convert.ToInt32(cboShipMode.EditValue); objProgramProduction.Label = txtLabel.Text; objProgramProduction.Addionational = txtAddionational.Text; objProgramProduction.FlagState = true; objProgramProduction.Login = Parametros.strUsuarioLogin; objProgramProduction.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objProgramProduction.IdCompany = Parametros.intEmpresaId; //DETAIL List <ProgramProductionDetailBE> lstProgramProductionDetail = new List <ProgramProductionDetailBE>(); foreach (var item in mListaProgramProductionDetailOrigen) { ProgramProductionDetailBE objE_ProgramProductionDetail = new ProgramProductionDetailBE(); objE_ProgramProductionDetail.IdCompany = Parametros.intEmpresaId; objE_ProgramProductionDetail.IdProgramProduction = IdProgramProduction; objE_ProgramProductionDetail.IdProgramProductionDetail = item.IdProgramProductionDetail; objE_ProgramProductionDetail.IdStyle = item.IdStyle; objE_ProgramProductionDetail.Dyelot = item.Dyelot; objE_ProgramProductionDetail.Item = item.Item; objE_ProgramProductionDetail.Detail = item.Detail; objE_ProgramProductionDetail.Units = item.Units; objE_ProgramProductionDetail.Fob = item.Fob; objE_ProgramProductionDetail.Total = item.Total; objE_ProgramProductionDetail.FlagState = true; objE_ProgramProductionDetail.Login = Parametros.strUsuarioLogin; objE_ProgramProductionDetail.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objE_ProgramProductionDetail.TipoOper = item.TipoOper; lstProgramProductionDetail.Add(objE_ProgramProductionDetail); } if (pOperacion == Operacion.Nuevo) { var Buscar = lstProgramProduction.Where(oB => oB.NumberPO.ToUpper() == txtNumberPO.Text.ToUpper() && oB.IdVendor == Convert.ToInt32(cboVendor.EditValue) && oB.IdClientDepartment == Convert.ToInt32(cboDivision.EditValue)).ToList(); if (Buscar.Count > 0) { if (XtraMessageBox.Show("the Number #PO already exists.\n The record can be duplicated, do you want to continue?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { objProgramProduction.IdProgramProduction = 0; int intNumero = 0; string strNumero = ""; intNumero = objBL_ProgramProduction.Inserta(objProgramProduction, lstProgramProductionDetail); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 10); txtNumero.Text = strNumero; //ActualizaNumero ProgramProductionBL objBProgramProduction = new ProgramProductionBL(); objBProgramProduction.ActualizaNumero(intNumero, txtNumero.Text); Application.DoEvents(); } } else { objProgramProduction.IdProgramProduction = 0; int intNumero = 0; string strNumero = ""; intNumero = objBL_ProgramProduction.Inserta(objProgramProduction, lstProgramProductionDetail); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 10); txtNumero.Text = strNumero; //ActualizaNumero ProgramProductionBL objBProgramProduction = new ProgramProductionBL(); objBProgramProduction.ActualizaNumero(intNumero, txtNumero.Text); Application.DoEvents(); } } else { objProgramProduction.IdProgramProduction = IdProgramProduction; objBL_ProgramProduction.Actualiza(objProgramProduction, lstProgramProductionDetail); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { CommimentBL objBL_Commiment = new CommimentBL(); CommimentBE objCommiment = new CommimentBE(); objCommiment.IdCommiment = IdCommiment; objCommiment.NumberCommiment = txtNumero.Text; objCommiment.IdClient = Convert.ToInt32(cboClient.EditValue); objCommiment.IdVendor = Convert.ToInt32(cboVendor.EditValue); objCommiment.CommimentDate = Convert.ToDateTime(deCommimentDate.DateTime.ToShortDateString()); objCommiment.ContractShipDate = Convert.ToDateTime(deContractShipDate.DateTime.ToShortDateString()); objCommiment.RevisionDate = Convert.ToDateTime(deRevisionDate.DateTime.ToShortDateString()); objCommiment.NumberRevision = txtNumberRevision.Text; objCommiment.IdOrigen = Convert.ToInt32(cboOrigin.EditValue); objCommiment.IdDestination = Convert.ToInt32(cboDestination.EditValue); objCommiment.IdCurrency = Convert.ToInt32(cboCurrency.EditValue); objCommiment.FreightPaid = txtFreightPaid.Text; objCommiment.Addionational = txtAddionational.Text; objCommiment.FlagState = true; objCommiment.Login = Parametros.strUsuarioLogin; objCommiment.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objCommiment.IdCompany = Parametros.intEmpresaId; //DETAIL List <CommimentDetailBE> lstCommimentDetail = new List <CommimentDetailBE>(); foreach (var item in mListaCommimentDetailOrigen) { CommimentDetailBE objE_CommimentDetail = new CommimentDetailBE(); objE_CommimentDetail.IdCompany = Parametros.intEmpresaId; objE_CommimentDetail.IdCommiment = IdCommiment; objE_CommimentDetail.IdCommimentDetail = item.IdCommimentDetail; objE_CommimentDetail.IdStyle = item.IdStyle; objE_CommimentDetail.Quantity = item.Quantity; objE_CommimentDetail.Fob = item.Fob; objE_CommimentDetail.Total = item.Total; objE_CommimentDetail.FlagState = true; objE_CommimentDetail.Login = Parametros.strUsuarioLogin; objE_CommimentDetail.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objE_CommimentDetail.TipoOper = item.TipoOper; lstCommimentDetail.Add(objE_CommimentDetail); } if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_Commiment.Inserta(objCommiment, lstCommimentDetail); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 10); txtNumero.Text = strNumero; //ActualizaNumero CommimentBL objBCommiment = new CommimentBL(); objBCommiment.ActualizaNumero(intNumero, txtNumero.Text); } else { objBL_Commiment.Actualiza(objCommiment, lstCommimentDetail); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { InspeccionTrabajoBE objInspeccionTrabajo = new InspeccionTrabajoBE(); InspeccionTrabajoBL objBL_InspeccionTrabajo = new InspeccionTrabajoBL(); objInspeccionTrabajo.IdInspeccionTrabajo = IdInspeccionTrabajo; objInspeccionTrabajo.IdUnidadMinera = Convert.ToInt32(cboUnidadMinera.EditValue); objInspeccionTrabajo.IdArea = Convert.ToInt32(cboAreaResponsable.EditValue); objInspeccionTrabajo.IdSector = Convert.ToInt32(cboSector.EditValue); objInspeccionTrabajo.IdTipoInspeccion = Convert.ToInt32(cboTipoInspeccion.EditValue); objInspeccionTrabajo.Numero = txtNumero.Text; objInspeccionTrabajo.Fecha = Convert.ToDateTime(deFecha.DateTime.ToShortDateString()); objInspeccionTrabajo.Hora = Convert.ToDateTime(teHora.EditValue); objInspeccionTrabajo.Objetivo = txtObjetivo.Text; objInspeccionTrabajo.Lugar = txtLugar.Text; objInspeccionTrabajo.IdEmpresaContratista = Convert.ToInt32(cboEmpresaContratista.EditValue); objInspeccionTrabajo.IdInspeccionadoPor = intIdInspeccionadoPor; objInspeccionTrabajo.IdResponsableArea = (int?)null; objInspeccionTrabajo.IdResponsableSector = intIdResponsableSector == 0 ? (int?)null : intIdResponsableSector; objInspeccionTrabajo.NumeroTrabajadores = Convert.ToInt32(txtNumeroTrabajadores.Text); objInspeccionTrabajo.PersonaRegistro = txtPersonaRegistro.Text; objInspeccionTrabajo.PersonaCargo = txtPersonaCargo.Text; objInspeccionTrabajo.FlagEstado = true; objInspeccionTrabajo.Usuario = Parametros.strUsuarioLogin; objInspeccionTrabajo.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objInspeccionTrabajo.IdEmpresa = Convert.ToInt32(cboEmpresa.EditValue); //INSPECCION TRABAJO DETALLE List <InspeccionTrabajoDetalleBE> lstInspeccionTrabajoDetalle = new List <InspeccionTrabajoDetalleBE>(); foreach (var item in mListaInspeccionTrabajoDetalleOrigen) { InspeccionTrabajoDetalleBE objE_InspeccionTrabajoDetalle = new InspeccionTrabajoDetalleBE(); objE_InspeccionTrabajoDetalle.IdEmpresa = Parametros.intEmpresaId; objE_InspeccionTrabajoDetalle.IdInspeccionTrabajo = IdInspeccionTrabajo; objE_InspeccionTrabajoDetalle.IdInspeccionTrabajoDetalle = item.IdInspeccionTrabajoDetalle; objE_InspeccionTrabajoDetalle.Item = item.Item; objE_InspeccionTrabajoDetalle.Foto = item.Foto; objE_InspeccionTrabajoDetalle.CondicionSubEstandar = item.CondicionSubEstandar; objE_InspeccionTrabajoDetalle.AccionCorrectiva = item.AccionCorrectiva; objE_InspeccionTrabajoDetalle.IdResponsable = item.IdResponsable; objE_InspeccionTrabajoDetalle.FechaEjecucion = (item.FechaEjecucion.ToString().Length == 0) ? null : item.FechaEjecucion; objE_InspeccionTrabajoDetalle.FotoCumplimiento = item.FotoCumplimiento; objE_InspeccionTrabajoDetalle.Observacion = item.Observacion; objE_InspeccionTrabajoDetalle.IdSituacion = item.IdSituacion; objE_InspeccionTrabajoDetalle.FlagEstado = true; objE_InspeccionTrabajoDetalle.Usuario = Parametros.strUsuarioLogin; objE_InspeccionTrabajoDetalle.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_InspeccionTrabajoDetalle.TipoOper = item.TipoOper; lstInspeccionTrabajoDetalle.Add(objE_InspeccionTrabajoDetalle); } if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_InspeccionTrabajo.Inserta(objInspeccionTrabajo, lstInspeccionTrabajoDetalle); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ACTUALIZAR NUMERO InspeccionTrabajoBL objBInspeccionTrabajo = new InspeccionTrabajoBL(); objBInspeccionTrabajo.ActualizaNumero(intNumero, txtNumero.Text); //ELIMINAMOS LOR ARCHIVOS CREADOS foreach (var item in Directory.GetFiles(@"D:\", "*.pdf")) { File.SetAttributes(item, FileAttributes.Normal); File.Delete(item); } //GENERAR EL REPORTE EN PDF List <ReporteInspeccionTrabajoBE> lstReporteInspeccion = null; lstReporteInspeccion = new ReporteInspeccionTrabajoBL().Listado(intNumero); rptInspeccionTrabajo objReporte = new rptInspeccionTrabajo(); objReporte.SetDataSource(lstReporteInspeccion); objReporte.ExportToDisk(ExportFormatType.PortableDocFormat, @"D:\" + strNumero + ".pdf"); StringBuilder strMensaje = new StringBuilder(); strMensaje.Append("*****************************************************************************\n\n"); strMensaje.Append("Se Generó la N° Condición Insegura : " + strNumero + "\n\n"); strMensaje.Append("Regularizar de acuerdo a las fechas descritas en el archivo adjunto" + "\n\n"); strMensaje.Append("Emitido Por el Area de Seguridad y Salud en el Trabajo" + "\n\n"); strMensaje.Append("*****************************************************************************\n\n"); string strMailTO = ""; strMailTO = strMailSectorResponsable; if (intIdResponsableAdicional1 > 0) { strMailTO = strMailTO + ";" + strMailResponsableAdicional1; } if (intIdResponsableAdicional2 > 0) { strMailTO = strMailTO + ";" + strMailResponsableAdicional2; } foreach (var item in mListaInspeccionTrabajoDetalleOrigen) { PersonaBE objE_Persona = new PersonaBE(); objE_Persona = new PersonaBL().Selecciona(0, 0, 0, item.IdResponsable); if (objE_Persona != null) { strMailTO = strMailTO + ";" + objE_Persona.Email; } } if (Convert.ToInt32(cboEmpresaContratista.EditValue) != Parametros.intEmpresaContratistaNinguno) { ActividadContratistaBE objE_ActividadContratista = new ActividadContratistaBE(); objE_ActividadContratista = new ActividadContratistaBL().SeleccionaEmpresa(Convert.ToInt32(cboEmpresaContratista.EditValue)); if (objE_ActividadContratista != null) { strMailTO = strMailTO + ";" + objE_ActividadContratista.EmailContratista; } } BSUtils.EmailSend(strMailTO, "Inspección Interna de Trabajo", strMensaje.ToString(), @"D:\" + strNumero + ".pdf", "", "", ""); Application.DoEvents(); XtraMessageBox.Show("Se creó el registro de Inspeccion N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_InspeccionTrabajo.Actualiza(objInspeccionTrabajo, lstInspeccionTrabajoDetalle); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { EppBE objEpp = new EppBE(); EppBL objBL_Epp = new EppBL(); StringBuilder strMensaje = new StringBuilder(); objEpp.IdEpp = IdEpp; objEpp.IdEmpresa = Parametros.intEmpresaId; objEpp.IdUnidadMinera = Parametros.intUnidadMineraId; objEpp.Numero = txtNumero.Text; objEpp.IdSolicitudEpp = intIdSolicitudEpp; objEpp.IdPersona = intIdPersona; objEpp.IdEmpresaResponsable = intIdEmpresaResponsable; objEpp.IdUnidadMineraResponsable = intIdUnidadMineraResponsable; objEpp.IdAreaResponsable = intIdAreaResponsable; objEpp.IdSectorResponsable = intIdSectorResponsable; objEpp.Fecha = Convert.ToDateTime(deFecha.DateTime.ToShortDateString()); objEpp.DescOrdenInterna = cboOrdenInterna.Text; objEpp.Observacion = txtObservacion.Text; objEpp.FlagEstado = true; objEpp.Usuario = Parametros.strUsuarioLogin; objEpp.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); //Epp FOTO List <EppDetalleBE> lstEppDetalle = new List <EppDetalleBE>(); foreach (var item in mListaEppDetalleOrigen) { EppDetalleBE objE_EppDetalle = new EppDetalleBE(); objE_EppDetalle.IdEmpresa = Parametros.intEmpresaId; objE_EppDetalle.IdEpp = IdEpp; objE_EppDetalle.IdEppDetalle = item.IdEppDetalle; objE_EppDetalle.Item = item.Item; objE_EppDetalle.IdEquipo = item.IdEquipo; objE_EppDetalle.Codigo = item.Codigo; objE_EppDetalle.DescEquipo = item.DescEquipo; objE_EppDetalle.FechaVencimiento = item.FechaVencimiento; objE_EppDetalle.Cantidad = item.Cantidad; objE_EppDetalle.Precio = item.Precio; objE_EppDetalle.Total = item.Total; objE_EppDetalle.IdTipoEntrega = item.IdTipoEntrega; objE_EppDetalle.IdKardex = item.IdKardex; objE_EppDetalle.FlagEstado = true; objE_EppDetalle.Usuario = Parametros.strUsuarioLogin; objE_EppDetalle.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_EppDetalle.TipoOper = item.TipoOper; lstEppDetalle.Add(objE_EppDetalle); } if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_Epp.Inserta(objEpp, lstEppDetalle); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ACTUALIZA NUMERO EppBL objBEpp = new EppBL(); objBEpp.ActualizaNumero(intNumero, txtNumero.Text); decimal decTotal = 0; strMensaje.Append("**************************** REGISTRO DE ENTREGA DE EPP ***************************************\n\n"); strMensaje.Append("Se Generó el N° REGISTRO DE ENTREGA DE EPP : " + txtNumero.Text + "\n\n"); strMensaje.Append("Responsable : " + txtResponsable.Text + "\n\n"); foreach (var item in mListaEppDetalleOrigen) { strMensaje.Append("Código : " + item.Codigo.ToString() + "\n"); strMensaje.Append("EPP : " + item.DescEquipo.ToString() + "\n"); strMensaje.Append("Cantidad : " + item.Cantidad.ToString() + "\n\n"); decTotal = decTotal + item.Precio; } strMensaje.Append("Costo Total S/.: " + decTotal.ToString() + "\n\n"); strMensaje.Append("**********************************************************************************************\n\n"); //GENERAR EL REPORTE EN PDF List <ReporteEppBE> lstReporte = null; lstReporte = new ReporteEppBL().Listado(intNumero); rptEpp objReporte = new rptEpp(); objReporte.SetDataSource(lstReporte); objReporte.SetParameterValue("Coordinador", Parametros.strUsuarioNombres); objReporte.SetParameterValue("EmpresaResponsable", "CROSLAND LOGISTICA S.A.C."); objReporte.ExportToDisk(ExportFormatType.PortableDocFormat, @"D:\" + strNumero + ".pdf"); BSUtils.EmailSend(strEmail, "Registro de entrega de Epp", strMensaje.ToString(), @"D:\" + strNumero + ".pdf", "", "", ""); XtraMessageBox.Show("Se creó el Registro de Epp N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_Epp.Actualiza(objEpp, lstEppDetalle); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ImportarExcel() { if (strFleExcel == "") { return; } Excel._Application xlApp; Excel._Workbook xlLibro; Excel._Worksheet xlHoja; Excel.Sheets xlHojas; xlApp = new Excel.Application(); xlLibro = xlApp.Workbooks.Open(strFleExcel, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlHojas = xlLibro.Sheets; xlHoja = (Excel._Worksheet)xlHojas[1]; int Secuencia = 2; int _row = 2; int _totRow = 2; try { List <StyleBE> lstStyle = new List <StyleBE>(); while (FuncionBase.IsNumeric((string)xlHoja.get_Range("A" + _row, Missing.Value).Text.ToString().Trim())) { //Declaracion de variables int IdCompany = 0; int intIdClient = 0; string strNameClient = ""; string strNameStyle = ""; DateTime RevenueDate = new DateTime(2010, 1, 1); string strDescription = ""; int intIdClientDepartment = 0; string strNameDivision = ""; int IdMediaUnit = 0; string strAbbreviate = ""; strNameClient = (string)xlHoja.get_Range("B" + _row, Missing.Value).Text.ToString().Trim(); ClientBE objE_Client = null; objE_Client = new ClientBL().SeleccionaDescripcion(Parametros.intEmpresaId, strNameClient); if (objE_Client != null) { intIdClient = objE_Client.IdClient; strNameStyle = (string)xlHoja.get_Range("C" + _row, Missing.Value).Text.ToString().Trim(); RevenueDate = Convert.ToDateTime(xlHoja.get_Range("D" + _row, Missing.Value).Text.ToString().Trim()); strDescription = (string)xlHoja.get_Range("E" + _row, Missing.Value).Text.ToString().Trim(); strNameDivision = (string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim(); ClientDepartmentBE objE_ClientDepartment = null; objE_ClientDepartment = new ClientDepartmentBL().SeleccionaDescripcion(intIdClient, strNameDivision); if (objE_ClientDepartment != null) { intIdClientDepartment = objE_ClientDepartment.IdClientDepartment; } else { XtraMessageBox.Show("N° Secuencia : " + Secuencia.ToString() + "\n Division: " + strNameDivision, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Dispose(); this.Close(); } strAbbreviate = (string)xlHoja.get_Range("G" + _row, Missing.Value).Text.ToString().Trim(); MediaUnitBE objE_MediaUnit = null; objE_MediaUnit = new MediaUnitBL().SeleccionaAbreviatura(Parametros.intEmpresaId, strAbbreviate); if (objE_MediaUnit != null) { IdMediaUnit = objE_MediaUnit.IdMediaUnit; } else { XtraMessageBox.Show("N° Secuencia : " + Secuencia.ToString() + "\n Media Unit: " + strAbbreviate, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Dispose(); this.Close(); } StyleBE objE_Style = new StyleBE(); objE_Style.IdStyle = 0; objE_Style.IdCompany = Parametros.intEmpresaId; objE_Style.IdClient = intIdClient; objE_Style.NameStyle = strNameStyle; objE_Style.RevenueDate = RevenueDate; objE_Style.Description = strDescription; objE_Style.IdClientDepartment = intIdClientDepartment; objE_Style.IdMediaUnit = IdMediaUnit; objE_Style.FlagState = true; objE_Style.Login = Parametros.strUsuarioLogin; objE_Style.Machine = WindowsIdentity.GetCurrent().Name.ToString(); lstStyle.Add(objE_Style); } Application.DoEvents(); _row++; Secuencia++; } StyleBL objBL_Style = new StyleBL(); objBL_Style.InsertaMasivo(lstStyle); XtraMessageBox.Show("Los Datos se guardaron conrrectamente.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Close(); } catch (Exception ex) { xlApp.Quit(); XtraMessageBox.Show(ex.Message + "\n N° Secuencia : " + Secuencia.ToString(), ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void ImportarExcel() { if (strFleExcel == "") { return; } Excel._Application xlApp; Excel._Workbook xlLibro; Excel._Worksheet xlHoja; Excel.Sheets xlHojas; xlApp = new Excel.Application(); xlLibro = xlApp.Workbooks.Open(strFleExcel, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlHojas = xlLibro.Sheets; xlHoja = (Excel._Worksheet)xlHojas[1]; int Secuencia = 2; int _row = 2; int _totRow = 2; try { //Contador de Registros while (FuncionBase.IsNumeric((string)xlHoja.get_Range("A" + _totRow, Missing.Value).Text.ToString().Trim())) { if (FuncionBase.IsNumeric((string)xlHoja.get_Range("A" + _totRow, Missing.Value).Text.ToString().Trim())) { _totRow++; } } _totRow = _totRow - _row + 1; prgPlanilla.Minimum = 1; prgPlanilla.Maximum = _totRow; Application.DoEvents(); prgPlanilla.Value = 1; Application.DoEvents(); List <PersonaBE> lstPersona = new List <PersonaBE>(); while (FuncionBase.IsNumeric((string)xlHoja.get_Range("A" + _row, Missing.Value).Text.ToString().Trim())) { //Declaracion de variables if (xlHoja.get_Range("T" + _row, Missing.Value).Text.ToString().Trim() == "ACTIVO") { int intIdPersona = 0; string strRuc = ""; int intIdEmpresa = 0; string strDescNegocio = ""; int intIdNegocio = 0; string strDescUnidadMinera = ""; int intIdUnidadMinera = 0; string strDescArea = ""; int intIdArea = 0; string strDni = ""; string strApeNom = ""; DateTime FechaNacimiento = new DateTime(2010, 1, 1); string strEdad = ""; DateTime FechaIngreso = new DateTime(2000, 1, 1); DateTime?FechaCese = null; string strCargo = ""; string strSexo = ""; string strDescTipoContrato = ""; int intIdTipoContrato = 0; string strDescEstadoCivil = ""; int intIdEstadoCivil = 0; string strEmail = ""; int intIdSituacion = 0; strRuc = (string)xlHoja.get_Range("D" + _row, Missing.Value).Text.ToString().Trim(); EmpresaBE objE_Empresa = null; objE_Empresa = new EmpresaBL().SeleccionaRuc(strRuc); if (objE_Empresa != null) { intIdEmpresa = objE_Empresa.IdEmpresa; strDescNegocio = (string)xlHoja.get_Range("E" + _row, Missing.Value).Text.ToString().Trim(); NegocioBE objE_Negocio = null; objE_Negocio = new NegocioBL().SeleccionaDescripcion(intIdEmpresa, strDescNegocio); if (objE_Negocio != null) { intIdNegocio = objE_Negocio.IdNegocio; } else { intIdNegocio = Parametros.intPeriodo; } strDescUnidadMinera = (string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim(); if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "OFICINA SAN ISIDRO") { strDescUnidadMinera = "SAN ISIDRO"; } if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "Oficina Lima") { strDescUnidadMinera = "SAN ISIDRO"; } if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "Oficina Callao") { strDescUnidadMinera = "CALLAO"; } if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "DEPOSITO ANCON") { strDescUnidadMinera = "ANCON"; } if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "Oficina Cusco") { strDescUnidadMinera = "CUZCO"; } if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "Oficina Ollantaytambo") { strDescUnidadMinera = "OLLANTAYTAMBO"; } if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "Oficina Machu Picchu") { strDescUnidadMinera = "MACHU PICCHU"; } if ((string)xlHoja.get_Range("F" + _row, Missing.Value).Text.ToString().Trim() == "Oficina Aeropuerto LAP") { strDescUnidadMinera = "AEROPUERTO LAP"; } UnidadMineraBE objE_UnidadMinera = null; objE_UnidadMinera = new UnidadMineraBL().SeleccionaDescripcion(intIdEmpresa, strDescUnidadMinera); if (objE_UnidadMinera != null) { intIdUnidadMinera = objE_UnidadMinera.IdUnidadMinera; } else { XtraMessageBox.Show("N° Secuencia : " + Secuencia.ToString() + "\n Unidad Minera: " + strDescUnidadMinera, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Dispose(); this.Close(); } strDescArea = (string)xlHoja.get_Range("G" + _row, Missing.Value).Text.ToString().Trim(); if ((string)xlHoja.get_Range("G" + _row, Missing.Value).Text.ToString().Trim() == "") { strDescArea = "NINGUNO"; } AreaBE objE_Area = null; objE_Area = new AreaBL().SeleccionaDescripcion(intIdEmpresa, intIdUnidadMinera, strDescArea); if (objE_Area != null) { intIdArea = objE_Area.IdArea; } else { XtraMessageBox.Show("N° Secuencia : " + Secuencia.ToString() + "\n Area: " + strDescArea, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Dispose(); this.Close(); } strDni = (string)xlHoja.get_Range("C" + _row, Missing.Value).Text.ToString().Trim(); strApeNom = (string)xlHoja.get_Range("I" + _row, Missing.Value).Text.ToString().Trim() + " " + xlHoja.get_Range("J" + _row, Missing.Value).Text.ToString().Trim() + " " + xlHoja.get_Range("H" + _row, Missing.Value).Text.ToString().Trim(); FechaNacimiento = Convert.ToDateTime(xlHoja.get_Range("K" + _row, Missing.Value).Text.ToString().Trim()); strEdad = (string)xlHoja.get_Range("L" + _row, Missing.Value).Text.ToString().Trim(); FechaIngreso = Convert.ToDateTime(xlHoja.get_Range("M" + _row, Missing.Value).Text.ToString().Trim()); if (xlHoja.get_Range("N" + _row, Missing.Value).Text.ToString().Trim() == "") { FechaCese = (DateTime?)null; } else { FechaCese = Convert.ToDateTime(xlHoja.get_Range("N" + _row, Missing.Value).Text.ToString().Trim()); } strCargo = (string)xlHoja.get_Range("O" + _row, Missing.Value).Text.ToString().Trim(); if (xlHoja.get_Range("P" + _row, Missing.Value).Text.ToString().Trim() == "F") { strSexo = "FEMENINO"; } else { strSexo = "MASCULINO"; } strDescTipoContrato = (string)xlHoja.get_Range("Q" + _row, Missing.Value).Text.ToString().Trim(); TablaElementoBE objE_TablaElemento = null; objE_TablaElemento = new TablaElementoBL().SeleccionaDescripcion(Parametros.intTblTipoContrato, strDescTipoContrato); if (objE_TablaElemento != null) { intIdTipoContrato = objE_TablaElemento.IdTablaElemento; } else { XtraMessageBox.Show("N° Secuencia : " + Secuencia.ToString() + "\n Tipo de Contrato: " + strDescTipoContrato, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Dispose(); this.Close(); } strDescEstadoCivil = (string)xlHoja.get_Range("R" + _row, Missing.Value).Text.ToString().Trim(); TablaElementoBE objE_TablaElementoCivil = null; objE_TablaElementoCivil = new TablaElementoBL().SeleccionaDescripcion(Parametros.intTblEstadoCivil, strDescEstadoCivil); if (objE_TablaElementoCivil != null) { intIdEstadoCivil = objE_TablaElementoCivil.IdTablaElemento; } else { XtraMessageBox.Show("N° Secuencia : " + Secuencia.ToString() + "\n Estado Civil: " + strDescEstadoCivil, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Dispose(); this.Close(); } strEmail = (string)xlHoja.get_Range("S" + _row, Missing.Value).Text.ToString().Trim(); if (xlHoja.get_Range("T" + _row, Missing.Value).Text.ToString().Trim() == "ACTIVO") { intIdSituacion = Parametros.intSPActivo; } else { intIdSituacion = Parametros.intSPCesado; } PersonaBE objE_Persona = new PersonaBE(); objE_Persona.IdPersona = intIdPersona; objE_Persona.IdEmpresa = intIdEmpresa; objE_Persona.IdNegocio = intIdNegocio; objE_Persona.IdUnidadMinera = intIdUnidadMinera; objE_Persona.IdArea = intIdArea; objE_Persona.Dni = strDni; objE_Persona.ApeNom = strApeNom; objE_Persona.FechaNacimiento = FechaNacimiento; objE_Persona.Edad = Convert.ToInt32(strEdad); objE_Persona.FechaIngreso = FechaIngreso; objE_Persona.FechaCese = FechaCese; objE_Persona.Cargo = strCargo; objE_Persona.Sexo = strSexo; objE_Persona.IdTipoContrato = intIdTipoContrato; objE_Persona.IdEstadoCivil = intIdEstadoCivil; objE_Persona.Email = strEmail; objE_Persona.IdSituacion = intIdSituacion; objE_Persona.FlagEstado = true; objE_Persona.Usuario = Parametros.strUsuarioLogin; objE_Persona.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); lstPersona.Add(objE_Persona); } } prgPlanilla.Value = prgPlanilla.Value + 1; Application.DoEvents(); _row++; Secuencia++; } PersonaBL objBL_Persona = new PersonaBL(); objBL_Persona.InsertaMasivo(lstPersona); XtraMessageBox.Show("Los Datos de las Personas se guardaron conrrectamente.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); this.Close(); } catch (Exception ex) { xlApp.Quit(); XtraMessageBox.Show(ex.Message + "\n N° Secuencia : " + Secuencia.ToString(), ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { SolicitudBE objSolicitud = new SolicitudBE(); SolicitudBL objBL_Solicitud = new SolicitudBL(); objSolicitud.IdSolicitud = IdSolicitud; objSolicitud.IdEmpresa = intIdEmpresa; objSolicitud.IdUnidadMinera = intIdUnidadMinera; objSolicitud.IdArea = intIdArea; objSolicitud.Numero = txtNumero.Text; objSolicitud.IdPersona = intIdSolicitante; objSolicitud.Solicitante = txtSolicitante.Text; objSolicitud.Cargo = txtCargo.Text; objSolicitud.Fecha = Convert.ToDateTime(deFecha.DateTime.ToShortDateString()); objSolicitud.IdSituacion = Parametros.intSCEPSGenerada; objSolicitud.FlagEstado = true; objSolicitud.Usuario = Parametros.strUsuarioLogin; objSolicitud.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_Solicitud.Inserta(objSolicitud); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ActualizaNumero SolicitudBL objBSolicitud = new SolicitudBL(); objBSolicitud.ActualizaNumero(intNumero, txtNumero.Text); StringBuilder strMensaje = new StringBuilder(); strMensaje.Append("********************************************************************************************************************************************************************************************\n\n"); strMensaje.Append("Se Generó el N° de Solicitud de Información de EPS : " + strNumero + "\n\n"); strMensaje.Append("Se adjunta información acerca de la EPS (Plan de Salud y Boletín Informativo) así como los formatos para afiliación, los mismos que deberán ser llenados y firmados por el solicitante. Presentar al Área de Bienestar Seguridad y Salud en el Trabajo" + "\n"); strMensaje.Append("hasta el 24 del presente, para que la vigencia inicie el primer día del mes siguiente (si los documentos se presentan luego del día 24, la vigencia demorará un mes más)." + "\n\n"); strMensaje.Append("Adjuntar:" + "\n"); strMensaje.Append("1. Partida de Matrimonio en caso de ser casado." + "\n"); strMensaje.Append("2. Unión de Hecho en caso de ser conviviente" + "\n"); strMensaje.Append("3. DNI escaneados de los titulares y dependientes a incorporar en el Seguro." + "\n"); strMensaje.Append("4. Constancia de afiliación en EPS anterior (para mantener preexistencias)." + "\n\n"); strMensaje.Append("Bienestar realizará la gestión del Seguro." + "\n\n"); strMensaje.Append("Cualquier información adicional al 989059808 o al anexo 2267. (Zarella Monteverde)" + "\n\n"); strMensaje.Append("*******************************************************************************************************************************************************************************************\n\n"); string strArchivo1 = Path.Combine(Directory.GetCurrentDirectory(), "Formato de afiliación EPS 1.jpg"); string strArchivo2 = Path.Combine(Directory.GetCurrentDirectory(), "Formato de afiliación EPS 2.jpg"); string strArchivo3 = Path.Combine(Directory.GetCurrentDirectory(), "Plan de Salud EPS.pdf"); string strArchivo4 = Path.Combine(Directory.GetCurrentDirectory(), "Boletin Informativo EPS.pdf"); BSUtils.EmailSend(strEmailSolicitante, "Solicitud de Información de EPS", strMensaje.ToString(), strArchivo1, strArchivo2, strArchivo3, strArchivo4); Application.DoEvents(); StringBuilder strMensajeDestino = new StringBuilder(); strMensajeDestino.Append("*****************************************************************************\n\n"); strMensajeDestino.Append("Se Generó el N° de Solicitud de Información de EPS : " + strNumero + "\n\n"); strMensajeDestino.Append("Fecha de Solicitud : " + deFecha.DateTime.ToString().Substring(0, 10) + "\n\n"); strMensajeDestino.Append("Solictante : " + txtSolicitante.Text + "\n\n"); strMensajeDestino.Append("Cargo : " + txtCargo.Text + "\n\n"); strMensajeDestino.Append("Fecha de Ingreso : " + strFechaIngreso + "\n\n"); strMensajeDestino.Append("Empresa : " + txtEmpresa.Text + "\n\n"); strMensajeDestino.Append("Sede : " + txtUnidadMinera.Text + "\n\n"); strMensajeDestino.Append("Area : " + txtArea.Text + "\n\n"); strMensajeDestino.Append("Emitido Por el Area de Bienestar Seguridad y Salud en el Trabajo" + "\n\n"); strMensajeDestino.Append("*****************************************************************************\n\n"); BSUtils.EmailSend("*****@*****.**", "Solicitud de Información de EPS", strMensajeDestino.ToString(), "", "", "", ""); XtraMessageBox.Show("Se creó la Solicitud de Información de EPS N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_Solicitud.Actualiza(objSolicitud); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { CapacitacionBE objCapacitacion = new CapacitacionBE(); CapacitacionBL objBL_Capacitacion = new CapacitacionBL(); objCapacitacion.IdCapacitacion = IdCapacitacion; objCapacitacion.IdEmpresa = Convert.ToInt32(cboEmpresa.EditValue); objCapacitacion.IdUnidadMinera = Convert.ToInt32(cboUnidadMinera.EditValue); objCapacitacion.IdProveedor = Convert.ToInt32(cboProveedor.EditValue); objCapacitacion.Numero = txtNumero.Text; objCapacitacion.Fecha = Convert.ToDateTime(deFecha.DateTime.ToShortDateString()); objCapacitacion.FechaIni = Convert.ToDateTime(teHoraInicio.EditValue); objCapacitacion.FechaFin = Convert.ToDateTime(teHoraFin.EditValue); objCapacitacion.Participantes = Convert.ToInt32(txtNumeroParticpantes.EditValue); objCapacitacion.IdLugar = Convert.ToInt32(cboLugar.EditValue); objCapacitacion.IdTipoCapacitacion = Convert.ToInt32(cboTipo.EditValue); objCapacitacion.IdClasificacionCapacitacion = Convert.ToInt32(cboClasificacion.EditValue); objCapacitacion.IdTema = Convert.ToInt32(cboTema.EditValue); objCapacitacion.IdExpositor = Convert.ToInt32(cboExpositor.EditValue); objCapacitacion.FlagEstado = true; objCapacitacion.Usuario = Parametros.strUsuarioLogin; objCapacitacion.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); //CAPACITACION DETALLE List <CapacitacionDetalleBE> lstCapacitacionDetalle = new List <CapacitacionDetalleBE>(); if (pOperacion == Operacion.Nuevo) { int[] rows = gvCapacitacionDetalle.GetSelectedRows(); for (int i = 0; i < rows.Length; i++) { CapacitacionDetalleBE objE_CapacitacionDetalle = new CapacitacionDetalleBE(); objE_CapacitacionDetalle.IdEmpresa = Parametros.intEmpresaId; objE_CapacitacionDetalle.IdCapacitacion = IdCapacitacion; objE_CapacitacionDetalle.IdCapacitacionDetalle = 0; objE_CapacitacionDetalle.Item = int.Parse(gvCapacitacionDetalle.GetRowCellValue(rows[i], gvCapacitacionDetalle.Columns.ColumnByFieldName("Item")).ToString()); objE_CapacitacionDetalle.IdPersona = int.Parse(gvCapacitacionDetalle.GetRowCellValue(rows[i], gvCapacitacionDetalle.Columns.ColumnByFieldName("IdPersona")).ToString()); objE_CapacitacionDetalle.Codigo = gvCapacitacionDetalle.GetRowCellValue(rows[i], gvCapacitacionDetalle.Columns.ColumnByFieldName("Codigo")).ToString(); objE_CapacitacionDetalle.ApeNom = gvCapacitacionDetalle.GetRowCellValue(rows[i], gvCapacitacionDetalle.Columns.ColumnByFieldName("ApeNom")).ToString(); objE_CapacitacionDetalle.DescArea = gvCapacitacionDetalle.GetRowCellValue(rows[i], gvCapacitacionDetalle.Columns.ColumnByFieldName("DescArea")).ToString(); objE_CapacitacionDetalle.Nota = int.Parse(gvCapacitacionDetalle.GetRowCellValue(rows[i], gvCapacitacionDetalle.Columns.ColumnByFieldName("Nota")).ToString()); objE_CapacitacionDetalle.FlagEstado = true; objE_CapacitacionDetalle.Usuario = Parametros.strUsuarioLogin; objE_CapacitacionDetalle.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_CapacitacionDetalle.TipoOper = Convert.ToInt32(Operacion.Nuevo); lstCapacitacionDetalle.Add(objE_CapacitacionDetalle); } int intNumero = 0; string strNumero = ""; intNumero = objBL_Capacitacion.Inserta(objCapacitacion, lstCapacitacionDetalle); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ActualizaNumero CapacitacionBL objBCapacitacion = new CapacitacionBL(); objBCapacitacion.ActualizaNumero(intNumero, txtNumero.Text); XtraMessageBox.Show("Se creó el registro de capacitación N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { foreach (var item in mListaCapacitacionDetalleOrigen) { CapacitacionDetalleBE objE_CapacitacionDetalle = new CapacitacionDetalleBE(); objE_CapacitacionDetalle.IdEmpresa = Parametros.intEmpresaId; objE_CapacitacionDetalle.IdCapacitacion = IdCapacitacion; objE_CapacitacionDetalle.IdCapacitacionDetalle = item.IdCapacitacionDetalle; objE_CapacitacionDetalle.Item = item.Item; objE_CapacitacionDetalle.IdPersona = item.IdPersona; objE_CapacitacionDetalle.Codigo = item.Codigo; objE_CapacitacionDetalle.ApeNom = item.ApeNom; objE_CapacitacionDetalle.DescArea = item.DescArea; objE_CapacitacionDetalle.Nota = item.Nota; objE_CapacitacionDetalle.FlagEstado = true; objE_CapacitacionDetalle.Usuario = Parametros.strUsuarioLogin; objE_CapacitacionDetalle.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_CapacitacionDetalle.TipoOper = item.TipoOper; lstCapacitacionDetalle.Add(objE_CapacitacionDetalle); } objBL_Capacitacion.Actualiza(objCapacitacion, lstCapacitacionDetalle); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { foreach (var item in mLista) { SctrBE objSctr = new SctrBE(); SctrBL objBL_Sctr = new SctrBL(); objSctr.IdSctr = IdSctr; objSctr.IdEmpresa = item.IdEmpresa; objSctr.Numero = ""; objSctr.Fecha = item.Fecha; objSctr.Mes = item.Mes; objSctr.TipoDocumento = item.TipoDocumento; objSctr.IdPersona = item.IdPersona; objSctr.NumeroDocumento = item.NumeroDocumento; objSctr.Solicitante = item.Solicitante; objSctr.Cargo = item.Cargo; objSctr.FechaNacimiento = item.FechaNacimiento; objSctr.Nacionalidad = item.Nacionalidad; objSctr.IdSituacion = Parametros.intSCTRGenerada; objSctr.FlagEstado = true; objSctr.Usuario = Parametros.strUsuarioLogin; objSctr.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_Sctr.Inserta(objSctr); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); //ActualizaNumero SctrBL objBSctr = new SctrBL(); objBSctr.ActualizaNumero(intNumero, strNumero); } else { objBL_Sctr.Actualiza(objSctr); } } //LLENAMOS EL FORMATO EXCEL DE SCTR ExportarFormatoExcel(""); StringBuilder strMensaje = new StringBuilder(); strMensaje.Append("*****************************************************************************\n\n"); strMensaje.Append("Se Generó el N° de Solicitud de Afiliación SCTR" + "\n\n"); strMensaje.Append("Emitido Por el Area de Bienestar Seguridad y Salud en el Trabajo" + "\n\n"); strMensaje.Append("*****************************************************************************\n\n"); BSUtils.EmailSend("*****@*****.**", "Solicitud de Afiliación de SCTR", strMensaje.ToString(), "D:\\Plantilla SCTR.xlsx", "", "", ""); XtraMessageBox.Show("Se creó la solicitud de afiliación del seguro SCTR", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { SeguroViajeBE objSeguroViaje = new SeguroViajeBE(); SeguroViajeBL objBL_SeguroViaje = new SeguroViajeBL(); objSeguroViaje.IdSeguroViaje = IdSeguroViaje; objSeguroViaje.IdEmpresa = intIdEmpresa; objSeguroViaje.Numero = txtNumero.Text; objSeguroViaje.FechaSalida = Convert.ToDateTime(deFechaSalida.DateTime.ToShortDateString()); objSeguroViaje.FechaLlegada = Convert.ToDateTime(deFechaLlegada.DateTime.ToShortDateString()); objSeguroViaje.Dias = Convert.ToInt32(txtDias.EditValue); objSeguroViaje.Pais = txtPais.Text; objSeguroViaje.IdPersona = intIdSolicitante; objSeguroViaje.Dni = txtDni.Text; objSeguroViaje.Pasaporte = txtPasaporte.Text; objSeguroViaje.Solicitante = txtSolicitante.Text; objSeguroViaje.FechaNacimiento = Convert.ToDateTime(deFechaNacimiento.DateTime.ToShortDateString()); objSeguroViaje.Direccion = txtDireccion.Text; objSeguroViaje.Distrito = txtDistrito.Text; objSeguroViaje.Telefono = txtTelefono.Text; objSeguroViaje.Email = txtEmailTrabajo.Text; objSeguroViaje.EmailPersonal = txtEmailPersonal.Text; objSeguroViaje.Cargo = txtCargo.Text; objSeguroViaje.Contacto = txtContacto.Text; objSeguroViaje.TelefonoContacto1 = txtTelefonoContacto1.Text; objSeguroViaje.TelefonoContacto2 = txtTelefonoContacto2.Text; objSeguroViaje.EmpresaBoleta = txtEmpresaBoleta.Text; objSeguroViaje.EmpresaFactura = txtEmpresaFactura.Text; objSeguroViaje.Ruc = txtRuc.Text; objSeguroViaje.Autoriza = txtAutoriza.Text; objSeguroViaje.Oiseco = txtOICECO.Text; objSeguroViaje.IdSituacion = Parametros.intSVJGenerada; objSeguroViaje.FlagEstado = true; objSeguroViaje.Usuario = Parametros.strUsuarioLogin; objSeguroViaje.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_SeguroViaje.Inserta(objSeguroViaje); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ActualizaNumero SeguroViajeBL objBSeguroViaje = new SeguroViajeBL(); objBSeguroViaje.ActualizaNumero(intNumero, txtNumero.Text); //LLENAMOS EL FORMATO EXCEL DE SEGURO DE VIAJE ExportarFormatoExcel("", intNumero); StringBuilder strMensaje = new StringBuilder(); strMensaje.Append("*****************************************************************************\n\n"); strMensaje.Append("Se Generó el N° de Solicitud de Afiliación de Seguro de Viaje : " + strNumero + "\n\n"); strMensaje.Append("Solicitante : " + txtSolicitante.Text + "\n"); strMensaje.Append("Empresa : " + txtEmpresa.Text + "\n\n"); strMensaje.Append("Emitido Por el Area de Bienestar Seguridad y Salud en el Trabajo" + "\n\n"); strMensaje.Append("*****************************************************************************\n\n"); BSUtils.EmailSend("*****@*****.**", "Solicitud de Afiliación de Seguro de Viaje", strMensaje.ToString(), "D:\\Seguro de Viaje " + strNumero + ".xlsx", "", "", ""); XtraMessageBox.Show("Se creó la solicitud de afiliación del seguro de viaje N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_SeguroViaje.Actualiza(objSeguroViaje); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { DescansoMedicoBE objDescansoMedico = new DescansoMedicoBE(); DescansoMedicoBL objBL_DescansoMedico = new DescansoMedicoBL(); objDescansoMedico.IdDescansoMedico = IdDescansoMedico; objDescansoMedico.IdEmpresa = intIdEmpresa; objDescansoMedico.IdUnidadMinera = intIdUnidadMinera; objDescansoMedico.IdArea = intIdArea; objDescansoMedico.Numero = txtNumero.Text; objDescansoMedico.IdPersona = intIdPersona; objDescansoMedico.IdTipoDescansoMedico = Convert.ToInt32(cboTipoDescansoMedico.EditValue); objDescansoMedico.FechaIni = Convert.ToDateTime(deFechaIni.DateTime.ToShortDateString()); objDescansoMedico.FechaFin = Convert.ToDateTime(deFechaFin.DateTime.ToShortDateString()); objDescansoMedico.Mes = Convert.ToInt32(cboMes.EditValue); objDescansoMedico.Dias = Convert.ToInt32(txtDias.EditValue); objDescansoMedico.Horas = Convert.ToInt32(txtHoras.EditValue); objDescansoMedico.Sueldo = Convert.ToDecimal(txtSueldo.EditValue); objDescansoMedico.Kpi = Convert.ToDecimal(txtKpi.EditValue); objDescansoMedico.IdContingencia = Convert.ToInt32(cboContingencia.EditValue); objDescansoMedico.Diagnostico = txtDiagnostica.Text; objDescansoMedico.CentroMedico = txtCentroMedico.Text; objDescansoMedico.IdCategoriaDiagnostico = Convert.ToInt32(cboCategoriaDiagnostico.EditValue); objDescansoMedico.IdCondicionDescansoMedico = Convert.ToInt32(cboCondicionDescansoMedico.EditValue); objDescansoMedico.FlagEstado = true; objDescansoMedico.IdCategoriaDiagnostico = Convert.ToInt32(cboCategoriaDiagnostico.EditValue); objDescansoMedico.Usuario = Parametros.strUsuarioLogin; objDescansoMedico.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_DescansoMedico.Inserta(objDescansoMedico); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ActualizaNumero DescansoMedicoBL objBDescansoMedico = new DescansoMedicoBL(); objBDescansoMedico.ActualizaNumero(intNumero, txtNumero.Text); XtraMessageBox.Show("Se creó el Descanso Médico N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_DescansoMedico.Actualiza(objDescansoMedico); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { SolicitudEppBE objSolicitudEpp = new SolicitudEppBE(); SolicitudEppBL objBL_SolicitudEpp = new SolicitudEppBL(); StringBuilder strMensaje = new StringBuilder(); objSolicitudEpp.IdSolicitudEpp = IdSolicitudEpp; objSolicitudEpp.IdUnidadMinera = Parametros.intUnidadMineraId; objSolicitudEpp.IdArea = Parametros.intAreaId; objSolicitudEpp.Numero = txtNumero.Text; objSolicitudEpp.IdJefe = intIdJefe; objSolicitudEpp.IdPersona = intIdPersona; objSolicitudEpp.IdEmpresaResponsable = intIdEmpresaResponsable; objSolicitudEpp.IdUnidadMineraResponsable = intIdUnidadMineraResponsable; objSolicitudEpp.IdAreaResponsable = intIdAreaResponsable; objSolicitudEpp.IdSectorResponsable = Convert.ToInt32(cboSector.EditValue); objSolicitudEpp.Fecha = Convert.ToDateTime(deFecha.DateTime.ToShortDateString()); objSolicitudEpp.IdSituacion = Parametros.intSLCPendiente; objSolicitudEpp.FlagEstado = true; objSolicitudEpp.Usuario = Parametros.strUsuarioLogin; objSolicitudEpp.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objSolicitudEpp.IdEmpresa = Parametros.intEmpresaId; objSolicitudEpp.Jefe = txtJefe.Text.Trim(); objSolicitudEpp.Responsable = txtResponsable.Text.Trim(); objSolicitudEpp.DescUnidadMinera = txtUnidadMineraResponsable.Text; objSolicitudEpp.Email = strEmailJefe; //Solicitud Epp Detalle List <SolicitudEppDetalleBE> lstSolicitudEppDetalle = new List <SolicitudEppDetalleBE>(); foreach (var item in mListaSolicitudEppDetalleOrigen) { SolicitudEppDetalleBE objE_SolicitudEppDetalle = new SolicitudEppDetalleBE(); objE_SolicitudEppDetalle.IdEmpresa = Parametros.intEmpresaId; objE_SolicitudEppDetalle.IdSolicitudEpp = IdSolicitudEpp; objE_SolicitudEppDetalle.IdSolicitudEppDetalle = item.IdSolicitudEppDetalle; objE_SolicitudEppDetalle.Item = item.Item; objE_SolicitudEppDetalle.IdEquipo = item.IdEquipo; objE_SolicitudEppDetalle.Codigo = item.Codigo; objE_SolicitudEppDetalle.DescEquipo = item.DescEquipo; objE_SolicitudEppDetalle.Cantidad = item.Cantidad; objE_SolicitudEppDetalle.FlagEstado = true; objE_SolicitudEppDetalle.Usuario = Parametros.strUsuarioLogin; objE_SolicitudEppDetalle.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_SolicitudEppDetalle.TipoOper = item.TipoOper; lstSolicitudEppDetalle.Add(objE_SolicitudEppDetalle); } if (pOperacion == Operacion.Nuevo) { int intNumero = 0; string strNumero = ""; intNumero = objBL_SolicitudEpp.Inserta(objSolicitudEpp, lstSolicitudEppDetalle); strNumero = FuncionBase.AgregarCaracter(intNumero.ToString(), "0", 7); txtNumero.Text = strNumero; //ActualizaNumero SolicitudEppBL objBSolicitudEpp = new SolicitudEppBL(); objBSolicitudEpp.ActualizaNumero(intNumero, txtNumero.Text); strMensaje.Append("**************************** SOLICITUD DE EPP *********************************\n\n"); strMensaje.Append("Se Generó el N° de Solicitud de EPP : " + txtNumero.Text + "\n\n"); strMensaje.Append("Solicitante : " + objSolicitudEpp.Jefe + "\n\n"); strMensaje.Append("Responsable : " + objSolicitudEpp.Responsable + "\n\n"); strMensaje.Append("Sede : " + objSolicitudEpp.DescUnidadMinera + "\n\n"); foreach (var item in mListaSolicitudEppDetalleOrigen) { strMensaje.Append("Código : " + item.Codigo.ToString() + "\n"); strMensaje.Append("EPP : " + item.DescEquipo.ToString() + "\n"); strMensaje.Append("Cantidad : " + item.Cantidad.ToString() + "\n\n"); } strMensaje.Append("Responsable de Entrega de EPP: Jencarlo Villanueva Bruno Anexo 3052/3113 \n\n"); strMensaje.Append("********************************************************************************\n\n"); BSUtils.EmailSend(objSolicitudEpp.Email, "Solicitud de Epp", strMensaje.ToString(), "", "", "", ""); XtraMessageBox.Show("Se creó la Solicitud de Epp N° : " + txtNumero.Text, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_SolicitudEpp.Actualiza(objSolicitudEpp, lstSolicitudEppDetalle); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }