Beispiel #1
0
        public Boolean ModificarDB(tb_persona_direccion_Info Info, ref string msjError)
        {
            try
            {
                using (EntitiesGeneral Context = new EntitiesGeneral())
                {
                    var contact = Context.tb_persona_direccion.FirstOrDefault(af => af.IdPersona == Info.IdPersona && af.IdDireccion == Info.IdDireccion);
                    if (contact != null)
                    {
                        contact.Direccion       = Info.Direccion;
                        contact.estado          = Info.estado;
                        contact.prioridad       = Info.prioridad;
                        contact.referencia      = Info.referencia;
                        contact.calle           = Info.calle;
                        contact.Ciudad          = Info.Ciudad;
                        contact.cod_postal      = Info.cod_postal;
                        contact.IdTipoDireccion = Info.IdTipoDireccion;

                        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;
                msjError = mensaje;
                throw new Exception(ex.ToString());
            }
        }
Beispiel #2
0
 public Boolean GuardarDB(tb_persona_direccion_Info Info, decimal IdPersona, ref string msjError)
 {
     try
     {
         using (EntitiesGeneral Context = new EntitiesGeneral())
         {
             var Address = new tb_persona_direccion();
             Address.IdDireccion     = GetId(IdPersona);
             Address.IdPersona       = IdPersona;
             Address.Direccion       = Info.Direccion;
             Address.estado          = true;
             Address.prioridad       = 0;
             Address.IdTipoDireccion = Info.IdTipoDireccion;
             Context.tb_persona_direccion.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.ToString() + " " + ex.Message;
         msjError = mensaje;
         throw new Exception(ex.ToString());
     }
 }
 public Boolean ModificarDB(tb_persona_direccion_Info Info, ref string msjError)
 {
     try
     {
         return(Odata.ModificarDB(Info, ref msjError));
     }
     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("", "ObtenerEmpresa", ex.Message), ex)
               {
                   EntityType = typeof(tb_Empresa_Bus)
               };
     }
 }
Beispiel #4
0
        public tb_persona_direccion_Info Get_Info_persona_direccion(decimal IdPersona, int IdDireccion)
        {
            try
            {
                tb_persona_direccion_Info info    = new tb_persona_direccion_Info();
                EntitiesGeneral           objEnti = new EntitiesGeneral();

                var pais = from p in objEnti.tb_persona_direccion
                           where p.IdPersona == IdPersona &&
                           p.IdDireccion == IdDireccion
                           select p;

                foreach (var item in pais)
                {
                    info             = new tb_persona_direccion_Info();
                    info.Direccion   = item.Direccion;
                    info.estado      = item.estado;
                    info.IdDireccion = item.IdDireccion;
                    info.IdPersona   = item.IdPersona;
                    info.prioridad   = item.prioridad;
                    info.referencia  = item.referencia;

                    info.calle           = item.calle;
                    info.Ciudad          = item.Ciudad;
                    info.cod_postal      = item.cod_postal;
                    info.IdTipoDireccion = item.IdTipoDireccion;
                }

                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());
            }
        }
        private void gridView_Direcciones_x_Persona_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                tb_persona_direccion_Info row = new tb_persona_direccion_Info();
                row = (tb_persona_direccion_Info)gridView_Direcciones_x_Persona.GetFocusedRow();

                int cont = 0;
                if (row != null)
                {
                    cont = List_direcciones_x_persona.Where(q => q.IdTipoDireccion == row.IdTipoDireccion).Count();
                    if (cont > 1)
                    {
                        gridView_Direcciones_x_Persona.DeleteSelectedRows();
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }