Ejemplo n.º 1
0
        public bool guardarDB(Af_ruta_Info info)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    Af_ruta Entity = new Af_ruta();
                    Entity.IdEmpresa      = info.IdEmpresa;
                    Entity.IdRuta         = info.IdRuta = get_id(info.IdEmpresa);
                    Entity.ru_descripcion = info.ru_descripcion;
                    Entity.ru_cantidad_km = info.ru_cantidad_km;
                    Entity.ru_observacion = info.ru_observacion;
                    Entity.estado         = info.estado = true;
                    Context.Af_ruta.Add(Entity);
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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 mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                //saca la excepción controlada a la proxima capa
                throw new Exception(ex.InnerException.ToString());
            }
        }
Ejemplo n.º 2
0
        private void ucGe_Menu_Mantenimiento_x_usuario1_event_btnModificar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                info_ruta = (Af_ruta_Info)gridView_ruta.GetFocusedRow();
                if (info_ruta == null)
                {
                    MessageBox.Show("Seleccione un registro", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }

                if (info_ruta.estado == false)
                {
                    MessageBox.Show("El registro se encuentra anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                llamar_formulario(Cl_Enumeradores.eTipo_action.actualizar);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Ejemplo n.º 3
0
        public bool anularDB(Af_ruta_Info info)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    Af_ruta Entity = Context.Af_ruta.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRuta == info.IdRuta);
                    if (Entity != null)
                    {
                        Entity.estado = false;
                        Context.SaveChanges();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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 mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                //saca la excepción controlada a la proxima capa
                throw new Exception(ex.InnerException.ToString());
            }
        }
Ejemplo n.º 4
0
 public bool anularDB(Af_ruta_Info info)
 {
     try
     {
         return(oData.anularDB(info));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "get_list", ex.Message), ex)
               {
                   EntityType = typeof(Af_ruta_Bus)
               };
     }
 }
Ejemplo n.º 5
0
 public void set_info(Af_ruta_Info Info)
 {
     try
     {
         info_ruta = Info;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
Ejemplo n.º 6
0
 private void limpiar()
 {
     try
     {
         info_ruta            = new Af_ruta_Info();
         txt_IdRuta.Text      = "";
         txt_descripcion.Text = "";
         txt_kms.Text         = "";
         txt_observacion.Text = "";
         Accion = Cl_Enumeradores.eTipo_action.grabar;
         set_accion_in_controls();
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
Ejemplo n.º 7
0
        public List <Af_ruta_Info> get_list(int IdEmpresa)
        {
            try
            {
                List <Af_ruta_Info> Lista = new List <Af_ruta_Info>();

                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var lst = from q in Context.Af_ruta
                              where q.IdEmpresa == IdEmpresa
                              select q;

                    foreach (var item in lst)
                    {
                        Af_ruta_Info info = new Af_ruta_Info();
                        info.IdEmpresa      = item.IdEmpresa;
                        info.IdRuta         = item.IdRuta;
                        info.ru_descripcion = item.ru_descripcion;
                        info.ru_cantidad_km = item.ru_cantidad_km;
                        info.ru_observacion = item.ru_observacion;
                        info.estado         = item.estado;
                        Lista.Add(info);
                    }
                }

                return(Lista);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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 mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                //saca la excepción controlada a la proxima capa
                throw new Exception(ex.InnerException.ToString());
            }
        }
Ejemplo n.º 8
0
 private void gridView_ruta_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
 {
     try
     {
         Af_ruta_Info row = (Af_ruta_Info)gridView_ruta.GetFocusedRow();
         if (row == null)
         {
             return;
         }
         if (!row.estado)
         {
             e.Appearance.ForeColor = Color.Red;
         }
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }