コード例 #1
0
 static void Main()
 {
     // creating teachers
        // we need e set of discip
     Disciplines disc1 = new Disciplines("Math", 23, 140);
     Disciplines disc2 = new Disciplines("Biology", 23, 140);
     Disciplines disc3 = new Disciplines("OOP", 23, 140);
     IList<Disciplines> disciplines = new List<Disciplines>();
     disciplines.Add(disc1);
     disciplines.Add(disc2);
     disciplines.Add(disc3);
     //disciplines can have comments
     disc1.Comment("I am free this week");
     // and that is the teacher with his disciplines
     Teachers teacher1 = new Teachers("Petrow",disciplines);
     //he can make comments
     teacher1.Comment("Ivancho is bad");
     //you can see his comment
     Console.WriteLine(teacher1.SayComment());
     //we can make second teacher and than a set of teachers
     Teachers teacher2 = new Teachers("Stoqnow", disciplines);
     IList<Teachers> setOfTeachers = new List<Teachers>();
     setOfTeachers.Add(teacher1);
     setOfTeachers.Add(teacher2);
     // to create a class we need and a set of students
     // first we create a few students
     Students student1 = new Students("Ivancho", 7);
     Students student2 = new Students("Mariika", 16);
     Students student3 = new Students("Qworcho",25);
     IList<Students> setOfStudents = new List<Students>();
     setOfStudents.Add(student1);
     setOfStudents.Add(student2);
     setOfStudents.Add(student3);
     // now we can ctreate class
     Classes class1 = new Classes("10b", setOfStudents, setOfTeachers);
     // the classes can make comments
     class1.Comment("We are happy class");
     // finaly we make a list of classes
     Classes class2 = new Classes("11v",setOfStudents,setOfTeachers);
     IList<Classes> setOfClasses = new List<Classes>();
     setOfClasses.Add(class1);
     setOfClasses.Add(class2);
     //school
     School school1 = new School(setOfClasses);
     Console.WriteLine(school1.ToString());
 }
コード例 #2
0
        public async Task <IActionResult> ModifyTeachers(int id, [FromBody] Teachers teacher)
        {
            try
            {
                Teachers target = await _repository.Teachers.GetTeachersByIdAsync(id);

                if (target == null)
                {
                    return(NotFound());
                }
                target.Name    = teacher.Name;
                target.Surname = teacher.Surname;
                target.Title   = teacher.Title;
                await _repository.Teachers.ModifyTeachersAsync(target);

                return(Ok("Teacher successfully modified"));
            }
            catch (Exception)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }
コード例 #3
0
ファイル: ExamSubjuectDal.cs プロジェクト: Ho-J/exam-system
        //搜索这个老师负责的考试科目
        public List <ExamSubject> IdToSubject(Teachers t)
        {
            string sql = "select * from ExamSubject where name in( select subjectName from Subject_Teacher where TeacherId=@id)";

            SqlParameter[] pars1 =
            {
                new SqlParameter("@id", SqlDbType.Int),
            };
            pars1[0].Value = t.id;

            DataTable          da   = SqlHelper.GetTable(sql, CommandType.Text, pars1);
            List <ExamSubject> list = new List <ExamSubject>();
            ExamSubject        examSubject;

            foreach (DataRow row in da.Rows)
            {
                examSubject = new ExamSubject();
                LoadExamSubject(row, examSubject);
                list.Add(examSubject);
            }
            return(list);
        }
コード例 #4
0
        public void EditTeacher(FullInfoTeacher teacher)
        {
            Users    editUser     = teacher;
            Teachers editTeachers = null;

            using (ElectronicalJournalContext db = new ElectronicalJournalContext())
            {
                var teach = from tc in db.Teachers
                            where tc.UserId == editUser.UserId
                            select new Teachers
                {
                    TeacherId  = tc.TeacherId,
                    PositionId = tc.PositionId,
                    UserId     = tc.UserId
                };
                foreach (Teachers item in teach)
                {
                    editTeachers = item;
                }

                if (editTeachers == null && teacher.PositionId != null)
                {
                    Teachers tc = new Teachers();
                    tc.UserId     = teacher.UserId;
                    tc.PositionId = teacher.PositionId;
                    db.Teachers.Add(tc);
                }
                else if (editTeachers == null)
                {
                }
                else if (editTeachers.PositionId != teacher.PositionId)
                {
                    editTeachers.PositionId = teacher.PositionId;
                    db.Teachers.Update(editTeachers);
                }
                db.Users.Update(editUser);
                db.SaveChanges();
            }
        }
コード例 #5
0
        private void Init()
        {
            IsLoading = true;
            _dataProvider.GetFacultyGroupsAsync(_facultyId).Subscribe(
                result =>
            {
                result.GroupsList = result.GroupsList.OrderBy(g => g.GroupName).ToList();
                _dataProvider.PutGroups(_universityId, _facultyId, result.GroupsList);
                _storedGroupsRequest = result;
                GroupsList           = FormatResult(result.GroupsList, _groupFunc);
                IsLoading            = false;
            },
                ex => OnError());

            _dataProvider.GetUniversityTeachersAsync(_universityId).Subscribe(
                result =>
            {
                _storedTeachersRequest = result;
                TeachersList           = FormatResult(result.TeachersList, _teachersGroupFunc);
            }, ex => OnError()
                );
        }
コード例 #6
0
        private async void UpdateGrid(Reservations[] reservations)
        {
            InitializeGrid();
            string date       = "01-01-2000";
            int    count_date = 0;

            foreach (Reservations item in reservations)
            {
                if (item.Date.ToString("dd-MM-yyyy") != date)
                {
                    date = item.Date.ToString("dd-MM-yyyy");
                    count_date++;
                    ColumnDefinition kolumna = new ColumnDefinition();
                    kolumna.Width = GridLength.Auto;
                    Plan.ColumnDefinitions.Add(kolumna);
                    Plan.Children.Add((new TextBlockItem(date, count_date, 0)).Element());
                }
                Teachers teacher = await TeacherById(item.Teacher_id.ToString());

                Subjects subject = await SubjectById(item.Subject_id.ToString());

                Rooms room = await RoomById(item.Room_id.ToString());

                Button przycisk = new Button
                {
                    Content = subject.ToString() + '\n' +
                              teacher.ToString() + '\n' +
                              '[' + room.ToString() + ']',
                    FontSize = 10,
                    Uid      = item.Id.ToString(),
                    Margin   = new Thickness(2)
                };
                Grid.SetColumn(przycisk, count_date);
                Grid.SetRow(przycisk, item.Begin - 7);
                Grid.SetRowSpan(przycisk, item.End - item.Begin);
                Plan.Children.Add(przycisk);
            }
        }
コード例 #7
0
        public IdentityResult Register(AccountModel model)
        {
            var userStore      = new UserStore <ApplicationUser>(new ApplicationDbContext());
            var manager        = new UserManager <ApplicationUser>(userStore);
            var studentManager = new StudentManager();
            var teacherManager = new TeacherManager();
            var user           = new ApplicationUser()
            {
                UserName = model.UserName, Email = model.Email
            };

            user.FirstName            = model.FirstName;
            user.LastName             = model.LastName;
            manager.PasswordValidator = new PasswordValidator
            {
                RequiredLength = 3
            };
            model.Password = "******";
            IdentityResult result = manager.Create(user, model.Password);

            manager.AddToRole(user.Id, model.Role);
            if (!string.IsNullOrEmpty(model.Class_Code))
            {
                Students s = new Students();
                s.User_Id     = user.Id;
                s.Classe_Code = model.Class_Code;
                studentManager.CreateStudentIntoDB(s);
            }
            if (!string.IsNullOrEmpty(model.Subject_Code))
            {
                Teachers t = new Teachers();
                t.User_Id      = user.Id;
                t.Subject_Code = model.Subject_Code;
                t.FullName     = user.FirstName + ' ' + user.LastName;
                teacherManager.CreateTeacherIntoDB(t);
            }
            return(result);
        }
コード例 #8
0
 private void teacherChange_Method(object parametr)
 {
     if (editButtonContent.Equals("Изменить"))
     {
         if (IsValid(ValidatesChangeProperties, out ChangeErrors))
         {
             if (teachersModel.IsExist(TeachersModel.getTeacherObject(changeName, changeSurname, changePatronymic, changeShortPulpitName)))
             {
                 EditButtonContent = "Сохранить";
                 CancelVisibility  = Visibility.Visible;
                 changedTeacher    = TeachersModel.getTeacherObject(changeName, changeSurname, changePatronymic, changeShortPulpitName);
                 return;
             }
             else
             {
                 MessageBox.Show("Изменяемого объекта не существует", "Результат изменения");
             }
         }
         else
         {
             MessageBox.Show("Заполните корректно поля!", "Результат Изменения");
         }
     }
     else if (editButtonContent.Equals("Сохранить"))
     {
         if (IsValid(ValidatesChangeProperties, out ChangeErrors))
         {
             MessageBox.Show(teachersModel.Change(changedTeacher, TeachersModel.getTeacherObject(changeName, changeSurname, changePatronymic, changeShortPulpitName)), "Результат изменения");
             EditButtonContent = "Изменить";
             CancelVisibility  = Visibility.Collapsed;
             FilterTeachers();
         }
         else
         {
             MessageBox.Show("Заполните корректно поля!", "Результат изменения");
         }
     }
 }
コード例 #9
0
        private void enterBttn_Click(object sender, EventArgs e)
        {
            //add in info for player select
            switch (teachNum)
            {
                case 0:
                    Teachers bond = new Teachers(Form1.bondHP, Form1.bondAtk, Form1.bondDef, Form1.bondSpd, "CriteriaChart", 
                        "Dissection", "MadExperiment", "TalkAboutFamily", "Bond");
                    Form1.teacher.Add(bond);
                    break;
                case 1:
                    Teachers brad = new Teachers(Form1.bradHP, Form1.bradAtk, Form1.bradDef, Form1.bradSpd, "AttackBot",
                        "ComplainAboutApple", "DefenderBot", "VideoFriday", "Bradshaw");
                    Form1.teacher.Add(brad);
                    break;
                case 2:
                    Teachers leitch = new Teachers(Form1.leitchHP, Form1.leitchAtk, Form1.leitchDef, Form1.leitchSpd, "Documentary",
                        "EssayQuestion", "HistoricWar", "MultipleChoice", "Leitch");
                    Form1.teacher.Add(leitch);
                    break;
                case 3:
                    Teachers cutch = new Teachers(Form1.cutchHP, Form1.cutchAtk, Form1.cutchDef, Form1.cutchSpd, "Dodgeball",
                        "DunkOn", "PushUps", "HealthClass", "McCutcheon");
                    Form1.teacher.Add(cutch);
                    break;
                case 4:
                    Teachers ort = new Teachers(Form1.ortHP, Form1.ortAtk, Form1.ortDef, Form1.ortSpd, "ClarinetSqueak",
                        "FullBandFortissimo", "MelodiousPassage", "Tuning", "Ortelli");
                    Form1.teacher.Add(ort);
                    break;
                case 5:
                    Teachers steel = new Teachers(Form1.steelHP, Form1.steelAtk, Form1.steelDef, Form1.steelSpd, "EqualSign",
                        "PinkPaper", "QuadraticAttack", "TextbookBarricade", "Steel");
                    Form1.teacher.Add(steel);
                    break;

            }
        }
コード例 #10
0
        public IActionResult AddEntity(string value)
        {
            if (!String.IsNullOrEmpty(value))
            {
                switch (Rooms.CurrentEditType)
                {
                case 1:
                    if (!Teachers.GetTeachersList().Contains(value))     //Duplicates not allowed
                    {
                        Teachers.TeachersList.Add(value);
                    }
                    break;

                case 2:
                    if (!Classes.GetClassesList().Contains(value))     //Duplicates not allowed
                    {
                        Classes.ClassesList.Add(value);
                    }
                    break;

                case 3:
                    if (!Rooms.GetRoomsList().Contains(value))     //Duplicates not allowed
                    {
                        Rooms.RoomList.Add(value);
                    }
                    TableEntries.AppendRoom();
                    break;

                case 4:
                    if (!Courses.GetCoursesList().Contains(value))     //Duplicates not allowed
                    {
                        Courses.CoursesList.Add(value);
                    }
                    break;
                }
            }
            return(View("Views/Home/Privacy.cshtml"));
        }
コード例 #11
0
        public void QueryWithIEntityKey()
        {
            IEntityKey <string> teacher = new Teachers();
            var query = Query.From <Teachers>().Where(t => t.Id == teacher.Id);
            var r     = queryBuilder.Build(query);

            Assert.AreEqual("select * from `Teachers` where `Teachers`.`Id` = @p0", r.SQL);
            Assert.AreEqual(teacher.Id, r.Parameters[0].Value);

            var teacher1 = new FTeachers();

            query = Query.From <Teachers>().Where(t => t.Id == teacher1.Teachers.Id);
            r     = queryBuilder.Build(query);

            Assert.AreEqual("select * from `Teachers` where `Teachers`.`Id` = @p0", r.SQL);

            IEntityKey <string> tea = new Teachers();
            IQuery q = Query.Where <Teachers>(t => t.Id == tea.Id);

            r = queryBuilder.Build(q);

            Assert.AreEqual("where `Teachers`.`Id` = @p0", r.SQL);
        }
コード例 #12
0
        private void OnDeleteTeacher(object obj)
        {
            if (SelectedTeacher == null)
            {
                return;
            }
            if (Teachers.Count <= 1)
            {
                MessageBox.Show("There must be at least one teacher employed");
                return;
            }
            var classBooks = SelectedTeacher.ClassBooks;

            Teachers.Remove(SelectedTeacher);
            MainViewModel.Teachers.Remove(SelectedTeacher);

            foreach (var classBook in classBooks)
            {
                SchoolUtil.HireTeacher(classBook, Teachers[0]);
            }

            Update();
        }
コード例 #13
0
        public void TeacherCreate()
        {
            //Arrange
            var db = new DbAccess();

            var teacher = new Teachers()
            {
                FirstName    = "Teszt"
                , LastName   = "Elek"
                , ClassCode  = "191"
                , Subject_Id = 1
            };
            var id = db.CreateTeacher(teacher);

            Assert.AreNotEqual(0, id);
            var teacherSaved = db.ReadTeacher(id);

            Assert.IsNotNull(teacherSaved);

            var deletedLines = db.DeleteTeacher(id);

            Assert.AreEqual(1, deletedLines);
        }
コード例 #14
0
        public HttpResponseMessage EditTeacher(Teachers teacher)
        {
            using (var context = new SchoolDBContext())
            {
                var originalTeacher = context.Teachers
                                      .Where(t => t.Id == teacher.Id)
                                      .FirstOrDefault();
                originalTeacher.Name   = teacher.Name;
                originalTeacher.Date   = teacher.Date;
                originalTeacher.Active = teacher.Active;
                originalTeacher.Salary = teacher.Salary;

                context.SaveChanges();
            }
            var newUrl = this.Url.Link("Default", new
            {
                Controller = "Teachers",
                Action     = "Index"
            });

            return(Request.CreateResponse(HttpStatusCode.OK,
                                          new { Success = true, RedirectUrl = "https://localhost:44376/Teachers" }));
        }
コード例 #15
0
 public void AddFromBDC(BaseDataClass dataClass)
 {
     if (dataClass is Teacher teacher)
     {
         Teachers.Add(teacher);
     }
     if (dataClass is Form form)
     {
         Forms.Add(form);
     }
     if (dataClass is Subject subject)
     {
         Subjects.Add(subject);
     }
     if (dataClass is Lesson lesson)
     {
         Lessons.Add(lesson);
     }
     if (dataClass is Group group)
     {
         Groups.Add(group);
     }
 }
コード例 #16
0
        public async void FetchTeachersAsync()
        {
            App.Dispatcher.Invoke(() => IsTeacherFetchEnabled = false);

            var teachers = await HttpClient.GetTeachersAsync();

            lock (teachers)
            {
                App.Dispatcher.Invoke(() =>
                {
                    if (teachers == null)
                    {
                        State.Message = "加载错误";
                    }
                    else
                    {
                        Teachers.ReplaceItems(teachers);
                    }
                });
            }

            App.Dispatcher.Invoke(() => IsTeacherFetchEnabled = true);
        }
コード例 #17
0
        public ActionResult Create(Teachers teachers)
        {
            if (ModelState.IsValid)
            {
                if (teachers.ImgFile == null)
                {
                    ModelState.AddModelError("", "Image is required");
                    return(View(teachers));
                }

                string imgName = DateTime.Now.ToString("ddMMyyyyHHmmssfff") + teachers.ImgFile.FileName;
                string imgPath = Path.Combine(Server.MapPath("~/Uploads/"), imgName);

                teachers.ImgFile.SaveAs(imgPath);
                teachers.Image = imgName;

                context.Teachers.Add(teachers);
                context.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(teachers));
        }
コード例 #18
0
        public static async Task <Teachers> TeacherById(string id)
        {
            try
            {
                HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync("https://localhost:44379/api/teachers/" + id);

                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();

                    Teachers jsonObject = JsonConvert.DeserializeObject <Teachers>(result);
                    return(jsonObject);
                }
                else
                {
                    throw new Exception(response.StatusCode.ToString());
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #19
0
        public bool CreateOrUpdate(TeacherDTO teacher)
        {
            try
            {
                using (var ctx = new Utn_SysContext())
                {
                    var oTeacher = ctx.Teachers.AsNoTracking()
                                   .Where(c => c.Id == teacher.Id)
                                   .FirstOrDefault();

                    if (oTeacher == null)
                    {
                        oTeacher = new Teachers();
                        ctx.Teachers.Add(oTeacher);
                    }
                    else
                    {
                        ctx.Teachers.Attach(oTeacher);
                    }
                    oTeacher.Names     = teacher.Names;
                    oTeacher.Surnames  = teacher.Surnames;
                    oTeacher.Email     = teacher.Email;
                    oTeacher.Birthdate = teacher.Birthdate;
                    oTeacher.Cuil      = teacher.Cuil;
                    oTeacher.Dni       = teacher.Dni;
                    oTeacher.Deleted   = false;
                    oTeacher.Address   = teacher.Address;

                    ctx.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #20
0
ファイル: Display.cs プロジェクト: tiann153/project_new
        private void AddNewTeacher()
        {
            Console.WriteLine("--------- Add new teacher ---------");

            Console.WriteLine("Teacher id:");
            int id = int.Parse(Console.ReadLine());


            Console.WriteLine("Teacher Name:");
            string name = Console.ReadLine();

            Console.WriteLine("Teacher Surname:");
            string surname = Console.ReadLine();

            Console.WriteLine("Teacher class number:");
            int classNumber = int.Parse(Console.ReadLine());

            Console.WriteLine("Teacher exam:");
            string exam = Console.ReadLine();

            Teachers teacher = new Teachers(id, name, surname, classNumber, exam);

            this.studentsBusinessLogic.CreateTeacher(teacher);
        }
コード例 #21
0
ファイル: TeachersBLL.cs プロジェクト: hanyweal/HCM
 internal TeachersBLL MapTeacher(Teachers Teacher)
 {
     try
     {
         TeachersBLL TeacherBLL = null;
         if (Teacher != null)
         {
             TeacherBLL = new TeachersBLL()
             {
                 TeacherID             = Teacher.TeacherID,
                 EmployeeCareerHistory = Teacher.EmployeesCareersHistory != null ? new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(Teacher.EmployeesCareersHistory) : null,
                 StartDate             = Teacher.StartDate,
                 EndDate     = Teacher.EndDate,
                 CreatedDate = Teacher.CreatedDate,
                 CreatedBy   = new EmployeesCodesBLL().MapEmployeeCode(Teacher.EmployeesCodes)
             };
         }
         return(TeacherBLL);
     }
     catch
     {
         throw;
     }
 }
コード例 #22
0
        public async Task <IActionResult> GetSchools(FilterIn filter)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var schools = await _context.Schools.Where(sch => sch.adress == filter.adress).Include(s => s.items)  //FromSqlRaw($"SELECT * FROM Schools WHERE Schools.adress = {filter.adress}")
                          .ThenInclude(i => i.Item).ToListAsync();

            if (schools.Count == 0)
            {
                return(BadRequest(new { errorText = "No such schools" }));
            }

            List <SchoolOut> result = new List <SchoolOut>();

            foreach (Schools school in schools)
            {
                Teachers teacher = get_teacher_from_teacherId(school.id_teacher);
                Managers manager = get_manager_from_managerId(school.id_manager);
                result.Add(new SchoolOut(school, manager.name + " " + manager.surname + " " + manager.lastname, teacher.name + " " + teacher.surname + " " + teacher.lastname));
            }
            return(Ok(result));
        }
コード例 #23
0
 public void SaveTeachers(Teachers teachers)
 {
     if (teachers.ID == 0)
     {
         context.Teachers.Add(teachers);
     }
     else
     {
         Teachers dbEntry = context.Teachers.Find(teachers.ID);
         if (dbEntry != null)
         {
             dbEntry.Name          = teachers.Name;
             dbEntry.Title         = teachers.Title;
             dbEntry.ImageData     = teachers.ImageData;
             dbEntry.ImageMimeType = teachers.ImageMimeType;
             dbEntry.Tell          = teachers.Tell;
             dbEntry.E_Mail        = teachers.E_Mail;
             dbEntry.Direction     = teachers.Direction;
             dbEntry.Resume        = teachers.Resume;
             dbEntry.Remark        = teachers.Remark;
         }
     }
     context.SaveChanges();
 }
コード例 #24
0
        public async Task <IActionResult> UserUpdate(Teachers model, string userId)
        {
            var user = await _userManager.FindByIdAsync(userId);

            if (user == null)
            {
                ViewBag.ErrorMessage = $"User with Id = {userId} cannot be found";
                return(View("NotFound"));
            }

            user.Name    = model.Name;
            user.Surname = model.Surname;
            user.Phone   = model.Phone;

            var result = await _userManager.UpdateAsync(user);

            if (!result.Succeeded)
            {
                ModelState.AddModelError("", "Cannot remove user existing roles");
                return(View(model));
            }

            return(RedirectToAction("Index", "Home", new { Id = userId }));
        }
コード例 #25
0
        public List <Teachers> GetTeachers()
        {
            List <Teachers> result     = new List <Teachers>();
            string          sqlQuery   = String.Format("SELECT first.Id,first.FIO,first.DateOfBirth,first.Address,first.Phone,first.Subjects_id,second.SubjectName from Teachers first, Subjects second where first.Subjects_id = second.Id");
            SqlDataReader   dataReader = base.Get(sqlQuery);
            Teachers        article    = null;

            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    article             = new Teachers();
                    article.Id          = Convert.ToInt32(dataReader["Id"]);
                    article.FIO         = dataReader["FIO"].ToString();
                    article.DateOfBirth = Convert.ToDateTime(dataReader["DateOfBirth"]);
                    article.Address     = dataReader["Address"].ToString();
                    article.Phone       = dataReader["Phone"].ToString();
                    article.Subjects_id = Convert.ToInt32(dataReader["Subjects_id"]);
                    article.SubjectName = dataReader["SubjectName"].ToString();
                    result.Add(article);
                }
            }
            return(result);
        }
コード例 #26
0
ファイル: TeachersBLL.cs プロジェクト: hanyweal/HCM
        public virtual Result Update()
        {
            try
            {
                Result result = this.IsValid();
                if (result == null)
                {
                    Teachers Teacher = new Teachers();
                    Teacher.TeacherID = this.TeacherID;
                    Teacher.EmployeeCareerHistoryID = new EmployeesCareersHistoryBLL().GetEmployeeCurrentJob(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID).EmployeeCareerHistoryID;
                    Teacher.StartDate       = StartDate;
                    Teacher.EndDate         = EndDate;
                    Teacher.LastUpdatedDate = DateTime.Now;
                    Teacher.LastUpdatedBy   = this.LoginIdentity.EmployeeCodeID;

                    int UpdateResult = new TeachersDAL().Update(Teacher);
                    if (UpdateResult != 0)
                    {
                        result            = new Result();
                        result.Entity     = this;
                        result.EnumType   = typeof(TeachersValidationEnum);
                        result.EnumMember = TeachersValidationEnum.Done.ToString();
                    }

                    return(result);
                }
                else
                {
                    return(result);
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #27
0
        static void Main(string[] args)
        {
            int numTeachers = 0;
            int numStudents = 0;

            Teachers theTeacher = new Teachers();
            theTeacher.Name = "Donnie Santos");
            numTeachers++;

            Student student1 = new Student();
            student1.Name = "John Doe";
            Student.grade = "B";
            numStudents++;

            Student student2 = new Student();
            student2.Name = "Jane Doe";
            Student.grade = "A";
            numStudents++;

            System.Console.WriteLine(numTeachers);
            System.Console.WriteLine(numStudents);
            System.Console.WriteLine("Press any key to continue...");
            System.Console.ReadKey();
        }
コード例 #28
0
        public static string ReturnSubject(string str, Teachers teacher)
        {
            string subject = teacher.Subject.Where(s => s == str).FirstOrDefault();

            return(subject);
        }
コード例 #29
0
 public int Add(Teachers _Teachers)
 {
     return(_TeacherRepository.Add(_Teachers));
 }
コード例 #30
0
 public decimal AlreadyExitEmail(Teachers _Teachers)
 {
     return(_TeacherRepository.AlreadyExitEmail(_Teachers));
 }
コード例 #31
0
ファイル: TeacherModel.cs プロジェクト: tanmyblog/webapi
 public TeacherModel(Teachers t)
 {
     this.Id   = t.Id;
     this.Code = t.Code;
     this.Name = t.Name;
 }
コード例 #32
0
        /// <summary>
        /// 单击新建条目按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddNewItemButtonClick(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            if (btn.Tag.Equals("2"))
            {
                AddNewCourseDialog dialog = new AddNewCourseDialog(Courses.Max(p => p.Id) + 1, "新增课程");
                if (dialog.ShowDialog() == true)
                {
                    Course course = dialog.Course;
                    if (Courses.Any(p => p.Id == course.Id))
                    {
                        TaskDialog.ShowError("该ID已存在");
                        return;
                    }
                    ModifiedCourses.Add(new UICourse(course));
                    Courses.Add(new UICourse(course));
                }
            }
            else
            {
                bool teacher = btn.Tag.Equals("1");
                AddNewPersonDialog dialog = new AddNewPersonDialog(teacher? Students.Max(p => p.Id) + 1:Teachers.Max(p => p.Id) + 1, teacher);
                if (dialog.ShowDialog() == true)
                {
                    Person person = dialog.Person;
                    if (Students.Any(p => p.Id == person.Id) || Teachers.Any(p => p.Id == person.Id))
                    {
                        TaskDialog.ShowError("该ID已存在");
                        return;
                    }
                    if (btn.Tag.Equals("0"))
                    {
                        Students.Add(person);
                    }
                    else
                    {
                        Teachers.Add(person);
                    }
                    ModifiedPersons.Add(person);
                }
            }
        }
コード例 #33
0
ファイル: Program.cs プロジェクト: powernick/CodeLib
        static void MyIterator()
        {
            #region student
            Students students = new Students();
            Student st = new Student();
            st.Name = "lili";

            students.Add(st);
            st = new Student();
            st.Name = "OK";

            students.Add(st);

            foreach (Student obj in students)
            {
                Console.WriteLine(obj.Name);
            }
            #endregion

            #region teacher
            Teachers ts = new Teachers();
            Teacher t1 = new Teacher(1001, "t1", 33);
            Teacher t2 = new Teacher(1002, "t2", 34);
            ts.Add(t1);
            ts.Add(t2);

            foreach (Teacher t in ts)
            {
                Console.WriteLine("{0}, {1}, {2};", t.Tid.ToString(), t.Name, t.Age.ToString());
            }

            // other methods for the foreach
            {
                IEnumerator enumerator = ts.GetEnumerator();
                Teacher t;

                while (enumerator.MoveNext())
                {
                    t = (Teacher)enumerator.Current;
                    Console.WriteLine("{0}, {1}, {2};", t.Tid.ToString(), t.Name, t.Age.ToString());
                }
            }

            #endregion

            #region doctor
            // using IEnumerable<T> interface
            Doctors ds = new Doctors();
            Doctor d1 = new Doctor("lili", 28);
            Doctor d2 = new Doctor("wang", 30);
            ds.Add(d1);
            ds.Add(d2);

            foreach (Doctor d in ds)
            {
                Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString());
            }
            Console.WriteLine();

            {
                IEnumerator enumerator = ds.GetEnumerator();
                Doctor d;

                while (enumerator.MoveNext())
                {
                    d = (Doctor)enumerator.Current;
                    Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString());
                }
            }

            Console.WriteLine();

            {
                IEnumerator<Doctor> enumerator = ds.GetEnumerator();
                Doctor d;

                while (enumerator.MoveNext())
                {
                    d = enumerator.Current;
                    Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString());
                }
            }
            #endregion

            #region myStack

            MyStack<int> s = new MyStack<int>();
            for (int i = 0; i < 10; i++)
            {
                s.Push(i);
            }

            // Prints: 9 8 7 6 5 4 3 2 1 0
            // Foreach legal since s implements IEnumerable<int>
            foreach (int n in s)
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            // Prints: 9 8 7 6 5 4 3 2 1 0
            // Foreach legal since s.TopToBottom returns IEnumerable<int>
            foreach (int n in s.TopToBottom)
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            // Prints: 0 1 2 3 4 5 6 7 8 9
            // Foreach legal since s.BottomToTop returns IEnumerable<int>
            foreach (int n in s.BottomToTop)
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            // Prints: 9 8 7 6 5 4 3
            // Foreach legal since s.TopN returns IEnumerable<int>
            foreach (int n in s.TopN(7))
            {
                System.Console.Write("{0} ", n);
            }
            System.Console.WriteLine();

            #endregion
        }
コード例 #34
0
ファイル: ass.Designer.cs プロジェクト: sleepandeat/Program
 public static Teachers CreateTeachers(int teaID, string teaName, string pswd)
 {
     Teachers teachers = new Teachers();
     teachers.TeaID = teaID;
     teachers.TeaName = teaName;
     teachers.Pswd = pswd;
     return teachers;
 }
コード例 #35
0
ファイル: ass.Designer.cs プロジェクト: sleepandeat/Program
 public void AddToTeachers(Teachers teachers)
 {
     base.AddObject("Teachers", teachers);
 }