private List <Prereq> GetInput() { var adventNum = this.GetType().Name.ToCharArray().Last(); string resourceName = "Advent2018.Advent7.Input.txt"; var input = this.GetType().Assembly.GetManifestResourceStream(resourceName); var vals = new List <Prereq>(); using (var txt = new StreamReader(input)) { while (!txt.EndOfStream) { vals.Add(Prereq.Parse(txt.ReadLine())); } } return(vals); }
public string IsExistOrInsert(Prereq prereq) { string exist = ""; try { sqlConnection.Open(); commadString = "SELECT * FROM prereqs WHERE course_id = '" + prereq.Course_id + "' AND prereq_id = '" + prereq.Prereq_id + "'"; sqlCommand = new SqlCommand(commadString, sqlConnection); sqlDataAdapter = new SqlDataAdapter(sqlCommand); dataTable = new DataTable(); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { exist = "Data is exist \n Please check duplicated data"; } sqlConnection.Close(); if (String.IsNullOrEmpty(exist)) { sqlConnection.Open(); commadString = "INSERT INTO prereqs VALUES('" + prereq.Course_id + "','" + prereq.Prereq_id + "')"; sqlCommand = new SqlCommand(commadString, sqlConnection); sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); } } catch (Exception exception) { sqlConnection.Close(); } return(exist); }
public PrereqUi() { InitializeComponent(); prereq = new Prereq(); preReqManager = new PreReqManager(); }
public Prereq Or(Prereq a, Prereq b) { // TODO: Fixme return(null); }
public string IsExistOrInsert(Prereq prereq) { return(prereqRepository.IsExistOrInsert(prereq)); }
public void AddPrereq(Prereq prereq) { // Prereqs.Add(prereq); }
public Prereq Unit(UnitCode code) { // TODO: Fixme return(Prereq.NewUnit(code)); }
public Prereq CP(int count) { // TODO: Fixme return(Prereq.NewCreditPoints(count)); }
public Prereq Or(Prereq a, Prereq b) { // TODO: Fixme return(Prereq.NewOr(new[] { a, b })); }
public Prereq And(Prereq a, Prereq b) { // TODO: Fixme return(Prereq.NewAnd(new[] { a, b })); }
public Prereq Unit(UnitCode code) { return(Prereq.NewUnit(code)); }
public Prereq CP(int count) { return(Prereq.NewCreditPoints(count)); }
public Prereq Or(Prereq a, Prereq b) { return(Prereq.NewOr(new List <Prereq> { a, b })); }
public Prereq And(Prereq a, Prereq b) { return(Prereq.NewAnd(new List <Prereq> { a, b })); }