public SignController(
     ISignService signService,
     ILogFactory logFactory)
 {
     _signService = signService ?? throw new ArgumentNullException(nameof(signService));
     _log         = logFactory?.CreateLog(this) ?? throw new ArgumentNullException(nameof(logFactory));
 }
Пример #2
0
        //private ISignService GetSignService()
        //{
        //    ISignService signService = ObjectFactory.GetInstance<ISignService>();
        //    return signService;
        //}

        public XMLDigitalSignature GetXMLDigitalSignatureInfo(string document)
        {
            ISignService signService = ObjectFactory.GetInstance <ISignService>();
            var          signInfo    = signService.GetXMLDigitalSignatureInfo(document);

            return(signInfo);
        }
Пример #3
0
        public static VaspClient Create(
            VaspInformation vaspInfo,
            VaspContractInfo vaspContractInfo,
            string handshakePrivateKeyHex,
            string signaturePrivateKeyHex,
            IEthereumRpc nodeClientEthereumRpc,
            IWhisperRpc nodeClientWhisperRpc,
            IEnsProvider ensProvider,
            ISignService signService,
            ITransportClient transportClient)
        {
            var handshakeKey = ECDH_Key.ImportKey(handshakePrivateKeyHex);

            var vaspClient = new VaspClient(
                handshakeKey,
                signaturePrivateKeyHex,
                vaspContractInfo,
                vaspInfo,
                nodeClientEthereumRpc,
                nodeClientWhisperRpc,
                ensProvider,
                transportClient,
                signService);

            return(vaspClient);
        }
Пример #4
0
        private void SignDocuments(Preservation preservation, ISignService _signService, Models.ArubaSignModel model)
        {
            string currentFilePath = Directory.GetFiles(preservation.Path, "IPDA*.xml").FirstOrDefault();

            if (currentFilePath != null)
            {
                //get file content
                byte[] content = System.IO.File.ReadAllBytes(currentFilePath);

                //sign document with aruba automatic
                VecompSoftware.Sign.ArubaSignService.ArubaSignModel arubaModel = new VecompSoftware.Sign.ArubaSignService.ArubaSignModel()
                {
                    DelegatedDomain   = model.DelegatedDomain,
                    DelegatedPassword = model.DelegatedPassword,
                    DelegatedUser     = model.DelegatedUser,
                    OTPPassword       = model.OTPPassword,
                    OTPAuthType       = model.OTPAuthType,
                    User          = model.User,
                    CertificateId = model.CertificateId,
                    TSAUser       = model.TSAUser,
                    TSAPassword   = model.TSAPassword
                };

                content = _signService.SignDocument(arubaModel, content, Path.GetFileName(currentFilePath), true);

                //save signed file back to disk
                ByteArrayToFile(currentFilePath, content);

                //update CloseDate field so that we can close the preservation
                _preservationService.ClosePreservation(preservation.IdPreservation);
            }
        }
Пример #5
0
 public SyncServiceFactory(GitConfig config, string passwordStorePath, ISignService signService, GitSyncStrategies gitSyncStrategies)
 {
     this.config            = config;
     this.passwordStorePath = passwordStorePath;
     this.signService       = signService;
     this.gitSyncStrategies = gitSyncStrategies;
 }
Пример #6
0
        public SecurionPayGateway(string secretKey, string serverUrl = "https://api.securionpay.com/", string uploadsUrl = "https://uploads.securionpay.com")
        {
            var configurationProvider = new ConfigurationProvider(secretKey, serverUrl, uploadsUrl);

            _configurationProvider = configurationProvider;
            _apiClient             = new ApiClient(new SecurionPay.Internal.HttpClient(), configurationProvider, new FileExtensionToMimeMapper());
            _signService           = new SignService(configurationProvider);
        }
Пример #7
0
 public DashboardController(
     IContestService contestService,
     ISignService signService,
     UserManager <ApplicationUser> userManager)
 {
     this.contestService = contestService;
     this.signService    = signService;
     this.userManager    = userManager;
 }
        private void BindSgins()
        {
            //获取当前用户签到列表
            ISignService signServices = IoC.Resolve <ISignService>();

            sgins = signServices.Where(c => c.Uid == CookUserInfo.Id && c.IsBack == false).ToList().OrderBy(c => c.OccDay).Select(c => c.OccDay).ToList();
            if (sgins == null)
            {
                sgins = new List <int>();
            }
        }
Пример #9
0
 public SignController(
     UserManager <ApplicationUser> userManager,
     ISignService signService,
     IEmailSender emailSender,
     IConfiguration configuration,
     IContestService contestService)
 {
     this.userManager    = userManager;
     this.signService    = signService;
     this.emailSender    = emailSender;
     this.configuration  = configuration;
     this.contestService = contestService;
 }
Пример #10
0
 private async Task SingUsersForContest(ISignService signService, List <string> contestarsIds, List <int> contestIds)
 {
     foreach (var contestId in contestIds)
     {
         foreach (var contestantId in contestarsIds)
         {
             if (!signService.UserAlreadyRegisteredForCompetition(contestantId, contestId))
             {
                 await signService.RegisterForContestAsync(contestantId, contestId);
             }
         }
     }
 }
Пример #11
0
 public CreateController(
     IContestService contestService,
     HtmlSanitizer htmlSanitizer,
     UserManager <ApplicationUser> userManager,
     RoleManager <ApplicationRole> roleManager,
     ISignService signService)
 {
     this.contestService = contestService;
     this.htmlSanitizer  = htmlSanitizer;
     this.userManager    = userManager;
     this.roleManager    = roleManager;
     this.signService    = signService;
 }
        /// <summary>
        /// 签到
        /// </summary>
        private string Sign()
        {
            int state = 1;

            if (!Utils.HasAvtivityDateTimes())
            {
                state = 5;
                return(state.ToString());
            }


            //验证当前用户当天投注是否达到条件
            DateTime          startTime         = Utils.GetNowBeginDate();
            DateTime          endTime           = Utils.GetNowEndDate();
            IBetDetailService betDetailServices = IoC.Resolve <IBetDetailService>();
            var totalAmt = 0m;

            int[] whereStates = new int[] { 1, 2 };
            var   sumResult   = betDetailServices.Where(c => c.UserId == this.CookUserInfo.Id && c.OccDate >= startTime && c.OccDate <= endTime && whereStates.Contains((int)c.Stauts));

            if (sumResult.Any())
            {
                totalAmt = sumResult.Sum(c => c.TotalAmt);
            }
            if (totalAmt > Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["sign"]))
            {
                ISignService signServices = IoC.Resolve <ISignService>();
                //查询今天是否已经签到过
                int occday = Utils.GetActivityOccDay();
                if (signServices.Where(c => c.Uid == CookUserInfo.Id && c.OccDay == occday).Count() < 1)
                {
                    signServices.Create(new BasicModel.Act.Sign()
                    {
                        OccDay = occday,
                        Uid    = CookUserInfo.Id
                    });
                    signServices.Save();
                    state = 0;
                }
                else
                {
                    state = 3;
                }
            }
            else
            {
                state = 2;
            }

            return(state.ToString());
        }
        //开始抽奖
        private string ExRotate()
        {
            string result = "";
            //验证今天是否签到
            ISignService signServices = IoC.Resolve <ISignService>();
            //查询今天是否已经签到过
            int occday = Convert.ToInt32(DateTime.Now.ToString("yyyyMMdd"));
            var fs     = signServices.Where(c => c.Uid == CookUserInfo.Id && c.OccDay == occday).FirstOrDefault();

            if (fs != null)
            {
                if (fs.IsDap)
                {
                    return(result = "-3,0,0");//已经抽过了
                }
                fs.IsDap = true;
                signServices.Save();                           //存储状态
                var iawards = Awards();
                var monery  = Convert.ToDecimal(iawards.Name); //抽取的金额 //RechargeConfig.LotteryLevelMonery(Convert.ToInt32(iawards.Name));
                //存入账号

                var details = new BasicModel.SysUserBalanceDetail()
                {
                    RelevanceNo = CookUserInfo.Id.ToString(),
                    SerialNo    = "q" + Utils.BuilderNum(),
                    Status      = 0,
                    TradeAmt    = monery,
                    TradeType   = BasicModel.TradeType.幸运大转盘,
                    UserId      = CookUserInfo.Id
                };

                //奖励金额
                ISysUserBalanceService userBalanceServices = IoC.Resolve <ISysUserBalanceService>();

                if (userBalanceServices.UpdateUserBalance(details, monery) > 0)
                {
                }
                result = "1," + iawards.Name + "," + 0;
            }
            else
            {
                //今天没签到呢
                result = "-1,0,0";//已经没有抽奖的次数了
            }
            return(result + ",0");
        }
Пример #14
0
        public BeneficiarySession(
            VaspContractInfo beneficiaryVaspContractInfo,
            VaspInformation beneficiaryVasp,
            string sessionId,
            string counterpartyTopic,
            string counterPartyPubSigningKey,
            string sharedKey,
            string privateSigningKey,
            IWhisperRpc whisperRpc,
            IVaspMessageHandler vaspMessageHandler,
            ITransportClient transportClient,
            ISignService signService)
            : base(
                beneficiaryVaspContractInfo,
                beneficiaryVasp,
                counterPartyPubSigningKey,
                sharedKey,
                privateSigningKey,
                whisperRpc,
                transportClient,
                signService)
        {
            this.SessionId           = sessionId;
            this.CounterPartyTopic   = counterpartyTopic;
            this._vaspMessageHandler = vaspMessageHandler;

            _messageHandlerResolverBuilder.AddHandler(typeof(TransferRequestMessage), new TransferRequestMessageHandler(
                                                          async(message, cancellationToken) =>
            {
                await _vaspMessageHandler.TransferRequestHandlerAsync(message, this);
            }));

            _messageHandlerResolverBuilder.AddHandler(typeof(TransferDispatchMessage), new TransferDispatchMessageHandler(
                                                          async(message, cancellationToken) =>
            {
                await _vaspMessageHandler.TransferDispatchHandlerAsync(message, this);
            }));

            _messageHandlerResolverBuilder.AddHandler(typeof(TerminationMessage),
                                                      new TerminationMessageHandler(async(message, token) =>
            {
                _hasReceivedTerminationMessage = true;
                await TerminateAsync(message.GetMessageCode());
            }));
        }
 public VaspSession(
     VaspContractInfo vaspContractInfo,
     VaspInformation vaspInfo,
     string counterPartyPubSigningKey,
     string sharedEncryptionKey,
     string privateSigningKey,
     IWhisperRpc whisperRpc,
     ITransportClient transportClient,
     ISignService signService)
 {
     this._vaspInfo                      = vaspInfo;
     this._vaspContractInfo              = vaspContractInfo;
     this._sessionTopic                  = TopicGenerator.GenerateSessionTopic();
     this._cancellationTokenSource       = new CancellationTokenSource();
     this._whisperRpc                    = whisperRpc;
     this._sharedKey                     = sharedEncryptionKey;
     this._privateSigningKey             = privateSigningKey;
     this._counterPartyPubSigningKey     = counterPartyPubSigningKey;
     this._messageHandlerResolverBuilder = new MessageHandlerResolverBuilder();
     this._transportClient               = transportClient;
     this._signService                   = signService;
 }
Пример #16
0
 //TODO: Get rid of Whisper completely
 private VaspClient(
     ECDH_Key handshakeKey,
     string signatureHexKey,
     VaspContractInfo vaspContractInfo,
     VaspInformation vaspInfo,
     IEthereumRpc nodeClientEthereumRpc,
     IWhisperRpc nodeClientWhisperRpc,
     IEnsProvider ensProvider,
     ITransportClient transportClient,
     ISignService signService)
 {
     this._handshakeKey            = handshakeKey;
     this._signatureKey            = signatureHexKey;
     this._vaspContractInfo        = vaspContractInfo;
     this.VaspInfo                 = vaspInfo;
     this._ethereumRpc             = nodeClientEthereumRpc;
     this._whisperRpc              = nodeClientWhisperRpc;
     this._cancellationTokenSource = new CancellationTokenSource();
     this._ensProvider             = ensProvider;
     this._transportClient         = transportClient;
     this._signService             = signService;
 }
Пример #17
0
        /// <summary>
        /// C-tor
        /// </summary>
        public TransactionsManager(
            VaspCode vaspCode,
            string handshakePrivateKeyHex,
            string signaturePrivateKeyHex,
            IEthereumRpc ethereumRpc,
            ISignService signService,
            IEnsProvider ensProvider,
            ITransportClient transportClient,
            ITransactionDataService transactionDataService,
            ISessionsRepository sessionsRepository,
            ITransactionsRepository transactionsRepository,
            IVaspCodeManager vaspCodeManager,
            VaspInformation vaspInformation,
            ILoggerFactory loggerFactory)
        {
            _vaspClient = VaspClient.Create(
                vaspCode,
                handshakePrivateKeyHex,
                signaturePrivateKeyHex,
                ethereumRpc,
                ensProvider,
                signService,
                transportClient,
                loggerFactory);

            _vaspClient.SessionRequestMessageReceived       += SessionRequestMessageReceivedAsync;
            _vaspClient.SessionReplyMessageReceived         += SessionReplyMessageReceivedAsync;
            _vaspClient.TransferReplyMessageReceived        += TransferReplyMessageReceivedAsync;
            _vaspClient.TransferConfirmationMessageReceived += TransferConfirmationMessageReceivedAsync;
            _vaspClient.TransferRequestMessageReceived      += TransferRequestMessageReceivedAsync;
            _vaspClient.TransferDispatchMessageReceived     += TransferDispatchMessageReceivedAsync;
            _vaspClient.BeneficiarySessionCreated           += BeneficiarySessionCreatedAsync;

            _transactionDataService = transactionDataService;
            _sessionsRepository     = sessionsRepository;
            _transactionsRepository = transactionsRepository;
            _vaspCodeManager        = vaspCodeManager;
            _vaspInformation        = vaspInformation;
        }
Пример #18
0
 public SignController(ISignService signService, ILogger <SignController> logger)
 {
     _signService = signService;
     _logger      = logger;
 }
Пример #19
0
 public FakeTransportClient(IMessageFormatter messageFormatter, ISignService signService)
 {
     this._messageFormatter = messageFormatter;
     this._signService      = signService;
 }
Пример #20
0
        public OriginatorSession(
            Originator originator,
            VaspContractInfo originatorVaspContractInfo,
            VaspInformation originatorVasp,
            VirtualAssetsAccountNumber beneficiaryVaan,
            string beneficiaryPubSigningKey,
            string beneficiaryPubHandshakeKey,
            string sharedEncryptionKey,
            string pubEncryptionKey,
            string privateSigningKey,
            IWhisperRpc whisperRpc,
            ITransportClient transportClient,
            ISignService signService,
            IOriginatorVaspCallbacks originatorVaspCallbacks)
        //IEnsProvider ensProvider)
            : base(
                originatorVaspContractInfo,
                originatorVasp,
                beneficiaryPubSigningKey,
                sharedEncryptionKey,
                privateSigningKey,
                whisperRpc,
                transportClient,
                signService)
        {
            this._beneficiaryVaan            = beneficiaryVaan;
            this.SessionId                   = Guid.NewGuid().ToString();
            this._beneficiaryPubHandshakeKey = beneficiaryPubHandshakeKey;
            this._pubEncryptionKey           = pubEncryptionKey;
            this._originatorVaspCallbacks    = originatorVaspCallbacks;
            //this._ensProvider = ensProvider;
            this._originator = originator;

            _messageHandlerResolverBuilder.AddHandler(typeof(SessionReplyMessage),
                                                      new SessionReplyMessageHandler((sessionReplyMessage, token) =>
            {
                this.CounterPartyTopic = sessionReplyMessage.HandShake.TopicB;
                return(_originatorVaspCallbacks.SessionReplyMessageHandlerAsync(sessionReplyMessage, this));
            }));

            _messageHandlerResolverBuilder.AddHandler(typeof(TransferReplyMessage),
                                                      new TransferReplyMessageHandler((transferReplyMessage, token) =>
            {
                return(_originatorVaspCallbacks.TransferReplyMessageHandlerAsync(transferReplyMessage, this));
            }));

            _messageHandlerResolverBuilder.AddHandler(typeof(TransferConfirmationMessage),
                                                      new TransferConfirmationMessageHandler((transferDispatchMessage, token) =>
            {
                return(_originatorVaspCallbacks.TransferConfirmationMessageHandlerAsync(transferDispatchMessage,
                                                                                        this));
            }));

            _messageHandlerResolverBuilder.AddHandler(typeof(TerminationMessage),
                                                      new TerminationMessageHandler(async(message, token) =>
            {
                _hasReceivedTerminationMessage = true;

                await TerminateAsync(message.GetMessageCode());
            }));
        }
Пример #21
0
 public SignController(ISignService iSignService, IVillageService iVillageService)
 {
     _iSignService    = iSignService;
     _iVillageService = iVillageService;
 }
Пример #22
0
 public AdminController(ISignService service, IQuestionService srv, IUserService usrv)
 {
     _signService  = service;
     _questService = srv;
     _userService  = usrv;
 }
        /// <summary>
        /// 领取奖励  1 为活动未开始 2签到时间未完成要求 -1为异常
        /// </summary>
        /// <returns></returns>
        protected void btnME_Click(object sender, EventArgs e)
        {
            if (this.Master != null)
            {
                UserAmt = (this.Master as lotterySite).GetUserBalance();
            }
            if (!Utils.HasAvtivityDateTimes())
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "<script type=\"text/javascript\">$.alert('活动时间为每日07:30:00 – 次日凌晨02:00:00!');</script>");
                return;
            }
            //领取奖励,获取当前签到次数
            ISignService signServices = IoC.Resolve <ISignService>();
            int          count        = signServices.Where(c => c.Uid == CookUserInfo.Id && c.IsBack == false).Count();//当前签到总数

            try
            {
                decimal monery = 0m;//奖励
                if (count >= 28)
                {
                    monery = 188;
                }
                else if (count >= 20)
                {
                    monery = 88;
                }
                else if (count >= 14)
                {
                    monery = 58;
                }
                else if (count >= 7)
                {
                    monery = 18;
                }

                if (monery < 1)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "<script type=\"text/javascript\">$.alert('签到时间未完成要求,领取奖励失败!'); </script>");
                    return;
                }
                var result = signServices.Where(c => c.Uid == CookUserInfo.Id);
                foreach (var item in result)
                {
                    item.IsBack = true;
                    signServices.Save();
                }
                signServices.Save();
                var details = new BasicModel.SysUserBalanceDetail()
                {
                    RelevanceNo = CookUserInfo.Id.ToString(),
                    SerialNo    = "q" + Utils.BuilderNum(),
                    Status      = 0,
                    TradeAmt    = monery,
                    TradeType   = BasicModel.TradeType.签到有你,
                    UserId      = CookUserInfo.Id
                };
                //奖励金额
                ISysUserBalanceService userBalanceServices = IoC.Resolve <ISysUserBalanceService>();
                if (userBalanceServices.UpdateUserBalance(details, monery) > 0)
                {
                    string mesggage = "领取奖金成功,共签到" + count + "天领取金额为:" + monery + "<br/>";
                    mesggage += "感谢你的参与,祝你游戏愉快!";
                    ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "<script type=\"text/javascript\">$.alert('" + mesggage + "',2,function(){refchangemonery();});</script>");
                    isautoRefbanner = false;
                }

                BindSgins();
                return;
            }
            catch (Exception ex)
            {
                Ytg.Scheduler.Comm.LogManager.Error("btnME_Click", ex);
            }
            ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "<script type=\"text/javascript\">$.alert('奖励领取失败,请稍后再试!');</script>");
        }
Пример #24
0
        public bool Verify(string document)
        {
            ISignService signService = ObjectFactory.GetInstance <ISignService>();

            return(signService.Verify(document));
        }
Пример #25
0
 /// <summary>
 /// Initialises the wrapper.
 /// </summary>
 /// <param name="repo">The repository git should operate on.</param>
 /// <param name="gitSyncStrategy">The strategy to use for synchronising repository changes.</param>
 public Git(IRepository repo, IGitSyncStrategy gitSyncStrategy, ISignService signService)
 {
     this.repo            = repo;
     this.gitSyncStrategy = gitSyncStrategy;
     this.signService     = signService;
 }
Пример #26
0
 public SignController(ISignService signService)
 {
     _signService = signService;
 }
 public TransportClient(IWhisperRpc whisper, ISignService signService, IMessageFormatter messageFormatter)
 {
     _whisper          = whisper;
     _signService      = signService;
     _messageFormatter = messageFormatter;
 }
Пример #28
0
 public HomeController(IUserService serv, ITestService srv, ISignService sign)
 {
     _userService = serv;
     _testService = srv;
     _signService = sign;
 }
Пример #29
0
 public SecurionPayGateway(IApiClient apiClient, IConfigurationProvider configurationProvider, ISignService signService)
 {
     _apiClient             = apiClient;
     _signService           = signService;
     _configurationProvider = configurationProvider;
 }