Exemplo n.º 1
0
        private string GetArchivePrefix(ResetSoftParams resetSoftParams)
        {
            var electionMode = ElectionMode.Training;
            var electionDate = "xxxxxxxx";

            if (_electionManager.HasSourceData())
            {
                electionMode = _electionManager.SourceData.ElectionMode;
                electionDate = _electionManager.SourceData.ElectionDate.ToString("yyyyMMdd");
            }
            var    electionModeStr = (electionMode == ElectionMode.Real ? "real" : "train");
            string reasonStr;

            switch (resetSoftParams.Reason)
            {
            case ResetSoftReason.ElectionFinished:
                reasonStr = "el";
                break;

            case ResetSoftReason.ResetSoftFromSystemMenu:
                reasonStr = "rsm";
                break;

            case ResetSoftReason.ResetUikFromSystemMenu:
                reasonStr = "rum";
                break;

            case ResetSoftReason.ControlVotingStartTriggered:
                reasonStr = "cvs";
                break;

            case ResetSoftReason.ConflictDetected:
                reasonStr = "cnf";
                break;

            default:
                throw new ArgumentOutOfRangeException("resetSoftParams", "Неожиданная причина сброса ПО");
            }
            if (resetSoftParams.IsRemoteScannerInitiator)
            {
                reasonStr += "_rs";
            }
            return(string.Format("{{0:000000}}_{0}_{1}_{2}", electionModeStr, electionDate, reasonStr));
        }