Beispiel #1
0
        public void LoadAllStudent()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("SN");
            dt.Columns.Add("ID");
            dt.Columns.Add("Name");
            dt.Columns.Add("Email");
            dt.Columns.Add("Address");
            dt.Columns.Add("students");
            dt.Columns.Add("Status");

            var student = DropDownManager.GetAllSchools();

            if (student != null)
            {
                int sn = 0;
                foreach (var item in student)
                {
                    string id       = item.Id.ToString();
                    string status   = GetStatus(item.Id);
                    string Name     = item.Name;
                    string Email    = item.Email.ToString();
                    string students = stat.GetStudentCount(item.Id);
                    string Address  = item.Address;
                    sn++;

                    dt.Rows.Add(sn, id, Name, Email, Address, students, status);
                }

                gvSchools.DataSource = dt;
                gvSchools.DataBind();

                foreach (GridViewRow row in gvSchools.Rows)
                {
                    Label lblStatus = (Label)row.FindControl("lblStatus");
                    if (lblStatus.Text == "Registered")
                    {
                        lblStatus.CssClass = "btn btn-success";
                    }
                    else
                    {
                        lblStatus.CssClass = "btn btn-danger";
                    }
                }
            }
        }
Beispiel #2
0
        public void PopulateTable()
        {
            var dt = new DataTable();

            dt.Columns.Add("ID");
            dt.Columns.Add("SN");
            dt.Columns.Add("Name");
            dt.Columns.Add("Email");
            dt.Columns.Add("Address");
            dt.Columns.Add("LocalGovt");
            dt.Columns.Add("Inspector");

            IEnumerable <Models.School> schools;

            if (User.IsInRole("Inspector"))
            {
                schools = DropDownManager.GetAllSchools(SessionUser.LgaId);
            }
            else
            {
                schools = DropDownManager.GetAllSchools();
            }

            if (schools != null)
            {
                int sn = 0;
                foreach (var item in schools)
                {
                    sn++;
                    string id         = item.Id.ToString();
                    string Name       = item.Name.ToString();
                    string Email      = item.Email.ToString();
                    string Addreess   = item.Address.ToString();
                    string principal  = item.LocalGovernment.LocalGovernment1;
                    var    nofstudent = item.LocalGovernment.Inspectors.FirstOrDefault()?.CIEName; // statManager.GetStudentCount(item.Id);
                    dt.Rows.Add(id, sn, Name, Email, Addreess, principal, nofstudent);
                }
                gvSchool.DataSource = dt;
                gvSchool.DataBind();
                gvSchool.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
        }
Beispiel #3
0
        private void PopulateTable(int selectValue)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("ID");
            dataTable.Columns.Add("SN");
            dataTable.Columns.Add("Name");
            dataTable.Columns.Add("Inspector");
            int counter = 0;
            var schools = DropDownManager.GetAllSchools(selectValue, GeneralUtility.SessionUser.SchoolType, null);

            foreach (var item in schools)
            {
                ++counter;
                string id        = item.Id.ToString();
                string name      = item.Name.ToString();
                string inspector = item.LocalGovernment.Inspectors.FirstOrDefault()?.CIEName;
                dataTable.Rows.Add(id, counter, name, inspector);
            }
            gvAllQuota.DataSource = dataTable;
            gvAllQuota.DataBind();
            gvAllQuota.HeaderRow.TableSection = TableRowSection.TableHeader;
        }
Beispiel #4
0
 public IHttpActionResult GetAllSchool(int?id)
 {
     return(Ok(DropDownManager.GetAllSchools()));
 }
Beispiel #5
0
        public void PopulatePrimaryTable()
        {
            var dt = new DataTable();

            dt.Columns.Add("ID");
            dt.Columns.Add("SN");
            dt.Columns.Add("Name");
            dt.Columns.Add("Email");
            dt.Columns.Add("Address");
            dt.Columns.Add("Principal");
            dt.Columns.Add("Student");
            dt.Columns.Add("Type");

            var inspector = inspectorServices.GetInspectorByName();

            var schools = DropDownManager.GetAllSchools(inspector.LocalGovernmentId, primary);

            if (schools != null && schools.Count() > 0)
            {
                int sn = 0;
                foreach (var item in schools)
                {
                    sn++;
                    string id         = item.Id.ToString();
                    string Name       = item.Name.ToString();
                    string Email      = item.Email.ToString();
                    string Addreess   = item.Address.ToString();
                    var    nofstudent = statManager.GetStudentCount(item.Id);
                    string principal  = item.NameOfPrincipal;
                    string type       = item.SchoolType.SchoolType1;
                    dt.Rows.Add(id, sn, Name, Email, Addreess, principal, nofstudent, type);
                }
                gvPrimary.DataSource = dt;
                gvPrimary.DataBind();
                gvPrimary.HeaderRow.TableSection = TableRowSection.TableHeader;

                foreach (GridViewRow row in gvPrimary.Rows)
                {
                    Label type = (Label)row.FindControl("type");
                    if (type.Text == "Public")
                    {
                        type.CssClass = "btn btn-primary";
                    }
                    else
                    {
                        type.CssClass = "btn btn-warning";
                    }
                }
            }
            else
            {
                dt.Rows.Add("", "", "No School Registered under your Local Government", "", "", "", "", "");
                gvPrimary.DataSource = dt;
                gvPrimary.DataBind();
                gvPrimary.HeaderRow.TableSection = TableRowSection.TableHeader;

                foreach (GridViewRow row in gvPrimary.Rows)
                {
                    Button type = (Button)row.FindControl("btnview");
                    type.Visible = false;
                }
            }
        }