private void BtnLimpiar_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; Empleados_Load(sender, e); LimpiarPantalla(); _PersonaSeleccionada = null; Cursor.Current = Cursors.Default; }
private void gridEmpleados_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) { try { if (gridEmpleados.Rows.Count < 1) { return; } var selectedUser = (MssBD.CON_Empleados_Rut_Centro_Result) this.gridEmpleados.CurrentRow.DataBoundItem; _ConsultaEmp = selectedUser; txtRutDato.Text = selectedUser.Rut.ToString(); if (txtRutDato.Text != string.Empty) { txtRutDato.Text = string.Format("{0:#,##0}", double.Parse(txtRutDato.Text)); } else { txtRutDato.Text = "0"; } txtDvDato.Text = selectedUser.Dv; txtApellidoPaterno.Text = selectedUser.ApellidoPaterno; txtApellidoMaterno.Text = selectedUser.ApellidoMaterno; txtNombres.Text = selectedUser.Nombres; txtDireccion.Text = selectedUser.Direccion; txtFechaInicio.Value = selectedUser.FechaIngreso.Value; txtFechaVencimiento.Value = selectedUser.FechaVencimiento.Value; if (selectedUser.FechaNacimiento != null) { txtFechaNacimiento.Value = (DateTime)selectedUser.FechaNacimiento; } else { txtFechaNacimiento.Value = DateTime.Parse("19000101"); } txtTeleFijo.Text = selectedUser.TelFijo; txtTeleCel.Text = selectedUser.TelCelular; if (txtRutDato.Text != string.Empty) { txtRutDato.Text = string.Format("{0:#,##0}", double.Parse(txtRutDato.Text)); } else { txtRutDato.Text = "0"; } } catch (Exception) { throw; } }
public Boolean RegistrarDocumento(Int32 DocumentoTipo_Id , MssBD.Usuarios _usu , MssBD.CON_Empleados_Rut_Centro_Result _per , bool PorVisar , string RutaFinal , ref String Mensaje , ref Int32 Doc_Id) { try { MssBD.Documentos _doc = new MssBD.Documentos(); _doc.DocumentoTipo_Id = DocumentoTipo_Id; _doc.Fecha = DateTime.Now; _doc.Personal_Id = _per.Rut; _doc.PorVisar = true; _doc.RutaFinal = RutaFinal; _doc.Usuario_Id = _usu.Usuario_Id; Modelo_BDMSS.Documentos.Add(_doc); Modelo_BDMSS.SaveChanges(); switch (DocumentoTipo_Id) { case 1: Mensaje = "Se ha registrado Contrato. Dar a conocer a Administrador para su visado."; break; case 2: Mensaje = "Se ha registrado Anexo. Dar a conocer a Administrador para su visado."; break; case 3: Mensaje = "Se ha registrado Finiquito. Dar a conocer a Administrador para su visado."; break; default: break; } try { Doc_Id = Modelo_BDMSS.Documentos.Where(doc => doc.Documento_Id == doc.Documento_Id) .Max(doc => doc.Documento_Id); } catch (Exception ex) { throw ex; } return(true); } catch (Exception) { throw; } }
private void btnEliminar_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; if (txtRutDato.Text != string.Empty && txtDvDato.Text != string.Empty) { MssBD.Personal _persEliminar = new MssBD.Personal(); _persEliminar.Rut = Int32.Parse(txtRutDato.Text.Replace(".", "").Replace(",", "")); _persEliminar.Dv = txtDvDato.Text; if (!_Empleado.ExistePersonal(_persEliminar)) { MessageBox.Show(String.Concat("Empleado no existe en la Base de Datos."), "Mss", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (DialogResult.Cancel == MessageBox.Show(String.Concat("Realmente desea eliminar al Personal '", _persEliminar.Nombres, _persEliminar.ApellidoPaterno, _persEliminar.ApellidoMaterno, "'"), "Mss", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { return; } if (_Empleado.EliminaPersonal(_usuarioSesion, _persEliminar)) { MessageBox.Show("Se ha eliminado Empleado con éxito", "Mss", MessageBoxButtons.OK, MessageBoxIcon.Information); BtnLimpiar_Click(sender, e); _PersonaSeleccionada = null; } else { MessageBox.Show("No se ha podido eliminado Empleado.", "Mss", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(String.Concat("Debe seleccionar personal o ingresar Rut y Digito verificador en la sección 'Datos del Personal'."), "Mss", MessageBoxButtons.OK, MessageBoxIcon.Information); _PersonaSeleccionada = null; return; } } catch (Exception ex) { Cursor.Current = Cursors.Default; MensajeControlado mensa = new MensajeControlado("", ex.Message, ex); mensa.Show(); return; } finally { Cursor.Current = Cursors.Default; } }
public Boolean RegistrarContrato(Int32 DocumentoTipo_Id , MssBD.Usuarios _usu , MssBD.CON_Empleados_Rut_Centro_Result _per , bool PorVisar , string RutaFinal , ref String Mensaje , Int32 Doc_Id) { try { MssBD.Contratos _con = new MssBD.Contratos(); _con.Afp_Id = _per.Afp_Id; _con.CentroCosto_Id = _per.CentroCosto_Id; _con.Documento_Id = Doc_Id; _con.EstructuraSueldo_Id = _per.EstructuraSueldo_Id; _con.FechaDesde = _per.FechaIngreso.Value; _con.FechaHasta = _per.FechaVencimiento.Value; _con.Isapre_Id = _per.Isapre_Id; _con.TipoContrato = _per.TipoContrato; Modelo_BDMSS.Contratos.Add(_con); Modelo_BDMSS.SaveChanges(); _log.IngresaLog(_usu, String.Concat(_usu.Usuario_Nombre, " ha registrado Contratos de ", _per.Rut, "-", _per.Dv)); switch (DocumentoTipo_Id) { case 1: Mensaje = "Se ha registrado Contrato. Dar a conocer a Administrador para su visado."; break; case 2: Mensaje = "Se ha registrado Anexo. Dar a conocer a Administrador para su visado."; break; case 3: Mensaje = "Se ha registrado Finiquito. Dar a conocer a Administrador para su visado."; break; default: break; } return(true); } catch (Exception) { throw;; } }
public Boolean RetornaContratoId(MssBD.CON_Empleados_Rut_Centro_Result _per) { try { String _TipoContrato = (from con in Modelo_BDMSS.Contratos join doc in Modelo_BDMSS.Documentos on con.Documento_Id equals doc.Documento_Id join per in Modelo_BDMSS.Personal on doc.Personal_Id equals per.Rut where per.Rut == _per.Rut select con.TipoContrato).First(); if (_TipoContrato.Equals("INDEFINIDO")) { return(false); } return(true); } catch (Exception) { throw; } }
public Boolean RetornaContratoId(MssBD.CON_Empleados_Rut_Centro_Result _per , ref String Mensaje , ref int ContratoId) { try { //String _TipoContrato = (from con in Modelo_BDMSS.Contratos // join doc in Modelo_BDMSS.Documentos on con.Documento_Id equals doc.Documento_Id // join per in Modelo_BDMSS.Personal on doc.Personal_Id equals per.Rut // where per.Rut == _per.Rut // select con.TipoContrato).First(); //if (_TipoContrato.Equals("INDEFINIDO")) //{ // Mensaje = String.Concat(_per.Nombres, " ya posee contrato Indefinido, no se puede realizar un Anexo de Contrato."); // return false; //} int _contratoId = (from con in Modelo_BDMSS.Contratos join doc in Modelo_BDMSS.Documentos on con.Documento_Id equals doc.Documento_Id join per in Modelo_BDMSS.Personal on doc.Personal_Id equals per.Rut where per.Rut == _per.Rut select con.Contrato_Id).First(); if (_contratoId > 0) { ContratoId = _contratoId; return(true); } else { Mensaje = String.Concat("No se ha encontrado un Contrato anteriormente registrado para Id de Contrato", _per.Nombres); return(false); } } catch (Exception) { throw; } }
private void gridEmpleados_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (gridEmpleados.Rows.Count < 1) { return; } var selectedUser = (MssBD.CON_Empleados_Rut_Centro_Result) this.gridEmpleados.CurrentRow.DataBoundItem; _ConsultaEmp = selectedUser; txtRutDato.Text = selectedUser.Rut.ToString().Replace(",", String.Empty).Replace(".", String.Empty); txtDvDato.Text = selectedUser.Dv; if (txtRutDato.Text != string.Empty) { txtRutDato.Text = string.Format("{0:#,##0}", double.Parse(txtRutDato.Text)); } else { txtRutDato.Text = "0"; } txtApellidoPaterno.Text = selectedUser.ApellidoPaterno; txtApellidoMaterno.Text = selectedUser.ApellidoMaterno; txtNombres.Text = selectedUser.Nombres; txtDireccion.Text = selectedUser.Direccion; txtFechaContrato.Value = DateTime.Now; if (selectedUser.FechaNacimiento != null) { txtFechaNacimiento.Value = (DateTime)selectedUser.FechaNacimiento; } else { txtFechaNacimiento.Value = DateTime.Parse("19000101"); } if (selectedUser.FechaIngreso != null) { txtFechaInicio.Value = (DateTime)selectedUser.FechaIngreso; } else { txtFechaInicio.Value = DateTime.Parse("19000101"); } if (selectedUser.FechaVencimiento != null) { txtFechaVencimiento.Value = (DateTime)selectedUser.FechaVencimiento; } else { txtFechaVencimiento.Value = DateTime.Parse("19000101"); } txtTeleFijo.Text = selectedUser.TelFijo; txtTeleCel.Text = selectedUser.TelCelular; //Datos Contratos cboTipoContrato.Text = selectedUser.TipoContrato; cboCursoOS10.Text = selectedUser.CursoOS10; txtCredencial.Text = selectedUser.Credencial; // Centro y Estructuras if (selectedUser.CentroCosto_Id != null) { cboCentroCostoInfo.SelectedValue = selectedUser.CentroCosto_Id; } else { cboCentroCostoInfo.SelectedItem = -1; } if (selectedUser.EstructuraSueldo_Id != null) { cboEstructuraSueldo.SelectedValue = selectedUser.EstructuraSueldo_Id; } else { cboEstructuraSueldo.SelectedItem = -1; } try { cboEstadoCivil.SelectedItem = selectedUser.EstadoCivil; } catch (Exception) { } //Previsiones if (selectedUser.Afp_Id != null) { cboAfp.SelectedValue = selectedUser.Afp_Id; } else { cboAfp.SelectedItem = -1; } if (selectedUser.Isapre_Id != null) { cboIsapre.SelectedValue = selectedUser.Isapre_Id; } else { cboIsapre.SelectedItem = -1; } //Cuentas Corrientes txtNumeroCuenta.Text = selectedUser.NumeroCuenta; if (selectedUser.Id_Banco != null) { cboBancos.SelectedValue = selectedUser.Id_Banco; } else { cboBancos.SelectedItem = -1; } cboTipoCuenta.Text = selectedUser.TipoCuenta; if (selectedUser.Privilegio_Id == 5) { txtCargo.Text = "Guardia"; txtAnticipo.Text = "60000"; } txtCargo.Text = selectedUser.Cargo; } catch (Exception) { throw; } }
public Boolean RegistrarFiniquito(Int32 DocumentoTipo_Id , MssBD.Usuarios _usu , MssBD.CON_Empleados_Rut_Centro_Result _per , bool PorVisar , string RutaFinal , ref String Mensaje , Int32 Doc_Id , Finiquitos _Finiquito , IDictionary <int, Negocio.Documentos.Remuneracion> _listRemu) { try { Int32 _Finiquito_Id = 0; MssBD.Finiquito _fin = new MssBD.Finiquito(); _fin.Documento_Id = Doc_Id; _fin.Articulo = _Finiquito._Articulo; _fin.Articulo_Numero = Int32.Parse(_Finiquito._NumeroArticulo); _fin.Comentario = _Finiquito._Motivo; _fin.Documento_Id = Doc_Id; _fin.Vacaciones = _Finiquito._Vacaciones; _fin.MontoTotal = _Finiquito._Total; _fin.RutaFinal = RutaFinal; Modelo_BDMSS.Finiquito.Add(_fin); Modelo_BDMSS.SaveChanges(); _Finiquito_Id = Modelo_BDMSS.Finiquito.Where(fin => fin.Finiquito_Id == fin.Finiquito_Id) .Max(fin => fin.Finiquito_Id); foreach (var item in _listRemu) { Remuneracion remu = new Remuneracion(); remu = (Remuneracion)item.Value; MssBD.Remuneraciones _remu = new MssBD.Remuneraciones(); _remu.FechaInicio = remu.FechaInicio; _remu.FechaTermino = remu.FechaTermino; _remu.Finiquito_Id = _Finiquito_Id; _remu.monto = remu.Monto; Modelo_BDMSS.Remuneraciones.Add(_remu); Modelo_BDMSS.SaveChanges(); } _log.IngresaLog(_usu, String.Concat(_usu.Usuario_Nombre, " ha registrado Finiquito de ", _per.Rut, "-", _per.Dv)); switch (DocumentoTipo_Id) { case 1: Mensaje = "Se ha registrado Contrato. Dar a conocer a Administrador para su visado."; break; case 2: Mensaje = "Se ha registrado Anexo. Dar a conocer a Administrador para su visado."; break; case 3: Mensaje = "Se ha registrado Finiquito. Dar a conocer a Administrador para su visado."; break; default: break; } return(true); } catch (Exception) { throw;; } }
private void gridEmpleados_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (gridEmpleados.Rows.Count < 1) { return; } var selectedUser = (MssBD.CON_Empleados_Rut_Centro_Result) this.gridEmpleados.CurrentRow.DataBoundItem; _PersonaSeleccionada = selectedUser; txtRutDato.Text = selectedUser.Rut.ToString(); txtDvDato.Text = selectedUser.Dv; if (txtRutDato.Text != string.Empty) { txtRutDato.Text = string.Format("{0:#,##0}", double.Parse(txtRutDato.Text)); } else { txtRutDato.Text = "0"; } txtApellidoPaterno.Text = selectedUser.ApellidoPaterno; txtApellidoMaterno.Text = selectedUser.ApellidoMaterno; txtNombres.Text = selectedUser.Nombres; txtDireccion.Text = selectedUser.Direccion; if (selectedUser.FechaNacimiento != null) { txtFechaNacimiento.Value = (DateTime)selectedUser.FechaNacimiento; } else { txtFechaNacimiento.Value = DateTime.Parse("19000101"); } if (selectedUser.FechaIngreso != null) { txtFechaContrato.Value = (DateTime)selectedUser.FechaIngreso; } else { txtFechaContrato.Value = DateTime.Parse("19000101"); } if (selectedUser.FechaVencimiento != null) { txtFechaVencimiento.Value = (DateTime)selectedUser.FechaVencimiento; } else { txtFechaVencimiento.Value = DateTime.Parse("19000101"); } txtTeleFijo.Text = selectedUser.TelFijo; txtTeleCel.Text = selectedUser.TelCelular.Replace("56", string.Empty); txtContactTeleFijo.Text = selectedUser.TelContactoFijo; txtContactTeleCelular.Text = selectedUser.TelContactoCelular; txtNombreContacto.Text = selectedUser.NombreContacto; txtParentesco.Text = selectedUser.Parentesco; //Datos Contratos cboTipoContrato.Text = selectedUser.TipoContrato; cboCursoOS10.Text = selectedUser.CursoOS10; txtCredencial.Text = selectedUser.Credencial; //Datos Ropa txtCalzado.Text = selectedUser.Calzado.ToString(); txtPantalon.Text = selectedUser.Pantalon; txtPolera.Text = selectedUser.Polera; txtCamisa.Text = selectedUser.Camisa; txtPolar.Text = selectedUser.Polar; txtCasaca.Text = selectedUser.Casaca; txtCorbata.Text = selectedUser.Corbata; txtGorro.Text = selectedUser.Gorro; txtCazadora.Text = selectedUser.Cazadora; //imagen try { MemoryStream _ms = new MemoryStream(selectedUser.Imagen); txtImagen.Image = Image.FromStream(_ms); _PersonaSeleccionada.Imagen = selectedUser.Imagen; _ms.Dispose(); _ms = null; } catch (Exception) { txtImagen.Image = null; } //Localidades try { cboPais.SelectedValue = selectedUser.Pais_Codigo; cboRegiones.SelectedValue = selectedUser.Region_Codigo; cboProvincias.SelectedValue = selectedUser.Provincia_Codigo; cboComunas.SelectedValue = selectedUser.Comuna_Codigo; } catch (Exception) { } //Privilegios Usuarios if (selectedUser.Privilegio_Id != null) { cboPrivilegios.SelectedValue = selectedUser.Privilegio_Id; } else { cboPrivilegios.SelectedValue = 5; } // Centro y Estructuras if (selectedUser.CentroCosto_Id != null) { cboCentroCostoInfo.SelectedValue = selectedUser.CentroCosto_Id; } else { cboCentroCostoInfo.SelectedItem = -1; } if (selectedUser.EstructuraSueldo_Id != null) { cboEstructuraSueldo.SelectedValue = selectedUser.EstructuraSueldo_Id; } else { cboEstructuraSueldo.SelectedItem = -1; } //Previsiones if (selectedUser.Afp_Id != null) { cboAfp.SelectedValue = selectedUser.Afp_Id; } else { cboAfp.SelectedItem = -1; } if (selectedUser.Isapre_Id != null) { cboIsapre.SelectedValue = selectedUser.Isapre_Id; } else { cboIsapre.SelectedItem = -1; } try { cboEstadoCivil.SelectedItem = selectedUser.EstadoCivil; } catch (Exception) { } //Cuentas Corrientes txtNumeroCuenta.Text = selectedUser.NumeroCuenta; if (selectedUser.Id_Banco != null) { cboBancos.SelectedValue = selectedUser.Id_Banco; } else { cboBancos.SelectedItem = -1; } cboTipoCuenta.Text = selectedUser.TipoCuenta; txtCargo.Text = selectedUser.Cargo; } catch (Exception) { throw; } }
private void gridEmpleados_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (gridEmpleados.Rows.Count < 1) { return; } Cursor.Current = Cursors.WaitCursor; var selectedUser = (MssBD.CON_Empleados_Rut_Centro_Result) this.gridEmpleados.CurrentRow.DataBoundItem; _ConsultaEmp = selectedUser; txtRutDato.Text = selectedUser.Rut.ToString(); if (txtRutDato.Text != string.Empty) { txtRutDato.Text = string.Format("{0:#,##0}", double.Parse(txtRutDato.Text)); } else { txtRutDato.Text = "0"; } txtDvDato.Text = selectedUser.Dv; txtApellidoPaterno.Text = selectedUser.ApellidoPaterno; txtApellidoMaterno.Text = selectedUser.ApellidoMaterno; txtNombres.Text = selectedUser.Nombres; txtDireccion.Text = selectedUser.Direccion; txtFechaInicio.Value = selectedUser.FechaIngreso.Value; txtFechaVencimiento.Value = selectedUser.FechaVencimiento.Value; cboTipoContrato.Text = selectedUser.TipoContrato; if (selectedUser.FechaNacimiento != null) { txtFechaNacimiento.Value = (DateTime)selectedUser.FechaNacimiento; } else { txtFechaNacimiento.Value = DateTime.Parse("19000101"); } txtTeleFijo.Text = selectedUser.TelFijo; txtTeleCel.Text = selectedUser.TelCelular; try { cboEstadoCivil.SelectedItem = selectedUser.EstadoCivil; } catch (Exception) { } } catch (Exception ex) { Cursor.Current = Cursors.Default; MensajeControlado mensa = new MensajeControlado("", ex.Message, ex); mensa.Show(); return; } finally { Cursor.Current = Cursors.Default; } }