public object GetStudentDetails(StudentParam obj)
        {
            StudentBusiness result      = new StudentBusiness();
            var             StudentList = result.GetStudent(obj);

            return(StudentList);
        }
        //public bool Update(int? id, StudentParam studentParam)
        //{
        //    var result = 0;
        //    var student = Get(id);
        //    student.FirstName = studentParam.FirstName;
        //    student.LastName = studentParam.LastName;
        //    student.Dob = studentParam.Dob;
        //    student.Pob = studentParam.Pob;
        //    student.Gender = studentParam.Gender;
        //    student.Religion = studentParam.Religion;
        //    student.Address = studentParam.Address;
        //    student.RT = studentParam.RT;
        //    student.RW = studentParam.RW;
        //    student.Village = studentParam.Village;
        //    student.District = studentParam.District;
        //    student.Regencie = studentParam.Regencie;
        //    student.Provience = studentParam.Provience;
        //    student.Phone = studentParam.Phone;
        //    student.Email = studentParam.Email;
        //    student.Username = studentParam.Username;
        //    student.Password = studentParam.Password;
        //    student.Status = studentParam.Status;
        //    student.SecretQuestion = studentParam.SecretQuestion;
        //    student.SecretAnswer = studentParam.SecretAnswer;
        //    student.HiringLocation = studentParam.HiringLocation;
        //    student.AccessCard = studentParam.AccessCard;
        //    student.classes = _context.Classes.Find(studentParam.classes);
        //    student.UpdateDate = DateTimeOffset.Now.LocalDateTime;
        //    result = _context.SaveChanges();
        //    if (result > 0)
        //    {
        //        status = true;
        //        MessageBox.Show("Update Successfully");
        //    }
        //    else
        //    {
        //        MessageBox.Show("Update Failed");
        //    }

        //    return status;
        //}


        public bool UpdateHR(int?id, StudentParam studentParam)
        {
            var result  = 0;
            var student = Get(id);

            student.FirstName      = studentParam.FirstName;
            student.LastName       = studentParam.LastName;
            student.Phone          = studentParam.Phone;
            student.Email          = studentParam.Email;
            student.Username       = studentParam.Username;
            student.Password       = studentParam.Password;
            student.Status         = studentParam.Status;
            student.SecretQuestion = studentParam.SecretQuestion;
            student.SecretAnswer   = studentParam.SecretAnswer;
            student.HiringLocation = studentParam.HiringLocation;
            student.AccessCard     = studentParam.AccessCard;
            student.classes        = _context.Classes.Find(studentParam.classes);
            student.UpdateDate     = DateTimeOffset.Now.LocalDateTime;
            result = _context.SaveChanges();
            if (result > 0)
            {
                status = true;
                MessageBox.Show("Update Successfully");
            }
            else
            {
                MessageBox.Show("Update Failed");
            }

            return(status);
        }
        public bool UpdatePr(int?id, StudentParam studentParam)
        {
            var result  = 0;
            var student = Get(id);

            student.FirstName      = studentParam.FirstName;
            student.LastName       = studentParam.LastName;
            student.Dob            = studentParam.Dob;
            student.Pob            = studentParam.Pob;
            student.Gender         = studentParam.Gender;
            student.Religion       = studentParam.Religion;
            student.Address        = studentParam.Address;
            student.RT             = studentParam.RT;
            student.RW             = studentParam.RW;
            student.Village        = studentParam.Village;
            student.District       = studentParam.District;
            student.Regencie       = studentParam.Regencie;
            student.Provience      = studentParam.Provience;
            student.Phone          = studentParam.Phone;
            student.Email          = studentParam.Email;
            student.HiringLocation = studentParam.HiringLocation;
            student.UpdateDate     = DateTimeOffset.Now.LocalDateTime;
            result = _context.SaveChanges();
            if (result > 0)
            {
                status = true;
                MessageBox.Show("Update Successfully");
            }
            else
            {
                MessageBox.Show("Update Failed");
            }

            return(status);
        }
Exemplo n.º 4
0
        public IActionResult Post([FromBody] dynamic value)
        {
            JObject      @object      = JObject.Parse(value.ToString());
            StudentParam StudentParam = @object.ToObject <StudentParam>();
            //连接数据库
            MongoClient client = new MongoClient("mongodb://127.0.0.1");
            //获取database,没有则创建
            IMongoDatabase mydb = client.GetDatabase("mydb");
            //获取collection
            IMongoCollection <Student> collection = mydb.GetCollection <Student>("student");

            //插入一条数据
            StudentParam.Student.StudentId = Guid.NewGuid().ToString();
            collection.InsertOne(StudentParam.Student);

            return(Ok());

            /*
             * //查询添加的数据
             * mydb = client.GetDatabase("mydb");
             * //获取collection
             * collection = mydb.GetCollection<Student>("student");
             *
             * var filter = Builders<Student>.Filter;
             * var students= collection.Find(filter.Where(c=>c.FirstName!=""));
             * List<StudentDto> list = _mapper.Map<List<StudentDto>>(students);
             * return Ok(list);
             */
        }
Exemplo n.º 5
0
        //public StudentProcessor(IStudentDao dao, IStudentParamConverter paramConverter,
        //    IStudentResultConverter resultConverter)
        //{
        //    this.Dao = dao;
        //    this.ParamConverter = paramConverter;
        //    this.ResultConverter = resultConverter;
        //}

        public StudentResult Create(StudentParam param)
        {
            Model.Student entity = ParamConverter.Convert(param, null);

            entity = Dao.Save(entity);

            return(ResultConverter.Convert(entity));
        }
 public void Post([FromBody] StudentParam newStudent)
 {
     // TODO: Validation of items passed in
     _studentRepository.AddStudent(new Student {
         Name      = newStudent.name,
         StudentId = newStudent.studentId,
         Grade     = newStudent.grade
     });
 }
        public object GetStudent(StudentParam obj)
        {
            try
            {
                SchoolMainContext db = new ConcreateContext().GetContext(obj.UserName, obj.Password);
                if (db == null)
                {
                    return(new Results {
                        IsSuccess = false, Message = "Invalid User"
                    });
                }
                else
                {
                    var data = db.TBLUSERLOGINs.Where(r => r.UserName == obj.UserName && r.Password == obj.Password).FirstOrDefault();
                    if (data == null)
                    {
                        return(new Results {
                            IsSuccess = false, Message = "Invalid User"
                        });
                    }
                    var academicyear = db.View_GETACADEMICYEAR.FirstOrDefault();
                    if (academicyear == null)
                    {
                        return(new StudentDetails {
                            IsSuccess = true, StudentInformation = "Academic Year Not Found"
                        });
                    }
                    if (data != null)
                    {
                        int StudentId = Convert.ToInt32(data.EmpCode);
                        var result    = //db.View_DisplayStudentDetails.Where(r => r.STUDENTID == StudentId && r.ACADEMICYEAR == academicyear.ACADEMICYEAR).FirstOrDefault();
                                        from c in db.View_DisplayStudentDetails.Where(r => r.STUDENTID == StudentId && r.ACADEMICYEAR == academicyear.ACADEMICYEAR)
                                        select new { c.STUDENTNAME, c.GENDER, c.DOB, c.GMOBILE, c.IMAGEPATH, c.PADDRESS, c.SARALNO, c.STUDENTID, c.STANDARDNAME, c.BLOOGGROUP };

                        return(new StudentDetails {
                            IsSuccess = true, StudentInformation = result
                        });
                    }
                    else
                    {
                        return(new StudentDetails {
                            IsSuccess = true, StudentInformation = "Student Not Found"
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                return(new Results
                {
                    IsSuccess = false,
                    Message = ex.Message
                });
            }
        }
Exemplo n.º 8
0
 public void Post([FromBody] StudentParam Student) => _StudentRepository.InsertStudent(student: new StudentData
 {
     StudentId = Student.StudentId,
     FirstName = Student.FirstName,
     LastName  = Student.LastName,
     Age       = Student.Age,
     Grade     = Student.Grade,
     Gender    = Student.Gender,
     CreatedOn = DateTime.Now,
     UpdatedOn = DateTime.Now,
 });
Exemplo n.º 9
0
 public bool Update(int?id, StudentParam studentParam)
 {
     if (_studentRepository.Get(id) == null)
     {
         MessageBox.Show("Sorry, your data is not found");
     }
     else
     {
         status = _studentRepository.Update(id, studentParam);
     }
     return(status);
 }
Exemplo n.º 10
0
        public bool Update(int?id, StudentParam studentParam)
        {
            var get = Get(id);

            get.Email      = studentParam.Email;
            get.Username   = studentParam.Username;
            get.Password   = studentParam.Password;
            get.FirstName  = studentParam.FirstName;
            get.LastName   = studentParam.LastName;
            get.UpdateDate = DateTimeOffset.Now.LocalDateTime;
            return(saveChange.save());
        }
Exemplo n.º 11
0
 public bool Insert(StudentParam studentParam)
 {
     student.Email      = studentParam.Email;
     student.Username   = studentParam.Username;
     student.Password   = studentParam.Password;
     student.FirstName  = studentParam.FirstName;
     student.LastName   = studentParam.LastName;
     student.CreateDate = DateTimeOffset.Now.LocalDateTime;
     //var getVillage
     myContext.Students.Add(student);
     return(saveChange.save());
 }
Exemplo n.º 12
0
        public void Update(long id, StudentParam param)
        {
            Model.Student oldEntity = Dao.Find(id);

            if (oldEntity != null)
            {
                Dao.Delete(oldEntity);
                Dao.Update(ParamConverter.Convert(param, null));
            }
            else
            {
                Console.WriteLine($"No entity with Id = {id}  was found");
            }
        }
Exemplo n.º 13
0
 public bool Insert(StudentParam studentParam)
 {
     if (studentParam == null)
     {
         throw new NullReferenceException();
     }
     else if (studentParam.FirstName == " " || studentParam.LastName == " ")
     {
         status = false;
     }
     else
     {
         status = _studentService.Insert(studentParam);
     }
     return(status);
 }
        public bool UpdateP(int?id, StudentParam studentParam)
        {
            var result  = 0;
            var student = Get(id);

            student.Password   = studentParam.Password;
            student.UpdateDate = DateTimeOffset.Now.LocalDateTime;
            result             = _context.SaveChanges();
            if (result > 0)
            {
                status = true;
                MessageBox.Show("Update Successfully");
            }
            else
            {
                MessageBox.Show("Update Failed");
            }

            return(status);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Function to update information about a entity .
        /// </summary>
        /// <param name="id">entity's id</param>
        /// <param name="param">entity</param>
        /// <returns>response and update entity</returns>
        public ApiResponse Update(long id, StudentParam param)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                Processor.Update(id, param);
                response.Text   = "The entity updated successfully . \n";
                response.Result = true;

                return(response);
            }
            catch (Exception ex)
            {
                response.Result = false;
                response.Text   = ex.Message;

                return(response);
            }
        }
Exemplo n.º 16
0
        //public StudentService(IStudentProcessor processor)
        //{
        //    this.Processor = processor;
        //}

        /// <summary>
        /// Function to create new a entity .
        /// </summary>
        /// <param name="param">a entity</param>
        /// <returns>response and new entity</returns>
        public ApiResponse Create(StudentParam param)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                response.Text = $"The entity successfully added .\n" +
                                $" {Serialization.Serizlize(Processor.Create(param))}";
                response.Result = true;

                return(response);
            }
            catch (Exception ex)
            {
                response.Result = false;
                response.Text   = ex.Message;

                return(response);
            }
        }
Exemplo n.º 17
0
        public object GetStudent(StudentParam obj)
        {
            SchoolMainContext db = new ConcreateContext().GetContext(obj.UserName, obj.Password);

            if (db == null)
            {
                return(new Results {
                    IsSuccess = false, Message = "Invalid User"
                });
            }
            else
            {
                var data      = db.TBLUSERLOGINs.Where(r => r.UserName == obj.UserName && r.Password == obj.Password).FirstOrDefault();
                int StudentId = Convert.ToInt32(data.EmpCode);
                var result    = db.View_DisplayStudentDetails.Where(r => r.STUDENTID == StudentId).FirstOrDefault();
                return(new StudentDetails {
                    IsSuccess = true, StudentInformation = result
                });
            }
        }
Exemplo n.º 18
0
        public bool Update(int?id, StudentParam studentParam)
        {
            if (id == null)
            {
                throw new NullReferenceException();
            }
            var get = Get(id);

            if (studentParam == null)
            {
                throw new NullReferenceException();
            }
            else if (studentParam.FirstName == " " || studentParam.LastName == " ")
            {
                status = false;
            }
            else
            {
                status = _studentService.Update(id, studentParam);
            }
            return(status);
        }
 public bool Insert(StudentParam studentParam)
 {
     try
     {
         var result = 0;
         student.Name       = studentParam.Name;
         student.Dob        = studentParam.Dob;
         student.Pob        = studentParam.Pob;
         student.Gender     = studentParam.Gender;
         student.Religion   = studentParam.Religion;
         student.Address    = studentParam.Address;
         student.RT         = studentParam.RT;
         student.RW         = studentParam.RW;
         student.Kelurahan  = studentParam.Kelurahan;
         student.Kecamatan  = studentParam.Kecamatan;
         student.Kabupaten  = studentParam.Kabupaten;
         student.Phone      = studentParam.Phone;
         student.Email      = studentParam.Email;
         student.Username   = studentParam.Username;
         student.Password   = studentParam.Password;
         student.Status     = "ON BOOTCAMP";
         student.classes    = _context.Classes.Find(studentParam.Classes);
         student.placements = _context.Placements.Find(studentParam.Placements);
         student.CreateDate = DateTimeOffset.Now.LocalDateTime;
         _context.Students.Add(student);
         result = _context.SaveChanges();
         if (result > 0)
         {
             status = true;
             MessageBox.Show("Insert Successfully");
         }
     }
     catch (DbEntityValidationException e)
     {
         Console.Write(e.EntityValidationErrors);
     }
     return(status);
 }
 public bool Insert(StudentParam studentParam)
 {
     try
     {
         var result = 0;
         student.FirstName = studentParam.FirstName;
         student.LastName  = studentParam.LastName;
         //student.Dob = studentParam.Dob;
         //student.Pob = studentParam.Pob;
         //student.Gender = studentParam.Gender;
         //student.Religion = studentParam.Religion;
         //student.Address = studentParam.Address;
         //student.RT = studentParam.RT;
         //student.RW = studentParam.RW;
         //student.Village = studentParam.Village;
         //student.District = studentParam.District;
         //student.Regencie = studentParam.Regencie;
         student.Phone      = studentParam.Phone;
         student.Email      = studentParam.Email;
         student.Username   = studentParam.Username;
         student.Password   = studentParam.Password;
         student.Status     = "ON BOOTCAMP";
         student.classes    = _context.Classes.Find(studentParam.classes);
         student.CreateDate = DateTimeOffset.Now.LocalDateTime;
         _context.Students.Add(student);
         result = _context.SaveChanges();
         if (result > 0)
         {
             status = true;
             MessageBox.Show("Insert Successfully");
         }
     }
     catch (DbEntityValidationException e)
     {
         Console.Write(e.EntityValidationErrors);
     }
     return(status);
 }
        public bool Update(int?id, StudentParam studentParam)
        {
            var result  = 0;
            var student = Get(id);

            student.Name       = studentParam.Name;
            student.Dob        = studentParam.Dob;
            student.Pob        = studentParam.Pob;
            student.Gender     = studentParam.Gender;
            student.Religion   = studentParam.Religion;
            student.Address    = studentParam.Address;
            student.RT         = studentParam.RT;
            student.RW         = studentParam.RW;
            student.Kelurahan  = studentParam.Kelurahan;
            student.Kecamatan  = studentParam.Kecamatan;
            student.Kabupaten  = studentParam.Kabupaten;
            student.Phone      = studentParam.Phone;
            student.Email      = studentParam.Email;
            student.Username   = studentParam.Username;
            student.Password   = studentParam.Password;
            student.Status     = studentParam.Status;
            student.classes    = _context.Classes.Find(studentParam.Classes);
            student.placements = _context.Placements.Find(studentParam.Placements);
            student.UpdateDate = DateTimeOffset.Now.LocalDateTime;
            result             = _context.SaveChanges();
            if (result > 0)
            {
                status = true;
                MessageBox.Show("Update Successfully");
            }
            else
            {
                MessageBox.Show("Update Failed");
            }

            return(status);
        }
Exemplo n.º 22
0
        // GET: Students
        public async Task <IActionResult> Index(
            int?StudentID,
            int?CourseID,
            string sortString   = "",
            string searchString = "",
            int pageIndex       = 1)
        {
            StudentIndexData viewModel = new StudentIndexData();
            StudentParam     param     = new StudentParam();

            param.SearchString       = searchString;
            param.SortString         = sortString;
            param.SortLastName       = (sortString == "lastName_desc") ? "lastName" : "lastName_desc";
            param.SortID             = (sortString == "id_desc") ? "id" : "id_desc";
            param.SortEnrollmentDate = (sortString == "enrollDate_desc") ? "enrollDate" : "enrollDate_desc";
            param.PageIndex          = pageIndex;
            viewModel.Param          = param;

            IQueryable <Student> students = _context.Students
                                            .Include(s => s.Enrollments)
                                            .ThenInclude(s => s.Course)
                                            .ThenInclude(s => s.Department)
                                            .Include(s => s.Enrollments)
                                            .ThenInclude(s => s.Course)
                                            .ThenInclude(s => s.CourseAssignments)
                                            .ThenInclude(s => s.Instructor)
                                            .AsNoTracking()
                                            .AsQueryable();

            if (!String.IsNullOrEmpty(searchString))
            {
                students = students.Where(
                    s => s.FirstName.Contains(searchString) ||
                    s.LastName.Contains(searchString)
                    );
            }

            if (StudentID != null)
            {
                viewModel.Param.StudentID = StudentID;
                //ViewData["StudentID"] = StudentID;
                Student student = students
                                  .Where(i => i.StudentId == StudentID).Single();
                viewModel.Courses = student.Enrollments
                                    .Select(c => c.Course);
            }

            if (CourseID != null)
            {
                viewModel.Param.CourseID = CourseID;
                Course course = viewModel.Courses
                                .Where(c => c.CourseID == CourseID).FirstOrDefault();
                viewModel.CourseAssignments = course.CourseAssignments;
            }

            students = SortStudents(students, sortString);

            int pageSize             = 10;
            PagedList <Student> list = _pagedList.PagedList();

            viewModel.PagedList = list.Paging(await students.ToListAsync(), pageIndex, pageSize);

            return(View(viewModel));
        }
Exemplo n.º 23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="param">a entity</param>
 public void ValidateParameters(StudentParam param)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 24
0
 public bool Insert(StudentParam studentParam)
 {
     return(_studentRepository.Insert(studentParam));
 }