Пример #1
0
        public void MoveToRecycleBin(string id)
        {
            CheckIsValid();

            string src = id;
            string dst;

            if (VirtualDrive.ExistsDirectory(id))
            {
                dst = Path.Combine(RootDir, RecycleBinNameDir());
                SafeOperations.MoveDirectory(src, dst);
            }
            else if (VirtualDrive.ExistsFile(id))
            {
                dst = Path.Combine(RootDir, RecycleBinNameFile());
                VirtualDrive.MoveFile(src, dst);
            }
            else
            {
                throw new Exception("\"" + id + "\" does not exist!");
            }

            recycledToSrc[dst] = src;
            srcToRecycled[src] = dst;
        }
Пример #2
0
        public void Restore(string id)
        {
            CheckIsValid();

            string recycled = srcToRecycled[id];
            string src      = id;

            if (VirtualDrive.ExistsDirectory(recycled))
            {
                SafeOperations.MoveDirectory(recycled, src);
            }
            else if (VirtualDrive.ExistsFile(recycled))
            {
                VirtualDrive.MoveFile(recycled, src);
            }
            else
            {
                throw new Exception("\"" + id + "\" not found!");
            }

            recycledToSrc.Remove(recycled);
            srcToRecycled.Remove(src);
        }
Пример #3
0
 /// <summary>
 /// get (the) local authority for...
 /// </summary>
 /// <param name="theTouchpoint">the touchpoint</param>
 /// <param name="theLADCode">the local adinistrative district code</param>
 /// <param name="inScope">in scope</param>
 /// <returns>the result of the operation</returns>
 public async Task <HttpResponseMessage> GetAuthorityFor(string theTouchpoint, string theLADCode, IScopeLoggingContext inScope) =>
 await SafeOperations.Try(() => ProcessGetAuthorityFor(theTouchpoint, theLADCode, inScope), x => Faults.GetResponseFor(x, inScope));
Пример #4
0
 /// <summary>
 /// add new authority for...
 /// </summary>
 /// <param name="theTouchpoint">the touchpoint</param>
 /// <param name="usingContent">using content</param>
 /// <param name="inScope">in scope</param>
 /// <returns>the result of the operation</returns>
 public async Task <HttpResponseMessage> AddNewAuthorityFor(string theTouchpoint, string usingContent, IScopeLoggingContext inScope) =>
 await SafeOperations.Try(() => ProcessAddNewAuthorityFor(theTouchpoint, usingContent, inScope), x => Faults.GetResponseFor(x, inScope));
 /// <summary>
 /// delete an area routing detail using...
 /// </summary>
 /// <param name="theTouchpointID">the touchpoint id</param>
 /// <param name="inScope">in logging scope</param>
 /// <returns>the currently running task containing the response message (success or fail)</returns>
 public async Task <HttpResponseMessage> DeleteAreaRoutingDetailUsing(string theTouchpointID, IScopeLoggingContext inScope) =>
 await SafeOperations.Try(() => ProcessDeleteAreaRoutingDetailUsing(theTouchpointID, inScope), x => Faults.GetResponseFor(x, TypeOfFunction.Delete, inScope));
 /// <summary>
 /// get all route id's
 /// </summary>
 /// <param name="inScope">in logging scope</param>
 /// <returns>the currently running task containing the response message (success or fail)</returns>
 public async Task <HttpResponseMessage> GetAllRouteIDs(IScopeLoggingContext inScope) =>
 await SafeOperations.Try(() => ProcessGetAllRouteIDs(inScope), x => Faults.GetResponseFor(x, TypeOfFunction.GetAll, inScope));
 /// <summary>
 /// add new area routing detail
 /// excluded from coverage as moq doesn't support the lambda complexity for this routine
 /// </summary>
 /// <param name="theTouchpoint">the touchpoint</param>
 /// <param name="usingContent">using content</param>
 /// <param name="inScope">in scope</param>
 /// <returns>the result of the operation</returns>
 public async Task <HttpResponseMessage> AddAreaRoutingDetailUsing(string theContent, IScopeLoggingContext inScope) =>
 await SafeOperations.Try(() => ProcessAddAreaRoutingDetailUsing(theContent, inScope), x => Faults.GetResponseFor(x, TypeOfFunction.Post, inScope));
 /// <summary>
 /// get (the) area routing detail by...
 /// excluded from coverage as moq doesn't support the lambda complexity for this routine
 /// </summary>
 /// <param name="theLocation">the location</param>
 /// <param name="inScope">in logging scope</param>
 /// <returns>the currently running task containing the response message (success or fail)</returns>
 public async Task <HttpResponseMessage> GetAreaRoutingDetailBy(string theLocation, IScopeLoggingContext inScope) =>
 await SafeOperations.Try(() => ProcessGetAreaRoutingDetailBy(theLocation, inScope), x => Faults.GetResponseFor(x, TypeOfFunction.GetByLocation, inScope));