public static bool DeleteData(CompaniasRecord pComp, ref string sMensaje)
        {
            bool bRetorno = true;

            try
            {
                COMPANIAS oCom = new COMPANIAS();
                oCom.ConnectionString = Parametros.CadenaConexion;

                oCom.LoadByPrimaryKey(pComp.COM_CODIGO);


                oCom.MarkAsDeleted();

                oCom.Save();
            }
            catch (Exception ex)
            {
                sMensaje = ex.Message.ToString();
                bRetorno = false;
            }


            return(bRetorno);
        }
        public static bool  ReturnById(int Id, ref COMPANIAS pComp, ref string sMensaje)
        {
            bool bRetorno = true;

            try
            {
                COMPANIAS oCom = new COMPANIAS();
                oCom.ConnectionString = Parametros.CadenaConexion;
                oCom.LoadByPrimaryKey(Id);

                pComp = oCom;
            }
            catch (Exception ex)
            {
                sMensaje = ex.Message.ToString();
                bRetorno = false;
            }

            return(bRetorno);
        }
        public static DataView returnCombo(ref string sMensaje)
        {
            sMensaje = "";
            COMPANIAS oCom = new COMPANIAS();

            try
            {
                oCom.ConnectionString = Parametros.CadenaConexion;

                oCom.Query.AddResultColumn("COM_CODIGO");
                oCom.Query.AddResultColumn("COM_DESCRIPCION");

                oCom.Query.Load();
            }
            catch (Exception ex)
            {
                sMensaje = ex.Message.ToString();
            }
            return(oCom.DefaultView);
        }
        public static bool SaveData(CompaniasRecord pComp, ref string sMensaje, bool bAdiciona)
        {
            bool bRetorno = true;

            try
            {
                COMPANIAS oCom = new COMPANIAS();
                oCom.ConnectionString = Parametros.CadenaConexion;

                if (!bAdiciona)
                {
                    oCom.LoadByPrimaryKey(pComp.COM_CODIGO);
                }
                else
                {
                    oCom.AddNew();
                }


                oCom.COM_DESCRIPCION = pComp.COM_DESCRIPCION;
                oCom.COM_DESCORTA    = pComp.COM_DESCORTA;
                oCom.COM_DESCRIPCION = pComp.COM_DESCRIPCION;
                oCom.COM_RESPONSABLE = pComp.COM_RESPONSABLE;
                oCom.COM_DIRECCION   = pComp.COM_DIRECCION;
                oCom.COM_EMAIL       = pComp.COM_EMAIL;
                oCom.COM_TELEFONO    = pComp.COM_TELEFONO;
                oCom.COM_FAX         = pComp.COM_FAX;
                oCom.COM_RNC         = pComp.COM_RNC;

                oCom.Save();
            }
            catch (Exception ex)
            {
                sMensaje = ex.Message.ToString();
                bRetorno = false;
            }


            return(bRetorno);
        }