Exemplo n.º 1
0
 private void SearchBoxVerify(object sender, KeyEventArgs e)
 {
     if (FilterBox.SelectedIndex == 0)
     {
         VerifyInput.VerifyNumber(sender, e);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Testar dina grundkunskaper.
        /// </summary>
        /// <returns>Procentvärde av resultat.</returns>
        public static double Grund(int debugX = 7)
        {
            const int max   = 9;
            int       score = 0;
            var       check = new CSRepvGrund();

            NiceDebug.Reset(debugX);

            score += VerifyInput(check.FörstaVärden(3, "A", "B", "C", "D", "Katt", "Hund"), "ABC");
            score += VerifyInput(check.FörstaVärden(9, "R", "A", "M", "M", "S", "T", "E", "I", "N", "Du Hast"), "RAMMSTEIN");

            score += VerifyInput(check.ForSkip(10, 3, '*'), new string('*', 6));
            score += VerifyInput(check.ForSkip(32, 7, '*'), new string('*', 27));

            score += VerifyInput(check.EleversBetyg("g", "G", "VG", "vg", "GV", "v", "V"), (2, 5));
            score += VerifyInput(check.EleversBetyg("vg", "vG", "G", "g", "V", "G", "v", "V", "VG", "KATT"), (3, 6));

            score += VerifyInput(check.VändPåOrdet("julafton"), "notfaluj");
            score += VerifyInput(check.VändPåOrdet("aluminium"), "muinimula");
            score += VerifyInput(check.VändPåOrdet("tacocat"), "tacocat");

            return(Math.Round((double)score / max * 100));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Testar dina grundkunskaper.
        /// </summary>
        /// <param name="debugX">Debugtext position<see cref="int"/>.</param>
        /// <returns>Procentvärde av resultat.</returns>
        public static double Grund(int debugX = 7)
        {
            const int  max   = 10;
            int        score = 0;
            CSRepGrund check = new CSRepGrund();

            NiceDebug.Reset(debugX);

            score += VerifyInput(check.SummeraText("112"), 4);
            score += VerifyInput(check.SummeraText("2+4=4"), 10);
            score += VerifyInput(check.SummeraText("*****@*****.**"), 21);
            score += VerifyInput(check.SummeraText("54.3"), 12);

            score += VerifyInput(check.Medelvärde(1, 4, 8, 12, 43, 12), 13);
            score += VerifyInput(check.Medelvärde(22, 32, 45, 67, 89, 11), 44);
            score += VerifyInput(check.Medelvärde(99, 44, 33, 22, 10), 41);
            score += VerifyInput(check.Medelvärde(10, 20), 15);

            score += VerifyInput(check.MinimiOchMaximiVärde(25, 234, 11, 4, 22), (4, 234));
            score += VerifyInput(check.MinimiOchMaximiVärde(-4, -22, -11, 0, 3), (-22, 3));

            return(Math.Round((double)score / max * 100));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Verify(VerifyInput verifyInput, CancellationToken cancellationToken)
        {
            VerifyResponse verifyResponse = await Payment.VerifyAsync(verifyInput.Token, cancellationToken);

            VerifyViewModel model = Mapper.Map <VerifyViewModel>(verifyResponse);

            model.Message = "عملیات انجام نشد";
            if (verifyResponse.Status == "1" && verifyResponse.Message == "OK")
            {
                model.Message = "عملیات با موفقیت انجام شد ";
                CustomUser user;
                if (User.Identity.IsAuthenticated)
                {
                    user = await UserManager.GetUserAsync(User);
                }
                else
                {
                    user = await UserManager.GetByToken(verifyInput.Token, cancellationToken);
                }

                user.Transactions = new List <Transact> {
                    new Transact
                    {
                        Balance      = verifyResponse.Amount.ToDecimal(),
                        Description  = verifyResponse.Description,
                        TransactType = TransactType.Creditor,
                        TransactDate = DateTime.Now,
                        CustomUserId = user.Id,
                        TransactId   = verifyResponse.TransId
                    }
                };
                user.PaymentToken    = string.Empty;
                user.AccountBalance += verifyResponse.Amount.ToDecimal();
                await UserManager.UpdateAsync(user);
            }
            return(View(model));
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var    db            = new TicketsDB();
            Ticket currentTicket = null;

            Console.WriteLine("Ticketing System 1.0\n");

            while (true)
            {
                if (currentTicket == null)
                {
                    Console.WriteLine($"Current ticket is not set\n");
                }
                else
                {
                    Console.WriteLine($"Current ticket: ID: {currentTicket.TicketID} - {currentTicket.Title}\n");
                }
                WriteColored.ColoredWriteLine("Available operations:\n");
                Console.WriteLine("0. Set current ticket(ID)");
                Console.WriteLine("1. Add a ticket(CreatorID, title, description)");
                Console.WriteLine("2. Display a specific ticket(ID)");
                Console.WriteLine("3. Display all active tickets");
                Console.WriteLine("4. Display all archived tickets");
                Console.WriteLine("5. Display all tickets");
                Console.WriteLine("6. Display employee data(ID)");

                WriteColored.ColoredWriteLine("\nCurrent Ticket based:");

                Console.WriteLine("7. Set ticket to finished");
                Console.WriteLine("8. Change ticket's title");
                Console.WriteLine("9. Change ticket's descriptions\n");


                var userInputOperation = Console.ReadKey(true);

                switch (userInputOperation.KeyChar)
                {
                case '0':
                {
                    int ticketID = VerifyInput.GetVerifyIdInput();

                    if (!db.CheckTicketIdExists(ticketID))
                    {
                        WriteColored.ColoredWriteLine("Ticket with that ID does not exist in the database");
                    }

                    else
                    {
                        currentTicket = db.GetTicket(ticketID);
                    }

                    break;
                }

                case '1':
                {
                    var creatorID = VerifyInput.GetVerifyIdInput();
                    if (!db.CheckEmployeeIdExists(creatorID))
                    {
                        WriteColored.ColoredWriteLine("Employee with that ID does not exist in the database");
                        break;
                    }
                    Console.WriteLine("Pass the ticket's title");
                    var title = Console.ReadLine();

                    Console.WriteLine("Pass the ticket's description");
                    var description = Console.ReadLine();

                    if (String.IsNullOrWhiteSpace(title) || String.IsNullOrWhiteSpace(description))
                    {
                        Console.WriteLine("\nTitle and description fields cannot be empty\n");
                        break;
                    }

                    db.AddTicket(creatorID, title, description);
                    break;
                }

                case '2':
                {
                    var ticket = db.GetTicket(VerifyInput.GetVerifyIdInput());
                    ticket.DisplayTicket();
                    break;
                }

                case '3':
                {
                    var ticketsActive = db.GetActiveTickets();

                    foreach (var ticket in ticketsActive)
                    {
                        ticket.DisplayTicket();
                    }
                    break;
                }

                case '4':
                {
                    var ticketsArchived = db.GetArchivedTickets();

                    foreach (var ticket in ticketsArchived)
                    {
                        ticket.DisplayTicket();
                    }
                    break;
                }

                case '5':
                {
                    var ticketsAll = db.GetAllTickets();


                    foreach (var ticket in ticketsAll)
                    {
                        ticket.DisplayTicket();
                    }
                    break;
                }

                case '6':
                {
                    var employeeID = VerifyInput.GetVerifyIdInput();
                    if (!db.CheckEmployeeIdExists(employeeID))
                    {
                        WriteColored.ColoredWriteLine("Employee with that ID does not exist in the database");
                        break;
                    }

                    var employee = db.GetEmployee(employeeID);
                    employee.DisplayInfo();
                    break;
                }

                case '7':
                {
                    if (currentTicket == null)
                    {
                        WriteColored.ColoredWriteLine("Current ticket is not defined");
                        break;
                    }

                    currentTicket.FinishTicket();
                    currentTicket = null;
                    break;
                }

                case '8':
                {
                    if (currentTicket == null)
                    {
                        WriteColored.ColoredWriteLine("Current ticket is not defined");
                        break;
                    }

                    WriteColored.ColoredWriteLine("Pass the new title");
                    string userInputArgument = Console.ReadLine();
                    currentTicket.ModifyTitle(userInputArgument);

                    break;
                }

                case '9':
                {
                    if (currentTicket == null)
                    {
                        WriteColored.ColoredWriteLine("Current ticket is not defined");
                        break;
                    }

                    Console.WriteLine("Pass the new description");
                    string userInputArgument = Console.ReadLine();
                    currentTicket.ModifyDescription(userInputArgument);
                    break;
                }

                default:
                    WriteColored.ColoredWriteLine("You've pressed a wrong character, you can only choose characters seen on the list\n");
                    break;
                }
                WriteColored.ColoredWriteLine("\nOperation finished\n\n");
            }


            /* Functionalities to add:
             * - (?) Make some TicketsDBConnection methods to inherit? the using statement is god damn everywhere()
             *
             *
             */
        }
Exemplo n.º 6
0
 private void NumberVerify(object sender, KeyEventArgs e)
 {
     VerifyInput.VerifyNumber(sender, e);
 }
Exemplo n.º 7
0
 private void DecimalVerify9(object sender, KeyEventArgs e)
 {
     VerifyInput.VerifyDecimal(sender, e, 9);
 }
 private void DateVerify(object sender, KeyEventArgs e)
 {
     VerifyInput.VerifyDate(sender, e);
 }
Exemplo n.º 9
0
 private void TimeVerify(object sender, KeyEventArgs e)
 {
     VerifyInput.VerifyTime(sender, e);
 }