internal virtual void createVerification(string phoneNumber, string method, bool skipPermissionCheck)
		{
			Config config = SinchVerification.config().applicationKey(APPLICATION_KEY).context(ApplicationContext).build();
			VerificationListener listener = new MyVerificationListener(this);

			if (method.Equals(MainActivity.SMS, StringComparison.CurrentCultureIgnoreCase))
			{

				if (!skipPermissionCheck && ContextCompat.checkSelfPermission(this, Manifest.permission.READ_SMS) == PackageManager.PERMISSION_DENIED)
				{
					ActivityCompat.requestPermissions(this, new string[]{Manifest.permission.READ_SMS}, 0);
					hideProgressBar();
				}
				else
				{
					mVerification = SinchVerification.createSmsVerification(config, phoneNumber, listener);
					mVerification.initiate();
				}

			}
			else
			{
				TextView messageText = (TextView) findViewById(R.id.textView);
				messageText.Text = [email protected];
				mVerification = SinchVerification.createFlashCallVerification(config, phoneNumber, listener);
				mVerification.initiate();
			}
		}
Exemple #2
0
        public void verification_with_no_providerkey_should_return_null()
        {
            Verification verification = new Verification();

            verification.ApiKey = "1234567890123456789012345678901234567890";

            Assert.Equal("1234567890123456789012345678901234567890", verification.ApiKey);
            Assert.Null(verification.ProviderKey);
        }
Exemple #3
0
        public void verification_should_have_two_properties()
        {
            Verification verification = new Verification();

            verification.ApiKey = "1234567890123456789012345678901234567890";
            verification.ProviderKey = "1234567890123456789012345678901234567890";

            Assert.Equal("1234567890123456789012345678901234567890", verification.ApiKey);
            Assert.Equal("1234567890123456789012345678901234567890", verification.ProviderKey);
        }
        public void verifyTest()
        {
            // arrange

            // act
            TestVerify testClass = new TestVerify();
            Verification v       = new Verification();
            v.verify(testClass);
            // assert
        }
Exemple #5
0
        public long Create(Verification verify)
        {
            VerificationDb verifydb = mapper.Map(verify);

            return(verifyDAO.Save(verifydb));
        }
Exemple #6
0
        public App()
        {
            Get("/", args => {
                if (client == null)
                {
                    Console.WriteLine("Inizializing ...");
                    client = new Client(
                        Environment.GetEnvironmentVariable("CLIENT_ID"),
                        Environment.GetEnvironmentVariable("CLIENT_SECRET"),
                        Environment.GetEnvironmentVariable("BASE_URL")
                        );
                    Console.WriteLine("Inizialization Complete ...");
                }

                Session["credentialsVerified"] = "false";
                Session["codeVerified"]        = "false";
                Session["codeId"] = "";

                return(Response.AsRedirect("/login"));
            });

            Get("/login", args => {
                if ((string)Session["credentialsVerified"] == "true" && (string)Session["codeVerified"] == "true")
                {
                    return(Response.AsRedirect("/dashboard"));
                }

                return(View["login.cshtml"]);
            });

            Post("/login", args => {
                Auth auth = this.Bind();

                if (auth.email != Environment.GetEnvironmentVariable("EMAIL") || auth.password != Environment.GetEnvironmentVariable("PASSWORD"))
                {
                    var alert = new Alert()
                    {
                        Message = "Invalid username or password",
                        Type    = "error"
                    };

                    return(View["login.cshtml", alert]);
                }

                Session["credentialsVerified"] = "true";
                Session["codeVerified"]        = "false";

                return(Response.AsRedirect("/verify"));
            });

            Get("/verify", args => {
                if ((string)Session["credentialsVerified"] == "true" && (string)Session["codeVerified"] == "true")
                {
                    return(Response.AsRedirect("/dashboard"));
                }

                if ((string)Session["credentialsVerified"] == "false")
                {
                    return(Response.AsRedirect("/logout"));
                }

                return(View["verify.cshtml"]);
            });

            Post("/send-code", args => {
                Code code = this.Bind();

                Twofactor.TwofactorResponse response = null;

                if (code.type == "sms")
                {
                    response = client.twofactor.SendCode(Environment.GetEnvironmentVariable("PHONE_NUMBER"), new Dictionary <string, string> {
                        ["message"] = "Your verification code: {code}",
                        ["method"]  = "sms"
                    });
                }
                else
                {
                    response = client.twofactor.SendCode(Environment.GetEnvironmentVariable("DESTINATION_EMAIL"), new Dictionary <string, string> {
                        ["message"] = "Your verification code: {code}",
                        ["method"]  = "email",
                        ["subject"] = "Twofactor verification"
                    });
                }

                if (response.hasError)
                {
                    var failureAlert = new Alert()
                    {
                        Message = ErrorMessageFrom(response),
                        Type    = "error"
                    };

                    return(View["verify.cshtml", failureAlert]);
                }

                Session["codeId"] = response.codeId;

                var successAlert = new Alert()
                {
                    Message = "Twofactor verification code sent successfully",
                    Type    = "success"
                };


                return(View["verify.cshtml", successAlert]);
            });

            Post("/verify", args => {
                Verification verification = this.Bind();

                var response = client.twofactor.VerifyCode(new Dictionary <string, string> {
                    ["codeId"]           = (string)Session["codeId"],
                    ["verificationCode"] = verification.code
                });

                if (response.hasError)
                {
                    var failureAlert = new Alert()
                    {
                        Message = ErrorMessageFrom(response),
                        Type    = "error"
                    };

                    return(View["verify.cshtml", failureAlert]);
                }

                if (response.verified)
                {
                    Session["codeVerified"] = "true";
                    return(Response.AsRedirect("/dashboard"));
                }

                var alert = new Alert()
                {
                    Message = response.verificationMessage,
                    Type    = "error"
                };

                return(View["verify.cshtml", alert]);
            });


            Get("/dashboard", args => {
                if ((string)Session["codeVerified"] != "true" || (string)Session["credentialsVerified"] != "true")
                {
                    return(Response.AsRedirect("/login"));
                }

                return(View["dashboard.cshtml"]);
            });

            Get("/logout", args => {
                Session["credentialsVerified"] = "false";
                Session["codeVerified"]        = "false";
                Session["codeId"] = "";

                return(Response.AsRedirect("/login"));
            });
        }
Exemple #7
0
        public List <Client_Box_Shelf_Row> StoredBox_ItemPK_IsRestoredOfEntries(Accessory accessory)
        {
            List <Client_Box_Shelf_Row> result = new List <Client_Box_Shelf_Row>();
            StoringDAO storingDAO = new StoringDAO();

            try
            {
                // cực phẩm IQ
                double inStoredQuantity = InStoredQuantity(accessory.AccessoryPK);
                if (inStoredQuantity == 0)
                {
                    throw new Exception("HÀNG TRONG KHO ĐÃ HẾT!");
                }
                List <Entry> entries = (from e in db.Entries
                                        where e.AccessoryPK == accessory.AccessoryPK
                                        select e).ToList();
                Dictionary <StoredBox_ItemPK_IsRestored, InBoxQuantity_AvailableQuantity> tempDictionary = new Dictionary <StoredBox_ItemPK_IsRestored, InBoxQuantity_AvailableQuantity>();
                foreach (var entry in entries)
                {
                    double    inBoxQuantity = 0;
                    StoredBox storedBox     = db.StoredBoxes.Find(entry.StoredBoxPK);

                    if (entry.KindRoleName == "AdjustingMinus" || entry.KindRoleName == "AdjustingPlus")
                    {
                        AdjustingSession adjustingSession = db.AdjustingSessions.Find(entry.SessionPK);
                        Verification     verification     = db.Verifications.Where(unit => unit.SessionPK == adjustingSession.AdjustingSessionPK &&
                                                                                   unit.IsDiscard == false).FirstOrDefault();
                        if (verification != null && verification.IsApproved)
                        {
                            inBoxQuantity = storingDAO.EntryQuantity(entry);
                        }
                    }
                    else if (entry.KindRoleName == "Discarding")
                    {
                        DiscardingSession discardingSession = db.DiscardingSessions.Find(entry.SessionPK);
                        Verification      verification      = db.Verifications.Where(unit => unit.SessionPK == discardingSession.DiscardingSessionPK &&
                                                                                     unit.IsDiscard == true).FirstOrDefault();
                        if (verification != null && verification.IsApproved)
                        {
                            inBoxQuantity = storingDAO.EntryQuantity(entry);
                        }
                    }
                    else
                    {
                        inBoxQuantity = storingDAO.EntryQuantity(entry);
                    }

                    Box          box = db.Boxes.Find(storedBox.BoxPK);
                    PassedItem   passedItem;
                    RestoredItem restoredItem;
                    StoredBox_ItemPK_IsRestored key;
                    if (entry.IsRestored)
                    {
                        restoredItem = db.RestoredItems.Find(entry.ItemPK);
                        key          = new StoredBox_ItemPK_IsRestored(storedBox.StoredBoxPK, restoredItem.RestoredItemPK, entry.IsRestored);
                    }
                    else
                    {
                        passedItem = db.PassedItems.Find(entry.ItemPK);
                        key        = new StoredBox_ItemPK_IsRestored(storedBox.StoredBoxPK, passedItem.PassedItemPK, entry.IsRestored);
                    }
                    if (box.IsActive)
                    {
                        InBoxQuantity_AvailableQuantity tmp = new InBoxQuantity_AvailableQuantity(inBoxQuantity, storingDAO.EntryQuantity(entry));
                        if (!tempDictionary.ContainsKey(key))
                        {
                            tempDictionary.Add(key, tmp);
                        }
                        else
                        {
                            tempDictionary[key].InBoxQuantity     += tmp.InBoxQuantity;
                            tempDictionary[key].AvailableQuantity += tmp.AvailableQuantity;
                        }
                    }
                }

                foreach (var item in tempDictionary)
                {
                    if (item.Value.AvailableQuantity > 0)
                    {
                        StoredBox storedBox = db.StoredBoxes.Find(item.Key.StoredBoxPK);
                        Box       box       = db.Boxes.Find(storedBox.BoxPK);
                        Shelf     shelf     = db.Shelves.Find(storedBox.ShelfPK);
                        Row       row       = db.Rows.Find(shelf.RowPK);
                        if (item.Key.IsRestored)
                        {
                            RestoredItem restoredItem = db.RestoredItems.Find(item.Key.ItemPK);
                            Restoration  restoration  = db.Restorations.Find(restoredItem.RestorationPK);
                            result.Add(new Client_Box_Shelf_Row(box.BoxID, storedBox.StoredBoxPK, shelf.ShelfID, row.RowID, item.Key.ItemPK, item.Key.IsRestored, item.Value.InBoxQuantity, restoration.RestorationID, item.Value.AvailableQuantity));
                        }
                        else
                        {
                            PassedItem     passedItem     = db.PassedItems.Find(item.Key.ItemPK);
                            ClassifiedItem classifiedItem = db.ClassifiedItems.Find(passedItem.ClassifiedItemPK);
                            PackedItem     packedItem     = db.PackedItems.Find(classifiedItem.PackedItemPK);
                            Pack           pack           = db.Packs.Find(packedItem.PackPK);
                            result.Add(new Client_Box_Shelf_Row(box.BoxID, storedBox.StoredBoxPK, shelf.ShelfID, row.RowID, item.Key.ItemPK, item.Key.IsRestored, item.Value.InBoxQuantity, pack.PackID, item.Value.AvailableQuantity));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }
Exemple #8
0
 private bool ShouldExecuteVerification(VerifyArgs args, Verification v)
 {
     return(args.Verifications.Any(verification => verification == Verification.All || verification == v));
 }
Exemple #9
0
        static void Main(string[] args)
        {
            Player player1 = new Player();

            player1.PlayerName     = "Magnus";
            player1.PlayerSurname  = "Carlsen";
            player1.TcNo           = "245165496";
            player1.PlayerBirthday = "30.11.1990";

            Player player2 = new Player();

            player2.PlayerName     = "Hikaru";
            player2.PlayerSurname  = "Nakamura";
            player2.TcNo           = "996526512";
            player2.PlayerBirthday = "9.12.1987";

            E_Devlet eDevletPlayerInformation1 = new E_Devlet();

            eDevletPlayerInformation1.E_devlet_Isim     = "Magnus";
            eDevletPlayerInformation1.E_devlet_Soyad    = "Carlsen";
            eDevletPlayerInformation1.E_devlet_TcNo     = "245165496";
            eDevletPlayerInformation1.E_devlet_Birthday = "30.11.1990";

            Game game1 = new Game();

            game1.GameName  = "Cyberpunk";
            game1.GamePrice = 249;

            Game game2 = new Game();

            game2.GameName  = "Age of Empires II";
            game2.GamePrice = 31;

            Game game3 = new Game();

            game1.GameName  = "Assasin's Creed: Odyssey";
            game1.GamePrice = 249;

            Game game4 = new Game();

            game1.GameName  = "SpiderMan: Miles Morales";
            game1.GamePrice = 499;


            Verification verification = new Verification();

            verification.PlayerControl(player1, eDevletPlayerInformation1);

            Console.WriteLine("------------------------------");

            ICampaignServices campaignManager = new CampaignManager();

            campaignManager.CampaignEntry(game1);
            campaignManager.DeleteCampaign(game1);
            campaignManager.UpdateCampaign(game1);

            Console.WriteLine("----------------------------");

            IPlayerServices playerManager = new PlayerManager();

            playerManager.NewPlayer(player1);
            playerManager.DeletePlayer(player1);
            playerManager.UpdatePlayer(player1);

            Console.WriteLine("-------------------------------");

            GameSaleManager gameSaleManager = new GameSaleManager();

            gameSaleManager.GameSale(player1, game2);

            Console.WriteLine("------------------------------");

            Console.ReadLine();
        }
Exemple #10
0
        private void AccountTransactionForm_Load(object sender, EventArgs e)
        {
            suggestion1CheckBox.Visible = false;
            suggestion2CheckBox.Visible = false;
            suggestion3CheckBox.Visible = false;

            using (var core = new StandardBusinessLayer(DataCache))
            {
                core.Connect();

                CurrentAccount      = core.GetAccount(_initialAccountNo);
                tagComboBox.Visible = CurrentAccount.Type == AccountType.Asset;
                tagLabel.Visible    = tagComboBox.Visible;
                int accountingYear = DataCache.Settings.AccountingYear;

                //var verifications = (from v in core.GetUnbalancedAndEmptyVerifications(accountingYear)
                //                     orderby v.No descending
                //                     select new
                //                                {
                //                                    No = v.No,
                //                                    Name = v.Year.ToString() + "-" + v.SerialNo.ToString()
                //                                }).ToList();

                var verifications = (from v in DataCache.GetUnbalancedAndEmptyVerifications()
                                     orderby v.No descending
                                     select new
                {
                    No = v.No,
                    Name = v.Year.ToString() + "-" + v.SerialNo.ToString()
                }).ToList();

                if (!verifications.Any())
                {
                    verifications.Insert(0, new { No = 0, Name = "Ny affärshändelse" });
                }

                if (_initialVerificationNo > 0 && verifications.All(x => x.No != _initialVerificationNo))
                {
                    Verification verification = DataCache.GetVerification(_initialVerificationNo);
                    //Verification verification = core.GetVerification(_initialVerificationNo);
                    verifications.Add(new { No = verification.No, Name = verification.Date.Year.ToString() + "-" + verification.SerialNo.ToString() });
                }

                verificationComboBox.ValueMember   = "No";
                verificationComboBox.DisplayMember = "Name";
                verificationComboBox.DataSource    = verifications;

                if (_initialAccountTransactionNo > 0)
                {
                    AccountTransaction transaction = DataCache.GetAccountTransaction(_initialAccountTransactionNo);

                    verificationComboBox.SelectedValue = _initialVerificationNo;

                    dateTimePicker.Value           = transaction.TransactionTime;
                    accountingDateTimePicker.Value = transaction.AccountingDate;
                    amountTextBox.Text             = transaction.Amount.ToString(CurrentApplication.MoneyEditFormat);
                    noteTextBox.Text = transaction.Note;
                }
                else
                {
                    verificationComboBox.SelectedIndex = verifications.Count() - 1;
                }

                _tagHandler = new TagHandler(DataCache, _initialAccountNo);

                tagComboBox.DataSource   = _tagHandler.ComboBoxItems;
                tagComboBox.SelectedItem = _tagHandler.GetDefaultComboBoxItem();
            }

            _accountingDateSameAsTransactionTime = false;
            if (dateTimePicker.Value == accountingDateTimePicker.Value)
            {
                _accountingDateSameAsTransactionTime = true;
            }

            EnableDisableControls();
        }
        private static async Task <int[]> ProcessMergesAsync(List <TraveltimeSegment> input, Verification verifyType, QueryManager <TraveltimeStatic> staticInfoQuerier)
        {
            string segment = input?[0]?.Id == null ? "" : input?[0]?.Id;

            int          itemsPerThread = input.Count / THREADS;
            int          currentIndex   = 0;
            List <Task>  tasks          = new List <Task>();
            List <int[]> resultCounts   = new List <int[]>();

            while (currentIndex < input.Count)
            {
                int itemCount = currentIndex + itemsPerThread < input.Count ? itemsPerThread : input.Count - currentIndex;
                List <TraveltimeSegment> slicedInput;
                try
                {
                    slicedInput = input.GetRange(currentIndex, itemsPerThread);
                }
                catch (System.ArgumentException ex)
                {
                    slicedInput = input.GetRange(currentIndex, input.Count - currentIndex);
                }
                Task <int[]> t = new Task <int[]>(() => ProcessMerges(slicedInput, verifyType, staticInfoQuerier));
                t.Start();
                int[] results = await t;
                resultCounts.Add(results);
                currentIndex += itemCount;
                Console.WriteLine($"status: {segment} {currentIndex}/{input.Count}");
            }


            int[] totalResultCounts = { 0, 0, 0 };
            foreach (int[] i in resultCounts)
            {
                for (int j = 0; j < totalResultCounts.Length; j++)
                {
                    if (j < i.Length)
                    {
                        totalResultCounts[j] += i[j];
                    }
                }
            }
            return(totalResultCounts);
        }
        private static async Task TransformationTask(QueryManager <TraveltimeSegment> queryManager, QueryManager <TraveltimeStatic> staticInfoQuerier, Verification verifyType, string segment, DateTime?startDate = null)
        {
            Console.WriteLine($"Fetching documents for segment {segment}, this will take a while...");
            List <TraveltimeSegment> input = queryManager.GetAllResults($"select * from c where c.TrajectID = '{segment}'");

            Console.WriteLine($"Processing segment: {segment}, fetched {input.Count} documents");

            // Console.WriteLine($"Fetched {input.Count} documents");

            //Console.WriteLine("Processing transformations...");
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            int[] res = await ProcessMergesAsync(input, verifyType, staticInfoQuerier);

            stopwatch.Stop();

            Console.WriteLine($"Processing finished for segment {segment} (thread: {Thread.CurrentThread.ManagedThreadId}) in {stopwatch.Elapsed}: {res[0]} succeeded, {res[1]} failed, {res[2]} skipped");
        }
 public static async Task TransformAndPersist(QueryManager <TraveltimeSegment> queryManager, QueryManager <TraveltimeStatic> staticInfoQuerier, Verification verifyType, string[] segmentIds, DateTime?startDate = null)
 {
     foreach (string segment in segmentIds)
     {
         Console.WriteLine("Processing documents for segment: " + segment);
         await TransformationTask(queryManager, staticInfoQuerier, verifyType, segment, startDate);
     }
 }
        public ActionResult SendToVerification(int id)
        {
            var userId = WebSecurity.GetUserId(User.Identity.Name);

            // Delete existing verification items for this user
            //var userItems = _db.Verifications.Where(x => x.UserId == userId);
            //var removeRange = _db.Verifications.RemoveRange(userItems);
            //var saveChanges = _db.SaveChanges();

            var lockedSections =
                _db.Verifications.Where(x => x.UserId == userId && x.Editable == false).Select(x => x.QQCategoryId).ToList();

            var applicationDataToVerify = _db.Responses.Where(x => x.UserId == userId && x.QuestionnaireId == 1 && !lockedSections.Contains(x.QuestionnaireQCategoryId)).ToList();

            var distinctQCategoryIds = applicationDataToVerify.Select(x => x.QCategoryId).Distinct();

            foreach (var qCategoryId in distinctQCategoryIds)
            {
                var distinctSubOrdinals = applicationDataToVerify.Where(x => x.QCategoryId == qCategoryId).Select(x => x.SubOrdinal).Distinct().ToList();
                for (var i = 0; i < distinctSubOrdinals.Count(); i++)
                {
                    var subOrdinal      = distinctSubOrdinals[i];
                    var questionnaireId = applicationDataToVerify[i].QuestionnaireId;

                    var categoryId   = qCategoryId;
                    var categoryName = _db.QCategories.Single(x => x.QCategoryId == categoryId).QCategoryName;
                    var qqCategoryId =
                        applicationDataToVerify.First(x => x.QCategoryId == qCategoryId && x.SubOrdinal == subOrdinal)
                        .QuestionnaireQCategoryId;

                    var subOrdinalQuestions = applicationDataToVerify.Where(x => x.QCategoryId == categoryId && x.SubOrdinal == subOrdinal).Select(x => new { x.QuestionText, x.ResponseItem });
                    var itemInfo            = "<b>" + categoryName.ToUpper() + "</b><br />";
                    itemInfo += subOrdinalQuestions.Aggregate("", (current, item) => current + ("<i>" + item.QuestionText + ":</i> " + item.ResponseItem + "<br />"));

                    if (_db.Verifications.Any(x => x.QQCategoryId == qqCategoryId))
                    {
                        //update
                        var verification = _db.Verifications.Single(x => x.QQCategoryId == qqCategoryId);
                        verification.ItemInfo         = itemInfo;
                        verification.Editable         = false;
                        _db.Entry(verification).State = (EntityState)System.Data.Entity.EntityState.Modified;
                    }
                    else
                    {
                        // make new
                        var verifyQCategory = new Verification
                        {
                            QuestionnaireId = questionnaireId,
                            UserId          = userId,
                            QCategoryId     = qCategoryId,
                            QQCategoryId    = qqCategoryId,
                            SubOrdinal      = subOrdinal,
                            ItemInfo        = itemInfo,
                            ItemVerified    = false,
                            ItemStepLevel   = "",
                            Editable        = false
                        };
                        _db.Verifications.Add(verifyQCategory);
                    }
                }
            }
            _db.SaveChanges();
            return(View());
        }
        private void btnCompute_Click(object sender, EventArgs e)
        {
            if (!bEditProject)
            {
                txtWeightEstName.Text = txtWeightEstName.Text.Trim();
                if (txtWeightEstName.Text.Length == 0)
                {
                    MessageBox.Show("设计数据名称不能为空!");
                    return;
                }

                if (Verification.IsCheckString(txtWeightEstName.Text))
                {
                    MessageBox.Show("设计数据名称含有非法字符");
                    return;
                }
                curWa.DataName = txtWeightEstName.Text;
            }

            for (int i = 0; i < curWa.FormulaList.Count; ++i)
            {
                CExpression expr = curExprList[i];
                foreach (WeightParameter wp in curWa.FormulaList[i].ParaList)
                {
                    expr.SetVariableValue(wp.ParaName, wp.ParaValue);
                }

                double value = expr.Run();
                if (double.IsInfinity(value) || double.IsNaN(value))
                {
                    MessageBox.Show("参数值或公式有误!节点: " + curWa.FormulaList[i].NodePath);
                    return;
                }
                curWa.FormulaList[i].Value = value;
            }


            //curWa.WriteArithmeticFile("test.xml", true);

            if (mainForm.designProjectData == null)
            {
                CoreDesignProject coreForm = new CoreDesignProject(mainForm, "new");
                coreForm.ShowDialog();
            }

            if (mainForm.designProjectData.lstWeightArithmetic == null)
            {
                mainForm.designProjectData.lstWeightArithmetic = new List <WeightArithmetic>();
            }


            //计算
            Dictionary <WeightParameter, WeightParameter> wpDict = new Dictionary <WeightParameter, WeightParameter>();

            List <WeightFormula> FormulaList = new List <WeightFormula>();

            foreach (WeightFormula formula in curWa.FormulaList)
            {
                List <WeightParameter> ParaList = new List <WeightParameter>();
                foreach (WeightParameter para in formula.ParaList)
                {
                    WeightParameter tempWp = null;
                    if (!wpDict.ContainsKey(para))
                    {
                        tempWp = new WeightParameter(para);
                        wpDict.Add(para, tempWp);
                    }
                    else
                    {
                        tempWp = wpDict[para];
                    }
                    ParaList.Add(tempWp);
                }
                formula.ParaList = ParaList;
            }

            if (!bEditProject)
            {
                mainForm.designProjectData.lstWeightArithmetic.Add(curWa);
                mainForm.BindProjectTreeData(mainForm.designProjectData);
                mainForm.SetWeightDesignTab(curWa, mainForm.designProjectData.lstWeightArithmetic.Count - 1);

                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"计算完成!");
            }
            else
            {
                //刷新页面
                mainForm.SetWeightDesignReuslt(curWa);
                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"重新计算完成!");
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        internal CompilationVerifier CompileAndVerify(
            Compilation compilation,
            IEnumerable <ResourceDescription> manifestResources = null,
            IEnumerable <ModuleData> dependencies        = null,
            Action <IModuleSymbol> sourceSymbolValidator = null,
            Action <PEAssembly> assemblyValidator        = null,
            Action <IModuleSymbol> symbolValidator       = null,
            SignatureDescription[] expectedSignatures    = null,
            string expectedOutput   = null,
            int?expectedReturnCode  = null,
            string[] args           = null,
            EmitOptions emitOptions = null,
            Verification verify     = Verification.Passes)
        {
            Assert.NotNull(compilation);

            Assert.True(expectedOutput == null ||
                        (compilation.Options.OutputKind == OutputKind.ConsoleApplication || compilation.Options.OutputKind == OutputKind.WindowsApplication),
                        "Compilation must be executable if output is expected.");

            if (verify == Verification.Passes)
            {
                // Unsafe code might not verify, so don't try.
                var csharpOptions = compilation.Options as CSharp.CSharpCompilationOptions;
                verify = (csharpOptions == null || !csharpOptions.AllowUnsafe) ? Verification.Passes : Verification.Skipped;
            }

            if (sourceSymbolValidator != null)
            {
                var module = compilation.Assembly.Modules.First();
                sourceSymbolValidator(module);
            }

            CompilationVerifier result = null;

            var verifier = Emit(compilation,
                                dependencies,
                                manifestResources,
                                expectedSignatures,
                                expectedOutput,
                                expectedReturnCode,
                                args ?? Array.Empty <string>(),
                                assemblyValidator,
                                symbolValidator,
                                emitOptions,
                                verify);

            if (result == null)
            {
                result = verifier;
            }
            else
            {
                // only one emitter should return a verifier
                Assert.Null(verifier);
            }

            // If this fails, it means that more that all emitters failed to return a validator
            // (i.e. none thought that they were applicable for the given input parameters).
            Assert.NotNull(result);

            return(result);
        }
Exemple #17
0
        public void Emit(string expectedOutput, int?expectedReturnCode, string[] args, IEnumerable <ResourceDescription> manifestResources, EmitOptions emitOptions, Verification peVerify, SignatureDescription[] expectedSignatures)
        {
            using var testEnvironment = RuntimeEnvironmentFactory.Create(_dependencies);

            string mainModuleName = Emit(testEnvironment, manifestResources, emitOptions);

            _allModuleData = testEnvironment.GetAllModuleData();
            testEnvironment.Verify(peVerify);

            if (expectedSignatures != null)
            {
                MetadataSignatureUnitTestHelper.VerifyMemberSignatures(testEnvironment, expectedSignatures);
            }

            if (expectedOutput != null || expectedReturnCode != null)
            {
                var returnCode = testEnvironment.Execute(mainModuleName, args, expectedOutput);

                if (expectedReturnCode is int exCode)
                {
                    Assert.Equal(exCode, returnCode);
                }
            }
        }
Exemple #18
0
 public async Task <Response <string> > VerifyUserAsync(Verification verification)
 {
     return(await this.SendPutRequest(VERIFICATIONS_URI, verification));
 }
Exemple #19
0
 public TransactionRequest()
 {
     Verification = new Verification();
     Order        = new Order();
     Version      = "3.1.1.15";
 }
Exemple #20
0
        public static MetadataReference CompileToMetadata(string source, string assemblyName = null, IEnumerable <MetadataReference> references = null, Verification verify = Verification.Passes)
        {
            if (references == null)
            {
                references = new[] { TestBase.MscorlibRef };
            }
            var compilation = CreateCompilationWithMscorlib(source, assemblyName, references);
            var verifier    = Instance.CompileAndVerifyCommon(compilation, verify: verify);

            return(MetadataReference.CreateFromImage(verifier.EmittedAssemblyData));
        }
Exemple #21
0
    public static void Diff(string[] options, string[] args)
    {
        if (!Verification.ProfileIsValid())
        {
            return;
        }

        if (args.Length == 0)
        {
            Msg.InfoDiff();
            return;
        }

        if (args.Length > 2)
        {
            ErrorMsg.TooManyArgs();
            return;
        }

        string rootFileOld = null;
        string rootFileNew = null;

        int?previousVersionOld = null;
        int?previousVersionNew = null;

        bool isRemoteOld = false;
        bool isRemoteNew = false;

        foreach (string option in options)
        {
            if (option == "--workspace" || option == "-w")
            {
                if (rootFileOld == null)
                {
                    rootFileOld = Program.settings.Read("workspace") + "/";
                }
                else
                {
                    rootFileNew = Program.settings.Read("workspace") + "/";
                }
            }
            else if (option == "--remote" || option == "-r")
            {
                if (rootFileOld == null)
                {
                    rootFileOld = Program.settings.Read("remote") + "/";
                    isRemoteOld = true;
                }
                else
                {
                    rootFileNew = Program.settings.Read("remote") + "/";
                    isRemoteNew = true;
                }
            }
            else if (option == "--other" || option == "-o")
            {
                if (rootFileOld == null)
                {
                    rootFileOld = "";
                }
                else
                {
                    rootFileNew = "";
                }
            }
            else
            {
                // Check if option is version notation (for example -3)
                if (int.TryParse(option, out int revisionStamp))
                {
                    if (previousVersionOld == null)
                    {
                        previousVersionOld = revisionStamp;
                    }
                    else
                    {
                        previousVersionNew = revisionStamp;
                    }
                }
            }
        }

        if (previousVersionNew == null)
        {
            previousVersionNew = 0;
        }

        if (previousVersionOld == null)
        {
            previousVersionOld = 0;
        }

        if (rootFileNew == null)
        {
            rootFileNew = rootFileOld;
        }

        string relPathOld = null;
        string relPathNew = null;

        foreach (string arg in args)
        {
            if (relPathOld == null)
            {
                relPathOld = arg;
            }
            else
            {
                relPathNew = arg;
            }
        }

        if (relPathNew == null)
        {
            relPathNew  = relPathOld;
            isRemoteNew = isRemoteOld;
        }

        string absPathOld = rootFileOld + relPathOld;
        string absPathNew = rootFileNew + relPathNew;

        Console.WriteLine(absPathOld + " " + previousVersionOld);
        Console.WriteLine(absPathNew + " " + previousVersionNew);

        string oldText = (isRemoteOld)
            ? GetFileRemote(absPathOld, (int)previousVersionOld)
            : File.ReadAllText(absPathOld);

        string newText = (isRemoteNew)
            ? GetFileRemote(absPathNew, (int)previousVersionNew)
            : File.ReadAllText(absPathNew);

        if (newText == null || oldText == null)
        {
            return;
        }

        List <SubText> compareResult = GetLCScollection(oldText, newText);

        foreach (SubText result in compareResult)
        {
            switch (result.blockType)
            {
            case BlockType.AddedText:
                Print.WriteBlueWord(result.text);
                break;

            case BlockType.RemovedText:
                Print.WriteRedWord(result.text);
                break;

            case BlockType.LCStext:
                Console.Write(result.text);
                break;
            }
        }

        Console.WriteLine();
    }
Exemple #22
0
 public Location AlwaysAllow(Verification allow)
 {
     alwaysAllow = allow;
     return(this);
 }
 public AddVerificationEvent(Verification verification)
 {
     Verification = verification;
 }
Exemple #24
0
 public Location Allow(Verification allow)
 {
     this.allow = allow;
     return(this);
 }
 public override async Task <ActionResult> RejectAsync(Verification model)
 {
     return(await base.RejectAsync(model).ConfigureAwait(true));
 }
        /// <summary>
        /// 页面验证
        /// </summary>
        /// <returns></returns>
        private string PageVerification()
        {
            string strErroInfo = string.Empty;

            if (txtDesignDataName.Text == string.Empty)
            {
                strErroInfo = "请输入设计数据名称";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(txtDesignDataName.Text))
                {
                    strErroInfo = "设计数据名称不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtDesignDataSumlieter.Text == string.Empty)
            {
                strErroInfo = "请输入设计数据提交者";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(txtDesignDataSumlieter.Text))
                {
                    strErroInfo = "设计数据提交者不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtHelicopterName.Text == string.Empty)
            {
                strErroInfo = "请输入直升机名称";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckSignleString(txtHelicopterName.Text))
                {
                    strErroInfo = "直升机名称不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtDesignTakingWeight.Text != string.Empty)
            {
                if (Verification.IsDoubleNumer(txtDesignTakingWeight.Text) == false)
                {
                    strErroInfo = "设计起飞重量格式错误";
                    return(strErroInfo);
                }
            }

            if (txtDagtaRemark.Text != string.Empty)
            {
                if (Verification.IsCheckRemarkString(txtDagtaRemark.Text))
                {
                    strErroInfo = "数据备注不能输入非法字符";
                    return(strErroInfo);
                }
            }

            return(strErroInfo);
        }
Exemple #27
0
        private void Run(string[] args)
        {
            ArgumentsObject arguments = Configuration.Configure<ArgumentsObject>().CreateAndBind(args);

            if(arguments.Help || args.Length == 0) {
                ShowHelp();
                return;
            }

            var prowlClient = new ProwlClient();

            if (arguments.RetrieveToken)
            {
                RetrieveToken retrieveToken = new RetrieveToken();
                retrieveToken.ProviderKey = arguments.ProviderKey;

                RetrieveTokenResult result = prowlClient.RetreiveToken(retrieveToken);
                System.Console.WriteLine("Token retreived\nToken: {0}\nUrl: {1}",
                    result.Token,
                    result.Url);

                return;
            }

            if (arguments.NewKey) {
                if(string.IsNullOrEmpty(arguments.Token) || string.IsNullOrEmpty(arguments.ProviderKey)) {
                    System.Console.WriteLine("ProviderKey and Token required for this operation.");
                    return;
                }
                RetrieveApikey retrieveApikey = new RetrieveApikey();
                retrieveApikey.Token = arguments.Token;
                retrieveApikey.ProviderKey = arguments.ProviderKey;

                RetrieveApikeyResult retrieveApikeyResult = prowlClient.RetrieveApikey(retrieveApikey);
                System.Console.WriteLine("New APIKEY: {0}");
                return;
            }

            if (string.IsNullOrEmpty(arguments.Key)) {
                System.Console.WriteLine("ApiKey requried");
                return;
            }

            if(arguments.Verify) {
                IVerification v = new Verification();
                v.ApiKey = arguments.Key;
                v.ProviderKey = arguments.ProviderKey;
                System.Console.WriteLine("Sending verification...");
                VerificationResult verificationResult = prowlClient.SendVerification(v);
                System.Console.WriteLine("Verification {3}\n\tVerification returned: {0} \n\tNumber of messages left to send: {1}\n\tReset UNIX timestamp: {2}",
                    verificationResult.ResultCode,
                    verificationResult.RemainingMessageCount.ToString(),
                    verificationResult.TimeStamp,
                    verificationResult.ResultCode == "200" ? "OK" : "NOT OK");
            }
            else {
                if (string.IsNullOrEmpty(arguments.Event))
                {
                    System.Console.WriteLine("Event is required");
                    return;
                }

                if (string.IsNullOrEmpty(arguments.Application))
                {
                    System.Console.WriteLine("Application is required");
                    return;
                }

                var notification = new Notification
                {
                    Application = arguments.Application,
                    Description = arguments.Description,
                    Event = arguments.Event,
                    Url = arguments.Url
                };

                switch (arguments.Priority.ToLower())
                {
                    case "verylow":
                        notification.Priority = NotificationPriority.VeryLow;
                        break;
                    case "moderate":
                        notification.Priority = NotificationPriority.Moderate;
                        break;
                    case "high":
                        notification.Priority = NotificationPriority.High;
                        break;
                    case "emergency":
                        notification.Priority = NotificationPriority.Emergency;
                        break;
                    default:
                        notification.Priority = NotificationPriority.Normal;
                        break;
                }

                foreach (string s in arguments.Key.Split(new[] { ',', ';' }))
                {
                    notification.AddApiKey(s);
                }

                NotificationResult notificationResult= prowlClient.SendNotification(notification);

                System.Console.WriteLine("Remaing number of messages: {0}", notificationResult.RemainingMessageCount.ToString());
            }
        }
Exemple #28
0
 public static async Task VerifyAsync(string tenant, long loginId, int userId, Verification model)
 {
     var repository = new FormRepository("hrm", "resignations", tenant, loginId, userId);
     await repository.VerifyAsync(model).ConfigureAwait(false);
 }
Exemple #29
0
        public async Task Verify()
        {
            if (!(Context.User is SocketGuildUser guildUser))
            {
                return;
            }

            var discordId          = guildUser.Id;
            var guildId            = Context.Guild.Id;
            var verificationResult = await _verificationStorage.GetVerification(guildId, discordId);

            if (verificationResult != null)
            {
                await ReplyAsync("You are already verified in this server.");

                return;
            }

            var dmChannel = await Context.User.GetOrCreateDMChannelAsync();

            var verification = new Verification {
                GuildId = guildId, DiscordId = discordId
            };

            try
            {
                await _verificationService.VerifyCode(async message =>
                {
                    try
                    {
                        await dmChannel.SendMessageAsync("After you authenticate with your corp account, we will collect and store your department, alias, " +
                                                         "and your corp user id. This data will only be used to validate your current status for the purpose of managing the verified role on this server.");
                        await dmChannel.SendMessageAsync(message);
                        await ReplyAsync($"{Context.User.Mention}, check your DMs for instructions.");
                    }
                    catch (HttpException ex) when(ex.DiscordCode == 50007)
                    {
                        await ReplyAsync($"{Context.User.Mention}, Please temporarily allow DMs from this server and try again.");
                        return;
                    }
                });

                await _verificationService.LoadUserDetails(Context.Configuration.Organization);

                if (_verificationService.Alias.Contains("#EXT#"))
                {
                    await dmChannel.SendMessageAsync("This account is external to Microsoft and is not eligible for validation.");

                    return;
                }

                if (Context.Configuration.RequiresOrganization && !_verificationService.Organization.Equals(Context.Configuration.Organization))
                {
                    await dmChannel.SendMessageAsync($"We see that you are a current Microsoft employee, however, this server requires that you be in a specific org in order to receive the validated status.");

                    return;
                }

                if (!Context.Configuration.AllowedUserTypesFlag.HasFlag(_verificationService.UserType))
                {
                    await dmChannel.SendMessageAsync($"Verification requires that you be one of the following: {Context.Configuration.AllowedUserTypesFlag}");

                    return;
                }

                var corpUserId = Guid.Parse(_verificationService.UserId);

                verification.CorpUserId  = corpUserId;
                verification.Alias       = _verificationService.Alias;
                verification.ValidatedOn = DateTimeOffset.UtcNow;
                verification.Department  = _verificationService.Department;
                await _verificationStorage.SaveVerification(verification);

                await dmChannel.SendMessageAsync($"Thanks for validating your status with Microsoft. You can unlink your accounts at any time with the `{Context.Configuration.Prefix}microsoft leave` command.");

                var role = Context.Guild.Roles.SingleOrDefault(a => a.Id == ulong.Parse(Context.Configuration.RoleId));
                await guildUser.AddRoleAsync(role);
            }
            catch (VerificationException ex) when(ex.ErrorCode == "code_expired")
            {
                _logger.LogInformation($"Code expired for {Context.User.Username}#{Context.User.Discriminator}");
                await dmChannel.SendMessageAsync("Your code has expired.");
            }
            catch (Exception ex)
            {
                await dmChannel.SendMessageAsync("An error occurred saving your validation. Please try again later.");

                _logger.LogCritical(ex, ex.Message);
            }
        }
Exemple #30
0
    public static void Show(string[] options, string[] args)
    {
        if (!Verification.ProfileIsValid())
        {
            return;
        }

        if (options.Length == 0)
        {
            ErrorMsg.NoOptions();
            return;
        }

        if (args.Length == 0)
        {
            ErrorMsg.NoArgs();
            return;
        }

        if (options.Length > 2)
        {
            ErrorMsg.TooManyOptions();
            return;
        }

        if (args.Length > 1)
        {
            ErrorMsg.TooManyArgs();
            return;
        }

        bool wOption = false;
        bool rOption = false;

        int previousVersion = 0;

        foreach (string option in options)
        {
            switch (option)
            {
            case "-w":
            case "--workspace":
                wOption = true;
                break;

            case "-r":
            case "--remote":
                rOption = true;
                break;

            default:

                // Check if option is version notation (for example -3)
                if (int.TryParse(option, out previousVersion))
                {
                    break;
                }

                ErrorMsg.UnknownOption();
                return;
            }
        }

        if (wOption && !rOption)
        {
            ShowFileWorkSpace(args[0]);
        }

        if (rOption && !wOption)
        {
            ShowFileRemote(args[0], previousVersion);
        }
    }
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (txtName.Text == string.Empty)
            {
                MessageBox.Show("算法名称不能为空!");
                return;
            }
            else
            {
                if (Verification.IsCheckSignleString(txtName.Text))
                {
                    MessageBox.Show("算法名称包含非法字符!");
                    txtName.Focus();
                    return;
                }
            }

            if (txtRemark.Text != string.Empty)
            {
                if (Verification.IsCheckRemarkString(txtRemark.Text))
                {
                    MessageBox.Show("算法备注包含非法字符!");
                    return;
                }
            }

            List <WeightParameter> templistpara = waData.GetParaList();
            bool bParaPrompt = false;

            foreach (WeightParameter wp in templistpara)
            {
                //if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                if (wp.ParaType == 10)
                {
                    bParaPrompt = true;
                    break;
                }
            }

            if (bParaPrompt)
            {
                if (MessageBox.Show("算法中含有未定义参数(临时参数)!\r\n保存算法前是否对这些参数进行设定?", "参数定义", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    List <WeightParameter> listparaforset = new List <WeightParameter>();
                    foreach (WeightParameter wp in templistpara)
                    {
                        //if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                        if (wp.ParaType == 10)
                        {
                            listparaforset.Add(wp);
                        }
                    }
                    TempWeightParaSet form = new TempWeightParaSet(listparaforset);
                    form.ShowDialog();
                }
            }

            bool bprompt = (strType == "edit") ? false : true;

            waData.SortName       = comboBoxWeightSort.Text;
            waData.Name           = txtName.Text;
            waData.CreateTime     = dateTimePickerCreateTime.Text;
            waData.LastModifyTime = dateTimePickerLastModifyTime.Text;
            waData.Remark         = txtRemark.Text;

            if (WriteArithmeticFile(waData, bprompt) == false)
            {
                return;
            }

            strWeightSortName           = waData.SortName;
            strWeightArithmeticFileName = waData.Name;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemple #32
0
        public HttpResponseMessage Verification(Verification Verification)
        {
            int ret = repository.Verification(pclsCache, Verification.userId, Verification.PwType);

            return(new ExceptionHandler().Verification(Request, ret));
        }
Exemple #33
0
        public void VerifyOnlineBillPay()
        {
            IWebDriver ChromeDriver = new ChromeDriver();

            ChromeDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
            ChromeDriver.Manage().Timeouts().PageLoad     = TimeSpan.FromSeconds(10);
            ChromeDriver.Manage().Window.Maximize();
            ChromeDriver.Navigate().GoToUrl($"https://{_baseSite}.mypatientvisit.com");
            IWebElement verifyLoginPage = ChromeDriver.FindElement(By.XPath("//input[@placeholder='Enter Username']"));

            WriteFile.WriteToFile("Login Page is Confirmed");
            Assert.IsTrue(verifyLoginPage.Enabled, "Login page is displayed");
            Verification.Sleep();

            //Login in MPV with correct credentials
            ChromeDriver.FindElement(By.XPath("//input[@placeholder='Enter Username']")).SendKeys("selenium");
            ChromeDriver.FindElement(By.XPath("//input[@name='Password']")).SendKeys("Password.1");
            ChromeDriver.FindElement(By.XPath("//input[@value='Login']")).SendKeys(Keys.Enter);
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//*[contains(text(), 'SELECT THE ')]")).Enabled);
            WriteFile.WriteToFile("Select the Medical Record Page is confirmed");
            ChromeDriver.FindElement(By.XPath("(//img[starts-with(@src, 'data:image/JPEG;base64,iVBORw')])[1]")).Click();
            Verification.Sleep();

            //Verify that the dashboard is displayed
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//h2[@class='ng-binding']")).Enabled, "Failed :- Dashboard is not present");
            WriteFile.WriteToFile("Dashboard is Present - REGRESSION TEST");
            System.Threading.Thread.Sleep(5000);

            //Navigating to myBillPay tab
            ChromeDriver.FindElement(By.XPath("//a[@class='dropdown-toggle']//span[@translate-once='BILLPAY']//following-sibling::span//parent::a")).Click();
            ChromeDriver.FindElement(By.XPath("//a[@href='#billPay']")).Click();
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//span[contains(text(), 'Account Balance')]")).Enabled);
            WriteFile.WriteToFile("Online Bill Pay Page is confirmed");

            //Making a partial Payment
            ChromeDriver.FindElement(By.XPath("//div[@class='md-on']//ancestor::md-radio-button[@aria-label='Partial Payment']")).Click();
            ChromeDriver.FindElement(By.XPath("//input[@id='partialPaymentAmount']")).SendKeys("20.20");

            //Selecting Visa as the card type
            ChromeDriver.FindElement(By.XPath("//div[@class='md-on']//ancestor::md-radio-button[@aria-label='Visa']")).Click();
            ChromeDriver.SwitchTo().Frame(ChromeDriver.FindElement(By.XPath("//iframe[@id='tokenframe']")));

            ChromeDriver.FindElement(By.XPath("//input[@id='ccnumfield']")).SendKeys("4111111111111111");
            ChromeDriver.SwitchTo().DefaultContent();
            ChromeDriver.FindElement(By.XPath("//input[@name='expiration']")).SendKeys("102020");
            ChromeDriver.FindElement(By.XPath("//input[@type='submit']")).Click();

            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//*[contains(text(),'Yes')]")).Enabled);
            WriteFile.WriteToFile("Confirmation Dialog is Present");
            ChromeDriver.FindElement(By.XPath("//*[contains(text(),'Yes')]")).Click();

            //Verifying if the Payment Confirmation Page is displayed
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//*[contains(text(), 'Thank you')]")).Enabled);
            WriteFile.WriteToFile("Payment Confirmation Page is displayed");

            //Clicking the return to dashboard button
            ChromeDriver.FindElement(By.XPath("//i[@aria-label='Go back to the dashboard']")).Click();

            //Verifying that the Dashboard is present
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//h2[@class='ng-binding']")).Displayed);

            //Navigating to myBillPay tab
            ChromeDriver.FindElement(By.XPath("//a[@class='dropdown-toggle']//span[@translate-once='BILLPAY']//following-sibling::span//parent::a")).Click();
            ChromeDriver.FindElement(By.XPath("//a[@href='#billPay']")).Click();
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//span[contains(text(), 'Account Balance')]")).Enabled);
            WriteFile.WriteToFile("Online Bill Pay Page is confirmed");

            //Making a Full Payment
            ChromeDriver.FindElement(By.XPath("//div[@class='md-on']//ancestor::md-radio-button[@aria-label='Full Payment']")).Click();

            //Selecting Visa as the card type
            ChromeDriver.FindElement(By.XPath("//div[@class='md-on']//ancestor::md-radio-button[@aria-label='Visa']")).Click();
            ChromeDriver.SwitchTo().Frame(ChromeDriver.FindElement(By.XPath("//iframe[@id='tokenframe']")));

            ChromeDriver.FindElement(By.XPath("//input[@id='ccnumfield']")).SendKeys("4111111111111111");
            ChromeDriver.SwitchTo().DefaultContent();
            ChromeDriver.FindElement(By.XPath("//input[@name='expiration']")).SendKeys("102020");
            ChromeDriver.FindElement(By.XPath("//input[@type='submit']")).Click();

            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//*[contains(text(),'Yes')]")).Enabled);
            WriteFile.WriteToFile("Confirmation Dialog is Present");
            ChromeDriver.FindElement(By.XPath("//*[contains(text(),'Yes')]")).Click();

            //Verifying if the Payment Confirmation Page is displayed
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//*[contains(text(), 'Thank you')]")).Enabled);
            WriteFile.WriteToFile("Payment Confirmation Page is displayed");

            //Clicking the return to dashboard button
            ChromeDriver.FindElement(By.XPath("//i[@aria-label='Go back to the dashboard']")).Click();

            //Verifying that the Dashboard is present
            Assert.IsTrue(ChromeDriver.FindElement(By.XPath("//h2[@class='ng-binding']")).Displayed);

            //Logging off from the application
            ChromeDriver.FindElement(By.XPath("//span[@translate-once='SETTINGS']")).Click();
            ChromeDriver.FindElement(By.XPath("//span[@translate-once='LOGOFF']")).Click();
            ChromeDriver.Close();
        }
Exemple #34
0
        private async void Charge(Unit unit, Modifier modifier, bool isHero)
        {
            try
            {
                if (unit.Team != LocalHero.Team)
                {
                    return;
                }

                var effectName = "particles/units/heroes/hero_spirit_breaker/spirit_breaker_charge_target.vpcf";
                if (isHero)
                {
                    if (LocalHero.Handle == unit.Handle)
                    {
                        ColorScreen = true;
                    }

                    effectName = "materials/ensage_ui/particles/spirit_breaker_charge_target.vpcf";

                    var position   = unit.Position;
                    var pos        = Pos(position, SpiritBreakerChargeMenu.OnWorldItem);
                    var minimapPos = MinimapPos(position, SpiritBreakerChargeMenu.OnMinimapItem);

                    Verification.InfoVerification(pos, minimapPos, unit.Name, AbilityId.spirit_breaker_charge_of_darkness, 0, SpiritBreakerChargeMenu.SideMessageItem, SpiritBreakerChargeMenu.SoundItem);

                    if (SpiritBreakerChargeMenu.WriteOnChatItem)
                    {
                        DisplayMessage(unit);
                    }
                }

                ParticleManager.CreateOrUpdateParticle($"ChargeUnit", effectName, EntityManager.GetEntityByHandle(unit.Handle), ParticleAttachment.OverheadFollow);

                var spiritBreaker = EntityManager.GetEntities <Hero>().FirstOrDefault(x => !x.IsIllusion && x.HeroId == HeroId.npc_dota_hero_spirit_breaker);
                var speed         = spiritBreaker.GetAbilityById(AbilityId.spirit_breaker_charge_of_darkness).GetAbilitySpecialDataWithTalent(spiritBreaker, "movement_speed");

                var rawGameTime    = GameManager.RawGameTime;
                var firstIsVisible = false;

                do
                {
                    var isVisible = spiritBreaker.IsVisible;
                    if (isVisible)
                    {
                        rawGameTime    = GameManager.RawGameTime;
                        firstIsVisible = true;
                    }

                    if (firstIsVisible)
                    {
                        startChargePosition = spiritBreaker.Position.Extend(unit.Position, (GameManager.RawGameTime - rawGameTime) * speed);
                        endChargePosition   = unit.Position;
                        DrawLine("Charge", startChargePosition, endChargePosition, 150, 185, Color.DarkRed);

                        if (SpiritBreakerChargeMenu.OnMinimapItem)
                        {
                            OnMinimap = true;
                        }

                        if (!isVisible)
                        {
                            DrawRange("Charge", startChargePosition, 100, Color.Red, 180);
                        }
                        else
                        {
                            DrawRangeRemove("Charge");
                        }
                    }

                    await Task.Delay(50);
                }while (modifier.IsValid);

                ColorScreen = false;
                OnMinimap   = false;

                ParticleManager.RemoveParticle("ChargeUnit");
                DrawRangeRemove("Charge");
                DrawLineRemove("Charge");
                startChargePosition = Vector3.Zero;
            }
            catch (Exception e)
            {
                LogManager.Error(e);
            }
        }
Exemple #35
0
 public TransactionRequest(string merchantId, string merchantKey)
 {
     Verification = new Verification(merchantId, merchantKey);
     Order        = new Order();
     Version      = "3.1.1.15";
 }
Exemple #36
0
        private static List<Verification> SetupVerifications(Setup setup, EventStream stream, Mono.CSharp.Evaluator evaluator, string tab)
        {
            var verifications = new List<Verification>();

            // First set the verifications.
            foreach (var verifyList in setup.Verify)
            {
                var verifyBuilder = new StringBuilder(@"
            var func = new Func<IEventStream, IObservable<Unit>>(stream =>
            ");

                var filters = new List<string>();
                for (int i = 0; i < verifyList.Then.Count; i++)
                {
                    var var = ((char)(97 + i)).ToString(); // 97 == 'a'
                    var verify = verifyList.Then[i];
                    var topicType = setup.Topics.Find(verify.Topic);
                    Assert.True(topicType != TopicType.Unknown, "Undeclared topic '" + verify.Topic + "'");

                    var codeType = Brain.TopicCodeTypes.Find(topicType);

                    Assert.False((topicType == TopicType.Void && verify.Value != null),
                        string.Format("Cannot specify a value to compare for void topic '{0}' in verification '{1}'", verify.Topic, verify));

                    verifyBuilder.Append(tab).AppendLine("from {var} in stream.Commands<{type}>(\"{topic}\", \"{devices}\")".FormatWith(
                        new { var = var, type = codeType, topic = verify.Topic, devices = verify.Devices }));

                    // For void topics there's no need to filter out payload values,
                    // just getting a message with the given topic satisfies the query.
                    if (topicType != TopicType.Void)
                    {
                        // In this case we need to take into account the value
                        // received.
                        filters.Add("{var} == {value}".FormatWith(
                            new { var = var, value = FormatValue(topicType, verify.Value) }));
                    }
                }

                if (filters.Count > 0)
                {
                    verifyBuilder.Append(tab).Append("where ");
                    if (verifyList.Negate)
                    {
                        verifyBuilder
                            .Append("!(")
                            .Append(string.Join(" && ", filters))
                            .AppendLine(")");
                    }
                    else
                    {
                        verifyBuilder.AppendLine(string.Join(" && ", filters));
                    }
                }

                verifyBuilder
                    .Append(tab).AppendLine("select Unit.Default")
                    .AppendLine(");")
                    .AppendLine()
                    .Append("func;");

                Tracer.Get<BrainExercise>().Verbose("Buit verification query: " + verifyBuilder.ToString());

                var func = (Func<IEventStream, IObservable<Unit>>)evaluator.Evaluate(verifyBuilder.ToString());
                var query = func(stream);
                var verification = new Verification
                {
                    Expression = (verifyList.Negate ? "!" : "") +
                        string.Join(" and ", verifyList.Then.Select(t => t.ToString())),
                    Succeeded = verifyList.Negate,
                };

                if (verifyList.Negate)
                    query.Subscribe(_ => verification.Succeeded = false);
                else
                    query.Subscribe(_ => verification.Succeeded = true);

                verifications.Add(verification);
            }

            return verifications;
        }