public FormRounds(MainDoc doc)
 {
     InitializeComponent();
     docMain = doc;
     //Rounds = new List<Round>();
     labels  = new List <Label>();
     buttons = new List <Button>();
     bgImage = new Bitmap("bgFootballStadium.jpg");
 }
 public FormRounds(MainDoc doc)
 {
     InitializeComponent();
     docMain = doc;
     //Rounds = new List<Round>();
     labels = new List<Label>();
     buttons = new List<Button>();
     bgImage = new Bitmap("bgFootballStadium.jpg");
 }
Beispiel #3
0
        public FormLogin()
        {
            InitializeComponent();

            initMessages();
            docMain = new MainDoc();
            fillMainDoc();
            player = new WindowsMediaPlayer();
            setPlayer();
        }
Beispiel #4
0
        public FormLogin()
        {
            
            
            InitializeComponent();

            initMessages();
            docMain = new MainDoc();
            fillMainDoc();
            player = new WindowsMediaPlayer();
            setPlayer();
            
        }
Beispiel #5
0
        //konstruktor so id namesto referenci
        public Player(MainDoc mainDoc, int id, String firstName, String lastName, DateTime dateOfBirth, double rating, int teamId, int positionId)
            : base(id, firstName, lastName, dateOfBirth)
        {
            Rating = rating;

            Team     = mainDoc.getTeamById(teamId);
            Position = mainDoc.getPositionById(positionId);

            TokensGoals = (int)Rating;//vo osnova verojatnosta daden igrac da dade gol e proporcionalna
            // na negoviot rejting
            TokensAssists    = (int)Rating;
            TokensInterrupts = (int)Rating;
            TokensSaves      = (int)Rating;
            switch (Position.Id)
            {
            case 1:                    //Napad
                TokensGoals      *= 3; //Napagacot da ima najgolemi shansi za gol
                TokensAssists    *= 2;
                TokensInterrupts *= 1;
                TokensSaves       = 0;
                break;

            case 2:    //Sredina
                TokensGoals      *= 2;
                TokensAssists    *= 3;
                TokensInterrupts *= 2;
                TokensSaves       = 0;
                break;

            case 3:    //Odbrana
                TokensGoals      /= 10;
                TokensAssists    /= 10;
                TokensInterrupts *= 5;
                TokensSaves       = 0;
                break;

            case 4:                       //Golman
                TokensGoals      /= 1000; //Postoi moznost i golman da dade gol, no taa e premnogu mala
                TokensAssists    /= 1000;
                TokensInterrupts /= 100;
                TokensSaves       = (int)Rating;
                break;
            }

            if (Position.Id != 4)
            {
                TokensGoals *= (int)Team.Rating / 10;
            }
        }
Beispiel #6
0
        //konstruktor so id namesto referenci
        public Player(MainDoc mainDoc, int id, String firstName, String lastName, DateTime dateOfBirth, double rating, int teamId, int positionId)
            : base(id, firstName, lastName, dateOfBirth)
        {
            Rating = rating;

            Team = mainDoc.getTeamById(teamId);
            Position = mainDoc.getPositionById(positionId);

            TokensGoals = (int)Rating;//vo osnova verojatnosta daden igrac da dade gol e proporcionalna
            // na negoviot rejting
            TokensAssists = (int)Rating;
            TokensInterrupts = (int)Rating;
            TokensSaves = (int)Rating;
            switch (Position.Id)
            {
                case 1://Napad
                    TokensGoals *= 3;//Napagacot da ima najgolemi shansi za gol
                    TokensAssists *= 2;
                    TokensInterrupts *= 1;
                    TokensSaves = 0;
                    break;
                case 2://Sredina
                    TokensGoals *= 2;
                    TokensAssists *= 3;
                    TokensInterrupts *= 2;
                    TokensSaves = 0;
                    break;
                case 3://Odbrana
                    TokensGoals /= 10;
                    TokensAssists /= 10;
                    TokensInterrupts *= 5;
                    TokensSaves = 0;
                    break;
                case 4://Golman
                    TokensGoals /= 1000;//Postoi moznost i golman da dade gol, no taa e premnogu mala
                    TokensAssists /= 1000;
                    TokensInterrupts /= 100;
                    TokensSaves = (int)Rating;
                    break;
            }

            if (Position.Id != 4)
            {
                TokensGoals *= (int)Team.Rating / 10;
            } 

        }
Beispiel #7
0
        public FormTeam(Team team, MainDoc doc)
        {
            InitializeComponent();
            Team    = team;
            docMain = doc;

            labels     = new List <Label>();
            idMatches  = new List <int>();
            homeTeams  = new List <String>();
            results    = new List <String>();
            guestTeams = new List <String>();


            players = docMain.getPlayersFromTeam(Team.Name);

            originalWidth        = this.Width;
            originalSize         = false;
            this.Width           = originalWidth - 400;
            tableResults.Visible = false;

            fillFields();
            changeChartView();
        }
Beispiel #8
0
        public FormTeam(Team team, MainDoc doc)
        {
            InitializeComponent();
            Team = team;
            docMain = doc;

            labels = new List<Label>();
            idMatches = new List<int>();
            homeTeams = new List<String>();
            results = new List<String>();
            guestTeams = new List<String>();
           

            players = docMain.getPlayersFromTeam(Team.Name);
            
            originalWidth = this.Width;
            originalSize = false;
            this.Width = originalWidth - 400;
            tableResults.Visible = false;

            fillFields();
            changeChartView();
            
        }
Beispiel #9
0
        public PlayTheMatch(MainDoc mainDoc, int idMatch)
        {
            Match match = mainDoc.getMatchById(idMatch);

            random = new Random();
            List <Player> homeTeam  = mainDoc.getFirstEleven(match.HomeTeam.Name);
            List <Player> guestTeam = mainDoc.getFirstEleven(match.GuestTeam.Name);

            int id = 0;//OVA TREBA DA GO DOBIJAM OD BAZATA

            Participations = new List <Participates>();
            AllPlayers     = new List <Player>();

            //za oznacuvanje deka e odigran

            using (OracleConnection conn = new OracleConnection(FormLogin.connString))
            {
                conn.Open();
                String query = "UPDATE Match SET Finished = 'y'" +
                               " WHERE idMatch = " + idMatch;
                OracleCommand command = new OracleCommand(query, conn);
                command.CommandType = CommandType.Text;

                command.ExecuteNonQuery();
            }

            totalAssistTokens = totalGoalTokens = totalInterruptTokens = totalSaveTokens = 0;
            foreach (Player p in homeTeam)
            {
                AllPlayers.Add(p);
                Participations.Add(new Participates(id, p, match, 0, 0, 0, 0)); //vaka za site ucesnici se stava isto id
                totalAssistTokens    += p.TokensAssists;                        //no ovaa lista e samo lokalna za ovaa klasa
                totalGoalTokens      += p.TokensGoals;                          //i toj index ne se koristi na drugi mesta, pa zatoa ne smeta
                totalInterruptTokens += p.TokensInterrupts;                     //ne go izbrisav poleto bidejki koga ke se zemaat site ucestva od glavnata forma
                totalSaveTokens      += p.TokensSaves;                          //ke bide potrebno i toa pole
            }
            foreach (Player p in guestTeam)
            {
                AllPlayers.Add(p);
                Participations.Add(new Participates(id, p, match, 0, 0, 0, 0));//slicna diskusija kako pogore
                totalAssistTokens    += p.TokensAssists;
                totalGoalTokens      += p.TokensGoals;
                totalInterruptTokens += p.TokensInterrupts;
                totalSaveTokens      += p.TokensSaves;
            }
            //sluckite vo dadeni minuti
            int goalsHome = 0, goalsGuest = 0;

            for (int minute = 1; minute <= 90; minute++)//0 - goal and eventually assist, 1 - interrupt, 2 save, nothing
            {
                int happens  = whatHappens();
                int nextGoal = 1;
                if (mainDoc.Goals.Count > 0)
                {
                    nextGoal = mainDoc.Goals[mainDoc.Goals.Count - 1].Id + 1; //Slicno kako kaj Participates, sekade ke se stava nextGoal = 0, no toa ne pravi problem
                }
                if (happens == 0)                                             //goal
                {
                    int  scorerId = goalScorer();
                    Goal goal     = new Goal(nextGoal, minute, match, AllPlayers[scorerId]);
                    if (scorerId < 11)
                    {
                        goalsHome++;
                    }
                    else
                    {
                        goalsGuest++;
                    }

                    //dodavanje na gol vo bazata
                    using (OracleConnection conn = new OracleConnection(FormLogin.connString))
                    {
                        conn.Open();

                        OracleCommand command = new OracleCommand("procInsertGoal", conn);
                        command.CommandType = CommandType.StoredProcedure;

                        /*
                         *  p_idPlayer in Goal.idPlayer%TYPE,
                         *  p_idMatch in Goal.idMatch%TYPE,
                         *  p_minutes in Goal.minutes%TYPE)
                         */
                        command.Parameters.Add("p_idPlayer", OracleDbType.Int32).Value = goal.Player.Id;
                        command.Parameters.Add("p_idMatch", OracleDbType.Int32).Value  = goal.Match.Id;
                        command.Parameters.Add("p_minutes", OracleDbType.Int32).Value  = goal.Minutes;


                        command.ExecuteNonQuery();
                    }
                    //azuriranje na mainDoc
                    mainDoc.Goals.Add(goal);
                    match.addGoal(goal);


                    Participations[scorerId].NumGoals++;
                    int assId = assistent();
                    if (assId != scorerId && (assId - 10) * (scorerId - 10) >= 0)
                    {
                        Participations[assId].NumAssists++;
                    }
                }
                else if (happens == 1)//interrupt
                {
                    int interrupterId = interrupter();
                    Participations[interrupterId].NumInterrupts++;
                }
                else if (happens == 2)//save
                {
                    int saverId = saver();
                    Participations[saverId].NumSaves++;
                }
            }
            //obnova na rejtinzi
            for (int i = 0; i < Participations.Count; i++)
            {
                Participates p = Participations[i];
                p.calculateMatchRating();
                p.MatchRating = (int)((AllPlayers[i].Rating + 9 * p.MatchRating) / 10);
                if (i < 11)
                {
                    p.MatchRating = p.MatchRating + goalsHome * WEIGHT_GOALS_MATCH_RATING - goalsGuest * WEIGHT_GOALS_MATCH_RATING;
                    if (p.Player.Position.Id == 1)//napagac
                    {
                        p.MatchRating += WEIGHT_GOALS_MATCH_RATING * goalsHome;
                    }
                    else if (p.Player.Position.Id == 4)//golman
                    {
                        p.MatchRating -= WEIGHT_GOALS_MATCH_RATING * goalsGuest;
                    }
                    if (goalsHome > goalsGuest)
                    {
                        p.MatchRating += WIN_BONUS;
                    }
                }
                else
                {
                    p.MatchRating = p.MatchRating + goalsHome * WEIGHT_GOALS_MATCH_RATING - goalsGuest * WEIGHT_GOALS_MATCH_RATING;
                    if (p.Player.Position.Id == 1)//napagac
                    {
                        p.MatchRating += WEIGHT_GOALS_MATCH_RATING * goalsGuest;
                    }
                    else if (p.Player.Position.Id == 4)//golman
                    {
                        p.MatchRating -= WEIGHT_GOALS_MATCH_RATING * goalsHome;
                    }
                    if (goalsHome < goalsGuest)
                    {
                        p.MatchRating += WIN_BONUS;
                    }
                }

                //int nextParticipateId = mainDoc.Par[mainDoc.Goals.Count - 1].Id + 1;
                //dodavanje na ucestvata vo bazata
                using (OracleConnection conn = new OracleConnection(FormLogin.connString))
                {
                    conn.Open();

                    OracleCommand command = new OracleCommand("procInsertParticipates", conn);
                    command.CommandType = CommandType.StoredProcedure;

                    /*
                     *  p_idPlayer in Participates.idPlayer%TYPE,
                     *  p_idMatch in Participates.idMatch%TYPE,
                     *  p_numgoals in Participates.numgoals%TYPE,
                     *  p_numassists in Participates.numassists%TYPE,
                     *  p_numinterrupts in Participates.NUMINTERRUPTS%TYPE,
                     *  p_numsaves in Participates.numsaves%TYPE,
                     *  p_matchrating in Participates.match_rating%TYPE)
                     */
                    command.Parameters.Add("p_idPlayer", OracleDbType.Int32).Value      = p.Player.Id;
                    command.Parameters.Add("p_idMatch", OracleDbType.Int32).Value       = p.Match.Id;
                    command.Parameters.Add("p_numgoals", OracleDbType.Int32).Value      = p.NumGoals;
                    command.Parameters.Add("p_numassists", OracleDbType.Int32).Value    = p.NumAssists;
                    command.Parameters.Add("p_numinterrupts", OracleDbType.Int32).Value = p.NumInterrupts;
                    command.Parameters.Add("p_numsaves", OracleDbType.Int32).Value      = p.NumSaves;
                    command.Parameters.Add("p_matchrating", OracleDbType.Int32).Value   = p.MatchRating;

                    command.ExecuteNonQuery();
                }
                //azuriranje na Participates
            }


            //update na Player rating
            int homeAvgRating = 0, guestAvgRating = 0;

            for (int i = 0; i < AllPlayers.Count; i++)
            {
                AllPlayers[i].updateRating(Participations[i].MatchRating);
                //mainDoc.Players[AllPlayers[i].Id].Rating = (double)AllPlayers[i].Rating;//azuriranje vo mainDoc
                if (i < 11)
                {
                    homeAvgRating += (int)AllPlayers[i].Rating;
                }
                else
                {
                    guestAvgRating += (int)AllPlayers[i].Rating;
                }
                using (OracleConnection conn = new OracleConnection(FormLogin.connString))
                {
                    conn.Open();
                    String query = "UPDATE Player SET rating = " + (int)AllPlayers[i].Rating +
                                   " WHERE idPlayer = " + AllPlayers[i].Id;
                    OracleCommand command = new OracleCommand(query, conn);
                    command.CommandType = CommandType.Text;

                    command.ExecuteNonQuery();
                }
            }
            //update team ratings
            homeAvgRating  /= 11;
            guestAvgRating /= 11;

            int homeNewRating  = (homeAvgRating + 49 * (int)match.HomeTeam.Rating) / 50;
            int guestNewRating = (guestAvgRating + 49 * (int)match.GuestTeam.Rating) / 50;

            match.HomeTeam.Rating  = homeNewRating;
            match.GuestTeam.Rating = guestNewRating;
            //mainDoc.Teams[match.GuestTeam.Id].Rating = (double) guestNewRating;
            using (OracleConnection conn = new OracleConnection(FormLogin.connString))
            {
                conn.Open();
                String query = "UPDATE Team SET rating = " + homeNewRating +
                               " WHERE idTeam = " + match.HomeTeam.Id;
                OracleCommand command = new OracleCommand(query, conn);
                command.CommandType = CommandType.Text;

                command.ExecuteNonQuery();
            }

            using (OracleConnection conn = new OracleConnection(FormLogin.connString))
            {
                conn.Open();
                String query = "UPDATE Team SET rating = " + guestNewRating +
                               " WHERE idTeam = " + match.GuestTeam.Id;
                OracleCommand command = new OracleCommand(query, conn);
                command.CommandType = CommandType.Text;

                command.ExecuteNonQuery();
            }
        }
        public PlayTheMatch(MainDoc mainDoc, int idMatch)
        {

            Match match = mainDoc.getMatchById(idMatch);

            random = new Random();
            List<Player> homeTeam = mainDoc.getFirstEleven(match.HomeTeam.Name);
            List<Player> guestTeam = mainDoc.getFirstEleven(match.GuestTeam.Name);

            int id = 0;//OVA TREBA DA GO DOBIJAM OD BAZATA
            Participations = new List<Participates>();
            AllPlayers = new List<Player>();

            //za oznacuvanje deka e odigran

            using (OracleConnection conn = new OracleConnection(FormLogin.connString))
            {
                conn.Open();
                String query = "UPDATE Match SET Finished = 'y'"  +
                    " WHERE idMatch = " + idMatch;
                OracleCommand command = new OracleCommand(query, conn);
                command.CommandType = CommandType.Text;

                command.ExecuteNonQuery();

            }

            totalAssistTokens = totalGoalTokens = totalInterruptTokens = totalSaveTokens = 0;
            foreach (Player p in homeTeam)
            {
                AllPlayers.Add(p);
                Participations.Add(new Participates(id, p, match, 0, 0, 0, 0));//vaka za site ucesnici se stava isto id
                totalAssistTokens += p.TokensAssists;                     //no ovaa lista e samo lokalna za ovaa klasa
                totalGoalTokens += p.TokensGoals;               //i toj index ne se koristi na drugi mesta, pa zatoa ne smeta
                totalInterruptTokens += p.TokensInterrupts;//ne go izbrisav poleto bidejki koga ke se zemaat site ucestva od glavnata forma
                totalSaveTokens += p.TokensSaves;           //ke bide potrebno i toa pole
            }
            foreach (Player p in guestTeam)
            {
                AllPlayers.Add(p);
                Participations.Add(new Participates(id, p, match, 0, 0, 0, 0));//slicna diskusija kako pogore
                totalAssistTokens += p.TokensAssists;
                totalGoalTokens += p.TokensGoals;
                totalInterruptTokens += p.TokensInterrupts;
                totalSaveTokens += p.TokensSaves;
            }
            //sluckite vo dadeni minuti
            int goalsHome = 0, goalsGuest = 0;
            for (int minute = 1; minute <= 90; minute++)//0 - goal and eventually assist, 1 - interrupt, 2 save, nothing
            {
                int happens = whatHappens();
                int nextGoal = 1;
                if (mainDoc.Goals.Count > 0) nextGoal = mainDoc.Goals[mainDoc.Goals.Count - 1].Id + 1;//Slicno kako kaj Participates, sekade ke se stava nextGoal = 0, no toa ne pravi problem
                if (happens == 0)//goal
                {
                    int scorerId = goalScorer();
                    Goal goal = new Goal(nextGoal, minute, match, AllPlayers[scorerId]);
                    if (scorerId < 11)
                    {
                        goalsHome++;
                    }
                    else
                    {
                        goalsGuest++;
                    }

                    //dodavanje na gol vo bazata
                    using (OracleConnection conn = new OracleConnection(FormLogin.connString))
                    {
                         conn.Open();

                        OracleCommand command = new OracleCommand("procInsertGoal", conn);
                        command.CommandType = CommandType.StoredProcedure;
                        /*
                         *  p_idPlayer in Goal.idPlayer%TYPE,
                         *  p_idMatch in Goal.idMatch%TYPE, 
                         *  p_minutes in Goal.minutes%TYPE) 
                         */
                        command.Parameters.Add("p_idPlayer", OracleDbType.Int32).Value = goal.Player.Id;
                        command.Parameters.Add("p_idMatch", OracleDbType.Int32).Value = goal.Match.Id;
                        command.Parameters.Add("p_minutes", OracleDbType.Int32).Value = goal.Minutes;


                        command.ExecuteNonQuery();

                    }
                    //azuriranje na mainDoc
                    mainDoc.Goals.Add(goal);
                    match.addGoal(goal);


                    Participations[scorerId].NumGoals++;
                    int assId = assistent();
                    if (assId != scorerId && (assId - 10) * (scorerId - 10) >= 0)
                    {
                        Participations[assId].NumAssists++;
                    }
                }
                else if (happens == 1)//interrupt
                {
                    int interrupterId = interrupter();
                    Participations[interrupterId].NumInterrupts++;
                }
                else if (happens == 2)//save
                {
                    int saverId = saver();
                    Participations[saverId].NumSaves++;
                }
            }
            //obnova na rejtinzi
            for(int i = 0; i < Participations.Count; i++)
            {
                Participates p = Participations[i];
                p.calculateMatchRating();
                p.MatchRating = (int) ((AllPlayers[i].Rating + 9 * p.MatchRating) / 10);
                if(i < 11) {
                    p.MatchRating = p.MatchRating + goalsHome * WEIGHT_GOALS_MATCH_RATING - goalsGuest * WEIGHT_GOALS_MATCH_RATING;
                    if (p.Player.Position.Id == 1)//napagac
                    {
                        p.MatchRating += WEIGHT_GOALS_MATCH_RATING * goalsHome;
                    }
                    else if (p.Player.Position.Id == 4)//golman
                    {
                        p.MatchRating -= WEIGHT_GOALS_MATCH_RATING * goalsGuest;
                    }
                    if (goalsHome > goalsGuest) p.MatchRating += WIN_BONUS;
                }
                else {
                    p.MatchRating = p.MatchRating + goalsHome * WEIGHT_GOALS_MATCH_RATING - goalsGuest * WEIGHT_GOALS_MATCH_RATING;
                    if (p.Player.Position.Id == 1)//napagac
                    {
                        p.MatchRating += WEIGHT_GOALS_MATCH_RATING * goalsGuest;
                    }
                    else if (p.Player.Position.Id == 4)//golman
                    {
                        p.MatchRating -= WEIGHT_GOALS_MATCH_RATING * goalsHome;
                    }
                    if (goalsHome < goalsGuest) p.MatchRating += WIN_BONUS;
                }
                
                //int nextParticipateId = mainDoc.Par[mainDoc.Goals.Count - 1].Id + 1;
                //dodavanje na ucestvata vo bazata
                using (OracleConnection conn = new OracleConnection(FormLogin.connString))
                {
                    conn.Open();

                    OracleCommand command = new OracleCommand("procInsertParticipates", conn);
                    command.CommandType = CommandType.StoredProcedure;
                    /*
                     *  p_idPlayer in Participates.idPlayer%TYPE,
                        p_idMatch in Participates.idMatch%TYPE, 
                        p_numgoals in Participates.numgoals%TYPE, 
                        p_numassists in Participates.numassists%TYPE, 
                        p_numinterrupts in Participates.NUMINTERRUPTS%TYPE,  
                        p_numsaves in Participates.numsaves%TYPE,
                        p_matchrating in Participates.match_rating%TYPE) 
                     */
                    command.Parameters.Add("p_idPlayer", OracleDbType.Int32).Value = p.Player.Id;
                    command.Parameters.Add("p_idMatch", OracleDbType.Int32).Value = p.Match.Id;
                    command.Parameters.Add("p_numgoals", OracleDbType.Int32).Value = p.NumGoals;
                    command.Parameters.Add("p_numassists", OracleDbType.Int32).Value = p.NumAssists;
                    command.Parameters.Add("p_numinterrupts", OracleDbType.Int32).Value = p.NumInterrupts;
                    command.Parameters.Add("p_numsaves", OracleDbType.Int32).Value = p.NumSaves;
                    command.Parameters.Add("p_matchrating", OracleDbType.Int32).Value = p.MatchRating;

                    command.ExecuteNonQuery();

                }
                //azuriranje na Participates

            }


            //update na Player rating
            int homeAvgRating = 0, guestAvgRating = 0;
            for (int i = 0; i < AllPlayers.Count; i++)
            {
                AllPlayers[i].updateRating(Participations[i].MatchRating);
                //mainDoc.Players[AllPlayers[i].Id].Rating = (double)AllPlayers[i].Rating;//azuriranje vo mainDoc
                if (i < 11)
                {
                    homeAvgRating += (int)AllPlayers[i].Rating;
                }
                else
                {
                    guestAvgRating += (int)AllPlayers[i].Rating;
                }
                using (OracleConnection conn = new OracleConnection(FormLogin.connString))
                {
                    conn.Open();
                    String query = "UPDATE Player SET rating = " + (int)AllPlayers[i].Rating +
                        " WHERE idPlayer = " + AllPlayers[i].Id;
                    OracleCommand command = new OracleCommand(query, conn);
                    command.CommandType = CommandType.Text;

                    command.ExecuteNonQuery();

                }
            }
            //update team ratings
            homeAvgRating /= 11;
            guestAvgRating /= 11;

            int homeNewRating = (homeAvgRating + 49 * (int)match.HomeTeam.Rating) / 50;
            int guestNewRating = (guestAvgRating + 49 * (int)match.GuestTeam.Rating) / 50;
            match.HomeTeam.Rating = homeNewRating;
            match.GuestTeam.Rating = guestNewRating;
            //mainDoc.Teams[match.GuestTeam.Id].Rating = (double) guestNewRating;
            using (OracleConnection conn = new OracleConnection(FormLogin.connString))
            {
                conn.Open();
                String query = "UPDATE Team SET rating = " + homeNewRating +
                    " WHERE idTeam = " + match.HomeTeam.Id;
                OracleCommand command = new OracleCommand(query, conn);
                command.CommandType = CommandType.Text;

                command.ExecuteNonQuery();

            }

            using (OracleConnection conn = new OracleConnection(FormLogin.connString))
            {
                conn.Open();
                String query = "UPDATE Team SET rating = " + guestNewRating +
                    " WHERE idTeam = " + match.GuestTeam.Id;
                OracleCommand command = new OracleCommand(query, conn);
                command.CommandType = CommandType.Text;

                command.ExecuteNonQuery();

            }

        }