Exemplo n.º 1
0
        public tb_ubicacion_Info Get_Info_Ubicacion(string idUbicacion)
        {
            try
            {
                EntitiesGeneral OEUbicacion = new EntitiesGeneral();

                var select_ubicacion = from A in OEUbicacion.tb_ubicacion
                                       where A.IdUbicacion == idUbicacion
                                       select A;
                tb_ubicacion_Info info = new tb_ubicacion_Info();
                foreach (var item in select_ubicacion)
                {
                    info.IdUbicacion       = item.IdUbicacion.Trim();
                    info.IdUbicacion_Padre = item.IdUbicacion_Padre.Trim();
                    info.ub_descripcion    = item.ub_descripcion.Trim();
                    info.ub_nivel          = item.ub_nivel;
                    info.ub_posicion       = item.ub_posicion;
                    info.Estado            = item.Estado;
                }
                return(info);
            }
            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 mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 2
0
 public Boolean ModificarDB(tb_ubicacion_Info info, ref string msg)
 {
     try
     {
         using (EntitiesGeneral context = new EntitiesGeneral())
         {
             var contact = context.tb_ubicacion.FirstOrDefault(obj => obj.IdUbicacion == info.IdUbicacion);
             if (contact != null)
             {
                 contact.IdUbicacion_Padre = info.IdUbicacion_Padre;
                 contact.ub_descripcion    = info.ub_descripcion;
                 contact.ub_posicion       = info.ub_posicion;
                 contact.IdUsuarioUltMod   = info.IdUsuarioUltMod;
                 contact.Fecha_UltMod      = info.Fecha_UltMod;
                 contact.nom_pc            = info.nom_pc;
                 contact.ip     = info.ip;
                 contact.Estado = info.Estado;
                 context.SaveChanges();
                 msg = "Se ha procedido actualizar el registro de la ubicación #: " + info.IdUbicacion.ToString() + " para la ubicación: " + info.ub_descripcion + " exitosamente";
             }
         }
         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 mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         msg     = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Exemplo n.º 3
0
 public Boolean GrabarDB(tb_ubicacion_Info info, ref string id, ref string msg)
 {
     try
     {
         tb_ubicacion_Data data = new tb_ubicacion_Data();
         return(data.GrabarDB(info, ref id, ref msg));
     }
     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("", "GrabarDB", ex.Message), ex)
               {
                   EntityType = typeof(tb_ubicacion_Bus)
               };
     }
 }
Exemplo n.º 4
0
        public Boolean EliminarDB(tb_ubicacion_Info info, ref string msg)
        {
            try
            {
                EntitiesGeneral OECSucursal = new EntitiesGeneral();
                var             select      = from q in OECSucursal.tb_ubicacion
                                              where q.IdUbicacion == info.IdUbicacion && q.Estado == "A"
                                              select q;

                if (select.ToList().Count > 0)
                {
                    using (EntitiesGeneral context = new EntitiesGeneral())
                    {
                        var contact = context.tb_ubicacion.First(obj => obj.IdUbicacion == info.IdUbicacion);
                        contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = info.Fecha_UltAnu;
                        contact.ub_posicion     = info.ub_posicion;
                        contact.nom_pc          = info.nom_pc;
                        contact.ip     = info.ip;
                        contact.Estado = "I";
                        context.SaveChanges();
                        msg = "Se ha procedido anular el registro de la ubicación #: " + info.IdUbicacion.ToString() + " para la ubicación: " + info.ub_descripcion + " exitosamente";
                    }

                    return(true);
                }
                else
                {
                    msg = "No es posible anular el registro de la ubicación #: " + info.IdUbicacion.ToString() + " debido a que ya se encuentra anulado.";
                    return(false);
                }
            }
            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 mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 5
0
 public Boolean GrabarDB(tb_ubicacion_Info info, ref string id, ref string msg)
 {
     try
     {
         using (EntitiesGeneral context = new EntitiesGeneral())
         {
             var    address = new tb_ubicacion();
             string idsucur = Get_Id(info.IdUbicacion_Padre);
             id = idsucur;
             address.IdUbicacion       = idsucur;
             address.IdUbicacion_Padre = info.IdUbicacion_Padre;
             address.ub_descripcion    = info.ub_descripcion;
             address.ub_nivel          = info.ub_nivel;
             address.ub_posicion       = info.ub_posicion;
             address.IdUsuario         = info.IdUsuario;
             address.Fecha_Transac     = info.Fecha_Transac;
             address.nom_pc            = info.nom_pc;
             address.ip     = info.ip;
             address.Estado = "A";
             context.tb_ubicacion.Add(address);
             context.SaveChanges();
             msg = "Se ha procedido a grabar el registro de la Ubbicación #: " + id.ToString() + " para la ubicación: " + info.ub_descripcion + " exitosamente";
         }
         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 mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         msg     = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Exemplo n.º 6
0
        public List <tb_ubicacion_Info> Get_List_Pais()
        {
            try
            {
                List <tb_ubicacion_Info> lM          = new List <tb_ubicacion_Info>();
                EntitiesGeneral          OEUbicacion = new EntitiesGeneral();

                var select_ubicacion = from A in OEUbicacion.tb_ubicacion
                                       orderby A.IdUbicacion, A.IdUbicacion_Padre, A.ub_posicion
                where A.ub_nivel == 0
                select A;

                foreach (var item in select_ubicacion)
                {
                    tb_ubicacion_Info info = new tb_ubicacion_Info();
                    info.IdUbicacion       = item.IdUbicacion.Trim();
                    info.IdUbicacion_Padre = item.IdUbicacion_Padre.Trim();
                    info.ub_descripcion    = item.ub_descripcion.Trim();
                    info.ub_nivel          = item.ub_nivel;
                    info.ub_posicion       = item.ub_posicion;
                    info.Estado            = item.Estado;
                    lM.Add(info);
                }
                return(lM);
            }
            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 mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }