コード例 #1
0
        static void Main(string[] args)
        {
            faculty f = new faculty();

            Console.WriteLine(f.department);
            Console.ReadKey();
        }
コード例 #2
0
        public ActionResult Login(student model)
        {
            if (ModelState.IsValid)
            {
                var Username = db.students.FirstOrDefault(x => x.username == model.username && x.password == model.password);
                if (Username != null)
                {

                    faculty faculty = db.faculties.SingleOrDefault(f => f.facultyID == Username.facultyID);
                    department department = db.departments.SingleOrDefault(d => d.departmentID == Username.departmentID);
                    instructor instructor = db.instructors.SingleOrDefault(d => d.instructorID == Username.instructorID);


                    Session["StudentName"] = Username.stufullname;
                    Session["StudentNumber"] = Username.number;
                    Session["StudentDep"] = department.depname;
                    Session["StudentFac"] = faculty.facultyname;
                    Session["studepid"] = Username.departmentID;
                    Session["studentid"] = Username.studentID;
                    Session["stufoto"] = Username.image;
                    Session["stuinst"] = instructor.instfullname;
                    Session["curriculum"] = department.curriculum;
                    Session["Username"] = Username;
                    ViewBag.curriculum = department.curriculum;
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ViewBag.Message = "Username or password wrong!!!";
                }
            }

            return View(model);
        }
コード例 #3
0
        public async Task <IHttpActionResult> CreateFaculty([FromBody] faculty form)
        {
            try
            {
                //find duplicate faculty code
                var faculty = db.faculties.Where(a => a.faculty_code.ToString().ToUpper() == form.faculty_code.ToString().ToUpper()).FirstOrDefault();
                if (faculty == null)
                {
                    form.create_at       = DateTime.Now;
                    db.Entry(form).State = System.Data.Entity.EntityState.Added;
                    int check = await db.SaveChangesAsync();

                    if (check > 0)
                    {
                        return(Ok(await ListFaculty()));
                    }
                    else
                    {
                        return(BadRequest("Create faculty error"));
                    }
                }
                else
                {
                    return(BadRequest("Duplicate faculty"));
                }
            }
            catch
            {
                return(BadRequest("Error"));
            }
        }
コード例 #4
0
        private JObject addStudyPlan(Command value)
        {
            var studyPlanObj = JsonConvert.DeserializeObject <StudyPlan>(value.data.ToString());
            var major        = new faculty();

            major.name      = studyPlanObj.major;
            major.idfaculty = Guid.NewGuid().ToString().Substring(0, 32).Replace("-", "");
            _db.insertFaculty(ref major);


            group group = new group();

            group.idgroups     = Guid.NewGuid().ToString().Replace("-", "");
            group.name         = studyPlanObj.major;
            group.idsemesters  = null;
            group.idsupergroup = null;
            group.idfaculty    = major.idfaculty;

            studyPlanObj.id = group.idgroups;

            _db.insertGroup(ref group);

            foreach (SubGroup it in studyPlanObj.semesters)
            {
                semester semester = new semester();
                semester.idsemesters = Guid.NewGuid().ToString().Replace("-", "");
                semester.name        = it.name;
                _db.insertSemester(ref semester);
                addGroup(it, semester.idsemesters, group.idgroups, major.idfaculty);
            }

            return(JObject.Parse(JsonConvert.SerializeObject(studyPlanObj)));
        }
コード例 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            faculty faculty = db.faculties.Find(id);

            db.faculties.Remove(faculty);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            faculty faculty = db.faculties.Find(id);

            faculty.is_deleted  = true;
            faculty.modified_on = DateTime.Now;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "facultyID,facultyname")] faculty faculty)
 {
     if (ModelState.IsValid)
     {
         db.Entry(faculty).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(faculty));
 }
コード例 #8
0
 public ActionResult Create([Bind(Include = "facultyID,facultyname")] faculty faculty)
 {
     if (ModelState.IsValid)
     {
         db.faculties.Add(faculty);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(faculty));
 }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "id,employee_id,first_name,middle_name,last_name,gender,birthdate,e_mail,mobile_number,work_number,is_deleted,created_by,created_on,modified_by,modified_on")] faculty faculty)
 {
     if (ModelState.IsValid)
     {
         db.Entry(faculty).State = EntityState.Modified;
         faculty.modified_on     = DateTime.Now;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(faculty));
 }
コード例 #10
0
        public FacultyViewModel(faculty f)
        {
            if (f != null)
            {
                this.Id        = f.Id;
                this.FirstName = f.Firstname;
                this.LastName  = f.Lastname;

                /* this.Offered = f.offereds
                 *   .Select(s => new OfferedViewModel(s))
                 *   .ToList();*/
            }
        }
コード例 #11
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            faculty faculty = db.faculties.Find(id);

            if (faculty == null)
            {
                return(HttpNotFound());
            }
            return(View(faculty));
        }
コード例 #12
0
        public async Task <IHttpActionResult> UpdateFaculty(int id, [FromBody] faculty form)
        {
            try
            {
                var findFac = db.faculties.Where(a => a.id == id).FirstOrDefault();
                if (findFac != null)
                {
                    //find duplicate faculty code
                    var faculty = db.faculties.Where(a => a.faculty_code.ToString().ToUpper() == form.faculty_code.ToString().ToUpper() && a.id != id).FirstOrDefault();
                    if (faculty == null)
                    {
                        findFac.faculty_name        = form.faculty_name;
                        findFac.faculty_code        = form.faculty_code;
                        findFac.faculty_description = form.faculty_description;
                        db.Entry(findFac).State     = System.Data.Entity.EntityState.Modified;
                        int check = await db.SaveChangesAsync();

                        if (check > 0)
                        {
                            return(Ok(await ListFaculty()));
                        }
                        else
                        {
                            return(BadRequest("Update faculty error"));
                        }
                    }
                    else
                    {
                        return(BadRequest("Duplicate faculty"));
                    }
                }
                else
                {
                    return(BadRequest("Faculty not found."));
                }
            }
            catch
            {
                return(BadRequest("Error"));
            }
        }
コード例 #13
0
ファイル: main.cs プロジェクト: CMalone9008/Lab11
    public static void Main(string[] args)
    {
        /*Console.WriteLine("Testing Address");
         * Address addr1 = new Address();
         * addr1.AddressLine1="1234 Main St";
         * addr1.AddressLine2="Apt 102";
         * addr1.City = "Cleveland";
         * addr1.State = "azzffdsfd";
         * addr1.Zipcode = "44143";
         *
         * addr1.Display();*/

        /*Console.WriteLine("Testing Person");
         * Person p1 = new Person();
         * p1.FirstName = "John";
         * p1.LastName = "Smith";
         * p1.PermanentAddress.AddressLine1 = "1234 Main St";
         * p1.PermanentAddress.City = "Cleveland";
         * p1.PermanentAddress.State = "OH";
         * p1.PermanentAddress.Zipcode = "44143";
         * p1.DateOfBirth = Convert.ToDateTime("07/13/1994");
         * p1.Intro();
         * p1.IsBirthday();  */

        Console.WriteLine("Testing Student 1");
        Student s1 = new Student();

        s1.FirstName   = "Kara";
        s1.LastName    = "Kaiser";
        s1.DateOfBirth = Convert.ToDateTime("01/01/2020");
        s1.PermanentAddress.AddressLine1 = "999 Mallard Dr";
        s1.PermanentAddress.City         = "Parma";
        s1.PermanentAddress.State        = "OH";
        s1.PermanentAddress.Zipcode      = "44143";
        s1.GPA    = 2.1;
        s1.School = "Cleveland State University";
        s1.Intro();
        s1.IsBirthday();
        s1.SetAcademicStanding();
        Console.WriteLine(s1.AcademicStanding);


        Console.WriteLine("Testing Student 2");
        Student s2 = new Student("Andrew", "Peggman");

        s2.DateOfBirth = Convert.ToDateTime("01/01/1989");
        s2.PermanentAddress.AddressLine1 = "999 Mallard Dr";
        s2.PermanentAddress.City         = "Parma";
        s2.PermanentAddress.State        = "OH";
        s2.PermanentAddress.Zipcode      = "44143";
        s2.GPA    = 2.75;
        s2.School = "Ohio State University";
        s2.Intro();
        s2.IsBirthday();
        s2.SetAcademicStanding();
        Console.WriteLine(s2.AcademicStanding);


        Console.WriteLine("\nNew Faculty Member:");
        faculty f1 = new faculty("Carl", "Malone", "Professor");

        f1.Intro();
        f1.GrantTenured(2000);
        f1.Raise();
        f1.Promote();
    }
コード例 #14
0
 public virtual void update faculty data()
 {
     throw new System.NotImplementedException();
 }