예제 #1
0
        public bool AddCikkCsoport(Csoport newCsoport)
        {
            bool            success    = false;
            MySqlCommand    command    = new MySqlCommand();
            MySqlConnection connection = getConnection();

            command.Connection  = connection;
            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.CommandText = "AddGroup";
            MySqlParameter p_name = new MySqlParameter()
            {
                Value         = newCsoport.Name,
                ParameterName = "newName",
                Direction     = System.Data.ParameterDirection.Input,
                DbType        = System.Data.DbType.String
            };

            command.Parameters.Add(p_name);
            try
            {
                OpenConnection(connection);
                success = command.ExecuteNonQuery() == 0 ? false : true;
            }
            catch (Exception e)
            {
                Logger.Log(e.Message);
                success = false;
            }
            finally {
                CloseConnection(connection);
            }


            return(success);
        }
예제 #2
0
            public Óra(string[] sortömb, Nyom nyom)
            {
                tanár    = Tanár.lista.First(t => t.kr == sortömb[0]);
                tantárgy = new Tantárgy(sortömb, nyom);
                csoport  = new Csoport(sortömb, nyom);
                nap      = int.Parse(nap2int[sortömb[3]]);
                hanyadik = int.Parse(sortömb[4]);
                terem    = Terem.lista.First(t => t.kr == sortömb[5]);

                lista.Add(this);

                DebugConsole.Write($"[red]{{({lista.Count})}}");
            }
예제 #3
0
        public bool AddNewRuha(string newName, string mertekegyseg, Csoport group)
        {
            bool            success    = false;
            MySqlCommand    command    = new MySqlCommand();
            MySqlConnection connection = getConnection();

            command.Connection  = connection;
            command.CommandText = "addcikk";
            command.CommandType = System.Data.CommandType.StoredProcedure;
            MySqlParameter name = new MySqlParameter()
            {
                Value         = newName,
                ParameterName = "megnevezes",
                Direction     = System.Data.ParameterDirection.Input,
                DbType        = System.Data.DbType.String
            };
            MySqlParameter mertek = new MySqlParameter()
            {
                Value         = mertekegyseg,
                ParameterName = "b_mertekegyseg",
                Direction     = System.Data.ParameterDirection.Input,
                DbType        = System.Data.DbType.String
            };
            MySqlParameter gid = new MySqlParameter()
            {
                Value         = group.Id,
                ParameterName = "b_cikkcsoport",
                Direction     = System.Data.ParameterDirection.Input,
                DbType        = System.Data.DbType.Int32
            };

            command.Parameters.Add(name);
            command.Parameters.Add(mertek);
            command.Parameters.Add(gid);
            try
            {
                OpenConnection(connection);
                success = command.ExecuteNonQuery() == 0 ? false : true;
            }
            catch (Exception e)
            {
                Logger.Log(e.Message);
            }
            finally {
                CloseConnection(connection);
            }
            return(success);
        }
예제 #4
0
        public bool DeleteCikkCsoport(Csoport delCsoport)
        {
            bool            success    = false;
            MySqlCommand    command    = new MySqlCommand();
            MySqlConnection connection = getConnection();

            command.CommandText = "Delgroup";
            command.CommandType = System.Data.CommandType.StoredProcedure;
            MySqlParameter p_id = new MySqlParameter()
            {
                Value         = delCsoport.Id,
                ParameterName = "delid",
                DbType        = System.Data.DbType.Int32,
                Direction     = System.Data.ParameterDirection.Input,
            };
            MySqlParameter p_success = new MySqlParameter()
            {
                DbType    = System.Data.DbType.Int32,
                Direction = System.Data.ParameterDirection.ReturnValue
            };

            command.Parameters.Add(p_id);
            command.Parameters.Add(p_success);
            command.Connection = connection;
            try
            {
                OpenConnection(connection);
                command.ExecuteNonQuery();
                success = p_success.Value.ToString() == "1" ? true:false;
            }
            catch (Exception e)
            {
                Logger.Log(e.Message);
                success = false;
            }
            finally {
                CloseConnection(connection);
            }
            return(success);
        }