Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shutdownData"></param>
 /// <param name="sErrorCode"></param>
 /// <param name="sErrorText"></param>
 /// <returns></returns>
 public bool Shutdown(
     DocumentAccess shutdownData,
     out string sErrorCode,
     out string sErrorText)
 {
     sErrorCode = string.Empty;
     sErrorText = string.Empty;
     return(true);
 }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="startupData"></param>
 /// <param name="sErrorCode"></param>
 /// <param name="sErrorText"></param>
 /// <returns></returns>
 public bool Startup(
     DocumentAccess startupData,
     out string sErrorCode,
     out string sErrorText)
 {
     sErrorCode = string.Empty;
     sErrorText = string.Empty;
     return(true);
 }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="accessSettings"></param>
        /// <param name="document"></param>
        /// <param name="sErrorCode"></param>
        /// <param name="sErrorText"></param>
        /// <returns></returns>
        public bool DeleteDocument(
            DocumentAccess accessSettings,
            ref Document document,
            out string sErrorCode,
            out string sErrorText)
        {
            sErrorCode = "-1";
            sErrorText = "Deleting document failed.";

            if (accessSettings != null && document != null)
            {
                if (!string.IsNullOrEmpty(accessSettings.SystemAddress) &&
                    !string.IsNullOrEmpty(accessSettings.AddressPort) &&
                    !string.IsNullOrEmpty(accessSettings.DatabaseName))
                {
                    if (!string.IsNullOrEmpty(document.FileId))
                    {
                        var couchConnector = new CouchConnector(accessSettings.SystemAddress,
                                                                accessSettings.AddressPort,
                                                                accessSettings.DatabaseName);

                        if (couchConnector.Document_Delete(document.FileId))
                        {
                            if (!couchConnector.Error)
                            {
                                sErrorCode = "0";
                            }
                        }
                        sErrorText = couchConnector.Message;
                    }
                    else
                    {
                        sErrorCode = "-4";
                        sErrorText = "Unique ID is missing. [FileID]";
                        return(true);
                    }
                }
                else
                {
                    sErrorCode = "-2";
                    sErrorText = "Database address information missing. [ServerAddress, ServerPort, DatabaseName]";
                }
                return(false);
            }
            sErrorCode = "-3";
            sErrorText = "Database access settings missing.";
            return(false);
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="accessSettings"></param>
 /// <param name="document"></param>
 /// <param name="sErrorCode"></param>
 /// <param name="sErrorText"></param>
 /// <returns></returns>
 public bool AddDocument(
     DocumentAccess accessSettings,
     ref Document document,
     out string sErrorCode,
     out string sErrorText)
 {
     sErrorCode = "-1";
     sErrorText = "Adding document to database failed.";
     if (!string.IsNullOrEmpty(accessSettings.SystemAddress) &&
         !string.IsNullOrEmpty(accessSettings.AddressPort) &&
         !string.IsNullOrEmpty(accessSettings.DatabaseName))
     {
         var couchConnector = new CouchConnector(accessSettings.SystemAddress,
                                                 accessSettings.AddressPort,
                                                 accessSettings.DatabaseName);
         return(AddDocument(couchConnector, ref document, out sErrorCode, out sErrorText));
     }
     return(false);
 }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="accessSettings"></param>
        /// <param name="document"></param>
        /// <param name="sErrorCode"></param>
        /// <param name="sErrorText"></param>
        /// <returns></returns>
        public bool GetDocument(
            DocumentAccess accessSettings,
            ref Document document,
            out string sErrorCode,
            out string sErrorText)
        {
            sErrorCode = "-1";
            sErrorText = "Retrieving document failed.";

            if (accessSettings != null &&
                document != null)
            {
                if (!string.IsNullOrEmpty(accessSettings.SystemAddress) &&
                    !string.IsNullOrEmpty(accessSettings.AddressPort) &&
                    !string.IsNullOrEmpty(accessSettings.DatabaseName))
                {
                    var couchConnector = new CouchConnector(accessSettings.SystemAddress,
                                                            accessSettings.AddressPort,
                                                            accessSettings.DatabaseName);
                    return(GetDocument(couchConnector, ref document, out sErrorCode, out sErrorText));
                }
            }
            return(false);
        }