示例#1
0
        public void SerializaTblContenidoByUser(ref DBConn oConn, string cPath, string cFile)
        {
            if (string.IsNullOrEmpty(cPath))
            {
                return;
            }

            try
            {
                CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                oContenidos.CodUsuario    = pCodUsuario;
                oContenidos.CodUsuarioRel = pCodUsuarioRel;
                DataTable oData = oContenidos.GetByUser();

                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;
            }
        }