Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 public PrereqUi()
 {
     InitializeComponent();
     prereq        = new Prereq();
     preReqManager = new PreReqManager();
 }
Пример #4
0
 public Prereq Or(Prereq a, Prereq b)
 {
     // TODO: Fixme
     return(null);
 }
Пример #5
0
 public string IsExistOrInsert(Prereq prereq)
 {
     return(prereqRepository.IsExistOrInsert(prereq));
 }
Пример #6
0
 public void AddPrereq(Prereq prereq)
 {
     // Prereqs.Add(prereq);
 }
Пример #7
0
 public Prereq Unit(UnitCode code)
 {
     // TODO: Fixme
     return(Prereq.NewUnit(code));
 }
Пример #8
0
 public Prereq CP(int count)
 {
     // TODO: Fixme
     return(Prereq.NewCreditPoints(count));
 }
Пример #9
0
 public Prereq Or(Prereq a, Prereq b)
 {
     // TODO: Fixme
     return(Prereq.NewOr(new[] { a, b }));
 }
Пример #10
0
 public Prereq And(Prereq a, Prereq b)
 {
     // TODO: Fixme
     return(Prereq.NewAnd(new[] { a, b }));
 }
Пример #11
0
 public Prereq Unit(UnitCode code)
 {
     return(Prereq.NewUnit(code));
 }
Пример #12
0
 public Prereq CP(int count)
 {
     return(Prereq.NewCreditPoints(count));
 }
Пример #13
0
 public Prereq Or(Prereq a, Prereq b)
 {
     return(Prereq.NewOr(new List <Prereq> {
         a, b
     }));
 }
Пример #14
0
 public Prereq And(Prereq a, Prereq b)
 {
     return(Prereq.NewAnd(new List <Prereq> {
         a, b
     }));
 }