Ejemplo n.º 1
0
        public void SerializaTblNodo(ref DBConn oConn, string cPath, string cFile)
        {
            if (string.IsNullOrEmpty(cPath))
            {
                return;
            }

            try
            {
                BinaryNodo bNodo  = new BinaryNodo();
                CmsNodos   oNodos = new CmsNodos(ref oConn);
                DataTable  oData  = oNodos.Get();

                if (Directory.Exists(cPath) && !string.IsNullOrEmpty(cFile) && oData != null)
                {
                    IFormatter oBinFormat  = new BinaryFormatter();
                    Stream     oFileStream = new FileStream(cPath + cFile, FileMode.Create, FileAccess.Write);
                    oBinFormat.Serialize(oFileStream, oData);
                    oFileStream.Close();
                    oFileStream = null;
                    oData.Dispose();
                }
            }
            catch (Exception Ex)
            {
                //return Ex.Source + " - " + Ex.Message + " - " + Ex.StackTrace;
            }
        }
Ejemplo n.º 2
0
        public string SerializaNodo(ref DBConn oConn, string cPath, string cFile)
        {
            if (string.IsNullOrEmpty(cPath))
            {
                return(string.Empty);
            }

            try
            {
                BinaryNodo oNodo  = new BinaryNodo();
                CmsNodos   oNodos = new CmsNodos(ref oConn);
                oNodos.CodNodo = pCodNodo;
                DataTable oData = oNodos.Get();

                if (oData != null)
                {
                    if (oData.Rows.Count > 0)
                    {
                        oNodo.CodNodo           = oData.Rows[0]["cod_nodo"].ToString();
                        oNodo.CodNodoRel        = oData.Rows[0]["cod_nodo_rel"].ToString();
                        oNodo.CodUsuario        = oData.Rows[0]["cod_usuario"].ToString();
                        oNodo.CodTemplate       = oData.Rows[0]["cod_template"].ToString();
                        oNodo.TituloNodo        = oData.Rows[0]["titulo_nodo"].ToString();
                        oNodo.TextoNodo         = oData.Rows[0]["texto_nodo"].ToString();
                        oNodo.DateNodo          = oData.Rows[0]["date_nodo"].ToString();
                        oNodo.EstNodo           = oData.Rows[0]["est_nodo"].ToString();
                        oNodo.PrvNodo           = oData.Rows[0]["prv_nodo"].ToString();
                        oNodo.IniNodo           = oData.Rows[0]["ini_nodo"].ToString();
                        oNodo.PfNodo            = oData.Rows[0]["pf_nodo"].ToString();
                        oNodo.TitleHeaderNodo   = oData.Rows[0]["titleheader_nodo"].ToString();
                        oNodo.KeywordsNodo      = oData.Rows[0]["keywords_nodo"].ToString();
                        oNodo.ContNodo          = oData.Rows[0]["cont_nodo"].ToString();
                        oNodo.OrdNodo           = oData.Rows[0]["ord_nodo"].ToString();
                        oNodo.IniAsocUsrNodo    = oData.Rows[0]["ini_asoc_usr_nodo"].ToString();
                        oNodo.IndDesplUsrClient = oData.Rows[0]["ind_despl_usr_client"].ToString();
                        oNodo.IndOlvClaveNodo   = oData.Rows[0]["ind_olvclave_nodo"].ToString();
                        oNodo.IndRstClaveNodo   = oData.Rows[0]["ind_rstclave_nodo"].ToString();
                        oNodo.IndLoginNodo      = oData.Rows[0]["ind_login_nodo"].ToString();
                        oNodo.IndDesplUsrSite   = oData.Rows[0]["ind_despl_usr_site"].ToString();
                        oNodo.IndPoltSecureNodo = oData.Rows[0]["ind_poltsecure_nodo"].ToString();
                        oNodo.IndTermUseNodo    = oData.Rows[0]["ind_termuse_nodo"].ToString();
                        oNodo.IndRegistrateNodo = oData.Rows[0]["ind_registrate_nodo"].ToString();
                        oNodo.IndPagExitoNodo   = oData.Rows[0]["ind_pagexito_nodo"].ToString();
                        oNodo.IndPhotoNodo      = oData.Rows[0]["ind_photo_nodo"].ToString();
                        oNodo.IndIniNodoPhone   = oData.Rows[0]["ini_nodo_phone"].ToString();
                        oNodo.IndPfNodoPhone    = oData.Rows[0]["pf_nodo_phone"].ToString();
                        oNodo.IndContNodoPhone  = oData.Rows[0]["cont_nodo_phone"].ToString();
                    }
                }
                oData.Dispose();
                oNodos = null;

                if (Directory.Exists(cPath) && !string.IsNullOrEmpty(cFile))
                {
                    IFormatter oBinFormat  = new BinaryFormatter();
                    Stream     oFileStream = new FileStream(cPath + cFile, FileMode.Create, FileAccess.Write);
                    oBinFormat.Serialize(oFileStream, oNodo);
                    oFileStream.Close();

                    oFileStream = null;
                    oNodo       = null;
                }
                return(string.Empty);
            }
            catch (Exception Ex)
            {
                return(Ex.Source + " - " + Ex.Message + " - " + Ex.StackTrace);
            }
        }