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); }
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})}}"); }
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); }
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); }