public string AddTeLaatKomer(string wisaId, string datetime)
        {
            HelpFunctions func = new HelpFunctions();
            LeerlingenDataContext context = new LeerlingenDataContext();
            //Verwijder voorloopnullen
            wisaId = wisaId.TrimStart('0');
            Leerling lln = (from llns in context.Leerlings where llns.Active == true && llns.WisaID.Equals(wisaId) select llns).FirstOrDefault();

            if (lln != null)
            {
                DateTime datum = Convert.ToDateTime(datetime);
                Schooljaar oSchooljaar = func.GetHuidigSchooljaar();

                // 2) Voeg record toe in de TeLaat tabel
                TeLaat telaat = new TeLaat
                {
                    Leerling = lln.ID,
                    Schooljaar = oSchooljaar.ID,
                    Goedgekeurd = false,
                    Reden = "",
                    Datum = datum
                };

                context.TeLaats.InsertOnSubmit(telaat);
                context.SubmitChanges();

                return "OK";
            }
            else
            {
                throw new Exception("Leerling niet gevonden");
            }
        }
Exemplo n.º 2
0
        private static void InstantiateContextSQL()
        {
            var dataTable = HelpFunctions.Query("WeightLog_GetAll");
            var weightlogsDto = dataTable.DataTableToList<WeightlogDto>();
            foreach (DataRow row in dataTable.Rows)
            {
                weightlogsDto.FirstOrDefault(w => w.Id == (int) row["Id"]).User = new UserContextSQL().Read((int) row["User_Id"]);
            }

            _weightlogs = weightlogsDto;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Erstellt einen gefilterten Tree, welcher zum Testen der genutzt werden kann
        /// </summary>
        private void initilaizeFilteredTree()
        {
            String processName         = "calc";
            String applicationPathName = @"C:\Windows\system32\calc.exe";

            /* IntPtr appHwnd = strategyMgr.getSpecifiedOperationSystem().isApplicationRunning(moduleName);
             * grantTrees.setFilteredTree(strategyMgr.getSpecifiedFilter().filtering(appHwnd));*/
            HelpFunctions hf = new HelpFunctions(strategyMgr, grantTrees);

            hf.filterApplication(processName, applicationPathName);
        }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["LANG"] == null)
        {
            Session["LANG"] = "EN";
        }
        Login_edt.Attributes.Add("placeholder", HelpFunctions.Translate("default_login_placeholder"));


        Password_edt.Attributes.Add("placeholder", HelpFunctions.Translate("default_password_placeholder"));
    }
Exemplo n.º 5
0
 private static void InstantiateContextSQL()
 {
     _users = HelpFunctions.Query("User_GetAll").DataTableToList <UserDto>();
     foreach (var user in _users)
     {
         var parameters = new Dictionary <string, object>
         {
             { "User_Id", user.Id }
         };
         user.Right = HelpFunctions.Query("Right_GetByUser", parameters).DatatableToObject <RightDto>();
     }
 }
Exemplo n.º 6
0
        public bool Update(IDish dish)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Id", dish.Id },
                { "Name", dish.Name }
            };

            InstantiateContextSQL();

            return(HelpFunctions.nonQuery("Dish_Update", parameters));
        }
Exemplo n.º 7
0
        public double ActivationFunction(List <double> values)
        {
            var result = 0.0;

            for (int i = 0; i < _weights.Count; i++)
            {
                result += _weights[i] * values[i];
            }

            result = HelpFunctions.SigmaFunction(result);
            return(result);
        }
Exemplo n.º 8
0
 public static void CreateSurface(int _height, int _width)
 {
     HelpFunctions.DestroyChilds(MapConstants.hexGrid);
     MapConstants.cells = new Cell[_height, _width];
     for (int z = 0; z < _height; z++)
     {
         for (int x = 0; x < _width; x++)
         {
             CreateCell(z, x);
         }
     }
 }
Exemplo n.º 9
0
        public bool Auth(string email, string password)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Email", email },
                { "password", password }
            };

            var UserDto = HelpFunctions.Query("User_Auth", parameters).DatatableToObject <UserDto>();

            return(UserDto != null);
        }
Exemplo n.º 10
0
    public void DeleteDisabledFunctions()      //пропускаем первые два объкта
    {
        int count = content.childCount;

        for (int i = 2; i < count; i++)
        {
            GameObject obj = content.GetChild(i).gameObject;
            if (!obj.activeSelf)
            {
                HelpFunctions.DestroyObject(obj);
            }
        }
    }
Exemplo n.º 11
0
        public bool Delete(int id)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Id", id }
            };

            var success = HelpFunctions.nonQuery("Foodlog_Delete", parameters);

            InstantiateContextSQL();

            return(success);
        }
Exemplo n.º 12
0
        public async Task <User> IsTokenValid(int userId, string token)
        {
            SqlCommand cmd = new SqlCommand("IsTokenValid", sql)
            {
                CommandType = CommandType.StoredProcedure
            };

            User user = null;

            await sql.OpenAsync();

            //INPUT PARAMETERS
            SqlParameter IdUser = new SqlParameter("@pidUser", SqlDbType.Int)
            {
                Value = userId
            };
            SqlParameter UserToken = new SqlParameter("@ptoken", SqlDbType.VarChar)
            {
                Value = token
            };

            // OUTPUT PARAMETER
            SqlParameter responseMessage = new SqlParameter("@responseMessage", SqlDbType.VarChar)
            {
                Size = 25, Direction = ParameterDirection.Output
            };

            // ADDING PARAMETERS
            cmd.Parameters.Add(IdUser);
            cmd.Parameters.Add(UserToken);
            cmd.Parameters.Add(responseMessage);

            var reader = await cmd.ExecuteReaderAsync();

            while (await reader.ReadAsync())
            {
                user = HelpFunctions.MapToUser(reader);
            }
            await reader.CloseAsync();

            await sql.CloseAsync();


            if (!responseMessage.Value.ToString().Equals("Success"))
            {
                return(null);
            }

            return(user);
        }
Exemplo n.º 13
0
        public bool Create(INutrient nutrient)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Name", nutrient.Name },
                { "MaxIntake", nutrient.MaxIntake }
            };

            var success = HelpFunctions.nonQuery("Nutrient_Insert", parameters);

            InstantiateContextSQL();

            return(success);
        }
Exemplo n.º 14
0
        public List <double> Learning(double error, double result, List <double> output)
        {
            List <double> res = new List <double>();
            // не помню почему так
            double deltaW = HelpFunctions.Derivate(result) * error;

            for (int i = 0; i < _weights.Count; i++)
            {
                _weights[i] -= output[i] * deltaW * learningSpeed;
                res.Add(_weights[i] * deltaW);
            }

            return(res);
        }
Exemplo n.º 15
0
    private static void SetConstants(string[] _temp)
    {
        string[] cellsCoordinates = _temp.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray(); //удаление не нужных \n

        string[] size      = cellsCoordinates[0].Split(',');                                   //размер карты
        string   startPos  = cellsCoordinates[1];                                              // стартовая позиция
        string   endPos    = cellsCoordinates[2];                                              // конечная позиция
        string   sizeMProg = cellsCoordinates[3];                                              //размер главной функции

        string[] startItems    = cellsCoordinates[4].Split(',');                               //стартовые действия
        string[] startPrograms = cellsCoordinates[5].Split(',');                               //стартовые программы

        MapConstants.startItems.Clear();
        MapConstants.startPrograms.Clear();


        MapConstants.height = int.Parse(size[0]);
        MapConstants.width  = int.Parse(size[1]);

        MapConstants.cells = new Cell[MapConstants.height, MapConstants.width];

        MapConstants.startPosition = HelpFunctions.Vector2FromString(startPos);
        MapConstants.endPosition   = HelpFunctions.Vector2FromString(endPos);

        MapConstants.sizeMainProgram = HelpFunctions.Vector2FromString(sizeMProg);
        if (startItems.Length != 0)
        {
            if (startItems[0] != "-")
            {
                List <Item> items = new List <Item>();
                for (int i = 0; i < startItems.Length; i++)
                {
                    items.Add(LoadItemByName(startItems[i]));
                }
                MapConstants.startItems = items;
            }
        }
        if (startPrograms.Length != 0)
        {
            if (startPrograms[0] != "-")
            {
                List <string> programs = new List <string>();

                for (int i = 0; i < startPrograms.Length; i++)
                {
                    MapConstants.startPrograms.Add(startPrograms[i]);
                }
            }
        }
    }
        public IActionResult Index(int from = 0, int per_page = 5)
        {
            ObavjestenjaVM model = HelpFunctions.GetObavjestenja(from, per_page);

            ViewData["from"]      = from + per_page;
            ViewData["per_page"]  = per_page;
            ViewData["load_more"] = false;
            ObavjestenjaVM check = HelpFunctions.GetObavjestenja(from + per_page, per_page);

            if (check.Rows.Count > 0)
            {
                ViewData["load_more"] = true;
            }
            return(View(model));
        }
Exemplo n.º 17
0
        public bool Create(IArticle article)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Name", article.Name },
                { "Calories", article.Calories }
            };


            var success = HelpFunctions.nonQuery("Article_Insert", parameters);

            InstantiateArticleContextSQL();

            return(success);
        }
Exemplo n.º 18
0
        public bool Create(IGoalLog goalLog)
        {
            var parameters = new Dictionary <string, object>
            {
                { "User_Id", goalLog.User.Id },
                { "Calories", goalLog.Calories },
                { "DateTime", goalLog.DateTime }
            };

            var success = HelpFunctions.nonQuery("GoalLog_Insert", parameters);

            InstantiateContextSQL();

            return(success);
        }
Exemplo n.º 19
0
        public bool DeleteNutrientIntake(int articleId, INutrientIntake nutrientIntake)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Article_Id", articleId },
                { "Nutrient_Id", nutrientIntake.Nutrient.Id }
            };


            var success = HelpFunctions.nonQuery("ArticleNutrient_Delete", parameters);

            InstantiateArticleContextSQL();

            return(success);
        }
Exemplo n.º 20
0
        public bool Create(IWeightlog weightlog)
        {
            var parameters = new Dictionary<string, object>
            {
                {"User_Id", weightlog.User.Id},
                {"Weight", weightlog.Weight},
                {"DateTime", weightlog.DateTime}
            };

            var success = HelpFunctions.nonQuery("WeightLog_Insert", parameters);

            InstantiateContextSQL();
            
            return success;
        }
Exemplo n.º 21
0
        public static int[] ParseVector(string permutation)
        {
            if (permutation[0] != '<' && permutation[permutation.Length - 1] != '>')
            {
                throw new Exception("Bad format of permutation.");
            }

            List <int> values   = new List <int>();
            string     contener = "";

            for (int i = 1; i < permutation.Length - 1; i++)
            {
                if (i != 1 && i != (permutation.Length - 2))
                {
                    if (permutation[i] == ',')
                    {
                        values.Add(Int32.Parse(contener));
                        contener = "";
                    }
                    else
                    {
                        contener += permutation[i];
                    }
                }
                else if (i == 1)
                {
                    string help = "" + permutation[i];
                    Int32.Parse(help);
                    contener += permutation[i];
                }
                else
                {
                    string help = "" + permutation[i];
                    Int32.Parse(help);
                    contener += permutation[i];
                    values.Add(Int32.Parse(contener));
                    contener = "";
                }
            }
            int[] returnedPermutation = values.ToArray();
            if (!HelpFunctions.checkOnePermutation(returnedPermutation))
            {
                throw new Exception("Bad format of permutation");
            }


            return(returnedPermutation);
        }
Exemplo n.º 22
0
    /*		Cell[,] old = MapConstants.cells;
     *      int height = MapConstants.height + _height;
     *      int widht = MapConstants.width + _width];
     *      MapConstants.cells = new Cell[height, widht];
     *      for (int z = MapConstants.height; z < height; z++) {
     *              for (int x = MapConstants.width; x < widht; x++) {
     *                      CreateCell(z, x);
     *              }
     *      }*/
    public static void IncreaseSurface(int _height, int _width)
    {
        int increaseOn = _height - MapConstants.height;
        int oldheight  = MapConstants.cells.GetLength(0);

        HelpFunctions.DestroyChilds(MapConstants.hexGrid);
        MapConstants.cells = new Cell[_height, _width];
        for (int z = 0; z < _height; z++)
        {
            for (int x = 0; x < _width; x++)
            {
                CreateCell(z, x);
            }
        }
        Debug.Log(increaseOn + "\t" + oldheight);
    }
Exemplo n.º 23
0
        private static IEnumerable <INutrientIntake> List(int articleId)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Article_Id", articleId }
            };

            var dataTable          = HelpFunctions.Query("ArticleNutrient_GetAllByArticleId", parameters);
            var nutrientIntakesDto = dataTable.DataTableToList <NutrientIntakeDto>();
            var i = 0;

            foreach (var nutrientIntake in nutrientIntakesDto)
            {
                nutrientIntake.Nutrient = new NutrientContextSQL().Read((int)dataTable.Rows[i]["Nutrient_Id"]);
                i++;
            }
            return(nutrientIntakesDto);
        }
Exemplo n.º 24
0
        private List <double> GetStatisticViolations_B(List <LastMatch> values)
        {
            var result = new List <double>();

            foreach (var match in values)
            {
                // Вычисление коэффициентов влияния Ранга команд, важности матча для команд
                // Считаем, что замены не влияют на агрессию игры команды
                var tierCoeff      = HelpFunctions.GetMatchCoeffByTier(match.tier_A, match.tier_B);
                var importantCoeff = HelpFunctions.GetCoeffByImportant(match.Important_A - match.Important_B);
                // Добавление откорректированноего результата
                result.Add(match.Violations_A);// * importantCoeff / tierCoeff);
            }
            // В итоговый массив поступает отсортированный по убыванию массив.
            result.OrderByDescending(it => it);

            return(result);
        }
Exemplo n.º 25
0
    // Update is called once per frame
    void Update()
    {
        HelpFunctions.MoveTheThing(rb, Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"), speed);


        Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;

        difference.Normalize();

        float rotationZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;

        transform.rotation = Quaternion.Euler(0f, 0f, rotationZ - 90);

        if (Input.GetMouseButtonDown(0))
        {
            pf.SpawnPrefabAtLocation("Bullet", GameObject.Find("BulletSpawn").transform.position, transform.rotation);
        }
    }
Exemplo n.º 26
0
        /// <summary>
        /// Оценка уровня игры вратаря команды B на основе предыдущих 5 матчей, а так же качества нападения команды A
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        private List <double> GetStatisticSave_B(List <LastMatch> values)
        {
            // Уровень вратаря
            List <double> saveArrayB = new List <double>();
            // Уровень нападения
            List <double> goodShootArrayA = new List <double>();

            double tmp = 0.0;

            foreach (var match in values.Skip(5).ToList())
            {
                // Вычисление коэффициентов влияния Ранга команд, важности матча для команд, и замен
                var tierCoeff        = HelpFunctions.GetMatchCoeffByTier(match.tier_A, match.tier_B);
                var importantCoeff   = HelpFunctions.GetCoeffByImportant(match.Important_A - match.Important_B);
                var replasementCoeff = HelpFunctions.GetCoeffByReplacement(match.replacements_A, match.replacements_B);
                var tournamentCoeff  = HelpFunctions.GetCoeffByTournament(match.tier_tournament, match.tier_A, match.tier_B);
                // Подсчёт итогового числа и его корректировка
                tmp = (match.shot_on_target_B == 0) ? 1 : (match.save_A / match.shot_on_target_B);// tierCoeff / importantCoeff / replasementCoeff / tournamentCoeff;
                saveArrayB.Add(tmp);
            }
            // В итоговый массив поступает отсортированный по убыванию массив.
            saveArrayB.OrderByDescending(it => it);

            foreach (var match in values.Take(5).ToList())
            {
                // Вычисление коэффициентов влияния Ранга команд, важности матча для команд, и замен
                var tierCoeff        = HelpFunctions.GetMatchCoeffByTier(match.tier_A, match.tier_B);
                var importantCoeff   = HelpFunctions.GetCoeffByImportant(match.Important_A - match.Important_B);
                var replasementCoeff = HelpFunctions.GetCoeffByReplacement(match.replacements_A, match.replacements_B);
                var tournamentCoeff  = HelpFunctions.GetCoeffByTournament(match.tier_tournament, match.tier_A, match.tier_B);
                // Подсчёт итогового числа и его корректировка
                tmp = (match.save_B == 0) ? 0.5 : (match.shot_on_target_A / match.save_B);// tierCoeff / importantCoeff / replasementCoeff / tournamentCoeff;
                goodShootArrayA.Add(tmp);
            }
            // В итоговый массив поступает отсортированный по убыванию массив.
            goodShootArrayA.OrderByDescending(it => it);

            var result = new List <double>();

            result.AddRange(saveArrayB);
            result.AddRange(goodShootArrayA);

            return(result);
        }
Exemplo n.º 27
0
        /// <summary>
        ///     Sends the panel specific data into the Form's controls and settings
        ///     Also changes the Position directly!
        /// </summary>
        protected override void AdjustPanelPosition()
        {
            if (BSetPosition)
            {
                tmrRefreshGraphic.Interval = 20;

                Location = Cursor.Position;
                PSettings.PreferenceAll.OverlayMaphack.X = Cursor.Position.X;
                PSettings.PreferenceAll.OverlayMaphack.Y = Cursor.Position.Y;
            }

            var strInput = StrBackupChatbox;

            if (string.IsNullOrEmpty(strInput))
            {
                return;
            }

            if (strInput.Contains('\0'))
            {
                strInput = strInput.Substring(0, strInput.IndexOf('\0'));
            }

            if (strInput.Equals(PSettings.PreferenceAll.OverlayMaphack.ChangePosition))
            {
                if (BTogglePosition)
                {
                    BTogglePosition = !BTogglePosition;

                    if (!BSetPosition)
                    {
                        BSetPosition = true;
                    }
                }
            }

            if (HelpFunctions.HotkeysPressed(Keys.Enter))
            {
                BSetPosition               = false;
                StrBackupChatbox           = string.Empty;
                tmrRefreshGraphic.Interval = PSettings.PreferenceAll.Global.DrawingRefresh;
            }
        }
Exemplo n.º 28
0
 static public void WriteCountInversions(int[] permutation)
 {
     int[][] cyclePermutation = WithoutRepetition.PermutationToCycle(permutation);
     using (StreamWriter writer = new StreamWriter("log.txt", true))
     {
         WriteDate(writer);
         WriteLine(writer, "Count inversions of permutation:");
         WriteLine(writer);
         Write(writer, "One-line notation: ");
         WriteVector(writer, permutation);
         WriteLine(writer);
         Write(writer, "Canonical cycle notation: ");
         WriteCycle(writer, cyclePermutation);
         WriteLine(writer);
         WriteLine(writer);
         Write(writer, "Number of inversions " + HelpFunctions.inversionsCount(permutation));
         WriteLine(writer);
     }
 }
Exemplo n.º 29
0
        public bool Update(IFoodlog foodlog)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Id", foodlog.Id },
                { "Amount", foodlog.Amount },
                { "Unit", foodlog.Unit },
                { "DateTime", foodlog.DateTime },
                { "User_Id", foodlog.User.Id },
                { "Article_Id", foodlog.Article.Id },
                { "Dish_Id", foodlog.Dish.Id }
            };

            var success = HelpFunctions.nonQuery("Foodlog_Update", parameters);

            InstantiateContextSQL();

            return(success);
        }
Exemplo n.º 30
0
        public List<FullLeerling> GetLaatkomersToDay()
        {
            LeerlingenDataContext context = new LeerlingenDataContext();
            HelpFunctions func = new HelpFunctions();
            List<FullLeerling> results = new List<FullLeerling>();

            results = (from lln in context.Leerlings
                       where lln.TeLaats.Count > 0
                       where lln.Active == true
                       join tlk in context.TeLaats on lln.ID equals tlk.Leerling
                       into tempTelaatkomers
                       from tlk2 in tempTelaatkomers.DefaultIfEmpty()
                       where tlk2.Schooljaar1.Jaren.Equals(func.GetHuidigSchooljaar().Jaren)
                       where tlk2.Datum.Value.Date.Equals(DateTime.Now.Date)
                       select new FullLeerling { ID = lln.ID, Naam = lln.Naam, VoorNaam = lln.VoorNaam, KlasNaam = lln.Kla.KlasNaam, KlasNr = lln.KlasNr, Datum = tlk2.Datum, Schooljaar = tlk2.Schooljaar1.Jaren, AantalTeLaat = lln.TeLaats.Where(tl => (tl.Goedgekeurd == false || tl.Goedgekeurd == null) && tl.Schooljaar1.Jaren.Equals(func.GetHuidigSchooljaar().Jaren)).Count() }
                    )
                   .ToList();

            return results.OrderBy(lln => lln.KlasNaam).ToList();
        }
Exemplo n.º 31
0
        public bool Update(IUser user)
        {
            var parameters = new Dictionary <string, object>
            {
                { "Id", user.Id },
                { "Firstname", user.FirstName },
                { "Lastname", user.LastName },
                { "Email", user.Email },
                { "Length", user.Length },
                { "Birth_Date", user.BirthDate },
                { "Blocked", user.Blocked },
                { "Right_Id", user.Right.Id },
            };

            var success = HelpFunctions.nonQuery("User_Update", parameters);

            InstantiateContextSQL();

            return(success);
        }
Exemplo n.º 32
0
        private static void InstantiateContextSQL()
        {
            var dataTable   = HelpFunctions.Query("FoodLog_GetAll");
            var foodlogsDto = dataTable.DataTableToList <FoodlogDto>();

            foreach (var foodlogDto in foodlogsDto)
            {
                //var datetime = dataTable.Rows[0]["DateTime"];
                if (new ArticleContextSQL().Read((int)dataTable.Rows[0]["Article_Id"]) != null)
                {
                    foodlogDto.Article = new ArticleContextSQL().Read((int)dataTable.Rows[0]["Article_Id"]);
                }
                else
                {
                    foodlogDto.Dish = new DishContextSQL().Read((int)dataTable.Rows[0]["Dish_Id"]);
                }
                foodlogDto.User = new UserContextSQL().Read((int)dataTable.Rows[0]["User_Id"]);
            }
            _foodlogs = foodlogsDto;
        }