public async Task <IActionResult> Put([FromBody] Address address)
        {
            bool employeeExists = await _employee.Exists(EmployeeQueries.EmployeeExists(address.EmployeeId));

            if (!employeeExists)
            {
                return(StatusCode(StatusCodes.Status406NotAcceptable, new { message = "Employee not exists." }));
            }

            var result = await _address.Add(address);

            return(StatusCode(StatusCodes.Status200OK, new { address = result }));
        }
Example #2
0
        public async Task <IActionResult> Put([FromBody] Employee employee)
        {
            //bool employeeExists = await _employeeService.Exists(x => x.Id == employee.Id);
            bool employeeExists = await _employeeService.Exists(EmployeeQueries.EmployeeExists(employee.Id.Value));

            if (!employeeExists)
            {
                return(StatusCode(StatusCodes.Status406NotAcceptable, new { message = "Employee not exists." }));
            }

            var alteredEmployee = await _employeeService.Alter(employee);

            return(StatusCode(StatusCodes.Status200OK, new { employee = alteredEmployee }));
        }
Example #3
0
        public async Task <IActionResult> Get(Guid?id)
        {
            //bool employeeExists = await _employeeService.Exists(x => x.Id == id);
            bool employeeExists = await _employeeService.Exists(EmployeeQueries.EmployeeExists(id));

            if (!employeeExists)
            {
                return(StatusCode(StatusCodes.Status406NotAcceptable, new { message = "Employee not exists." }));
            }

            var employee = await _employeeService.FindOne(x => x.Id == id);

            return(StatusCode(StatusCodes.Status200OK, new { selectedEmployee = employee }));
        }
        public async Task <IActionResult> Delete([FromBody] DeleteAddress address)
        {
            bool employeeExists = await _employee.Exists(EmployeeQueries.EmployeeExists(address.EmployeeId));

            if (!employeeExists)
            {
                return(StatusCode(StatusCodes.Status406NotAcceptable, new { message = "Employee not exists." }));
            }

            _address.Delete(new Address
            {
                EmployeeId = address.EmployeeId,
                Id         = address.AddressId
            });

            return(StatusCode(StatusCodes.Status200OK, new { message = "Address deleted successfully." }));
        }
Example #5
0
        /// <summary>
        /// Gets the spouse by identifier.
        /// </summary>
        /// <param name="spouseId">The spouse identifier.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">GetEmployeeById</exception>
        public ISpouseModel GetSpouseById(int spouseId)
        {
            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var employeeInfo = EmployeeQueries.GetSpouseByEmployee(dbContext, spouseId);

                    return(employeeInfo);
                }
            }
            catch (Exception e)
            {
                throw new ArgumentNullException("GetEmployeeById", e);
            }
        }
Example #6
0
        public static async Task SelectUsers()
        {
            var userManager = new UserManager("AdminUser", "AdminuserPassword", "Domain");
            var queries     = new EmployeeQueries("ConnecitonStringToDB");
            var e           = await queries.SelectAllEmployee();

            foreach (var employee in e)
            {
                var name = await queries.SelectName(new Data.Shared.Entities.Name {
                    Id = employee.NameId
                });

                var login = await queries.SelectLogin(new Data.Shared.Entities.Login {
                    Uuid = employee.LoginUuid
                });

                userManager.CreateUser("OU=MySubOu,OU=MyMainOu,DC=xyz,DC=local", login.Username, login.Password + login.Salt, name.First, name.Last, employee.Email, employee.Cell);
            }
        }
Example #7
0
        public static void Question1()
        {
            IEmployeeCommands employeeCommand = new EmployeeCommands(new EmployeeCommandsRepository());
            var firstEmployee = new Employee(1, "test", "test");

            employeeCommand.AddEmployee(firstEmployee);
            Console.WriteLine(
                $"Adding first employee :{firstEmployee.EmployeeId}, Name:{firstEmployee.FirstName}, Address:{firstEmployee.LastName}");
            var secondEmployee = new Employee(2, "test1", "test1");

            employeeCommand.AddEmployee(secondEmployee);

            Console.WriteLine(
                $"Adding second employee :{secondEmployee.EmployeeId}, Name:{secondEmployee.FirstName}, Address:{secondEmployee.LastName}");
            var thirdEmployee = new Employee(3, "test2", "test2");

            employeeCommand.AddEmployee(thirdEmployee);

            Console.WriteLine(
                $"Adding third employee :{thirdEmployee.EmployeeId}, Name:{thirdEmployee.FirstName}, Address:{thirdEmployee.LastName}");


            IEmployeeQueries employeeQuery = new EmployeeQueries(new EmployeeQueryRepository());
            var result = employeeQuery.GetEmployee(1);


            Console.WriteLine($"Get Employee ID =1 :{result.EmployeeId}, Name:{result.FirstName}, Address:{result.LastName}");


            var orderList = employeeQuery.GetOrderedEmployeeArray();

            for (int employeeCount = 1; employeeCount >= orderList.Count; employeeCount++)
            {
                Console.WriteLine(
                    $" Employee Ordered Array  :{orderList[employeeCount].EmployeeId}, Name:{orderList[employeeCount].FirstName}, Address:{orderList[employeeCount].LastName}");
            }
        }
Example #8
0
 public EmployeeController(EmployeeQueries queries, ICommandDispatcher commandDispatcher)
 {
     _queries           = queries;
     _commandDispatcher = commandDispatcher;
 }
        static void Main()
        {
            var price = 50000;

            ///////////////**** NATIVE SQL Query ****///////////////
            using var db = new SoftUniContext();
            var employees = db.Employees
                            .FromSqlInterpolated($"SELECT * FROM dbo.Employees WHERE Salary > 50000").ToList();

            Console.WriteLine(string.Join("\n", employees.Select(e => e.FirstName + " " + e.LastName)));

            ///////////////**** Compiled Queries ****///////////////
            // Improve the queries further in performance as they already save compiling the query by EF.

            db.Employees
            .Where(e => e.Salary > 50000)
            .Select(e => new Result
            {
                FullName = e.FirstName + " " + e.LastName
            });

            var query = EF.CompileQuery <SoftUniContext, IEnumerable <Result> >(db =>
                                                                                db.Employees
                                                                                .Where(e => e.Salary > 50000)
                                                                                .Select(e => new Result
            {
                FullName = e.FirstName + " " + e.LastName
            }));

            //** Compiled Query called from a class with one parameter "int" **//
            // this way eliminates overhead
            EmployeeQueries.ToResult(db, price);


            ///////////////**** Object State Tracking ****///////////////
            using var data = new SoftUniContext();
            var employee = db.Employees.FirstOrDefault();

            //start tracking the employee object in the db instance "data"
            data.Attach(employee);

            employee.FirstName += " pi4a";

            // stop tracking the object in this db instance "data"
            data.Entry(employee).State = EntityState.Detached;

            data.SaveChanges();


            ///////////////**** Executing a Stored Procedure ****///////////////
            // CREATE PROCEDURE UpdateAge @param int
            // AS
            // UPDATE EMployees SET Age = Age + @param

            var ageParameter = new SqlParameter("@age", 5);
            var uspQquery    = "EXEC UpdateAge @age";

            db.Database.ExecuteSqlCommand(uspQquery, ageParameter);


            ///////////////**** Batch Operations ****///////////////
            // Z.EntityFramework.Plus.EFCore
            // BULK DELETE can be done this way with the package installed.

            //db.Employees
            //    .Where(u => u.FirstName == "Kiro")
            //    .Delete();

            // BULK UPDATE
            //db.Employees
            //    .Where(e => e.Salary > 20000)
            //    .Update(w => new Employees { Salary = e.Salary * 1.2m });



            ///////////////**** TYPES OF LOADING ****///////////////
            ////////////////////////////////////////////////////////
            ////////////////////////////////////////////////////////
            // By default navigation properties are not loaded

            var empl = db.Employees
                       .Where(e => e.Salary > 10000)
                       .FirstOrDefault();

            //EXPLICIT loading of the reference of the Employee to the Department
            db.Entry(empl)
            .Reference(e => e.Department)
            .Load();

            //EAGER loading
            var guy = db.Employees
                      .Include(e => e.Department)
                      .Where(e => e.Salary > 10000)
                      .FirstOrDefault();

            //LAZY loading
            // Microsoft.EntityFrameworkCore.Proxies
            //in OnConfiguring() method
            // builder.UseLazyLoadingProxies().UseSqlServer(DataSettings.DefaultConnection);
            // all navigation properties of the models have to be virtual
            //convenient but generates a lot of queries so it must be used only when really needed.

            ///////////////**** CONCURRENCY CHECK ****///////////////
            //This enables "first-win" strategy
        }
Example #10
0
        public void Find_Employee_By_Id_01()
        {
            var result = employees.AsQueryable().Where(EmployeeQueries.EmployeeExists(new Guid()));

            Assert.Equal(1, result.Count());
        }
 public async Task <ActionResult> GetAll([FromQuery] PagingParams pagingParams)
 {
     return(await EmployeeQueries.GetAll(pagingParams));
 }
 public async Task <ActionResult> Get(Guid id)
 {
     return(await EmployeeQueries.Get(id));
 }
 public EmployeeController(IEmployeeService iEmployeeService, EmployeeQueries employeeQueries, IResponseMessages responsMessages)
 {
     IEmployeeService = iEmployeeService;
     EmployeeQueries  = employeeQueries;
     ResponsMessages  = responsMessages as ResponseMessages;
 }
Example #14
0
        private async Task SelectQuery()
        {
            await Task.Run(async() =>
            {
                if ((int)GetData[0].Answer == 0)
                {
                    EmployeeQueries employeeQueries = null;
                    if ((int)GetData[2].Answer == 0)
                    {
                        Main            = typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Adott alkalmazottakhoz mennyi páciens tartozik";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  0,
                                                                  (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = employeeQueries.GetStepInString();
                        return(await employeeQueries.PatientBelong());
                    }
                    else if ((int)GetData[2].Answer == 1)
                    {
                        Main            = ((List <int>)GetData[1].Answer).Count == 0 ? typeof(StackedLine) : typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Adott alkalmazottak mennyi vizsgálatot végeztek";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  0,
                                                                  (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = employeeQueries.GetStepInString();
                        return(await employeeQueries.ExaminationCount());
                    }
                    else if ((int)GetData[2].Answer == 2)
                    {
                        Main            = ((List <int>)GetData[1].Answer).Count == 0 ? typeof(StackedLine) : typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Adott alkalmazottak mennyi pácienst láttak el";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  0,
                                                                  (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = employeeQueries.GetStepInString();
                        return(await employeeQueries.EvidenceCount());
                    }
                    else if ((int)GetData[2].Answer == 3)
                    {
                        Main            = typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Adott alkalmazottak mennyi munkaórát dolgoztak";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  0,
                                                                  (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                  (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            employeeQueries = new EmployeeQueries((List <int>)GetData[1].Answer,
                                                                  (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = employeeQueries.GetStepInString();
                        return(await employeeQueries.WorkingHours());
                    }
                    else //if ((int)GetData[2].Answer == 4)
                    {
                        Main      = typeof(MultiLine);
                        Secondary = typeof(StackedBar);
                        FinanceQueries financeQueries = null;
                        ChartM.MainText = "Adott alkalmazottak mennyit értékesítettek";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = financeQueries.GetStepInString();
                        return(await financeQueries.IncomePerEmployee());
                    }
                }
                else if (GetData[0].Answer as int? == 1)
                {
                    PatientQueries patientQueries = null;
                    if ((int)GetData[2].Answer == 0)
                    {
                        Main            = ((List <int>)GetData[1].Answer).Count == 0 ? typeof(StackedLine) : typeof(StackedBar);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "A kiválasztott páiensekhez milyen eloszlásban tartoznak a státuszbejegyzések";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = patientQueries.GetStepInString();
                        return(await patientQueries.StatusDistibution());
                    }
                    else if ((int)GetData[2].Answer == 1)
                    {
                        Main            = typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Adott páciensekhez mennyi státuszbejegyzés tartozik";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = patientQueries.GetStepInString();
                        return(await patientQueries.StatusPerPatient());
                    }
                    else if ((int)GetData[2].Answer == 2)
                    {
                        Main            = typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Adott páciensek mennyi időt töltöttek az intézményben";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = patientQueries.GetStepInString();
                        return(await patientQueries.TimePerPatient());
                    }
                    else if ((int)GetData[2].Answer == 3)
                    {
                        Main            = typeof(StackedLine);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Új és meglévő páciensek eloszlása";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            patientQueries = new PatientQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = patientQueries.GetStepInString();
                        return(await patientQueries.NewPatientPercentage());
                    }
                }
                else if (GetData[0].Answer as int? == 2)
                {
                    ServiceQueries serviceQueries = null;
                    if ((int)GetData[2].Answer == 0)
                    {
                        Main            = typeof(MultiLine);
                        Secondary       = typeof(StackedBar);
                        ChartM.MainText = "Kezelések árainak módosulásai";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = serviceQueries.GetStepInString();
                        return(await serviceQueries.ServicesPrices());
                    }
                    else if ((int)GetData[2].Answer == 1)
                    {
                        Main            = typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Adott kezelésekből mennyit végeztek el";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = serviceQueries.GetStepInString();
                        return(await serviceQueries.ExecutedService());
                    }
                    else //if ((int)GetData[2].Answer == 2)
                    {
                        Main            = typeof(Line);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Kezelések számosságának alakulása";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            serviceQueries = new ServiceQueries((List <int>)GetData[1].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = serviceQueries.GetStepInString();
                        return(await serviceQueries.ServicesCount());
                    }
                }
                else //if (GetData[0].Answer as int? == 3)
                {
                    FinanceQueries financeQueries = null;
                    if ((int)GetData[1].Answer == 0)
                    {
                        Main            = typeof(MultiLine);
                        Secondary       = typeof(StackedBar);
                        ChartM.MainText = "Adott kezelésekből származó bevételek eloszlása";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[2].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[2].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[2].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = financeQueries.GetStepInString();
                        return(await financeQueries.IncomePerService());
                    }
                    else if ((int)GetData[1].Answer == 1)
                    {
                        Main            = typeof(StackedBar);
                        Secondary       = typeof(Bar);
                        ChartM.MainText = "Mennyi volt összesítve a bevétel";

                        if ((int)((List <object>)GetData[2].Answer)[0] == 0)
                        {
                            financeQueries = new FinanceQueries(new List <int>(),
                                                                0,
                                                                (DateTime)((List <object>)GetData[2].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[2].Answer)[0] == 1)
                        {
                            financeQueries = new FinanceQueries(new List <int>(),
                                                                (int)((List <object>)GetData[2].Answer)[1],
                                                                (DateTime)((List <object>)GetData[2].Answer)[2],
                                                                (DateTime)((List <object>)GetData[2].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[2].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            financeQueries = new FinanceQueries(new List <int>(),
                                                                (int)((List <object>)GetData[2].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[2].Answer)[1]);
                        }
                        ChartM.Step = financeQueries.GetStepInString();
                        return(await financeQueries.TotalIncome());
                    }
                    else //if ((int)GetData[1].Answer == 2)
                    {
                        Main            = typeof(MultiLine);
                        Secondary       = typeof(StackedBar);
                        ChartM.MainText = "Adott alkalmazottak mennyit értékesítettek";

                        if ((int)((List <object>)GetData[3].Answer)[0] == 0)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[2].Answer,
                                                                0,
                                                                (DateTime)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Adott időpontban";
                        }

                        else if ((int)((List <object>)GetData[3].Answer)[0] == 1)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[2].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1],
                                                                (DateTime)((List <object>)GetData[3].Answer)[2],
                                                                (DateTime)((List <object>)GetData[3].Answer)[3]);
                            ChartM.LesserText = "Adott intervallumban, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }

                        else //if ((int)((List<object>)GetData[3].Answer)[0] == 2)
                        {
                            financeQueries = new FinanceQueries((List <int>)GetData[2].Answer,
                                                                (int)((List <object>)GetData[3].Answer)[1]);
                            ChartM.LesserText = "Folyamatában, " + StepMeaning((int)((List <object>)GetData[3].Answer)[1]);
                        }
                        ChartM.Step = financeQueries.GetStepInString();
                        return(await financeQueries.IncomePerEmployee());
                    }
                }
                return(null);
            }, CancellationToken.None).ContinueWith(task =>
            {
                ChartM.FullRecords = task.Result;
                Duplicate();
            });
        }