예제 #1
0
        public void GetDepartment()
        {
            DepartmentBS departmentBS        = new DepartmentBS();
            ClsDepartmentDetailResult result = departmentBS.ProcessRead();

            if (result.Success)
            {
                gvDepartment.DataSource = result.departments;
                gvDepartment.DataBind();
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + result.ErrorDesc + "');", true);
            }
        }
예제 #2
0
        public ClsDepartmentDetailResult ProcessRead()
        {
            ClsDepartmentDetailResult detailResult = new ClsDepartmentDetailResult();

            detailResult.Success = true;
            try
            {
                detailResult.departments = (from T1 in studentEntities.Departments
                                            select new DepartmentBO()
                {
                    Id = T1.Id, Name = T1.Name
                }).ToList <DepartmentBO>();
            }
            catch (Exception ex)
            {
                detailResult.Success   = false;
                detailResult.ErrorDesc = ex.Message;
            }

            return(detailResult);
        }