Пример #1
0
        private void TeacherStudyGroups_Load(object sender, EventArgs e)
        {
            DataTable dtGroups = TeacherDAL.GetTeacherGroups(TeacherID);//TeacherDAL.GetTeacherStudents(TeacherID);

            this.dataGridViewGroups.DataSource = dtGroups;

            foreach (DataGridViewColumn dc in dataGridViewGroups.Columns)
            {
                if (dc.Name != "Description")
                {
                    dc.ReadOnly = true;
                }
            }

            this.dataGridViewGroups.Update();

            //bind binging navigator to data grid
            var bs = new BindingSource();

            bs.DataSource = dtGroups.DefaultView;
            bindingNavigator1.BindingSource = bs;
            dataGridViewGroups.DataSource   = bs;


            DataTable dtGroupStudents = GroupDAL.GetGroupStudents((int)dataGridViewGroups.Rows[dataGridViewGroups.SelectedCells[0].RowIndex].Cells["Group ID"].Value);

            this.dataGridViewGroupStudents.DataSource = dtGroupStudents;

            toolStripTeacherID.Text = "Teacher ID: " + TeacherID.ToString();
        }
Пример #2
0
        public JsonResult GetById(int tid)
        {
            TeacherDAL dal = new TeacherDAL();
            var        obj = dal.GetById(tid);

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public JsonResult GetAll()
        {
            TeacherDAL dal  = new TeacherDAL();
            var        list = dal.GetAll();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        public ReturnResult <Teacher> GetAllTeacherSearched(BaseCondition <Teacher> condition)
        {
            TeacherDAL mouseDAL = new TeacherDAL();
            var        result   = mouseDAL.GetAllTeacherSearched(condition);

            return(result);
        }
Пример #5
0
 /// <summary>
 /// 保存教师信息
 /// </summary>
 /// <param name="teachers"></param>
 public static void SaveTeachers(TeacherDAL teachers)
 {
     using (FileStream fs = new FileStream(teacherDocPath, FileMode.Create, FileAccess.Write))
     {
         BinaryFormatter bf = new BinaryFormatter();
         bf.Serialize(fs, teachers);
     }
 }
 /// <summary>
 /// 验证用户是否能登录成功
 /// </summary>
 /// <param name="UserName"></param>
 /// <param name="Pwd"></param>
 /// <param name="users"></param>
 /// <returns></returns>
 public static bool GetUsersLogin(string TeacherCode, string Pwd, out Teacher teacher)
 {
     teacher = TeacherDAL.GetIdByTeacherCode(TeacherCode);
     if (teacher != null && teacher.Pwd == Pwd)
     {
         return(true);
     }
     return(false);
 }
        private void handleTeacherLogin(User currentUser)
        {
            TeacherDAL teacherDAL = new TeacherDAL();
            Teacher    teacher    = teacherDAL.GetTeacherByTeacherID(currentUser.UserId);

            this.lblUsername.Text         = "Welcome, " + teacher.Name + " (" + currentUser.Role + ") ";
            this.smdsSite.SiteMapProvider = "Teacher";
            this.menuMain.Visible         = true;
        }
 static BaseBLL()
 {
     admins      = DataFileAccess.GetAdmins();
     students    = DataFileAccess.GetStudents();
     teachers    = DataFileAccess.GetTeachers();
     courses     = DataFileAccess.GetCourses();
     termCourses = DataFileAccess.GetTermCourses();
     InitInitIDs();
 }
        protected void Save_Click(object sender, EventArgs e)
        {
            TeacherDAL dal = new TeacherDAL();

            dal.UpdateFinalGradeByCRNAndStudentID(int.Parse(this.ddlCourses.SelectedValue),
                                                  this.ddlStudents.SelectedValue, this.finalLetterGrade.Text[0]);
            this.confirmation.Text     = "Grade saved.";
            this.finalLetterGrade.Text = "";
        }
        // 修改验证是否存在
        public static bool IsTrue(string TeacherCode, int TeacherId)
        {
            Teacher tch = TeacherDAL.GetIdByTeacherCode(TeacherCode);

            if (tch != null && tch.TeacherId != 0 && tch.TeacherId != TeacherId)
            {
                return(true);
            }
            return(false);
        }
Пример #11
0
        public void PutTeacherDTO(string Name, string password)
        {
            TeacherDAL td = new TeacherDAL();
            Teacher    t  = td.GetTeacher(Name, password);

            if (t != null)
            {
                Console.WriteLine("the teachet exist");
            }
            throw new Exception("teacher not exist");
        }
        // GET: StudentTeacher
        public ActionResult Details()
        {
            dynamic    container = new ExpandoObject();
            StudentDAL obj       = new StudentDAL();

            container.st = obj.GetStudents();

            TeacherDAL obj1 = new TeacherDAL();

            container.tea = obj1.GetTeachers();
            return(View(container));
        }
        protected void btnAddTeachers_Click(object sender, EventArgs e)
        {
            DepartmentAdminDAL dal = new DepartmentAdminDAL();
            var        crnRow      = this.dvwTeacherCourse.Rows[1];
            var        crnCell     = crnRow.Cells[1];
            var        crn         = int.Parse(crnCell.Text);
            string     teacherID   = this.ddlTeachers.SelectedValue;
            TeacherDAL tdal        = new TeacherDAL();

            Models.Teacher teacher = tdal.GetTeacherByTeacherID(teacherID);
            dal.AssignTeacherToCourse(teacher, crn);
        }
Пример #14
0
        private void btnMyProfile_Click(object sender, EventArgs e)
        {
            TeacherInfo   info = TeacherDAL.GetTeacher(TeacherID);
            ProfileWindow wnd  = new ProfileWindow(info, "Category", info.Category, "Specialization", info.Specialization);

            wnd.FormClosed += ((o, s) =>
            {
                this.Show();
            });
            wnd.Owner = this;
            wnd.Show();
            this.Hide();
        }
Пример #15
0
        public JsonResult DeleteById(int tid)
        {
            TeacherDAL dal = new TeacherDAL();

            dal.RemoveById(tid);

            var obj = new
            {
                success = true,
                message = "Record with ID:" + tid + " has been removed successfully"
            };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Пример #16
0
        public JsonResult SaveTeacher(TeacherDTO dto)
        {
            TeacherDAL dal = new TeacherDAL();

            dal.SaveTeacher(dto);

            var obj = new
            {
                success = true,
                message = "Record has been saved successfully"
            };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Пример #17
0
        public void AddHWBL(HwToStydyClassOnDateDTO hwDTO)
        {
            HwToStydyClassOnDate h = new HwToStydyClassOnDate();

            h.deadline = hwDTO.deadline;
            h.durationOfPreparation     = hwDTO.durationOfPreparation;
            h.hwDescription             = hwDTO.hwDescription;
            h.hwToStydyClassOnDate_Date = hwDTO.hwToStydyClassOnDate_Date;
            h.studyClassId         = hwDTO.studyClassId;
            h.verificationQuestion = hwDTO.verificationQuestion;
            h.verificationAnswer   = hwDTO.verificationAnswer;
            TeacherDAL t = new TeacherDAL();

            t.AddHW(h);
        }
Пример #18
0
        private void StudentListWindow_Load(object sender, EventArgs e)
        {
            DataTable dt = TeacherDAL.GetTeacherStudents(TeacherID);

            this.dataGridView1.DataSource = dt;
            this.dataGridView1.Update();

            //bind binging navigator to data grid
            var bs = new BindingSource();

            bs.DataSource = dt.DefaultView;
            bindingNavigator1.BindingSource = bs;
            dataGridView1.DataSource        = bs;

            this.toolStripTeacherID.Text = "TeacherID: " + TeacherID.ToString();
        }
Пример #19
0
        public int AddTeacher(TeacherDTO teacherDTO)
        {
            Teacher teacher = new Teacher();

            teacher.teacherId        = 13;
            teacher.teacherTz        = teacherDTO.teacherTz;
            teacher.teacherFirstName = teacherDTO.teacherFirstName;
            teacher.teacherLastName  = teacherDTO.teacherLastName;
            teacher.teacherPel       = teacherDTO.teacherPel;
            teacher.teacherEmail     = teacherDTO.teacherEmail;
            teacher.teacherPassword  = teacherDTO.teacherPassword;
            TeacherDAL t      = new TeacherDAL();
            int        result = t.AddTeacher(teacher);

            return(result);
        }
Пример #20
0
        public List <TeacherDTO> GetTeachers()
        {
            TeacherDAL tDaL = new TeacherDAL();

            List <TeacherDTO> listDTO = new List <TeacherDTO>();

            foreach (var item in tDaL.GetTeachers().ToList())
            {
                TeacherDTO td = new TeacherDTO();
                td.teacherId        = item.teacherId;
                td.teacherTz        = item.teacherTz;
                td.teacherFirstName = item.teacherFirstName;
                td.teacherLastName  = item.teacherLastName;
                td.teacherPel       = item.teacherPel;
                td.teacherEmail     = item.teacherEmail;
                td.teacherPassword  = item.teacherPassword;
                listDTO.Add(td);
            }
            return(listDTO);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var studentDAL = new StudentDAL();

            if (!IsPostBack)
            {
                this.currentStudent = HttpContext.Current.Session["SelectedStudent"] as Student;
                populateStudentDDL(studentDAL);
                this.currentGrade = HttpContext.Current.Session["CurrentGradedItem"] as GradeItem;
                this.ddlStudentNames_OnSelectedIndexChanged(null, null);
                int count = 0;
                foreach (var item in this.ddlAssignmentNames.Items)
                {
                    if (item.ToString() == this.currentGrade.Name)
                    {
                        this.ddlAssignmentNames.SelectedIndex = count;
                    }
                    count++;
                }
                this.ddlAssignmentNames_SelectedIndexChanged(null, null);
                DataBind();
            }

            this.currentGrade = HttpContext.Current.Session["CurrentGradedItem"] as GradeItem;



            if (currentGrade != null)
            {
                var        user       = HttpContext.Current.Session["User"] as User;
                TeacherDAL teacherDAL = new TeacherDAL();
                Teacher    teacher    = teacherDAL.GetTeacherByTeacherID(user.UserId);
                var        course     = HttpContext.Current.Session["CurrentCourse"] as Course;
                this.lblCourse.Text  = course.Name;
                this.lblTeacher.Text = teacher.Name;
                this.lblEmail.Text   = teacher.Email;
                double.TryParse(tbxGrade.Text, out this.workingGrade);
                //this.currFeedBack = this.currentGrade.Feedback == null ? "" : this.currentGrade.Feedback;
                this.workingFeedback = this.tbxDescription.Text;
            }
        }
Пример #22
0
        /// <summary>
        /// 读取教师信息
        /// </summary>
        /// <returns></returns>
        public static TeacherDAL GetTeachers()
        {
            TeacherDAL teachers;

            if (File.Exists(teacherDocPath))
            {
                using (FileStream fs = new FileStream(teacherDocPath, FileMode.Open, FileAccess.Read))
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    teachers = (TeacherDAL)bf.Deserialize(fs);
                }
            }
            else
            {
                using (FileStream fs = new FileStream(teacherDocPath, FileMode.CreateNew, FileAccess.Write))
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    teachers = new TeacherDAL();
                    bf.Serialize(fs, teachers);
                }
            }
            return(teachers);
        }
        protected void AvailableCourses_SelectedIndexChanged(object sender, EventArgs e)
        {
            int crn = (int)this.AvailableCoursesGrid.SelectedValue;

            HttpContext.Current.Session["chosenCRN"] = crn;
            CourseDAL  courseGetter = new CourseDAL();
            Course     courseToAdd  = courseGetter.GetCourseByCRN(crn);
            TeacherDAL dal          = new TeacherDAL();

            Models.Teacher instructor     = dal.GetTeacherByCRN(crn);
            string         instructorName = instructor != null ? instructor.Name : "TBA";

            this.lblCourseToAdd.Text = "Course to Add: " + courseToAdd.CRN + " " + courseToAdd.Name + " " +
                                       courseToAdd.SectionNumber + " Instructor: " + instructorName;
            CourseSignUpHelper degreeChecker = new CourseSignUpHelper();
            var current = HttpContext.Current.Session["User"] as User;

            if (!degreeChecker.CheckIfCourseContributesToMajor(crn, current.UserId))
            {
                this.lblCourseToAdd.Text +=
                    Environment.NewLine + "This course does not contribute to your degree program.";
            }
        }
Пример #24
0
        //UserDAL userDAL = new UserDAL();
        public TeacherDTO GetTeacherDTO(string Name, string password)
        {
            TeacherDAL td         = new TeacherDAL();
            Teacher    t          = td.GetTeacher(Name, password);
            TeacherDTO teacherDTO = new TeacherDTO();

            if (t != null)
            {
                teacherDTO.teacherId        = t.teacherId;
                teacherDTO.teacherTz        = t.teacherTz;
                teacherDTO.teacherFirstName = t.teacherFirstName;
                teacherDTO.teacherLastName  = t.teacherLastName;
                teacherDTO.teacherPel       = t.teacherPel;
                teacherDTO.teacherEmail     = t.teacherEmail;
                teacherDTO.teacherPassword  = t.teacherPassword;
                return(teacherDTO);
            }
            else
            {
                return(null);
            }
            //throw new Exception("teacher not exist");
        }
Пример #25
0
        public object Login(string identityCard, string passWord)
        {
            Teacher teacher = new Teacher();
            Student student = new Student();

            StudentDAL studentDAL = new StudentDAL();
            TeacherDAL teacherDAL = new TeacherDAL();

            try
            {
                student = studentDAL.SelectByProperty(s => s.IdentityCard.Trim() == identityCard.Trim()).FirstOrDefault();
                teacher = teacherDAL.SelectByProperty(t => t.IdentityCard.Trim() == identityCard.Trim()).FirstOrDefault();

                if (student !=null)
                {
                    if (student.PassWord.Trim() == passWord.Trim())
                        return student;
                    else
                        throw new ViladationException(new RuleViolation("�����ȷ."));
                }
                else if (teacher!=null)
                {
                    if (teacher.PassWord.Trim() == passWord.Trim())
                        return teacher;
                    else
                        throw new ViladationException(new RuleViolation("�����ȷ."));
                }
                else
                    throw new ViladationException(new RuleViolation("�������!"));

            }
            catch (AccessDataException ac)
            {
                throw ac;
            }
        }
Пример #26
0
 public TeacherBLL(string constring)
 {
     dal = new TeacherDAL(constring);
 }
Пример #27
0
        public List <StatusStudentByClass> StatusByClassBL(string studyGroupClass)
        {
            TeacherDAL t = new TeacherDAL();

            return(t.StatusByClass(studyGroupClass));
        }
Пример #28
0
        public List <StatusesStudentHomeWork> StatusPupilBL(string proffesion)
        {
            TeacherDAL t = new TeacherDAL();

            return(t.StatusPupil(proffesion));
        }
 /// <summary>
 /// 查询全部
 /// </summary>
 public static List <Teacher> AllData(string WhereSrc, string PXzd, string PXType)
 {
     return(TeacherDAL.AllData(WhereSrc, PXzd, PXType));
 }
 /// <summary>
 /// 根据主键查询实体
 ///</summary>
 public static Teacher GetIdByTeacher(int Id)
 {
     return(TeacherDAL.GetIdByTeacher(Id));
 }
 /// <summary>
 /// 根据主键删除
 ///</summary>
 public static int DeleteTeacher(int Id)
 {
     return(TeacherDAL.DeleteTeacher(Id));
 }