public Boolean ModificarUbicacion(Af_CambioUbicacion_Activo_Info Info, ref string msg)
 {
     try
     {
         using (EntitiesActivoFijo context = new EntitiesActivoFijo())
         {
             var contact = context.Af_Activo_fijo.FirstOrDefault(obj => obj.IdEmpresa == Info.IdEmpresa && obj.IdActivoFijo == Info.IdActivoFijo);
             if (contact != null)
             {
                 contact.IdSucursal = Info.IdSucursal_Actu == null ? contact.IdSucursal : (int)Info.IdSucursal_Actu;
                 contact.IdTipoCatalogo_Ubicacion = Info.IdTipoCatalogo_Ubicacion_Actu == null ? contact.IdTipoCatalogo_Ubicacion : Info.IdTipoCatalogo_Ubicacion_Actu;
                 context.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 mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         msg     = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Ejemplo n.º 2
0
 public void Set_Af_CambioUbicacion_Activo_Info(Af_CambioUbicacion_Activo_Info __InfoCambioUbicacion)
 {
     try
     {
         this._InfoCambioUbicacion = __InfoCambioUbicacion;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
Ejemplo n.º 3
0
        public Af_CambioUbicacion_Activo_Info Get_Info_CambioUbicacion(int IdEmpresa, int IdCambioUbicacion)
        {
            try
            {
                Af_CambioUbicacion_Activo_Info Info = new Af_CambioUbicacion_Activo_Info();
                using (EntitiesActivoFijo listado = new EntitiesActivoFijo())
                {
                    var select = from q in listado.Af_CambioUbicacion_Activo
                                 where q.IdCambioUbicacion == IdCambioUbicacion &&
                                 q.IdEmpresa == IdEmpresa
                                 select q;

                    foreach (var item in select)
                    {
                        Info.IdEmpresa                     = item.IdEmpresa;
                        Info.IdCambioUbicacion             = item.IdCambioUbicacion;
                        Info.IdActivoFijo                  = item.IdActivoFijo;
                        Info.IdSucursal_Actu               = item.IdSucursal_Actu;
                        Info.IdDepartamento_Actu           = item.IdDepartamento_Actu;
                        Info.IdTipoCatalogo_Ubicacion_Actu = item.IdTipoCatalogo_Ubicacion_Actu;
                        Info.IdCentroCosto_Actu            = item.IdCentroCosto_Actu;
                        Info.IdSucursal_Ant                = item.IdSucursal_Ant;
                        Info.IdDepartamento_Ant            = item.IdDepartamento_Ant;
                        Info.IdTipoCatalogo_Ubicacion_Ant  = item.IdTipoCatalogo_Ubicacion_Ant;
                        Info.IdCentroCosto_Ant             = item.IdCentroCosto_Ant;
                        Info.FechaCambio                   = item.FechaCambio;
                        Info.MotivoCambio                  = item.MotivoCambio;
                        Info.IdUsuario                     = item.IdUsuario;
                        Info.nom_pc              = item.nom_pc;
                        Info.ip                  = item.ip;
                        Info.IdUnidadFact_cat    = item.IdUnidadFact_cat;
                        Info.Af_ValorUnidad_Actu = item.Af_ValorUnidad_Actu;
                        Info.IdEncargado_Actu    = item.IdEncargado_Actu;
                        Info.IdEncargado_Ant     = item.IdEncargado_Ant;
                        Info.IdCentroCosto_sub_centro_costo_Actu = item.IdCentroCosto_sub_centro_costo_Actu;
                        Info.IdCentroCosto_sub_centro_costo_Ant  = item.IdCentroCosto_sub_centro_costo_Ant;
                    }
                }

                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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Ejemplo n.º 4
0
 public Boolean ModificarUbicacion(Af_CambioUbicacion_Activo_Info Info, ref string msg)
 {
     try
     {
         return(data.ModificarUbicacion(Info, 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("", "ModificarUbicacion", ex.Message), ex)
               {
                   EntityType = typeof(Af_Activo_fijo_Bus)
               };
     }
 }
Ejemplo n.º 5
0
 public Boolean GuardarDB(Af_CambioUbicacion_Activo_Info Info, ref int IdCambioUbicacion, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo context = new EntitiesActivoFijo())
         {
             Af_CambioUbicacion_Activo address = new Af_CambioUbicacion_Activo();
             address.IdEmpresa                     = Info.IdEmpresa;
             address.IdCambioUbicacion             = IdCambioUbicacion = GetId(Info.IdEmpresa);
             address.IdActivoFijo                  = Info.IdActivoFijo;
             address.IdSucursal_Actu               = Info.IdSucursal_Actu;
             address.IdDepartamento_Actu           = Info.IdDepartamento_Actu;
             address.IdTipoCatalogo_Ubicacion_Actu = Info.IdTipoCatalogo_Ubicacion_Actu;
             address.IdCentroCosto_Actu            = Info.IdCentroCosto_Actu;
             address.IdSucursal_Ant                = Info.IdSucursal_Ant;
             address.IdDepartamento_Ant            = Info.IdDepartamento_Ant;
             address.IdTipoCatalogo_Ubicacion_Ant  = Info.IdTipoCatalogo_Ubicacion_Ant;
             address.IdCentroCosto_Ant             = Info.IdCentroCosto_Ant == "" ? null : Info.IdCentroCosto_Ant;
             address.FechaCambio                   = Info.FechaCambio;
             address.MotivoCambio                  = Info.MotivoCambio;
             address.IdUsuario                     = Info.IdUsuario;
             address.nom_pc              = Info.nom_pc;
             address.ip                  = Info.ip;
             address.IdUnidadFact_cat    = Info.IdUnidadFact_cat;
             address.Af_ValorUnidad_Actu = Info.Af_ValorUnidad_Actu;
             address.IdEncargado_Actu    = Info.IdEncargado_Actu;
             address.IdEncargado_Ant     = Info.IdEncargado_Ant;
             address.IdCentroCosto_sub_centro_costo_Actu = Info.IdCentroCosto_sub_centro_costo_Actu;
             address.IdCentroCosto_sub_centro_costo_Ant  = Info.IdCentroCosto_sub_centro_costo_Ant;
             context.Af_CambioUbicacion_Activo.Add(address);
             context.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 mensaje);
         mensaje = ex.InnerException + " " + ex.Message;
         throw new Exception(ex.InnerException.ToString());
     }
 }
Ejemplo n.º 6
0
 public Boolean GuardarDB(Af_CambioUbicacion_Activo_Info Info, ref int IdCambioUbicacion, ref string msjError)
 {
     try
     {
         if (dataCambio.GuardarDB(Info, ref IdCambioUbicacion, ref msjError))
         {
             return(dataActivo.ModificarUbicacion(Info, ref msjError));
         }
         else
         {
             return(false);
         }
     }
     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("", "GuardarData", ex.Message), ex)
               {
                   EntityType = typeof(Af_CambioUbicacion_Activo_Bus)
               };
     }
 }