CmisSync.Lib.Database.Database.SetOperationRetryCounter C# (CSharp) Метод

SetOperationRetryCounter() публичный Метод

Sets the upload retry counter.
public SetOperationRetryCounter ( SyncItem item, long counter, OperationType type ) : void
item SyncItem Path of the local file.
counter long Counter.
type OperationType
Результат void
        public void SetOperationRetryCounter(SyncItem item, long counter, OperationType type)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            switch (type)
            {
                case OperationType.DOWNLOAD:
                    goto case OperationType.DELETE;
                case OperationType.DELETE:
                    parameters.Add("date", DateTime.Now.ToFileTimeUtc());
                    break;
                default:
                    parameters.Add("date", File.GetLastWriteTimeUtc(item.LocalPath));
                    break;
            }
            parameters.Add("path", item.RemoteRelativePath);
            parameters.Add("counter", (counter >= 0) ? counter : 0);
            string uploadCounter = "(SELECT CASE WHEN lastLocalModificationDate=@date THEN uploadCounter ELSE '' END FROM failedoperations WHERE path=@path)";
            string downloadCounter = "(SELECT CASE WHEN lastLocalModificationDate=@date THEN downloadCounter ELSE '' END FROM failedoperations WHERE path=@path)";
            string changeCounter = "(SELECT CASE WHEN lastLocalModificationDate=@date THEN changeCounter ELSE '' END FROM failedoperations WHERE path=@path)";
            string deleteCounter = "(SELECT CASE WHEN lastLocalModificationDate=@date THEN deleteCounter ELSE '' END FROM failedoperations WHERE path=@path)";
            switch (type)
            {
                case OperationType.UPLOAD:
                    uploadCounter = "@counter";
                    break;
                case OperationType.DOWNLOAD:
                    downloadCounter = "@counter";
                    break;
                case OperationType.CHANGE:
                    changeCounter = "@counter";
                    break;
                case OperationType.DELETE:
                    deleteCounter = "@counter";
                    break;
            }
            string command = String.Format(@"INSERT OR REPLACE INTO failedoperations (path, lastLocalModificationDate,
                                uploadCounter, downloadCounter, changeCounter, deleteCounter,
                                uploadMessage, downloadMessage, changeMessage, deleteCounter)
                                VALUES( @path, @date, {0},{1},{2},{3},
                                (SELECT CASE WHEN lastLocalModificationDate=@date THEN uploadMessage ELSE '' END FROM failedoperations WHERE path=@path ), 
                                (SELECT CASE WHEN lastLocalModificationDate=@date THEN downloadMessage ELSE '' END FROM failedoperations WHERE path=@path),
                                (SELECT CASE WHEN lastLocalModificationDate=@date THEN changeMessage ELSE '' END FROM failedoperations WHERE path=@path),
                                (SELECT CASE WHEN lastLocalModificationDate=@date THEN deleteMessage ELSE '' END FROM failedoperations WHERE path=@path)
                            )", uploadCounter, downloadCounter, changeCounter, deleteCounter);
            ExecuteSQLAction(command, parameters);
        }