Exemplo n.º 1
0
 public List <studentfile> GetUploadedFile(string Id)
 {
     try
     {
         List <studentfile> studentfiles  = new List <studentfile>();
         List <studentfile> studentfiles1 = new List <studentfile>();
         List <studentfile> studentfiles2 = new List <studentfile>();
         studentfile        studentfiles3 = new studentfile();
         using (DB_A3E3FF_scampus2020Context db = new DB_A3E3FF_scampus2020Context())
         {
             studentfiles1 = db.StudentIdupload.Where(x => x.StudentId.ToString() == Id && x.IsActive == true).Select(x => new studentfile
             {
                 FileID   = x.StudentUploadId,
                 FileName = x.UploadFileName,
                 FileType = x.UploadFileTitile
             }).ToList();
             studentfiles.AddRange(studentfiles1);
             studentfiles2 = db.CertificateUpload.Where(x => x.StudentId.ToString() == Id && x.IsActive == true).Select(x => new studentfile
             {
                 FileID   = x.CertificteUploadId,
                 FileName = x.UploadFileName,
                 FileType = x.UploadFileTitile
             }).ToList();
             studentfiles.AddRange(studentfiles2);
             var data = db.StudentDetails.Where(x => x.StudentId.ToString() == Id && x.IsActive == true).FirstOrDefault();
             var d    = data.StudentPhoto.Split("\\");
             studentfiles3 = new studentfile {
                 FileID = data.StudentId, FileName = d[8], FileType = "UploadPhoto"
             };
             studentfiles.Add(studentfiles3);
         }
         return(studentfiles);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public Student GetStudentByID(string Id)
 {
     try
     {
         Student            student       = new Student();
         List <studentfile> studentfiles  = new List <studentfile>();
         List <studentfile> studentfiles1 = new List <studentfile>();
         List <studentfile> studentfiles2 = new List <studentfile>();
         studentfile        studentfiles3 = new studentfile();
         using (DB_A3E3FF_scampus2020Context db = new DB_A3E3FF_scampus2020Context())
         {
             student = (from s in db.StudentDetails
                        from c in db.Course
                        .Where(x => x.StudentId.ToString() == Id && s.IsActive == true).DefaultIfEmpty()
                        from b in db.InBranch
                        .Where(x => x.BranchId == s.BranchId).DefaultIfEmpty()
                        from m in db.MainCourse
                        .Where(x => x.MainCourseId == s.MainCourseId).DefaultIfEmpty()
                        from mc in db.MainCourse
                        .Where(x => x.MainCourseId == c.MainCourseId).DefaultIfEmpty()
                        select new Student
             {
                 StudentID = s.StudentId,
                 CourseID = c.CourseId,
                 CourseName = mc.Name,
                 mainCourseID = mc.MainCourseId,
                 FirstName = s.StudentFname,
                 LastName = s.StudentLname,
                 MiddleName = s.StudentMname,
                 DOB = s.Dob,
                 Gender = s.Gender,
                 ParentName = s.ParentName,
                 ParentMobileNo = s.ParentMobile,
                 Email = s.Email,
                 UserName = s.UserName,
                 Password = s.Password,
                 ContactNo = s.Mobile,
                 AlternateContactNo = s.AlternateMobile,
                 Location = s.Location,
                 City = s.City,
                 Address = s.Address,
                 PinCode = s.Pincode,
                 State = s.State,
                 Coutry = s.Country,
                 BranchID = s.BranchId,
                 BranchName = b.BranchName,
                 RegistrationDate = c.RegistrationDate,
                 CourseStartDate = c.CourseStartDate,
                 Batch = c.Batch,
                 RegisterNo = c.RegistratioinNumber,
                 RollNumber = c.RollNo,
                 DiscountAmount = c.DiscountAmount,
                 ReferedPerson = c.ReferredPerson,
                 SourceOfEnquiry = c.SourceOfEnquiry,
                 FeeDiscountApplicable = c.FeeDiscountApplicable,
                 TypeofDiscount = c.TypeOfDiscount,
                 Comments = s.Comments,
                 IdProofType = c.IdproofType,
                 IdProofNo = c.IdproofNumber,
                 IsActive = s.IsActive,
                 CreatedDate = s.CreatedDate,
                 UploadedFile = studentfiles
             }
                        ).Where(x => x.IsActive == true).OrderByDescending(x => x.CreatedDate).FirstOrDefault();
         }
         return(student);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }