Example #1
0
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            //  Create CourseCatalog, ScheduleOfClasses, and Faculty objects.
            //  The order of creation is important because a ScheduleOfClasses
            //  needs a CourseCatalog object to properly initialize and a
            //  Faculty object needs a ScheduleOfClasses object.

            //  Create a CourseCatalog object and read data from input files. dfdgfddfg

            CourseCatalog catalog = new CourseCatalog("CourseCatalog.dat", "Prerequisites.dat");
            catalog.ReadCourseCatalogData();
            catalog.ReadPrerequisitesData();

            //  Create a ScheduleOfClasses object and read data from input file.

            ScheduleOfClasses schedule = new ScheduleOfClasses("SoC_SP2009.dat", "SP2009");
            schedule.ReadScheduleData(catalog);

            //  Create a Faculty object and read data from input files.

            Faculty faculty = new Faculty("Faculty.dat", "TeachingAssignments.dat");
            faculty.ReadFacultyData();
            faculty.ReadAssignmentData(schedule);

            // Create and display an instance of the main GUI window

            Application.Run(new MainForm(schedule));
        }
Example #2
0
 static void TestSaveFacultyToXML(string path, Faculty.Faculty faculty)
 {
     using (var st = new FileStream(path, FileMode.Create))
     {
         XML.SaveFacultyToXML(st, faculty);
     }
 }
Example #3
0
        public Member(StreamReader sr)
        {
            firstName = sr.ReadLine();
            lastName = sr.ReadLine();
            type = (MemberType)Convert.ToInt32(sr.ReadLine());
            uiStudentNumber = Convert.ToUInt32(sr.ReadLine());
            memberFaculty = (Faculty)Convert.ToInt32(sr.ReadLine());

            otherInstrument = sr.ReadLine();
            curInstrument = (Instrument)Convert.ToInt32(sr.ReadLine());

            this.bMultipleInstruments = Convert.ToBoolean(sr.ReadLine());

            // write if the member plays multiple instruments
            // write any other instruments that the member plays (or does not play)
            int numberOfInstruments = Enum.GetValues(typeof(Member.Instrument)).Length;
            if (this.bMultipleInstruments)
            {
                playsInstrument = new bool[Enum.GetValues(typeof(Member.Instrument)).Length];
                for (int j = 0; j < numberOfInstruments; j++)
                    playsInstrument[j] = Convert.ToBoolean(sr.ReadLine());
            }

            email = sr.ReadLine();
            comments = ClsStorage.ReverseCleanNewLine(sr.ReadLine());
            sID = Convert.ToInt16(sr.ReadLine());
            signupTime = new DateTime(Convert.ToInt64(sr.ReadLine()));
            size = (ShirtSize)Convert.ToInt32(sr.ReadLine());
        }
Example #4
0
 public Member(
     string firstName,
     string lastName,
     MemberType type,
     uint uiStudentNumber,
     int iFaculty,
     string instrument,
     string otherInstrument,
     string email,
     string comments,
     int iShirt)
 {
     // declare basic information about user
     this.firstName = firstName;
     this.lastName = lastName;
     this.type = type;
     this.uiStudentNumber = uiStudentNumber;
     this.memberFaculty = (Faculty)iFaculty;
     this.curInstrument = ParseInstrument(instrument);
     if (this.curInstrument == Instrument.Other && String.IsNullOrEmpty(otherInstrument))
         this.otherInstrument = instrument;
     else
         this.otherInstrument = otherInstrument;
     this.email = email;
     this.comments = comments;
     this.sID = ClsStorage.currentClub.iMember;
     this.signupTime = DateTime.Now;
     this.size = (ShirtSize)iShirt;
     this.bMultipleInstruments = false;
 }
 public static FacultyModel FromFaculty(Faculty faculty)
 {
     return new FacultyModel() {
         id = faculty.Id,
         name = faculty.Name
     };
 }
 public UniversityInfo(int course, Specialty spec, University uni, Faculty fac)
 {
     this.Course = course;
     this.Specialty = spec;
     this.University = uni;
     this.Faculty = fac;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["HOD"] != null)
         Response.Redirect("HOD/Home.aspx");
     if (Session["Faculty"] != null)
         Response.Redirect("Faculty/Home.aspx");
     HttpCookie rememberMeCookie = Request.Cookies["rememberMe"];
     if(rememberMeCookie != null)
     {
         Faculty faculty = new Faculty();
         faculty = faculty.GetFacultyDetails(int.Parse(rememberMeCookie["ID"].ToString()));
         if(faculty != null)
         {
             if (faculty.Designation == DesignationType.HOD)
             {
                 Session["HOD"] = faculty;
                 Response.Redirect("HOD/Home.aspx");
             }
             else
             {
                 Session["Faculty"] = faculty;
                 Response.Redirect("Faculty/Home.aspx");
             }
         }
     }
 }
Example #8
0
        public static void SaveToFile(Faculty faculty, string filename, BaseFormatter formatter)
        {
            Stream fs = new FileStream(filename, FileMode.Create);

            formatter.WriteFaculty(faculty, fs);

            fs.Close();
        }
Example #9
0
        private void ChangeAdvisor(Student stud, Faculty prof)
        {
            foreach (Faculty oldProf in FacultyList)
                oldProf.Advisees.Remove(stud.UserName);

            stud.Status = prof.UserName;
            prof.Advisees.Add(stud.UserName);
        }
Example #10
0
 public Course(int courseId, string name, Faculty faculy)
 {
     Id= new Guid();
     CourseId = courseId;
     Name = name;
     Faculty = faculy;
     CourseInSemesters = new List<CourseInSemester>();
 }
 public static string getDepartmentFromFacultyID(string faculty_id)
 {
     Faculty faculty = new Faculty(faculty_id);
     if (faculty.getFalcutyInformation()){
         return faculty.department;
     }
     return null;
 }
Example #12
0
 public Student(string firstName, string middleName, string familyName, string ssn, Speciality speciality, Faculty faculty, University university,
    string course, string addres, string email)
     : this(firstName, middleName, familyName, ssn, speciality, faculty, university)
 {
     this.Course = course;
     this.Adress = addres;
     this.Email = email;
 }
Example #13
0
 //every person to be a student must have this
 public Student(string firstName, string middleName, string familyName, string ssn,
     Speciality speciality, Faculty faculty, University university)
     : base(firstName, middleName, familyName, ssn)
 {
     this.Speciality = speciality;
     this.Faculty = faculty;
     this.University = university;
 }
Example #14
0
        private void ChangeInstructor(courseinfo course, Faculty prof)
        {
            foreach (Faculty oldProf in FacultyList)
                oldProf.Next.Remove(course.Coursename);

            course.Instructor = prof.UserName;
            prof.Next.Add(course.Coursename);
        }
Example #15
0
 public FacultyForm(Faculty fac, List<Student> studs, List<courseinfo> next, List<courseinfo> prev)
 {
     InitializeComponent();
     faculty = fac;
     StudentList = studs;
     NextCourses = next;
     PrevCourses = prev;
 }
Example #16
0
File: XML.cs Project: Raumo0/Labs
 public static Group LoadGroupFromXML(FileStream stream, Faculty.Faculty faculty)
 {
     try
     {
         var reader = new XmlTextReader(stream);
         int groupNumber = 0;
         var path = string.Empty;
         while (reader.Read())
         {
             switch (reader.Name)
             {
                 case "groupNumber":
                     groupNumber = int.Parse(reader.ReadString());
                     break;
                 case "students":
                     if (reader.AttributeCount >= 1)
                         path = reader.GetAttribute("path");
                     break;
             }
         }
         var group = new Group(faculty, groupNumber);
         if (faculty != null)
             faculty.Add(group);
         if (!string.IsNullOrWhiteSpace(path))
         {
             var dir = new DirectoryInfo(path);
             var files = dir.GetFiles(@"*.xml");
             foreach (var file in files)
             {
                 var intream = file.Open(FileMode.Open);
                 LoadStudentFromXML(intream, group);
                 intream.Close();
             }
         }
         return group;
     }
     catch (ArgumentNullException exception)
     {
         throw new ArgumentNullException(exception.Source);
     }
     catch (XmlException exception)
     {
         throw new XmlException(exception.Source);
     }
     catch (InvalidOperationException exception)
     {
         throw new InvalidOperationException(exception.Source);
     }
     catch(FileNotFoundException exception)
     {
         throw new FileNotFoundException(exception.Source);
     }
     catch (DirectoryNotFoundException exception)
     {
         throw new DirectoryNotFoundException(exception.Source);
     }
 }
 public Guid? Create(Faculty faculty)
 {
     var isUniqueAlias = !_objectFactory.GetRepositoryInstance<Faculty>().GetAll().Select(x => x.Alias).Contains(faculty.Alias);
     if (!isUniqueAlias)
         throw new Exception("Faculty Alias in not unique");
     _objectFactory.GetRepositoryInstance<Faculty>().Add(faculty);
     _objectFactory.Commit();
     return _objectFactory.GetRepositoryInstance<Faculty>().Find(x => x.Id == faculty.Id).FirstOrDefault().Id;
 }
Example #18
0
 static Faculty TestCreateFaculty(string name)
 {
     var faculty = new Faculty(name);
     faculty.Add(TestCreateGroup(faculty, 152001, 1520100));
     faculty.Add(TestCreateGroup(faculty, 152002, 1520200));
     faculty.Add(TestCreateGroup(faculty, 152003, 1520300));
     faculty.Add(TestCreateGroup(faculty, 152004, 1520400));
     faculty.Add(TestCreateGroup(faculty, 152005, 1520500));
     return faculty;
 }
Example #19
0
 static Group TestCreateGroup(Faculty faculty, int numberGroup, int studentID)
 {
     var group = new Group(faculty, numberGroup);
     var st = TestCreateStudent(group, studentID);
     foreach (var student in st)
     {
         group.Add(student);
     }
     return group;
 }
Example #20
0
        public override Faculty ReadFaculty(Stream st)
        {
            Faculty faculty = new Faculty();
            br = new BinaryReader(st);

            for (int i = 0; i < br.ReadInt32(); i++)
                faculty.Groups.Add(ReadGroup());

            br.Close();
            return faculty;
        }
 public Lecture(int id, string name, string description, ChannelType type, DateTimeOffset creationDate, 
     DateTimeOffset modificationDate, string term, string locations, string dates, string contacts,
     string website, bool deleted, Faculty faculty, string startDate, string endDate, string lecturer, string assistant)
     : base(id, name, description, type, creationDate, modificationDate, term, locations, dates, contacts, website, deleted)
 {
     this.faculty = faculty;
     this.startDate = startDate;
     this.endDate = endDate;
     this.lecturer = lecturer;
     this.assistant = assistant;
 }
Example #22
0
        public override void WriteFaculty(Faculty faculty, Stream st)
        {
            bw = new BinaryWriter(st);

            bw.Write(faculty.Name);
            bw.Write(faculty.Groups.Count);

            foreach (Group group in faculty.Groups)
                WriteGroup(group);

            bw.Close();
        }
 public Student(string firstName, string middleName, string lastName, string ssn, string address, string phoneNumber,
     string email, int? course, Specialty specialtyName, Faculty facultyName, University universityName)
     : this(firstName, middleName, lastName, ssn)
 {
     this.Address = address;
     this.PhoneNumber = phoneNumber;
     this.Email = email;
     this.Course = course;
     this.SpecialtyName = specialtyName;
     this.FacultyName = facultyName;
     this.UniversityName = universityName;
 }
Example #24
0
        public override void WriteFaculty(Faculty faculty, Stream st)
        {
            sw = new StreamWriter(st);

            sw.WriteLine(faculty.Name);
            sw.WriteLine(faculty.Groups.Count);

            foreach (Group group in faculty.Groups)
                WriteGroup(group);

            sw.Close();
        }
Example #25
0
    public static int DeleteFaculty(Faculty faculty)
    {
        SqlConnection con = new SqlConnection(GetConnectionString());
        string del = "DELETE FROM Faculty "
            + "WHERE FID = @FID ";
        SqlCommand cmd = new SqlCommand(del, con);
        cmd.Parameters.AddWithValue("FID", faculty.ID);

        con.Open();
        int i = cmd.ExecuteNonQuery();
        con.Close();
        return i;
    }
Example #26
0
        static void Main(string[] args)
        {
            Student[] students = {
                                     new Student("111111", "Vasya", "Petrov", 5.7),
                                     new Student("222222", "Vanya", "Ivanov", 6.4),
                                     new Student("333333", "Oleg", "Zubarev", 8.6),
                                     new Student("444444", "Vasya", "Vovochkin", 3.4),
                                     new Student("555555", "Mark", "Bezfamilniy", 9),
                                     new Student("666666", "Nikita", "Tolsty", 1),
                                 };

            Faculty faculty = new Faculty("FKSIS");

            Group group1 = new Group("052004");
            group1.AddStudent(students[0]);
            group1.AddStudent(students[1]);
            group1.AddStudent(students[3]);

            Group group2 = new Group("052001");
            group2.AddStudent(students[2]);
            group2.AddStudent(students[4]);
            group2.AddStudent(students[5]);

            faculty.AddGroup(group1);
            faculty.AddGroup(group2);

            Console.WriteLine(faculty);

            Console.WriteLine("\nWriting to text file data.txt");
            Storage.SaveToFile(faculty, "data.txt", new TextFormatter());

            Console.WriteLine("Reading from text file data.txt\n");
            faculty = Storage.LoadFromFile("data.txt", new TextFormatter());

            Console.WriteLine(faculty);

            Console.WriteLine("\nWriting to binary file data.bin");
            Storage.SaveToFile(faculty, "data.txt", new TextFormatter());

            Console.WriteLine("Reading from binarytext file data.bin\n");
            faculty = Storage.LoadFromFile("data.txt", new TextFormatter());

            Console.WriteLine(faculty);

            Console.WriteLine(String.Format("Student's count: {0}\n", faculty.GetStudentsCount()));
            Console.WriteLine(String.Format("Students with average mark above 5: {0}", faculty.GetStudentCountWhereMark(5, true)));
            Console.WriteLine(String.Format("Students with average mark below 5: {0}", faculty.GetStudentCountWhereMark(5, false)));
            Console.WriteLine(String.Format("\nAverage mark: {0:0.00}", faculty.GetAverageMark()));

            Console.Read();
        }
 public Student(string firstName, string middleName, string lastName, string address, uint phone, byte course, int ssn, 
     Specialty specialty, University university, Faculty faculty)
 {
     this.FirstName = firstName;
     this.MiddleName = middleName;
     this.LastName = lastName;
     this.Address = address;
     this.Phone = phone;
     this.Course = course;
     this.SSN = ssn;
     this.Specialty = specialty;
     this.University = university;
     this.Faculty = faculty;
 }
Example #28
0
        public void DeleteFacultyTest()
        {
            Faculty f = new Faculty();
            f.first = "TestPerson";
            f.last = "TestPersonsLastname";

            FacultyDB.InsertFaculty(f);

            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = FacultyDB.DeleteFaculty(f);
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #29
0
        public override Faculty ReadFaculty(Stream st)
        {
            sr = new StreamReader(st);

            Faculty faculty = new Faculty();

            faculty.Name = sr.ReadLine();
            int count = Int32.Parse(sr.ReadLine());

            for (int i = 0; i < count; i++)
                faculty.Groups.Add(ReadGroup());

            sr.Close();
            return faculty;
        }
 public Student(string firstName, string secondName, string lastName, string permanentAddress, int SSN, int mobilePhone,
                 string email, string course, Specialty spec, University uni, Faculty fac)
 {
     this.firstName = firstName;
     this.secondName = secondName;
     this.lastName = lastName;
     this.SSN = SSN;
     this.mobilePhone = mobilePhone;
     this.permanentAddress = permanentAddress;
     this.email = email;
     this.course = course;
     this.spec = spec;
     this.uni = uni;
     this.fac = fac;
 }
 public ActionResult Create(Faculty model)
 {
     db.Facultys.Add(model);
     db.SaveChanges();
     return(RedirectToAction("FacultyList", "Faculty"));
 }
Example #32
0
 public Student(string firstName, string lastName, University university, Faculty faculty, Specialty specialty, string ssn)
     : this(firstName, "", lastName, university, faculty, specialty, ssn, "", "", "", 0)
 {
 }
Example #33
0
 public ActionResult AddFaculty(Faculty f)
 {
     TempData["add"] = "Faculty Added Sucessfully";
     adminviewmodal.AddFaculty(f);
     return(View(adminviewmodal.GetAllFacuilty()));
 }
Example #34
0
 public Student(string firstName, string middleName, string familyName, string ssn, Speciality speciality, Faculty faculty, University university,
                string course, string addres, string email)
     : this(firstName, middleName, familyName, ssn, speciality, faculty, university)
 {
     this.Course = course;
     this.Adress = addres;
     this.Email  = email;
 }
        public async Task <ICollection <ExtendedLesson> > GetFacultyUnprocessedLessons(Faculty faculty)
        {
            // check if key is present
            // if not populate cache
            // return value
            ICollection <ExtendedLesson> result;
            var facultyLock = _facultyLocks.GetOrAdd(faculty, new OneManyLock());

            try
            {
                facultyLock.Enter(false);
                _cacheLock.Enter(false);

                if (!_unprocessedLessonsCache.ContainsKey(faculty))
                {
                    facultyLock.Leave();
                    _cacheLock.Leave();
                    facultyLock.Enter(true);
                    _cacheLock.Enter(false);

                    if (!_unprocessedLessonsCache.ContainsKey(faculty))
                    {
                        _cacheLock.Leave();

                        var facultyRawLessons = await GetFacultyRawLessonsInternal(faculty);

                        _cacheLock.Enter(true);
                        _unprocessedLessonsCache.Add(faculty, facultyRawLessons);
                    }
                }

                result = new List <ExtendedLesson>(_unprocessedLessonsCache[faculty]);
                return(result);
            }
            finally
            {
                _cacheLock.Leave();
                facultyLock.Leave();
            }
        }
Example #36
0
 public Student(string firstName, string middleName, string lastName, ulong ssn, string address, string phone, string email, int course, Specialty specialty, Faculty faculty, University university)
 {
     this.FirstName            = firstName;
     this.MiddleName           = middleName;
     this.LastName             = lastName;
     this.SocialSecurityNumber = ssn;
     this.Address     = address;
     this.MobilePhone = phone;
     this.Email       = email;
     this.Course      = course;
     this.Specialty   = specialty;
     this.Faculty     = faculty;
     this.University  = university;
 }
Example #37
0
 public Persona(string _surName, DateTime _DateOfBirth, Faculty _faculty)
 {
     surName     = _surName;
     DateOfBirth = _DateOfBirth;
     faculty     = _faculty;
 }
Example #38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];

            // ======== Process ===========
            if (!Page.IsPostBack)
            {
                List <FacultyData> faculty = new Faculty().getFaculty();
                ddlCURR_FACULTY.Items.Clear();
                foreach (FacultyData row in faculty)
                {
                    ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code));

                    //if(row.Faculty_Code == "11")
                    //    {
                    //    ddlCURR_FACULTY.Items.FindByValue(row.Faculty_Code).Selected = true;
                    //    }
                }
                ddlCURR_FACULTY.Items.Insert(0, new ListItem("-- ทุกคณะ --", "00"));


                // Head Table
                string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "คณะ", "แก้ไข", "ลบ" };
                tblElective.Attributes.Add("class", "table table-bordered table-striped table-hover");
                tblElective.Attributes.Add("id", "dt_basic");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    // Create a new cell and add it to the row.
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];
                    tRowHead.Cells.Add(cellHead);
                }
                tblElective.Rows.Add(tRowHead);

                List <CourseElective> electiveCourse = new List <CourseElective>();
                electiveCourse = new CourseElective().getCourseElective();

                foreach (CourseElective data in electiveCourse)
                {
                    TableRow tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    TableCell cellCourseCode = new TableCell();
                    cellCourseCode.Text  = data.CourseElectiveCode;
                    cellCourseCode.Width = 100;
                    tRowBody.Cells.Add(cellCourseCode);
                    //string urlShow = "showElective_COURSE.aspx?token=" + data.CourseElectiveCode + "&facId=" + data.FacultyCode;
                    //HyperLink hypShow = new HyperLink();
                    //hypShow.Attributes.Add("data-target", "#showModal");
                    //hypShow.Attributes.Add("data-toggle", "modal");
                    //hypShow.Text = data.CourseElectiveCode;
                    //hypShow.NavigateUrl = urlShow;
                    //hypShow.ToolTip = "Course details";
                    //cellCourseCode.Controls.Add(hypShow);
                    //cellCourseCode.CssClass = "text-center";
                    //cellCourseCode.Width = 100;
                    //tRowBody.Cells.Add(cellCourseCode);

                    TableCell cellCourseEnName = new TableCell();
                    cellCourseEnName.Text = data.CourseElectiveThName + "<br>" + data.CourseElectiveEnName;
                    tRowBody.Cells.Add(cellCourseEnName);

                    TableCell cellCredit = new TableCell();
                    cellCredit.Text  = data.Credit;
                    cellCredit.Width = 80;
                    tRowBody.Cells.Add(cellCredit);

                    TableCell cellFacultyCode = new TableCell();
                    cellFacultyCode.Text  = new Faculty().getFaculty(data.FacultyCode).Faculty_Thai;
                    cellFacultyCode.Width = 200;
                    tRowBody.Cells.Add(cellFacultyCode);

                    TableCell cellEdit = new TableCell();
                    // งานหลักสูตร
                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        //string urlEdit = "editElective_COURSE.aspx?token=" + data.CourseElectiveCode + "&facultyId=" + data.FacultyCode + "&FacultyCreated=" + data.FacultyCode;
                        string    urlEdit = "editElective_COURSE.aspx?token=" + data.Id;
                        HyperLink hypEdit = new HyperLink();
                        hypEdit.Attributes.Add("data-target", "#editModal");
                        hypEdit.Attributes.Add("data-toggle", "modal");
                        hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                        hypEdit.NavigateUrl = urlEdit;
                        hypEdit.ToolTip     = "Edit";
                        cellEdit.Controls.Add(hypEdit);
                    }
                    // วิชาการคณะ
                    //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    //{
                    //    bool editable = false;
                    //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                    //    foreach (string fac in faculty_authorized)
                    //    {
                    //        if (fac == data.FacultyCode)
                    //        {
                    //            editable = true;
                    //            break;
                    //        }
                    //    }

                    //    if (editable == true)
                    //    {
                    //        string urlEdit = "editElective_COURSE.aspx?token=" + data.Id;
                    //        HyperLink hypEdit = new HyperLink();
                    //        hypEdit.Attributes.Add("data-target", "#editModal");
                    //        hypEdit.Attributes.Add("data-toggle", "modal");
                    //        hypEdit.Text = "<h4><i class='fa fa-edit'></i></h4>";
                    //        hypEdit.NavigateUrl = urlEdit;
                    //        hypEdit.ToolTip = "Edit";
                    //        cellEdit.Controls.Add(hypEdit);
                    //    }
                    //    else
                    //    {
                    //        string urlEdit = "#";
                    //        HyperLink hypEdit = new HyperLink();
                    //        hypEdit.Text = "<h4><i class='fa fa-lock'></i></h4>";
                    //        hypEdit.NavigateUrl = urlEdit;
                    //        hypEdit.ToolTip = "ไม่สามารถแก้ไขได้";
                    //        cellEdit.Controls.Add(hypEdit);
                    //    }

                    //}
                    // วิชาการภาค
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        bool          editable = false;
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                        foreach (string dep in department_authorized)
                        {
                            if (dep.Substring(0, 2) == data.FacultyCode)
                            {
                                editable = true;
                                break;
                            }
                        }
                        if (editable == true)
                        {
                            string    urlEdit = "editElective_COURSE.aspx?token=" + data.Id;
                            HyperLink hypEdit = new HyperLink();
                            hypEdit.Attributes.Add("data-target", "#editModal");
                            hypEdit.Attributes.Add("data-toggle", "modal");
                            hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                            hypEdit.NavigateUrl = urlEdit;
                            hypEdit.ToolTip     = "Edit";
                            cellEdit.Controls.Add(hypEdit);
                        }
                        else
                        {
                            string    urlEdit = "#";
                            HyperLink hypEdit = new HyperLink();
                            hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypEdit.NavigateUrl = urlEdit;
                            hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                            cellEdit.Controls.Add(hypEdit);
                        }
                    }
                    // ทุกกลุ่มผู้ใช้
                    else
                    {
                        string    urlEdit = "#";
                        HyperLink hypEdit = new HyperLink();
                        hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                        hypEdit.NavigateUrl = urlEdit;
                        hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                        cellEdit.Controls.Add(hypEdit);
                    }

                    cellEdit.CssClass = "text-center";
                    cellEdit.Width    = 50;
                    tRowBody.Cells.Add(cellEdit);

                    TableCell cellDel = new TableCell();

                    //เช็คว่ารายวิชามีการนำไปใช้แล้วหรือยัง ถ้ามีแล้วจะไม่สามารถลบข้อมูลได้
                    bool chkExistCourse = new TQF2Sec3SemesterPlan().existCourse(data.Id);

                    // งานหลักสูตร
                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) && chkExistCourse == false)
                    {
                        //string urlDel = "deleteElective_COURSE.aspx?token=" + data.CourseElectiveCode + "&facultyId=" + data.FacultyCode;
                        string    urlDel = "deleteElective_COURSE.aspx?token=" + data.Id;
                        HyperLink hypDel = new HyperLink();
                        hypDel.Attributes.Add("data-target", "#deleteModal");
                        hypDel.Attributes.Add("data-toggle", "modal");
                        hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                        hypDel.NavigateUrl = urlDel;
                        hypDel.ToolTip     = "Delete";
                        cellDel.Controls.Add(hypDel);
                    }
                    // วิชาการคณะ
                    //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    //{
                    //    bool editable = false;
                    //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                    //    foreach (string fac in faculty_authorized)
                    //    {
                    //        if (fac == data.FacultyCode)
                    //        {
                    //            editable = true;
                    //            break;
                    //        }
                    //    }

                    //    if (editable == true && chkExistCourse == false)
                    //    {
                    //        string urlDel = "deleteElective_COURSE.aspx?token=" + data.Id;
                    //        HyperLink hypDel = new HyperLink();
                    //        hypDel.Attributes.Add("data-target", "#deleteModal");
                    //        hypDel.Attributes.Add("data-toggle", "modal");
                    //        hypDel.Text = "<h4><i class='fa fa-trash-o'></i></h4>";
                    //        hypDel.NavigateUrl = urlDel;
                    //        hypDel.ToolTip = "Delete";
                    //        cellDel.Controls.Add(hypDel);
                    //    }
                    //    else
                    //    {
                    //        string urlDel = "#";
                    //        HyperLink hypDel = new HyperLink();
                    //        hypDel.Text = "<h4><i class='fa fa-lock'></i></h4>";
                    //        hypDel.NavigateUrl = urlDel;
                    //        hypDel.ToolTip = "ไม่สามารถลบได้";
                    //        cellDel.Controls.Add(hypDel);
                    //    }

                    //}
                    // วิชาการภาค
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        bool          editable = false;
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                        foreach (string dep in department_authorized)
                        {
                            if (dep.Substring(0, 2) == data.FacultyCode)
                            {
                                editable = true;
                                break;
                            }
                        }
                        if (editable == true && chkExistCourse == false)
                        {
                            string    urlDel = "deleteElective_COURSE.aspx?token=" + data.Id;
                            HyperLink hypDel = new HyperLink();
                            hypDel.Attributes.Add("data-target", "#deleteModal");
                            hypDel.Attributes.Add("data-toggle", "modal");
                            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                            hypDel.NavigateUrl = urlDel;
                            hypDel.ToolTip     = "Delete";
                            cellDel.Controls.Add(hypDel);
                        }
                        else
                        {
                            string    urlDel = "#";
                            HyperLink hypDel = new HyperLink();
                            hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                            hypDel.NavigateUrl = urlDel;
                            hypDel.ToolTip     = "ไม่สามารถลบได้";
                            cellDel.Controls.Add(hypDel);
                        }
                    }
                    // ทุกกลุ่มผู้ใช้
                    else
                    {
                        string    urlDel = "#";
                        HyperLink hypDel = new HyperLink();
                        hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                        hypDel.NavigateUrl = urlDel;
                        hypDel.ToolTip     = "ไม่สามารถลบได้";
                        cellDel.Controls.Add(hypDel);
                    }

                    cellDel.CssClass = "text-center";
                    cellDel.Width    = 50;
                    tRowBody.Cells.Add(cellDel);

                    tblElective.Rows.Add(tRowBody);
                }
            }
            //=============================
        }
    }
Example #39
0
    public static void Main(string[] args)
    {
        /*Address addr1 = new Address();
         * addr1.AddressLine1="1234 Main St";
         * addr1.AddressLine2="Apt 102";
         * addr1.City ="Cleveland";
         * addr1.State ="OH";
         * 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.AddressLine2 ="Apt 102";
         * p1.PermanentAddress.City ="Cleveland";
         * p1.PermanentAddress.State ="OH";
         * p1.PermanentAddress.Zipcode ="44143";
         * p1.DateOfBirth = Convert.ToDateTime("07/21/1994");
         * p1.Intro();
         * p1.IsBirthday();
         *
         * Console.WriteLine("Testing Student 1");
         * Student s2 = new Student();
         * s2.FirstName ="Kera";
         * s2.LastName ="Kaiser";
         * s2.DateOfBirth = Convert.ToDateTime("01/01/1989");
         * s2.PermanentAddress.AddressLine1 ="999 Mallard St";
         * s2.PermanentAddress.AddressLine2 ="Apt 102";
         * s2.PermanentAddress.City ="Parma";
         * s2.PermanentAddress.State ="OH";
         * s2.PermanentAddress.Zipcode ="44143";
         * s2.GPA =2.1;
         * s2.School ="Cleveland State";
         * s2.Intro();
         * s2.IsBirthday();
         * s2.SetAcademicStanding();
         * Console.WriteLine(s2.AcademicStanding);
         *
         *
         * Console.WriteLine("Testing Student 2");
         * Student s1 = new Student("Andrew", "Peggman");
         * s1.DateOfBirth = Convert.ToDateTime("01/01/1989");
         * s1.PermanentAddress.AddressLine1 ="999 Mallard St";
         * s1.PermanentAddress.AddressLine2 ="Apt 102";
         * s1.PermanentAddress.City ="Parma";
         * s1.PermanentAddress.State ="OH";
         * s1.PermanentAddress.Zipcode ="44143";
         * s1.GPA =2.75;
         * s1.School ="Ohio State";
         * s1.Intro();
         * s1.IsBirthday();
         * s1.SetAcademicStanding();
         * Console.WriteLine(s1.AcademicStanding);
         */


        Console.WriteLine("Testing Faculty");
        Faculty f1 = new Faculty();

        f1.FirstName = "Tim";
        f1.LastName  = "Burton";
        f1.PermanentAddress.AddressLine1 = "42060 Medow Lane";
        f1.PermanentAddress.AddressLine2 = "Memorial Township";
        f1.PermanentAddress.City         = "Parma";
        f1.PermanentAddress.State        = "OH";
        f1.PermanentAddress.Zipcode      = "44133";
        f1.DateOfBirth      = Convert.ToDateTime("05/19/1950");
        f1.Id               = "1770";
        f1.Title            = "Instructor";
        f1.DateOfEmployment = Convert.ToDateTime("06/06/1975");
        f1.Employer         = "Tri-C";
        f1.Intro();
        f1.IsBirthday();
        f1.GrantTenure();
        f1.Promote();
        f1.Promote();
        f1.Promote();
        f1.Promote();
    }
        /*
         * Some legacy
         */

        public async Task <ICollection <ExtendedLesson> > Transform(ICollection <CalendarRawItem> calendarRawList, Faculty faculty)
        {
            var resultList = new List <ExtendedLesson>(calendarRawList.Count);

            foreach (var calendarRawItem in calendarRawList)
            {
                var lesson = new ExtendedLesson();
                //Set lesson date
                lesson.LessonSetUpDate = calendarRawItem.LessonSetDate;
                //Set subject
                if (!string.IsNullOrEmpty(calendarRawItem.SubjectName))
                {
                    var subject = new Subject(calendarRawItem.SubjectName);
                    lesson.Subject = subject;
                }

                //Set group
                lesson.Group = (await _groupsHolder.GetFacultiesGroups().ConfigureAwait(false))
                               .FirstOrDefault(a => a.TypeId == calendarRawItem.GroupId);

                //Set lecture
                lesson.Lecturer = (await _lecturersHolder.GetLecturers(faculty).ConfigureAwait(false))
                                  .FirstOrDefault(a => a.TypeId == calendarRawItem.LecturerId);

                //Set classroom
                lesson.Classroom = (await _classroomsHolder.GetClassrooms(faculty).ConfigureAwait(false))
                                   .FirstOrDefault(a => a.TypeId == calendarRawItem.ClassroomId);

                //Set LessonCount
                lesson.LessonCount = Convert.ToInt32(calendarRawItem.LessonCount);

                //Set LessonNumber
                lesson.LessonNumber = Convert.ToInt32(calendarRawItem.LessonNumber);

                //Set Fraction
                lesson.Fraction = (Fraction)calendarRawItem.Fraction;

                //Set Subgroup
                lesson.SubGroup = (SubGroup)calendarRawItem.SubGroup;
                resultList.Add(lesson);
            }

            return(resultList);
        }
        public void ResetPage()
        {
            State.log.WriteLine("{1} {0}:  Beginning Comment Letter Page From Scratch.", DateTime.Now.ToLongTimeString(), DateTime.Today.ToShortDateString());
            WebhostEventLog.CommentLog.LogInformation("Beginning Comment Letter Page From Scratch.");
            using (WebhostEntities db = new WebhostEntities())
            {
                State.log.WriteLine("{1} {0}:  Database Connection Established.", DateTime.Now.ToLongTimeString(), DateTime.Today.ToShortDateString());
                Faculty faculty = db.Faculties.Find(FacultyId);
                if (faculty == null)
                {
                    WebhostEventLog.CommentLog.LogError("Faculty ID {0} is invalid.", FacultyId);
                    throw new InvalidOperationException("Faculty Id is Invalid");
                }
                State.log.WriteLine("{1} {0}:  Editing Comments as {2} {3}", DateTime.Now.ToLongTimeString(), DateTime.Today.ToShortDateString(), faculty.FirstName, faculty.LastName);

                EditorLabel.Text = String.Format("Comments for {0} {1}", faculty.FirstName, faculty.LastName);

                int year = DateRange.GetCurrentAcademicYear();
                int term = SelectedTermId == -1? Import.GetCurrentOrLastTerm(): SelectedTermId;

                if (SelectedTermId != -1)
                {
                    Term t = db.Terms.Find(SelectedTermId);
                    year = t.AcademicYearID;
                }

                if (SelectedTermId != -1)
                {
                    EditorLabel.Text = "Select a class to Edit it's header, or load Students.";
                }
                else
                {
                    EditorLabel.Text = "To change terms, select from the dropdown.  Or continue to edit classes for the current term.";
                    TermDDL.ClearSelection();
                    TermDDL.SelectedValue = Convert.ToString(term);
                }
                TermDDL.DataSource = (from t in db.Terms
                                      where t.AcademicYearID == year
                                      select t).ToList();
                TermDDL.DataTextField  = "Name";
                TermDDL.DataValueField = "id";
                TermDDL.DataBind();

                List <int> currentSections = new List <int>();

                if (DepartmentHeadMode == -1)
                {
                    currentSections = faculty.Sections.Where(sec => sec.Course.AcademicYearID == year && sec.Terms.Where(t => t.id == term).Count() > 0).Select(sec => sec.id).ToList();
                    State.log.WriteLine("{1} {0}:  Found {2} current sections.", DateTime.Now.ToLongTimeString(), DateTime.Today.ToShortDateString(), currentSections.Count);
                    LogInformation("Got {0} sections for this period.", currentSections.Count);
                }
                else
                {
                    State.log.WriteLine("DepartmentHead mode enabled.");
                    currentSections = db.Sections.Where(sec => sec.Course.DepartmentID == DepartmentHeadMode && sec.Course.AcademicYearID == year && sec.Terms.Where(t => t.id == term).Count() > 0).Select(sec => sec.id).ToList();
                    State.log.WriteLine("{1} {0}:  Found {2} current sections.", DateTime.Now.ToLongTimeString(), DateTime.Today.ToShortDateString(), currentSections.Count);
                    LogInformation("Department Head Mode:  found {0} sections this period.", currentSections.Count);
                }

                ClassSelectCmbBx.DataSource     = SectionListItem.GetDataSource(currentSections);
                ClassSelectCmbBx.DataTextField  = DepartmentHeadMode == -1 ? "Text" : "ExtendedText";
                ClassSelectCmbBx.DataValueField = "ID";
                ClassSelectCmbBx.DataBind();

                StudentSelectCmbBx.Visible = false;
                HeaderPanel.Visible        = false;
                StudentPanel.Visible       = false;

                HeaderHTML         = "";
                StudentCommentHTML = "";

                SelectedSectionId = -1;
                SelectedStudentId = -1;
                LoadedHeaderId    = -1;
                LoadedCommentId   = -1;
            }
            HeaderBtn.Visible        = false;
            PreviewBtn.Visible       = false;
            DownloadClassBtn.Visible = false;
            ClassReviewBtn.Visible   = false;

            State.log.WriteLine("{1} {0}:  End of Page Reset Method.", DateTime.Now.ToLongTimeString(), DateTime.Today.ToShortDateString());
            WebhostEventLog.CommentLog.LogInformation("Page Reset Successful.");
        }
Example #42
0
        public bool Save()
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                State.log.WriteLine("Save Weekend Activity Called.");
                int             id       = ActivityId;
                Weekend         weekend  = db.Weekends.Where(w => w.id == WeekendId).Single();
                WeekendActivity activity = new WeekendActivity();
                bool            update   = true;

                if (id == -1)
                {
                    State.log.WriteLine("Creating a New Activity.");
                    update               = false;
                    id                   = db.WeekendActivities.Count() > 0 ? db.WeekendActivities.OrderBy(act => act.id).ToList().Last().id + 1 : 0;
                    activity.id          = id;
                    activity.isMandatory = false;
                }
                else
                {
                    State.log.WriteLine("Updating existing activity.");
                    activity = db.WeekendActivities.Where(act => act.id == id).Single();
                }

                activity.Name         = ActivityName.Text;
                activity.showStudents = isSignupCB.Checked;
                activity.isSignup     = !activity.isMandatory;
                activity.IsOffCampus  = isSignupCB.Checked && !MaxSignupDL.SelectedValue.Equals("0");
                activity.Description  = DescriptionInput.Text.Equals("Description") ? "" : DescriptionInput.Text;

                activity.Adults.Clear();


                foreach (int aid in FacultyGroupSelector1.GroupIds)
                {
                    Faculty fac = db.Faculties.Where(f => f.ID == aid).Single();
                    activity.Adults.Add(fac);
                }

                activity.WeekendIndex = WeekendId;
                DateTime date = weekend.StartDate.Date.AddDays(DaySelect.SelectedIndex);
                if (!AllDayCB.Checked)
                {
                    try
                    {
                        date = date.AddHours(StartTimeSelector.Hour);
                        date = date.AddMinutes(StartTimeSelector.Minute);
                    }
                    catch (WebhostException we)
                    {
                        State.log.WriteLine(we.Message);
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert_" + UniqueID, String.Format("alert('{0}');", we.Message), true);
                        return(false);
                    }
                }

                activity.DateAndTime = date;
                if (!AllDayCB.Checked && DurationCB.Checked)
                {
                    try
                    {
                        int hours   = DurationSelector.Hour - StartTimeSelector.Hour;
                        int minutes = DurationSelector.Minute - StartTimeSelector.Minute;
                        if (minutes < 0)
                        {
                            hours--;
                            minutes = 60 + minutes;
                        }
                        activity.Duration = 60 * hours + minutes;
                    }
                    catch (WebhostException we)
                    {
                        State.log.WriteLine(we.Message);
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert_" + UniqueID, String.Format("alert('{0}');", we.Message), true);
                        return(false);
                    }
                }
                else
                {
                    activity.Duration = 0;
                }

                if (!update)
                {
                    activity.GoogleCalendarEventId = "";

                    db.WeekendActivities.Add(activity);
                    State.log.WriteLine("Added New Activty to Database.");
                }

                db.SaveChanges();
                State.log.WriteLine("Saved Changes to Database.");
                return(true);
            }
        }
Example #43
0
 public void Add(Faculty customer)
 {
     Faculty1.Add(customer);
 }
 public void AddFaculty(Faculty faculty)
 {
     context.Faculties.Add(faculty);
     context.SaveChanges();
 }
Example #45
0
 public FacultyVM(Faculty faculty) : this()
 {
     codeOfFaculty.Value = faculty.CodeOfFaculty;
     nameOfFaculty.Value = faculty.NameOfFaculty;
 }
 public void EditFaculty(Faculty faculty)
 {
     context.Entry(faculty).State = EntityState.Modified;
     context.SaveChanges();
 }
        public async Task <Faculty> GetFaculty(int facultyId)
        {
            Faculty faculty = await _context.Faculties.Include(x => x.Groups).FirstOrDefaultAsync(x => x.Id == facultyId);

            return(faculty);
        }
 public int Insert(Faculty f)
 {
     this.context.Faculty.Add(f);
     return(this.context.SaveChanges());
 }
Example #49
0
        public static void Main(string[] args)
        {
            var BSU = new Universiry("BSU");

            var MMF = new Faculty("MMF");
            var FPM = new Faculty("FPM");

            BSU.AddFaculty(MMF);
            BSU.AddFaculty(FPM);


            for (var i = 1; i < 5; i++)
            {
                var group = new Group($"group_{i}_MMF");
                MMF.AddGroups(group);
                for (var j = 1; j <= 10; j++)
                {
                    var student = new Student($"student_{j}_MMF");
                    group.AddStudent(student);


                    var listMarks = new List <int>();
                    for (var k = 0; k < 7; k++)
                    {
                        var mark = new Random(i * 20);
                        listMarks.Add((mark.Next(4, 9) + i * k / j % 10 - 1));
                    }
                    student.AddMark("math", listMarks);


                    var listMarks1 = new List <int>();
                    for (var s = 0; s < 7; s++)
                    {
                        var mark = new Random(i * 20);
                        listMarks1.Add(mark.Next(4, 9) + j + s - 4 - 1);
                    }
                    student.AddMark("programming", listMarks1);

                    var listMarks2 = new List <int>();
                    for (var r = 0; r < 7; r++)
                    {
                        var mark = new Random(i * 14);
                        listMarks2.Add(mark.Next(4, 9) + i / 4 + j / 10 - 1);
                    }
                    student.AddMark("testing", listMarks2);
                }
            }

            for (var i = 1; i < 5; i++)
            {
                var group = new Group($"group_{i}_FPM");
                FPM.AddGroups(group);
                for (var j = 1; j <= 10; j++)
                {
                    var student = new Student($"student_{j}_FPM");
                    group.AddStudent(student);

                    var listMarks = new List <int>();
                    for (var k = 0; k < 7; k++)
                    {
                        var mark = new Random();
                        listMarks.Add(mark.Next(4, 9) + i % 10 - 2);
                    }
                    student.AddMark("math", listMarks);

                    listMarks = new List <int>();
                    for (var k = 0; k < 7; k++)
                    {
                        var mark = new Random();
                        listMarks.Add(mark.Next(4, 9) + j / 5 - 1);
                    }
                    student.AddMark("programming", listMarks);

                    listMarks = new List <int>();
                    for (var k = 0; k < 7; k++)
                    {
                        var mark = new Random();
                        listMarks.Add(mark.Next(4, 9) + i / 2 + j % (k + 1) - 2);
                    }
                    student.AddMark("testing", listMarks);
                }
            }

            Console.WriteLine($"avarage of BSU: {BSU.GetEverage()}");
            Console.WriteLine();
            Console.WriteLine($"avarage of MMf: {MMF.GetEverage()}");
            Console.WriteLine($"avarage of FPM: {FPM.GetEverage()}");
            Console.WriteLine();
            Console.WriteLine($"average of group_1_mmf : {MMF.Groups.Find(group => group.groupNumber == "group_1_MMF").GetEverage()}");
            Console.WriteLine($"average of group_2_mmf : {MMF.Groups.Find(group => group.groupNumber == "group_2_MMF").GetEverage()}");
            Console.WriteLine($"average of group_3_mmf : {MMF.Groups.Find(group => group.groupNumber == "group_3_MMF").GetEverage()}");
            Console.WriteLine($"average of group_4_mmf : {MMF.Groups.Find(group => group.groupNumber == "group_4_MMF").GetEverage()}");
            Console.WriteLine();
            Console.WriteLine($"average of group_1_fpm : {FPM.Groups.Find(group => group.groupNumber == "group_1_FPM").GetEverage()}");
            Console.WriteLine($"average of group_2_fpm : {FPM.Groups.Find(group => group.groupNumber == "group_2_FPM").GetEverage()}");
            Console.WriteLine($"average of group_3_fpm : {FPM.Groups.Find(group => group.groupNumber == "group_3_FPM").GetEverage()}");
            Console.WriteLine($"average of group_4_fpm : {FPM.Groups.Find(group => group.groupNumber == "group_4_FPM").GetEverage()}");
            Console.WriteLine();
            Console.WriteLine($"average of student_1_mmf group_1 : {MMF.Groups.Find(group => group.groupNumber == "group_1_MMF").Students.Find(name => name.studentName== "student_1_MMF").GetEverage()}");
            Console.WriteLine($"average of student_2_mmf group_1: {MMF.Groups.Find(group => group.groupNumber == "group_1_MMF").Students.Find(name => name.studentName == "student_2_MMF").GetEverage()}");
            Console.WriteLine($"average of student_3_mmf group_2: {MMF.Groups.Find(group => group.groupNumber == "group_2_MMF").Students.Find(name => name.studentName == "student_3_MMF").GetEverage()}");
            Console.WriteLine($"average of student_4_mmf group_2: {MMF.Groups.Find(group => group.groupNumber == "group_2_MMF").Students.Find(name => name.studentName == "student_4_MMF").GetEverage()}");
            Console.WriteLine($"average of student_5_mmf group_2: {MMF.Groups.Find(group => group.groupNumber == "group_2_MMF").Students.Find(name => name.studentName == "student_5_MMF").GetEverage()}");
            Console.WriteLine($"average of student_6_mmf group_3: {MMF.Groups.Find(group => group.groupNumber == "group_3_MMF").Students.Find(name => name.studentName == "student_6_MMF").GetEverage()}");
            Console.WriteLine($"average of student_7_mmf group_3: {MMF.Groups.Find(group => group.groupNumber == "group_3_MMF").Students.Find(name => name.studentName == "student_7_MMF").GetEverage()}");
            Console.WriteLine($"average of student_8_mmf group_4: {MMF.Groups.Find(group => group.groupNumber == "group_4_MMF").Students.Find(name => name.studentName == "student_8_MMF").GetEverage()}");
            Console.WriteLine($"average of student_9_mmf group_4: {MMF.Groups.Find(group => group.groupNumber == "group_4_MMF").Students.Find(name => name.studentName == "student_9_MMF").GetEverage()}");
            Console.WriteLine($"average of student_10_mmf group_4: {MMF.Groups.Find(group => group.groupNumber == "group_4_MMF").Students.Find(name => name.studentName == "student_10_MMF").GetEverage()}");
            Console.WriteLine();
            Console.WriteLine($"average of student_1_fpm group_1 : {FPM.Groups.Find(group => group.groupNumber == "group_1_FPM").Students.Find(name => name.studentName == "student_1_FPM").GetEverage()}");
            Console.WriteLine($"average of student_2_fpm group_1: {FPM.Groups.Find(group => group.groupNumber == "group_1_FPM").Students.Find(name => name.studentName == "student_2_FPM").GetEverage()}");
            Console.WriteLine($"average of student_3_fpm group_2: {FPM.Groups.Find(group => group.groupNumber == "group_2_FPM").Students.Find(name => name.studentName == "student_3_FPM").GetEverage()}");
            Console.WriteLine($"average of student_4_fpm group_2: {FPM.Groups.Find(group => group.groupNumber == "group_2_FPM").Students.Find(name => name.studentName == "student_4_FPM").GetEverage()}");
            Console.WriteLine($"average of student_5_fpm group_2: {FPM.Groups.Find(group => group.groupNumber == "group_2_FPM").Students.Find(name => name.studentName == "student_5_FPM").GetEverage()}");
            Console.WriteLine($"average of student_6_fpm group_3: {FPM.Groups.Find(group => group.groupNumber == "group_3_FPM").Students.Find(name => name.studentName == "student_6_FPM").GetEverage()}");
            Console.WriteLine($"average of student_7_fpm group_3: {FPM.Groups.Find(group => group.groupNumber == "group_3_FPM").Students.Find(name => name.studentName == "student_7_FPM").GetEverage()}");
            Console.WriteLine($"average of student_8_fpm group_4: {FPM.Groups.Find(group => group.groupNumber == "group_4_FPM").Students.Find(name => name.studentName == "student_8_FPM").GetEverage()}");
            Console.WriteLine($"average of student_9_fpm group_4: {FPM.Groups.Find(group => group.groupNumber == "group_4_FPM").Students.Find(name => name.studentName == "student_9_FPM").GetEverage()}");
            Console.WriteLine($"average of student_10_fpm group_4: {FPM.Groups.Find(group => group.groupNumber == "group_4_FPM").Students.Find(name => name.studentName == "student_10_FPM").GetEverage()}");
            Console.WriteLine();
            Console.WriteLine($"average of student_1_mmf group_1 by math: {MMF.Groups.Find(group => group.groupNumber == "group_1_MMF").Students.Find(name => name.studentName == "student_1_MMF").GetEverage("math")}");
            Console.WriteLine($"average of student_2_mmf group_1 by programmming: {MMF.Groups.Find(group => group.groupNumber == "group_1_MMF").Students.Find(name => name.studentName == "student_2_MMF").GetEverage("programming")}");
            Console.WriteLine($"average of student_3_mmf group_2 by testing: {MMF.Groups.Find(group => group.groupNumber == "group_2_MMF").Students.Find(name => name.studentName == "student_3_MMF").GetEverage("testing")}");
            Console.WriteLine($"average of student_4_mmf group_2 bu math: {MMF.Groups.Find(group => group.groupNumber == "group_2_MMF").Students.Find(name => name.studentName == "student_4_MMF").GetEverage("math")}");
            Console.WriteLine($"average of student_5_mmf group_2 by programming: {MMF.Groups.Find(group => group.groupNumber == "group_2_MMF").Students.Find(name => name.studentName == "student_5_MMF").GetEverage("programming")}");
            Console.WriteLine($"average of student_6_mmf group_3 by testing: {MMF.Groups.Find(group => group.groupNumber == "group_3_MMF").Students.Find(name => name.studentName == "student_6_MMF").GetEverage("testing")}");
            Console.WriteLine($"average of student_7_mmf group_3 by math: {MMF.Groups.Find(group => group.groupNumber == "group_3_MMF").Students.Find(name => name.studentName == "student_7_MMF").GetEverage("math")}");
            Console.WriteLine($"average of student_8_mmf group_4 by programming: {MMF.Groups.Find(group => group.groupNumber == "group_4_MMF").Students.Find(name => name.studentName == "student_8_MMF").GetEverage("programming")}");
            Console.WriteLine($"average of student_9_mmf group_4 by testing: {MMF.Groups.Find(group => group.groupNumber == "group_4_MMF").Students.Find(name => name.studentName == "student_9_MMF").GetEverage("testing")}");
            Console.WriteLine($"average of student_10_mmf group_4 by testing: {MMF.Groups.Find(group => group.groupNumber == "group_4_MMF").Students.Find(name => name.studentName == "student_10_MMF").GetEverage("testing")}");
            Console.WriteLine();
        }
Example #50
0
 public static XElement CreateXMLFaculty(Faculty faculty)
 {
     return(new XElement("Faculty",
                         new XElement("CodeOfFaculty", faculty.CodeOfFaculty),
                         new XElement("NameOfFaculty", faculty.NameOfFaculty)));
 }
Example #51
0
 public bool SetFaculty(Faculty model)
 {
     throw new NotImplementedException();
 }
Example #52
0
        public async Task CreateFaculty(Faculty faculty)
        {
            await context.Faculties.AddAsync(faculty);

            await context.SaveChangesAsync();
        }
Example #53
0
 public IActionResult PostFaculty(Faculty faculty)
 {
     _facultyRepository.Insert(faculty);
     return(new JsonResult(faculty));
 }
Example #54
0
        private void addAcct_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                db = new LetranIntegratedSystemEntities();
                string         roleid      = "";
                AspNetUser     aspuser     = new AspNetUser();
                AspNetUserRole asproleuser = new AspNetUserRole();
                var            x           = ((EmployeeClass)dgEmployeeList.SelectedItem);
                var            user        = db.AspNetUsers.Where(m => m.UserName == x.EmployeeNumber).FirstOrDefault();
                if (user != null)
                {
                    MessageBox.Show("User account for this person already exists!", "System Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                else
                {
                    var emp = db.Employees.Where(m => m.EmployeeNo == x.EmployeeNumber).FirstOrDefault();

                    roleid = "4";

                    //if (emp.EmployeeDesignation == 1 || emp.EmployeeDepartmentID == 19)
                    //{
                    //    roleid = "2";
                    //}
                    //if (emp.EmployeeDesignation == 2)
                    //{
                    //    roleid = "5";
                    //}
                    //if (emp.EmployeeDepartmentID == 34)
                    //{
                    //    roleid = "9";
                    //}
                    //else if (emp.EmployeeDepartmentID == 35)
                    //{
                    //    roleid = "10";
                    //}
                    //else if (emp.EmployeeDepartmentID == 18)
                    //{
                    //    roleid = "8";
                    //}

                    if (String.IsNullOrEmpty(roleid))
                    {
                        MessageBox.Show("Role is not specified", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                    if (String.IsNullOrEmpty(emp.PrimaryEmail))
                    {
                        MessageBox.Show("Email cannot be empty.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }
                    aspuser.Id                   = Guid.NewGuid().ToString();
                    aspuser.UserName             = emp.EmployeeNo;
                    aspuser.Email                = emp.PrimaryEmail;
                    aspuser.EmailConfirmed       = true;
                    aspuser.PhoneNumberConfirmed = false;
                    aspuser.TwoFactorEnabled     = false;
                    aspuser.LockoutEnabled       = true;
                    aspuser.AccessFailedCount    = 0;
                    aspuser.SecurityStamp        = Guid.NewGuid().ToString();
                    var passwordHasher = new Microsoft.AspNet.Identity.PasswordHasher();
                    aspuser.PasswordHash = passwordHasher.HashPassword("letran1620");
                    var adduser = db.AspNetUsers.Add(aspuser);
                    asproleuser.UserId = adduser.Id;
                    asproleuser.RoleId = roleid;
                    db.AspNetUserRoles.Add(asproleuser);

                    if (roleid == "5")
                    {
                        if (db.Faculties.Where(m => m.EmpNo == emp.EmployeeNo).FirstOrDefault() == null)
                        {
                            Faculty f = new Faculty();
                            f.FacultyCode = emp.EmployeeNo;
                            f.EmpNo       = emp.EmployeeNo;
                            db.Faculties.Add(f);
                        }
                    }
                    db.SaveChanges();
                    MessageBox.Show("Account successfully created.", "System Success", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong.", "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Example #55
0
 public Student(string firstName, string lastName, int course, int ssn, Specialty specialty, University univeristy, Faculty faculty)
     : this(firstName, string.Empty, lastName, ssn, string.Empty, string.Empty, string.Empty, course, specialty, univeristy, faculty)
 {
 }
Example #56
0
 public Student(string firstName, string middleName, string lastName, int ssn, string address, string phoneNumber, string email, int course, Specialty specialty, University university, Faculty faculty)
 {
     this.FirstName   = firstName;
     this.MiddleName  = middleName;
     this.LastName    = lastName;
     this.SSN         = ssn;
     this.Address     = address;
     this.PhoneNumber = phoneNumber;
     this.Email       = email;
     this.Course      = course;
     this.Specialty   = specialty;
     this.University  = university;
     this.Faculty     = faculty;
 }
Example #57
0
 public static void Map(this Faculty dbFaculty, Faculty faculty)
 {
     dbFaculty.Faculty_Id     = faculty.Faculty_Id;
     dbFaculty.Faculty_Status = faculty.Faculty_Status;
     dbFaculty.User_Id        = faculty.User_Id;
 }
        private async Task <ICollection <ExtendedLesson> > GetFacultyRawLessonsInternal(Faculty faculty)
        {
            var calendarRawItems =
                await _calendarRawItemHolder.GetCalendarItems()
                .ConfigureAwait(false);

            var facultyRawLessons =
                await Transform(calendarRawItems, faculty)
                .ConfigureAwait(false);

            return(facultyRawLessons);
        }
 public Faculty AddFaculty(Faculty faculty)
 {
     _faculties.Add(faculty);
     return(faculty);
 }
Example #60
0
 //constructors
 public Student(string firstName, string middleName, string lastName, string ssn, Specialty specialty, University uni, Faculty faculty)
 {
     this.FirstName  = firstName;
     this.MiddleName = middleName;
     this.LastName   = lastName;
     this.SSN        = ssn;
     this.Specialty  = specialty;
     this.University = uni;
     this.Faculty    = faculty;
 }