Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            major major = db.majors.Find(id);

            db.majors.Remove(major);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "majorId,major1,courseId")] major major)
 {
     if (ModelState.IsValid)
     {
         db.Entry(major).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.courseId = new SelectList(db.CourseLists, "courseId", "courseName", major.courseId);
     return(View(major));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "majorId,major1,courseId")] major major)
        {
            if (ModelState.IsValid)
            {
                db.majors.Add(major);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.courseId = new SelectList(db.CourseLists, "courseId", "courseName", major.courseId);
            return(View(major));
        }
Пример #4
0
        private int AddNewRowToTable(string name)
        {
            int id = -1;

            switch ((Types)tabControl1.SelectedIndex)
            {
            case Types.Family:
                family obj = new family {
                    name = name, majorid = Selections[Types.Major].Id
                };
                entities.family.Add(obj);
                id = obj.id;
                break;

            case Types.Genus:
                genus obj2 = new genus {
                    name = name, familyid = Selections[Types.Family].Id
                };
                entities.genus.Add(obj2);
                id = obj2.id;
                break;

            case Types.Species:
                species obj3 = new species {
                    name = name, genusid = Selections[Types.Genus].Id
                };
                entities.species.Add(obj3);
                id = obj3.id;
                break;

            case Types.Synonym:
                synonym obj4 = new synonym {
                    name = name, speciesid = Selections[Types.Species].Id
                };
                entities.synonym.Add(obj4);
                id = obj4.id;
                break;

            default:
                major obj5 = new major {
                    name = name
                };
                entities.major.Add(obj5);
                id = obj5.id;
                break;
            }

            entities.SaveChanges();
            GridView.CurrentRow.Cells[0].Value = id;
            Selections[(Types)tabControl1.SelectedIndex].Id = id;
            return(id);
        }
Пример #5
0
        // POST: MajorValues
        public IHttpActionResult Post(InsertMajor value)
        {
            using (universityEntities db = new universityEntities())
            {
                major major = new major();
                major.name            = value.name;
                major.numberOfCredits = value.numberOfCredits;

                db.majors.Add(major);
                db.SaveChanges();
            }
            return(Ok());
        }
Пример #6
0
        // GET: majors/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            major major = db.majors.Find(id);

            if (major == null)
            {
                return(HttpNotFound());
            }
            return(View(major));
        }
Пример #7
0
        public ActionResult Edit(string id)
        {
            MajorList majorList  = new MajorList();
            major     _majorList = majorList.GetMajorByCode(id);

            FacilityList facilityList = new FacilityList();


            var obj = facilityList.ListAll();

            ViewBag.facilityCode = new SelectList(obj, "code", "name", _majorList.facilitycode);

            return(View(_majorList));
        }
Пример #8
0
        // GET: majors/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            major major = db.majors.Find(id);

            if (major == null)
            {
                return(HttpNotFound());
            }
            ViewBag.courseId = new SelectList(db.CourseLists, "courseId", "courseName", major.courseId);
            return(View(major));
        }
Пример #9
0
        public ActionResult Create(major cl)
        {
            FacilityList facilityList = new FacilityList();             //Khởi tạo biếm có giá trị là class được khai báo trong models/batch
            var          obj          = facilityList.ListAll();         //Gọi hàm listall khai báo trong class trong models lấy ra danh sách batch

            ViewBag.facilityCode = new SelectList(obj, "code", "name"); //Đưa viewBag vào view
            //try
            //{
            // TODO: Add insert logic here
            MajorList majorList = new MajorList();

            majorList.Insert(cl);     //Gọi đến hàm addClass trong class ClassList trong models
            return(RedirectToAction("Index"));
            //}
            //catch
            //{
            //    return View();
            //}
        }
Пример #10
0
        public ActionResult Edit(string id, major cl)
        {
            FacilityList facilityList = new FacilityList();


            var obj = facilityList.ListAll();

            ViewBag.facilityCode = new SelectList(obj, "code", "name");
            //try
            //{
            // TODO: Add insert logic here
            MajorList majorList = new MajorList();

            majorList.UpdateMajor(id, cl);     //Gọi đến hàm addClass trong class ClassList trong models
            return(RedirectToAction("Index"));
            //}
            //catch
            //{
            //    return View();
            //}
        }
 => _minVersion = new Version(major, minor, build);
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModuleVersion"/> class using the specified major, minor, and build values.
 /// </summary>
 /// <param name="major">The major version number.</param>
 /// <param name="minor">The minor version number.</param>
 /// <param name="build">The build number.</param>
 public ModuleVersion(int major, int minor, int build) => Initialize(major, minor, build, null);
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModuleVersion"/> class using the specified major and minor values.
 /// </summary>
 /// <param name="major">The major version number.</param>
 /// <param name="minor">The minor version number.</param>
 public ModuleVersion(int major, int minor) => Initialize(major, minor, null, null);
Пример #14
0
 => version is not null && version < new Version(major, minor);
 public MinimumPostgresVersionAttribute(int major, int minor) => _version = new Version(major, minor);
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModuleVersion"/> class with the specified major, minor, build, and revision numbers.
 /// </summary>
 /// <param name="major">The major version number.</param>
 /// <param name="minor">The minor version number.</param>
 /// <param name="build">The build number.</param>
 /// <param name="revision">The revision number.</param>
 public ModuleVersion(int major, int minor, int build, int revision) => Initialize(major, minor, build, revision);
Пример #17
0
        private static void courseSubjectMap(string courseURL, string courseIDNumber)
        {
            Debug.WriteLine(courseURL);
            var htmldocument = DocumentURLReturn(courseURL);

            var courseSubjects = htmldocument.DocumentNode.Descendants("table")
                                 .Where(node => node.InnerText.Contains("Year")).ToList();

            if (courseSubjects.Count != 0)
            {
                var  list   = courseSubjects[0].SelectNodes("tr");
                int  i      = 0;
                bool noyear = true;
                while (noyear)
                {
                    //Debug.WriteLine(list[i + 1].InnerText.ToString() + "   " + list[i + 1].InnerText.Contains("Year"));
                    if (list[i + 1].InnerText.Contains("Year"))
                    {
                        noyear = false;
                    }
                    i++;
                }

                list.Skip(i);
                var    list2   = list.Skip(i - 1).ToList();
                string majorin = "";
                string year    = "";
                string session = "";
                string subject = "";

                using (MyDbContext context = new MyDbContext())
                {
                    for (int j = 0; j < list2.Count; j++)
                    {
                        if (list2[j].InnerHtml.ToString().Contains("<strong") && list2[j + 1].InnerHtml.ToString().Contains("<strong"))
                        {
                            majorin = list2[j].InnerText.ToString();
                            if (majorin == "")
                            {
                                majorin = "Default";
                            }
                            Debug.WriteLine("MAJOR: " + majorin);
                            Debug.WriteLine("Course Number: " + courseIDNumber);

                            CourseList courses = context.CourseLists.FirstOrDefault(c => c.courseNumber == courseIDNumber);
                            Debug.WriteLine("Course Name: " + courses.courseName + " Course ID: " + courses.courseId + " Course Number: " + courses.courseNumber);
                            courses.majors.Add(new major {
                                major1 = majorin, courseId = courses.courseId
                            });
                            context.SaveChanges();
                        }
                        if (list2[j].InnerText.ToString().Contains("Year"))
                        {
                            year = list2[j].InnerText.ToString();
                            Debug.WriteLine(" YEAR: " + year);
                        }
                        if (list2[j].InnerText.ToString().Contains("session"))
                        {
                            session = list2[j].InnerText.ToString().Trim();
                            Debug.WriteLine("  SESSION: " + session);
                        }
                        if (list2[j].InnerHtml.ToString().Contains("a href"))
                        {
                            if (list2[j].ChildNodes.Where(node => node.InnerHtml.Contains("a href")).First().FirstChild.InnerText.ToString().Trim().Any(x => char.IsLetter(x)))
                            {
                                Debug.WriteLine("   STREAM NUMBER : " + list2[j].ChildNodes.Where(node => node.InnerHtml.Contains("a href")).First().FirstChild.InnerText.ToString().Trim());
                            }
                            else
                            {
                                subject = list2[j].ChildNodes.Where(node => node.InnerHtml.Contains("a href")).First().FirstChild.InnerText.ToString().Trim();
                                Debug.WriteLine("   SUBJECT NUMBER: " + subject);
                                major majorTable = context.majors.FirstOrDefault(c => c.major1 == majorin);
                                majorTable.majorSubjects.Add(new majorSubject {
                                    subjectNumber = subject, subjectYear = Int32.Parse(Regex.Match(year, @"\d+").Value), subjectSemester = session
                                });
                            }
                        }
                        if (list2[j].InnerHtml.ToString().Contains(" credit points ") && list2[j].InnerHtml.ToString().Contains("following"))
                        {
                            Debug.WriteLine("      Credit Point Select: " + Regex.Match(list2[j].ChildNodes.Where(node => node.InnerHtml.Contains(" credit points ")).FirstOrDefault().InnerText.ToString().Trim(), @"\d+").Value);
                        }
                    }
                    context.SaveChanges();
                }

                Debug.WriteLine("");
                //var courselist = coursdetailsHTML[0].SelectNodes("a");

                //var coursdetailsHTML = htmldocument.DocumentNode.SelectNodes("//table")
                //    .Where(node => node.InnerText
                //    .Contains("Year"));
            }
        }
 => _minVersion = new Version(major, minor);