public bool Guardar_DB(ro_fectividad_x_empleado_Adm_x_periodo_Info info) { bool bandera = false; decimal id_nov = 0; try { if (data.Guardar_DB(info)) { if (Bus_Detalle.Guardar_DB(info.detalle)) { foreach (var item in Get_Novedades(info.detalle)) { bandera = bus_novedad.GrabarDB(item, ref id_nov); } } } return(bandera); } catch (Exception ex) { mensaje = ex.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public bool Guardar_DB(ro_fectividad_Entrega_x_Periodo_Empleado_Info info) { lista_detalle_grupos = bus_grupo_detalle.Get_lista(param.IdEmpresa); bool ba = false; int idefectividad = 0; decimal id_nov = 0; var ro_fectividad_Entrega_tipoServicio_info = ro_fectividad_Entrega_tipoServicio_Data.Get_Info(info.IdEmpresa, (int)info.IdServicioTipo); try { if (data.Guardar_DB(info, ref idefectividad)) { if (ro_fectividad_Entrega_tipoServicio_info.Genera_novedad == true) { foreach (var item in Get_Novedades(info.lista, Convert.ToInt32(info.IdServicioTipo))) { ba = bus_novedad.GrabarDB(item, ref id_nov); } } } return(true); } catch (Exception ex) { mensaje = ex.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public bool Guardar_DB(ro_Remplazo_x_emplado_Info info, ref int Id_Remplazo, ref decimal id_novedad) { try { decimal iddiario = 0; decimal idop = 0; if (data.Guardar_DB(info, ref Id_Remplazo)) { if (info.Descuenta_rol == true) { ro_Empleado_Novedad_Info info_novedad = new ro_Empleado_Novedad_Info(); info_novedad = Get_novedad_info(info); if (novedad_bus.GrabarDB(info_novedad, ref id_novedad, ref error)) { info_novedad.InfoNovedadDet.IdNovedad = id_novedad; info_novedad.InfoNovedadDet.IdEmpresa = info.IdEmpresa; if (novedad_det_bus.GrabarDB(info_novedad.InfoNovedadDet, ref error)) { info.IdNovedad = id_novedad; info.Id_remplazo = Id_Remplazo; Modificar_DB_IdNovedad(info); } } } GetOrdenPao(info); GetAsientoContable(info); if (bus_ct.GrabarDB(infocont, ref iddiario, ref mensaje)) { foreach (var item in CabOP.Detalle) { item.IdTipoCbte_cxp = infocont.IdTipoCbte; item.IdCbteCble_cxp = iddiario; } if (bus_op.GuardaDB(CabOP, ref idop, ref mensaje)) { } } } return(true); } catch (Exception ex) { mensaje = ex.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public bool Guardar_DB(ro_fectividad_Entrega_x_Periodo_Empleado_Info info) { lista_detalle_grupos = bus_grupo_detalle.Get_lista(param.IdEmpresa); bool ba = false; int idefectividad = 0; decimal id_nov = 0; try { if (data.Guardar_DB(info, ref idefectividad)) { foreach (var item in info.lista) { item.IdEmpresa = info.IdEmpresa; item.IdNomina_Tipo = info.IdNomina_Tipo; item.IdPeriodo = info.IdPeriodo; item.IdEfectividad = info.IdEfectividad; item.IdEfectividad = idefectividad; item.IdNomina_tipo_Liq = info.IdNomina_tipo_Liq; } if (ba = data_detalle.Guardar_DB(info.lista)) { foreach (var item in Get_Novedades(info.lista)) { ba = bus_novedad.GrabarDB(item, ref id_nov); } } } return(ba); } catch (Exception ex) { mensaje = ex.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public bool GrabarDB() { bool SiGrabo = false; string MsgError = ""; decimal Idtransaccion = 0, IdNovedad = 0; try { if (BusControlSubidaNovedad.SiArchivoFueSubido(param.IdEmpresa, IdCalendario, Convert.ToString(cmbNovedad.EditValue))) { MessageBox.Show("El Archivo Seleccionado se subio con la Novedad " + cmbNovedad.Text); Bandera_ValidarPagina = false; return(false); } foreach (var item in ListaNovedadesGrabarCab) { if (BusNovedadXempleado.GrabarDB(item, ref MsgError, ref IdNovedad, ref Idtransaccion)) { SiGrabo = true; } } BusControlSubidaNovedad.GrabarDB(param.IdEmpresa, IdCalendario, Convert.ToString(cmbNovedad.EditValue)); return(true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); return(false); } }
public bool Guardar_DB(ro_descuento_no_planificados_Info info) { try { string msg = ""; decimal idNovedad = 0; int sec = 0; bool ba = false; if (info.IdNovedad == null || info.IdNovedad == 0) { foreach (var item in Get_Novedad(info)) { if (bus_novedad.GrabarDB(item, ref idNovedad)) { info.IdNovedad = Convert.ToInt32(idNovedad); if (data.Modificar_DB(info)) { } } } foreach (var item_ in info.lista) { sec = sec + 1; item_.IdDescuento = info.IdDescuento; item_.Secuencia = sec; } ba = bus_detalle.Guardar_DB(info.lista); } else// modificar { foreach (var item in Get_Novedad(info)) { if (bus_novedad.ModificarDB(item)) { if (bus_novedad_Det.EliminarDB(item.IdEmpresa, item.IdNomina_Tipo, item.IdEmpleado, Convert.ToDecimal(item.IdNovedad))) { foreach (var itemN in item.LstDetalle) { bus_novedad_Det.GrabarDB(itemN, ref msg); } info.IdNovedad = Convert.ToInt32(info.IdNovedad); if (data.Modificar_DB(info)) { } } } } foreach (var item_ in info.lista) { item_.IdDescuento = info.IdDescuento; item_.Secuencia = 1; } ba = bus_detalle.Guardar_DB(info.lista); } return(ba); } catch (Exception ex) { mensaje = ex.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public bool GuardarNovedad(List <ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar_Info> lista) { try { decimal id_nov = 0; ro_Empleado_Novedad_Bus BUS_NOVEDAD = new ro_Empleado_Novedad_Bus(); info_parametro = bus_parametros.Get_info(param.IdEmpresa); foreach (var item in lista) { if (item.Max_num_horas_sab_dom > 1 && item.Calculo_Horas_extras_Sobre >= 160) { // creo la cabecera de la novedad ro_Empleado_Novedad_Info info = new ro_Empleado_Novedad_Info(); ro_Empleado_Novedad_Det_Info info_Detalle = new ro_Empleado_Novedad_Det_Info(); info.IdEmpresa = item.IdEmpresa; info.IdEmpleado = item.IdEmpleado; info.IdNomina_Tipo = item.IdTipoNomina; info.IdNomina_TipoLiqui = item.IdNomina_tipo; info.TotalValor = (Convert.ToDouble(item.SueldoActual / item.Calculo_Horas_extras_Sobre) * 2) * item.Max_num_horas_sab_dom; if (Convert.ToDateTime(item.es_fecha_registro).Day > info_parametro.Corte_Horas_extras) { info.Fecha_PrimerPago = item.FechaPago.AddMonths(1); info.Fecha = item.FechaPago; } else { info.Fecha_PrimerPago = item.FechaPago; info.Fecha = item.es_fecha_registro; } info.NumCoutas = 1; info.Num_Horas = item.Max_num_horas_sab_dom; info.Fecha_Transac = DateTime.Now; info.IdUsuario = param.IdUsuario; info.IdCalendario = item.es_fecha_registro.Year.ToString() + item.es_fecha_registro.Month.ToString().PadLeft(2, '0') + item.es_fecha_registro.Day.ToString().PadLeft(2, '0'); info.IdPeriodo = item.IdPeriodo; // creo el detalle info_Detalle.IdEmpleado = param.IdEmpresa; info_Detalle.IdEmpleado = item.IdEmpleado; info_Detalle.Secuencia = 1; info_Detalle.IdRubro = "9"; if (Convert.ToDateTime(item.es_fecha_registro).Day >= info_parametro.Corte_Horas_extras) { info_Detalle.FechaPago = item.es_fecha_registro.AddMonths(1); } else { info_Detalle.FechaPago = item.FechaPago; } info_Detalle.Valor = (Convert.ToDouble(item.SueldoActual / item.Calculo_Horas_extras_Sobre) * 2) * item.Max_num_horas_sab_dom; info_Detalle.EstadoCobro = "PEN"; info_Detalle.Observacion = "Horas extras al 100% correspondiente al" + item.es_fecha_registro.ToString().Substring(0, 10); info_Detalle.NumHoras = item.Max_num_horas_sab_dom; info_Detalle.Estado = "A"; info_Detalle.IdCalendario = item.es_fecha_registro.Year.ToString() + item.es_fecha_registro.Month.ToString().PadLeft(2, '0') + item.es_fecha_registro.Day.ToString().PadLeft(2, '0'); info_Detalle.IdPeriodos = item.IdPeriodo; info.InfoNovedadDet = info_Detalle; BUS_NOVEDAD.GrabarDB(info, ref id_nov); } } data.ModificarDB(lista);// modifico el valor de estado aprobado return(true); } catch (Exception ex) { mensaje = ex.ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public void Grbar() { try { switch (Accion) { case Cl_Enumeradores.eTipo_action.grabar: if (!Validar()) { return; } Get(); if (InfoCatalogo.IdCatalogo == 218) { if (BusNovedaCab.GrabarDB(InfoNovedadCab, ref IDNovedad, ref MensError)) // grabo cab novedad { InfoNovedadDet.IdNovedad = IDNovedad; if (BusNovedadDet.GrabarDB(InfoNovedadDet, ref MensError)) // grabo detale novedad { InfoGrabar.IdNovedad = (int)IDNovedad; if (BusDiasFaltados.GuardarDB(InfoGrabar)) // grabo reg dias faltados { MessageBox.Show("Se Guardo Correctamente la Informacion", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.None); Limpiar(); } else { MessageBox.Show("Error al Guardar la Informacion ", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } else { if (BusDiasFaltados.GuardarDB(InfoGrabar)) // grabo reg dias faltados { MessageBox.Show("Se Guardo Correctamente la Informacion", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.None); Limpiar(); } else { MessageBox.Show("Error al Guardar la Informacion ", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); } } break; case Cl_Enumeradores.eTipo_action.actualizar: break; case Cl_Enumeradores.eTipo_action.Anular: Get(); FrmGe_MotivoAnulacion Frm = new FrmGe_MotivoAnulacion(); Frm.ShowDialog(); InfoGrabar.MotiAnula = Frm.motivoAnulacion; InfoNovedadCab.MotiAnula = Frm.motivoAnulacion; // seteo datos de anulacion InfoGrabar.IdUsuarioUltAnu = param.IdUsuario; InfoGrabar.Fecha_UltAnu = DateTime.Now; InfoNovedadCab.IdUsuarioUltAnu = param.IdUsuario; InfoNovedadCab.Fecha_UltAnu = DateTime.Now; InfoNovedadCab.Estado = "I"; InfoNovedadDet.Estado = "I"; InfoGrabar.IdFalta = InfoGeneral.IdFalta; if (InfoGeneral.IdNovedad > 0) { InfoNovedadCab.IdNovedad = (int)InfoGeneral.IdNovedad; } if (InfoCatalogo.IdCatalogo == 218) { if (BusNovedaCab.AnularDB(InfoNovedadCab)) // anulo cab novedad { InfoNovedadDet.IdNovedad = (int)InfoGeneral.IdNovedad; if (BusNovedadDet.AnularDB(InfoNovedadDet)) // anulo detale novedad { if (BusDiasFaltados.Anular(InfoGrabar)) // anulo reg dias faltados { MessageBox.Show("Se Guardo Correctamente la Informacion", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.None); this.Close(); } else { MessageBox.Show("Error al Guardar la Informacion ", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } else { if (BusDiasFaltados.Anular(InfoGrabar)) { MessageBox.Show("Se Anulo Correctamente el Registro", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.None); this.Close(); } else { MessageBox.Show("No se Pudo Anular el Registro", "Sistemas", MessageBoxButtons.OK, MessageBoxIcon.Error); } } break; case Cl_Enumeradores.eTipo_action.consultar: break; case Cl_Enumeradores.eTipo_action.duplicar: break; default: break; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }