public bool Modificar_DB(ro_planificacion_x_ruta_x_empleado_Info info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var add = db.ro_planificacion_x_ruta_x_empleado.FirstOrDefault(v => v.IdEmpresa == info.IdEmpresa && v.IdNomina_Tipo == info.IdNomina_Tipo && v.IdPeriodo == info.IdPeriodo);

                    add.Observacion      = info.Observacion;
                    add.Fecha_UltMod     = info.Fecha_UltMod;
                    add.IdUsuarioUltModi = info.IdUsuarioUltModi;

                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
        public bool Guardar_DB(ro_planificacion_x_ruta_x_empleado_Info info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    ro_planificacion_x_ruta_x_empleado add = new ro_planificacion_x_ruta_x_empleado();
                    add.IdEmpresa         = info.IdEmpresa;
                    add.IdNomina_Tipo     = info.IdNomina_Tipo;
                    add.IdNomina_tipo_Liq = info.IdNomina_tipo_Liq;
                    add.IdPeriodo         = info.IdPeriodo;
                    add.Observacion       = info.Observacion;
                    add.Fecha_Transaccion = info.Fecha_Transaccion;
                    add.IdUsuario         = info.IdUsuario;
                    add.Estado            = info.Estado;

                    db.ro_planificacion_x_ruta_x_empleado.Add(add);
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
        void Get()
        {
            try
            {
                info_planificacion                   = new ro_planificacion_x_ruta_x_empleado_Info();
                info_planificacion.lista             = new List <ro_planificacion_x_ruta_x_empleado_det_Info>();
                info_planificacion.IdEmpresa         = param.IdEmpresa;
                info_planificacion.IdNomina_Tipo     = Convert.ToInt32(cmbnomina.EditValue);
                info_planificacion.IdNomina_tipo_Liq = Convert.ToInt32(cmbnominaTipo.EditValue);
                info_planificacion.IdPeriodo         = Convert.ToInt32(cmbPeriodos.EditValue);
                info_planificacion.Observacion       = txtobservacion.Text;
                info_planificacion.IdUsuario         = param.IdUsuario;
                info_planificacion.Fecha_Transaccion = DateTime.Now;
                info_planificacion.IdUsuarioUltModi  = param.IdUsuario;
                info_planificacion.Fecha_UltMod      = DateTime.Now;

                foreach (var item in lista_planificada)
                {
                    item.IdEmpresa         = param.IdEmpresa;
                    item.IdPeriodo         = Convert.ToInt32(cmbPeriodos.EditValue);
                    item.IdNomina_Tipo     = Convert.ToInt32(cmbnomina.EditValue);
                    item.IdNomina_Tipo_Liq = Convert.ToInt32(cmbnominaTipo.EditValue);
                }

                info_planificacion.lista = lista_planificada.ToList();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public bool Guardar_DB(ro_planificacion_x_ruta_x_empleado_Info info)
        {
            try
            {
                bool ba_siGrabo = false;

                if (Si_existe(info.IdEmpresa, info.IdNomina_Tipo, info.IdPeriodo))
                {
                    if (data.Modificar_DB(info))
                    {
                        ba_siGrabo = bus_detalle.Modificar_DB(info.lista);
                    }
                }
                else
                {
                    if (data.Guardar_DB(info))
                    {
                        ba_siGrabo = bus_detalle.Guardar_DB(info.lista);
                    }
                }

                return(ba_siGrabo);
            }
            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 Anular_DB(ro_planificacion_x_ruta_x_empleado_Info info)
 {
     try
     {
         return(data.Anular_DB(info));
     }
     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 Set(ro_planificacion_x_ruta_x_empleado_Info info)
        {
            try
            {
                txtobservacion.Text     = info.Observacion;
                cmbnomina.EditValue     = info.IdNomina_Tipo;
                cmbnominaTipo.EditValue = info.IdNomina_tipo_Liq;
                cmbPeriodos.EditValue   = info.IdPeriodo;

                lista_planificada = new BindingList <ro_planificacion_x_ruta_x_empleado_det_Info>(bus_planificacion_detalle.lista_planificacion(param.IdEmpresa, info.IdNomina_Tipo, info.IdPeriodo));
                gridControl_planificacion.DataSource = lista_planificada;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public List <ro_planificacion_x_ruta_x_empleado_Info> listado_Grupos(int IdEmpresa, DateTime Fecha_Inicio, DateTime Fecha_fin)
        {
            try
            {
                Fecha_fin    = Fecha_fin.Date;
                Fecha_Inicio = Fecha_Inicio.Date;
                List <ro_planificacion_x_ruta_x_empleado_Info> lista = new List <ro_planificacion_x_ruta_x_empleado_Info>();
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var query = from q in db.vwro_planificacion_x_ruta_emple
                                where
                                q.IdEmpresa == IdEmpresa &&
                                q.pe_FechaIni >= Fecha_Inicio &&
                                q.pe_FechaIni <= Fecha_fin
                                select q;

                    foreach (var item in query)
                    {
                        ro_planificacion_x_ruta_x_empleado_Info info = new ro_planificacion_x_ruta_x_empleado_Info();
                        info.IdEmpresa         = item.IdEmpresa;
                        info.IdNomina_Tipo     = item.IdNomina_Tipo;
                        info.IdNomina_tipo_Liq = item.IdNomina_tipo_Liq;
                        info.Observacion       = item.Observacion;
                        info.IdPeriodo         = item.IdPeriodo;
                        info.Estado            = item.Estado;
                        info.pe_FechaIni       = item.pe_FechaIni;
                        info.pe_FechaFin       = item.pe_FechaFin;
                        lista.Add(info);
                    }
                }

                return(lista);
            }
            catch (Exception ex)
            {
                string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 8
0
 private void ucGe_Menu_event_btnconsultar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         info = (ro_planificacion_x_ruta_x_empleado_Info)gvw_planificacion.GetFocusedRow();
         if (info == null)
         {
             MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Seleccione_un_registro), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         frmRo_Planificacion_x_Ruta_entrega_Mant frm = new frmRo_Planificacion_x_Ruta_entrega_Mant();
         frm.Accion    = Cl_Enumeradores.eTipo_action.consultar;
         frm.MdiParent = this.MdiParent;
         frm.Show();
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public bool Anular_DB(ro_planificacion_x_ruta_x_empleado_Info info)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             string IdCalendario = info.IdPeriodo + "V";
             string DeteEfec     = "delete fj_servindustrias.ro_planificacion_x_ruta_x_empleado_det where idempresa='" + info.IdEmpresa + "' and IdPeriodo = '" + info.IdPeriodo + "'";
             string CabeEfec     = "delete fj_servindustrias.ro_planificacion_x_ruta_x_empleado where idempresa='" + info.IdEmpresa + "' and IdPeriodo = '" + info.IdPeriodo + "'";
             db.Database.ExecuteSqlCommand(DeteEfec);
             db.Database.ExecuteSqlCommand(CabeEfec);
             return(true);
         }
     }
     catch (Exception ex)
     {
         string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }