示例#1
0
        public async Task ProcessCheck(CheckTypeEnum checkType, string schedule, CancellationToken cancellationToken)
        {
            var initialDelayTime = TimeSpan.FromMinutes(0);

            await Task.Delay(initialDelayTime);

            while (!cancellationToken.IsCancellationRequested)
            {
                CronExpression expression  = CronExpression.Parse(schedule);
                var            nextRunTime = expression.GetNextOccurrence(DateTime.UtcNow);
                var            delay       = nextRunTime - DateTime.UtcNow;

                if (delay == null)
                {
                    return;
                }

                await _processor.ExecuteCommand(checkType);

                if (cancellationToken.IsCancellationRequested)
                {
                    return;
                }

                await Task.Delay(delay.Value);
            }
        }
示例#2
0
 private IRequest <CommandResult> ResolveCommand(CheckTypeEnum checkType)
 {
     if (!_handlersDict.ContainsKey(checkType))
     {
         throw new Exception($"No command specified for {checkType}");
     }
     return(_handlersDict[checkType]);
 }
示例#3
0
        private async Task CheckBreach(CheckTypeEnum breachType)
        {
            if (!pluginHost.Database.IsOpen)
            {
                MessageBox.Show("You must first open a database", Resources.MessageTitle);
                return;
            }

            var dialog = new CheckerPrompt(breachType, breachType != CheckTypeEnum.Password);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                progressForm = new StatusProgressForm();
                var progressIndicator = new Progress <ProgressItem>(ReportProgress);
                progressForm.InitEx("Checking Breaches", false, breachType == CheckTypeEnum.SiteDomain, pluginHost.MainWindow);
                progressForm.Show();
                progressForm.SetProgress(0);
                List <BreachedEntry> result = new List <BreachedEntry>();
                if (dialog.CheckAllBreaches)
                {
                    progressForm.Tag = new ProgressHelper(Enum.GetValues(typeof(BreachEnum)).Length);
                    foreach (var breach in Enum.GetValues(typeof(BreachEnum)))
                    {
                        var foundBreaches = await CheckBreaches(supportedBreachCheckers[(BreachEnum)breach](client, pluginHost),
                                                                dialog.ExpireEntries, dialog.OnlyCheckOldEntries, dialog.IgnoreDeletedEntries, progressIndicator);

                        result.AddRange(foundBreaches);
                        ((ProgressHelper)progressForm.Tag).CurrentBreach++;
                    }
                }
                else
                {
                    progressForm.Tag = new ProgressHelper(1);
                    var foundBreaches = await CheckBreaches(supportedBreachCheckers[dialog.SelectedBreach](client, pluginHost),
                                                            dialog.ExpireEntries, dialog.OnlyCheckOldEntries, dialog.IgnoreDeletedEntries, progressIndicator);

                    result.AddRange(foundBreaches);
                }
                progressForm.Close();

                if (!result.Any())
                {
                    MessageBox.Show("No breached entries found.", Resources.MessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    var breachedEntriesDialog = new BreachedEntriesDialog(pluginHost);
                    breachedEntriesDialog.AddBreaches(result);
                    breachedEntriesDialog.ShowDialog();
                }
            }

            pluginHost.MainWindow.Show();
        }
示例#4
0
        public HashSet <char> GetStringSpan(CheckTypeEnum checkType)
        {
            var keywordList = StringSearchList.Where(i => i.CheckType == checkType).Select(i => i.Keyword).ToList();
            var hashSet     = new HashSet <char>();

            foreach (var keyword in keywordList)
            {
                foreach (var ch in keyword)
                {
                    hashSet.Add(ch);
                }
            }
            return(hashSet);
        }
示例#5
0
        public CheckerPrompt(CheckTypeEnum checkType, bool enableOldEntries)
        {
            InitializeComponent();
            Text = string.Format("Have I Been Pwned? - {0}", checkType.GetAttribute <DisplayAttribute>().Name);
            this.supportedBreachList.DataSource = Enum.GetValues(typeof(BreachEnum)).Cast <BreachEnum>().Where(b => b.GetAttribute <CheckerTypeAttribute>().Type == checkType)
                                                  .Select(b => new ListViewItem {
                Text = b.GetAttribute <CheckerTypeAttribute>().Name, Tag = b
            }).ToList();

            checkOldEntries.Enabled = enableOldEntries;
            checkOldEntries.Checked = enableOldEntries;

            checkAllBreaches.CheckedChanged          += CheckAllBreachesCheckedChanged;
            supportedBreachList.SelectedIndexChanged += SupportedBreachListSelectedIndexChanged;
            SetBreachDescription();
        }
示例#6
0
 public async Task ExecuteCommand(CheckTypeEnum checkType)
 {
     var command = ResolveCommand(checkType);
     await _mediator.Send(command);
 }
        private async Task CheckBreach(CheckTypeEnum breachType, PwGroup group)
        {
            var dialog = new CheckerPrompt(breachType, breachType != CheckTypeEnum.Password);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                progressForm = new StatusProgressForm();
                var progressIndicator = new Progress <ProgressItem>(ReportProgress);
                progressForm.InitEx("Checking Breaches", true, breachType == CheckTypeEnum.SiteDomain, pluginHost.MainWindow);
                progressForm.Show();
                progressForm.SetProgress(0);
                List <BreachedEntry> result = new List <BreachedEntry>();
                try
                {
                    if (dialog.CheckAllBreaches)
                    {
                        var breaches = Enum.GetValues(typeof(BreachEnum)).Cast <BreachEnum>().Where(b => b.GetAttribute <CheckerTypeAttribute>().Type == breachType);
                        progressForm.Tag = new ProgressHelper(breaches.Count());
                        foreach (var breach in breaches)
                        {
                            var foundBreaches = await CheckBreaches(supportedBreachCheckers[(BreachEnum)breach](client, pluginHost),
                                                                    group, dialog.ExpireEntries, dialog.OnlyCheckOldEntries, dialog.IgnoreDeletedEntries, dialog.IgnoreExpiredEntries, progressIndicator, () => progressForm.ContinueWork());

                            result.AddRange(foundBreaches);
                            ((ProgressHelper)progressForm.Tag).CurrentBreach++;
                        }
                    }
                    else
                    {
                        progressForm.Tag = new ProgressHelper(1);
                        var foundBreaches = await CheckBreaches(supportedBreachCheckers[dialog.SelectedBreach](client, pluginHost),
                                                                group, dialog.ExpireEntries, dialog.OnlyCheckOldEntries, dialog.IgnoreDeletedEntries, dialog.IgnoreExpiredEntries, progressIndicator, () => progressForm.ContinueWork());

                        result.AddRange(foundBreaches);
                    }
                }
                catch (Exception ex)
                {
                    result = null;
                    MessageBox.Show(pluginHost.MainWindow, ex.Message, Resources.MessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    progressForm.Close();
                }

                if (result != null)
                {
                    if (!result.Any())
                    {
                        MessageBox.Show(pluginHost.MainWindow, "No breached entries found.", Resources.MessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        var breachedEntriesDialog = new BreachedEntriesDialog(pluginHost);
                        breachedEntriesDialog.AddBreaches(result);
                        breachedEntriesDialog.ShowDialog();
                    }
                }
            }

            pluginHost.MainWindow.Show();
        }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TeleCheckAchPaymentMethod" /> class.
 /// </summary>
 /// <param name="achType">ACH application type values will be one of either TeleCheckICAPaymentMethod or TeleCheckCBPPaymentMethod. (required).</param>
 /// <param name="routingNumber">Bank routing number. (required).</param>
 /// <param name="accountNumber">Bank account number. (required).</param>
 /// <param name="accountType">Identifies if the account type is checking or savings. (required).</param>
 /// <param name="checkNumber">Check number..</param>
 /// <param name="checkType">Identifies if the check type is personal or company. (required).</param>
 /// <param name="productCode">Identifies the product code in the transaction..</param>
 /// <param name="manualIdInfo">manualIdInfo.</param>
 /// <param name="supplementIdInfo">supplementIdInfo.</param>
 /// <param name="agentId">Used to track the agent transaction activity..</param>
 /// <param name="terminalId">Identifies the register or lane number where the original sale transaction occurred..</param>
 /// <param name="registrationId">Unique ID assigned by the merchant for the consumer (never recycled). It is an additional level of authentication. To use this feature, the merchant must work with TeleCheck Risk to discuss. Registration IDs must not be generated for an existing or returning consumer returns. The single registration ID must be unique per consumer..</param>
 /// <param name="registrationDate">Date the consumer originally registered in format MMDDYYYY..</param>
 /// <param name="releaseType">Release type is used as a risk variable to gauge risk level when the merchant is releasing the purchased merchandise..</param>
 /// <param name="vipCustomer">Flags a transaction as a VIP order (based on merchant criteria). This field should not be sent for non-VIP orders..</param>
 /// <param name="sessionId">Session identifier. (required).</param>
 /// <param name="terminalState">Identifies the US state or territory where the original sale transaction occurred..</param>
 /// <param name="terminalCity">Identifies the city where the original sale transaction occurred..</param>
 /// <param name="achBillTo">achBillTo (required).</param>
 public TeleCheckAchPaymentMethod(string achType = default(string), string routingNumber = default(string), string accountNumber = default(string), AccountTypeEnum accountType = default(AccountTypeEnum), string checkNumber = default(string), CheckTypeEnum checkType = default(CheckTypeEnum), string productCode = default(string), IdInfo manualIdInfo = default(IdInfo), IdInfo supplementIdInfo = default(IdInfo), string agentId = default(string), string terminalId = default(string), string registrationId = default(string), DateTime registrationDate = default(DateTime), ReleaseTypeEnum?releaseType = null, VipCustomerEnum?vipCustomer = null, string sessionId = default(string), string terminalState = default(string), string terminalCity = default(string), TeleCheckAchPaymentMethodAchBillTo achBillTo = default(TeleCheckAchPaymentMethodAchBillTo))
 {
     // to ensure "achType" is required (not null)
     this.AchType = achType ?? throw new ArgumentNullException("achType is a required property for TeleCheckAchPaymentMethod and cannot be null");
     // to ensure "routingNumber" is required (not null)
     this.RoutingNumber = routingNumber ?? throw new ArgumentNullException("routingNumber is a required property for TeleCheckAchPaymentMethod and cannot be null");
     // to ensure "accountNumber" is required (not null)
     this.AccountNumber = accountNumber ?? throw new ArgumentNullException("accountNumber is a required property for TeleCheckAchPaymentMethod and cannot be null");
     this.AccountType   = accountType;
     this.CheckType     = checkType;
     // to ensure "sessionId" is required (not null)
     this.SessionId = sessionId ?? throw new ArgumentNullException("sessionId is a required property for TeleCheckAchPaymentMethod and cannot be null");
     // to ensure "achBillTo" is required (not null)
     this.AchBillTo        = achBillTo ?? throw new ArgumentNullException("achBillTo is a required property for TeleCheckAchPaymentMethod and cannot be null");
     this.CheckNumber      = checkNumber;
     this.ProductCode      = productCode;
     this.ManualIdInfo     = manualIdInfo;
     this.SupplementIdInfo = supplementIdInfo;
     this.AgentId          = agentId;
     this.TerminalId       = terminalId;
     this.RegistrationId   = registrationId;
     this.RegistrationDate = registrationDate;
     this.ReleaseType      = releaseType;
     this.VipCustomer      = vipCustomer;
     this.TerminalState    = terminalState;
     this.TerminalCity     = terminalCity;
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TeleCheckICAPaymentMethod" /> class.
 /// </summary>
 /// <param name="customerIpAddress">Customer IP address from the terminal where the order was placed (as captured by merchant). (required).</param>
 /// <param name="imeiCode">International mobile equipment identity code..</param>
 /// <param name="recurringType">recurringType.</param>
 /// <param name="achType">ACH application type values will be one of either TeleCheckICAPaymentMethod or TeleCheckCBPPaymentMethod. (required).</param>
 /// <param name="routingNumber">Bank routing number. (required).</param>
 /// <param name="accountNumber">Bank account number. (required).</param>
 /// <param name="accountType">Identifies if the account type is checking or savings. (required).</param>
 /// <param name="checkNumber">Check number..</param>
 /// <param name="checkType">Identifies if the check type is personal or company. (required).</param>
 /// <param name="productCode">Identifies the product code in the transaction..</param>
 /// <param name="manualIdInfo">manualIdInfo.</param>
 /// <param name="supplementIdInfo">supplementIdInfo.</param>
 /// <param name="agentId">Used to track the agent transaction activity..</param>
 /// <param name="terminalId">Identifies the register or lane number where the original sale transaction occurred..</param>
 /// <param name="registrationId">Unique ID assigned by the merchant for the consumer (never recycled). It is an additional level of authentication. To use this feature, the merchant must work with TeleCheck Risk to discuss. Registration IDs must not be generated for an existing or returning consumer returns. The single registration ID must be unique per consumer..</param>
 /// <param name="registrationDate">Date the consumer originally registered in format MMDDYYYY..</param>
 /// <param name="releaseType">Release type is used as a risk variable to gauge risk level when the merchant is releasing the purchased merchandise..</param>
 /// <param name="vipCustomer">Flags a transaction as a VIP order (based on merchant criteria). This field should not be sent for non-VIP orders..</param>
 /// <param name="sessionId">Session identifier. (required).</param>
 /// <param name="terminalState">Identifies the US state or territory where the original sale transaction occurred..</param>
 /// <param name="terminalCity">Identifies the city where the original sale transaction occurred..</param>
 /// <param name="achBillTo">achBillTo (required).</param>
 public TeleCheckICAPaymentMethod(string customerIpAddress = default(string), string imeiCode = default(string), AchRecurringType?recurringType = null, string achType = default(string), string routingNumber = default(string), string accountNumber = default(string), AccountTypeEnum accountType = default(AccountTypeEnum), string checkNumber = default(string), CheckTypeEnum checkType = default(CheckTypeEnum), string productCode = default(string), IdInfo manualIdInfo = default(IdInfo), IdInfo supplementIdInfo = default(IdInfo), string agentId = default(string), string terminalId = default(string), string registrationId = default(string), DateTime registrationDate = default(DateTime), ReleaseTypeEnum?releaseType = null, VipCustomerEnum?vipCustomer = null, string sessionId = default(string), string terminalState = default(string), string terminalCity = default(string), TeleCheckAchPaymentMethodAchBillTo achBillTo = default(TeleCheckAchPaymentMethodAchBillTo)) : base(achType, routingNumber, accountNumber, accountType, checkNumber, checkType, productCode, manualIdInfo, supplementIdInfo, agentId, terminalId, registrationId, registrationDate, releaseType, vipCustomer, sessionId, terminalState, terminalCity, achBillTo)
 {
     // to ensure "customerIpAddress" is required (not null)
     this.CustomerIpAddress = customerIpAddress ?? throw new ArgumentNullException("customerIpAddress is a required property for TeleCheckICAPaymentMethod and cannot be null");
     this.ImeiCode          = imeiCode;
     this.RecurringType     = recurringType;
 }
示例#10
0
        public Check GetCheck(CheckTypeEnum checkType)
        {
            var dict = _cache.Get <Dictionary <CheckTypeEnum, Check> >(CACHE_KEY);

            return(dict.ContainsKey(checkType) ? dict[checkType] : null);
        }
示例#11
0
        /// <summary>
        /// 没实际批次
        /// </summary>
        /// <param name="lotID"></param>
        /// <param name="sourceOrderID">源工单ID</param>
        /// <param name="sourceType"></param>
        /// <param name="dtSampleDate"></param>
        /// <param name="creator"></param>
        /// <param name="samplecount"></param>
        /// <param name="plancheckitemstring"></param>
        /// <param name="firscheck"></param>
        /// <param name="checkType"></param>
        /// <returns></returns>
        static public ReturnValue AutoCreateCheckOrder(int defpk, int hutid, string lotid, string sourceOrderID, SampleTypeEnum sampleType, DateTime dtSampleDate, string creator, int samplecount = 1, string plancheckitemstring = "", bool firscheck = true, CheckTypeEnum checkType = CheckTypeEnum.Normal)
        {
            if (!string.IsNullOrWhiteSpace(sourceOrderID))
            {
                EncodeCollection <CheckOrder> ec = Encode.EncodeData.GetDatas <CheckOrder>("sourceorderid = '" + sourceOrderID + "'", string.Empty, 1);
                if (ec.Count > 0)
                {
                    return(new ReturnValue(true, 1, "检验单已创建"));
                }
            }
            //find lot
            // EncodeCollection<MMReiptOrder> ecMR = Encode.EncodeData.GetDatas<MMReiptOrder>(string.Format("sitlotid='{0}'", lotID), string.Empty, -1);
            // MMLot lot = SSIT.Bread.UI.MM.MMCommon.GetLotbyID(lotID);
            //if (lot != null)
            //if(ecMR.Count > 0 )
            //{
            //MMReiptOrder mr = ecMR[0];
            //先创建SampleItem
            CheckOrder si = new CheckOrder {
                LotID = lotid, HutPK = hutid, DefPK = defpk
            };

            //si.HutID = lot.HutID;
            si.SampleID      = CheckOrder.GetNewCheckID(dtSampleDate);
            si.CheckQuantity = samplecount;
            si.PlanCheckDate = si.SampleDate = dtSampleDate.ToString(EncodeConst.DateFormat);
            //si.CreateType = createType;
            si.CheckOrderState     = CheckOrderStateEnum.Submit;
            si.SourceOrderID       = sourceOrderID;
            si.SampleType          = sampleType;
            si.Creator             = creator;
            si.CreateTime          = dtSampleDate.ToString(EncodeConst.DateTimeFormat);
            si.PlanCheckItemString = plancheckitemstring;
            //si.FirstCheck = firscheck;
            //if(User.CurrentUser != null)
            //{
            //    si.ActualInspector = User.CurrentUser.ParamName;
            //}
            if (string.IsNullOrWhiteSpace(si.PlanCheckItemString))
            {
                DefinitionCheckItemCombine combine = DefinitionCheckItemCombine.GetItemby(si.DefPK);
                if (combine != null)
                {
                    List <int> list = CheckItem.Instance.GetIdList(combine.GetCheckItems());
                    si.PlanCheckItemString = SSITEncode.Common.STRING.IntListToString(list);
                }
            }
            si.State = DataState.New;
            //EncodeCollection<SampleItemOrder> ec = new EncodeCollection<SampleItemOrder>(si);
            ReturnValue rv = Encode.EncodeData.SaveDatas <CheckOrder>(new EncodeCollection <CheckOrder>(si));

            if (rv.Success)
            {
                rv.ValueString = si.SampleID;
                //SSIT.SystemManager.DataInterface.MessageContent.CreateNewMessage(BreadInterface.SampleTypeEnum.QMOrder, si.SampleID, creator);
            }
            return(rv);

            // return new ReturnValue(false, -444, "找不到对应批次");
        }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TeleCheckCBPPaymentMethod" /> class.
 /// </summary>
 /// <param name="achType">ACH application type values will be one of either TeleCheckICAPaymentMethod or TeleCheckCBPPaymentMethod. (required) (default to &quot;TeleCheckCBPPaymentMethod&quot;).</param>
 /// <param name="routingNumber">Bank routing number. (required).</param>
 /// <param name="accountNumber">Bank account number. (required).</param>
 /// <param name="accountType">Identifies if the account type is checking or savings. (required).</param>
 /// <param name="checkNumber">Check number..</param>
 /// <param name="checkType">Identifies if the check type is personal or company. (required).</param>
 /// <param name="productCode">Identifies the product code in the transaction..</param>
 /// <param name="manualIdInfo">manualIdInfo.</param>
 /// <param name="supplementIdInfo">supplementIdInfo.</param>
 /// <param name="agentId">Used to track the agent transaction activity..</param>
 /// <param name="terminalId">Identifies the register or lane number where the original sale transaction occurred..</param>
 /// <param name="registrationId">Unique ID assigned by the merchant for the consumer (never recycled). It is an additional level of authentication. To use this feature, the merchant must work with TeleCheck Risk to discuss. Registration IDs must not be generated for an existing or returning consumer returns. The single registration ID must be unique per consumer..</param>
 /// <param name="registrationDate">Date the consumer originally registered in format MMDDYYYY..</param>
 /// <param name="releaseType">Release type is used as a risk variable to gauge risk level when the merchant is releasing the purchased merchandise..</param>
 /// <param name="vipCustomer">Flags a transaction as a VIP order (based on merchant criteria). This field should not be sent for non-VIP orders..</param>
 /// <param name="sessionId">Session identifier. (required).</param>
 /// <param name="terminalState">Identifies the US state or territory where the original sale transaction occurred..</param>
 /// <param name="terminalCity">Identifies the city where the original sale transaction occurred..</param>
 /// <param name="achBillTo">achBillTo.</param>
 public TeleCheckCBPPaymentMethod(string achType = "TeleCheckCBPPaymentMethod", string routingNumber = default(string), string accountNumber = default(string), AccountTypeEnum accountType = default(AccountTypeEnum), string checkNumber = default(string), CheckTypeEnum checkType = default(CheckTypeEnum), string productCode = default(string), IdInfo manualIdInfo = default(IdInfo), IdInfo supplementIdInfo = default(IdInfo), string agentId = default(string), string terminalId = default(string), string registrationId = default(string), DateTime registrationDate = default(DateTime), ReleaseTypeEnum?releaseType = default(ReleaseTypeEnum?), VipCustomerEnum?vipCustomer = default(VipCustomerEnum?), string sessionId = default(string), string terminalState = default(string), string terminalCity = default(string), TeleCheckAchPaymentMethodAchBillTo achBillTo = default(TeleCheckAchPaymentMethodAchBillTo)) : base(achType, routingNumber, accountNumber, accountType, checkNumber, checkType, productCode, manualIdInfo, supplementIdInfo, agentId, terminalId, registrationId, registrationDate, releaseType, vipCustomer, sessionId, terminalState, terminalCity, achBillTo)
 {
 }
示例#13
0
 public async Task RunManualCheck(CheckTypeEnum checkType)
 {
     await _commandsProcessor.ExecuteCommand(checkType);
 }