public Boolean GrabarDB(cp_orden_giro_x_imp_ordencompra_ext_Info info, ref string mensaje)
        {
            try
            {
                using (EntitiesCuentasxPagar context = new EntitiesCuentasxPagar())
                {
                    EntitiesCuentasxPagar EDB = new EntitiesCuentasxPagar();

                    //var contact = cp_orden_giro_x_imp_ordencompra_ext.Createcp_orden_giro_x_imp_ordencompra_ext(0, 0, 0, 0, 0, 0);
                    var address = new cp_orden_giro_x_imp_ordencompra_ext();

                    address.imp_IdEmpresa        = info.imp_IdEmpresa;
                    address.imp_IdOrdenCompraExt = info.imp_IdOrdenCompraExt;
                    address.imp_IdSucursal       = info.imp_IdSucursal;
                    address.og_IdCbteCble        = info.og_IdCbteCble;
                    address.og_IdEmpresa         = info.og_IdEmpresa;
                    address.og_IdTipoCbte        = info.og_IdTipoCbte;

                    //contact = address;

                    context.cp_orden_giro_x_imp_ordencompra_ext.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;
                throw new Exception(ex.ToString());
            }
        }
        public List <cp_orden_giro_x_imp_ordencompra_ext_Info> Get_List_orden_giro_x_imp_ordencompra_ext(int IdEmpresa_Ogiro, decimal IdCbteCble_Ogiro, int IdTipoCbte_Ogiro)
        {
            try
            {
                List <cp_orden_giro_x_imp_ordencompra_ext_Info> lM = new List <cp_orden_giro_x_imp_ordencompra_ext_Info>();
                EntitiesCuentasxPagar db = new EntitiesCuentasxPagar();

                var select_ = from T in db.cp_orden_giro_x_imp_ordencompra_ext
                              where T.og_IdEmpresa == IdEmpresa_Ogiro && T.og_IdCbteCble == IdCbteCble_Ogiro && T.og_IdTipoCbte == IdTipoCbte_Ogiro
                              select T;

                foreach (var item in select_)
                {
                    cp_orden_giro_x_imp_ordencompra_ext_Info dat = new cp_orden_giro_x_imp_ordencompra_ext_Info();
                    dat.imp_IdEmpresa        = item.imp_IdEmpresa;
                    dat.imp_IdOrdenCompraExt = item.imp_IdOrdenCompraExt;
                    dat.imp_IdSucursal       = item.imp_IdSucursal;
                    dat.og_IdCbteCble        = item.og_IdCbteCble;
                    dat.og_IdEmpresa         = item.og_IdEmpresa;
                    dat.og_IdTipoCbte        = item.og_IdTipoCbte;

                    lM.Add(dat);
                }
                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());
            }
        }
 public Boolean ModificarDB(cp_orden_giro_x_imp_ordencompra_ext_Info info)
 {
     try
     {
         using (EntitiesCuentasxPagar Contex = new EntitiesCuentasxPagar())
         {
             var contact = Contex.cp_orden_giro_x_imp_ordencompra_ext.FirstOrDefault(var => var.og_IdEmpresa == info.og_IdEmpresa && var.og_IdCbteCble == info.og_IdCbteCble && var.og_IdTipoCbte == info.og_IdTipoCbte);
             if (contact != null)
             {
                 contact.imp_IdEmpresa        = info.imp_IdEmpresa;
                 contact.imp_IdSucursal       = info.imp_IdSucursal;
                 contact.imp_IdOrdenCompraExt = info.imp_IdOrdenCompraExt;
                 Contex.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;
         throw new Exception(ex.ToString());
     }
 }
 public Boolean GrabarDB(cp_orden_giro_x_imp_ordencompra_ext_Info info, ref string mensaje)
 {
     try
     {
         return(data.GrabarDB(info, ref mensaje));
     }
     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(cp_orden_giro_x_imp_ordencompra_ext_Bus)
               };
     }
 }