public ClsStudentDetailResult ProcessRead(StudentDetailBO studentDetailBO)
        {
            ClsStudentDetailResult detailResult = new ClsStudentDetailResult();

            detailResult.Success = true;
            try
            {
                detailResult.Students = (from T1 in studentEntities.StudentDetails
                                         join T2 in studentEntities.Departments on T1.DepartmentId equals T2.Id
                                         where T1.Id == studentDetailBO.Id
                                         select new StudentDetailBO()
                {
                    Id = T1.Id,
                    Name = T1.Name,
                    DepartmentId = T2.Id,
                    DepartmentName = T2.Name
                }).ToList <StudentDetailBO>();
            }
            catch (Exception ex)
            {
                detailResult.Success   = false;
                detailResult.ErrorDesc = ex.Message;
            }

            return(detailResult);
        }
Example #2
0
        public void GetStudent()
        {
            StudentDetailBS        StudentBS = new StudentDetailBS();
            ClsStudentDetailResult result    = StudentBS.ProcessRead();

            if (result.Success)
            {
                gvStudent.DataSource = result.Students;
                gvStudent.DataBind();
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true);
            }
        }