private void BindDisciplineLevelInfo()
        {
            BPDisciplineLevels bp = new BPDisciplineLevels();
            BECompetencies ds = bp.SelectByID(DisciplineLevelID);

            if (ds.tbl_DisciplineLevels.Count > 0)
            {
                BECompetencies.tbl_DisciplineLevelsRow row = ds.tbl_DisciplineLevels[0];

                if (!row.DisciplineLevelActive || row.IsDisciplineLevelTitleFRNull())
                    Redirect();
                else
                {
                    PageName = row.DisciplineLevelTitleFR + " :: " + PageName;

                    lblTitleCrumb.Text = row.DisciplineLevelTitleFR;
                    lblTitle.Text = row.DisciplineLevelTitleFR;
                    lblName.Text = row.DisciplineLevelTitleFR;

                    if (!row.IsDisciplineLevelDescriptionFRNull())
                    {
                        lblDisciplineLevelDescription.Text = row.DisciplineLevelDescriptionFR;
                        plcDisciplineLevelDescription.Visible = true;
                    }
                }
            }
            else
                Redirect();
        }
        private void BindDisciplineLevelInfo()
        {
            if (DisciplineLevelID != 0)
            {
                BPDisciplineLevels bp = new BPDisciplineLevels();
                BECompetencies dsDisciplines = bp.SelectByID(DisciplineLevelID);
                BECompetencies.tbl_DisciplineLevelsRow discipline = dsDisciplines.tbl_DisciplineLevels.FindByDisciplineLevelID(DisciplineLevelID);

                if (discipline != null)
                {
                    txtTitle.Text = discipline.DisciplineLevelTitle;
                    txtTitleFR.Text = discipline.IsDisciplineLevelTitleFRNull() ? "" : discipline.DisciplineLevelTitleFR;
                    txtDescription.Text = discipline.IsDisciplineLevelDescriptionNull() ? "" : discipline.DisciplineLevelDescription;
                    txtDescriptionFR.Text = discipline.IsDisciplineLevelDescriptionFRNull() ? "" : discipline.DisciplineLevelDescriptionFR;
                    chkDisciplineLevelActive.Checked = discipline.DisciplineLevelActive;

                    lblTitle.Text = "Edit Discipline Level - " + discipline.DisciplineLevelTitle;
                }
            }
            else
            {
                btnDelete.Visible = false;
                lblTitle.Text = "Add Discipline Level";
            }
        }
        private void SaveDisciplineLevelInfo()
        {
            bool isNew = false;
            BPDisciplineLevels bp = new BPDisciplineLevels();
            BECompetencies dsDisciplines = new BECompetencies();
            BECompetencies.tbl_DisciplineLevelsRow discipline = null;

            if (DisciplineLevelID > 0)
            {
                dsDisciplines = bp.SelectByID(DisciplineLevelID);
                discipline = dsDisciplines.tbl_DisciplineLevels.FindByDisciplineLevelID(DisciplineLevelID);

                if (discipline.DisciplineLevelActive && (!chkDisciplineLevelActive.Checked))
                    UpdateAssignedItems();
            }

            if (discipline == null)
            {
                discipline = dsDisciplines.tbl_DisciplineLevels.Newtbl_DisciplineLevelsRow();
                isNew = true;
            }

            discipline.DisciplineLevelTitle = txtTitle.Text.Trim();

            if (txtTitleFR.Text.Trim() != "")
                discipline.DisciplineLevelTitleFR = txtTitleFR.Text.Trim();
            else
                discipline.SetDisciplineLevelTitleFRNull();

            if (txtDescription.Text.Trim() != "")
                discipline.DisciplineLevelDescription = txtDescription.Text.Trim();
            else
                discipline.SetDisciplineLevelDescriptionNull();

            if (txtDescriptionFR.Text.Trim() != "")
                discipline.DisciplineLevelDescriptionFR = txtDescriptionFR.Text.Trim();
            else
                discipline.SetDisciplineLevelDescriptionFRNull();

            discipline.DisciplineLevelActive = chkDisciplineLevelActive.Checked;
            discipline.DateModified = DateTime.Now;
            discipline.ModifiedByAdminID = PageUserID;

            if (isNew)
            {
                discipline.DisciplineLevelOrder = bp.GetDisciplineLevelMaxOrder();
                discipline.DateCreated = DateTime.Now;
                dsDisciplines.tbl_DisciplineLevels.Addtbl_DisciplineLevelsRow(discipline);
            }

            bp.Update(dsDisciplines);
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BPDisciplineLevels bpDisciplineLevels = new BPDisciplineLevels();
            BECompetencies ds = bpDisciplineLevels.SelectByID(DisciplineLevelID);
            BECompetencies.tbl_DisciplineLevelsRow discipline = ds.tbl_DisciplineLevels.FindByDisciplineLevelID(DisciplineLevelID);

            if (discipline != null)
            {
                BPCompetencyAreas bpCompAreas = new BPCompetencyAreas();
                BPCompetencies bpCompetencies = new BPCompetencies();

                ds.Merge(bpCompAreas.SelectByDisciplineLevelID(discipline.DisciplineLevelID));
                ds.Merge(bpCompetencies.SelectByDisciplineLevelID(discipline.DisciplineLevelID));

                foreach (BECompetencies.tbl_CompetenciesRow competency in ds.tbl_Competencies)
                {
                    competency.Delete();
                }

                foreach (BECompetencies.tbl_CompetencyAreasRow compArea in ds.tbl_CompetencyAreas)
                {
                    compArea.Delete();
                }

                discipline.Delete();

                bpCompetencies.Update(ds);
                bpCompAreas.Update(ds);
                bpDisciplineLevels.Update(ds);

                bpDisciplineLevels.ReOrderDisciplineLevels();
            }

            BrowseRedirect();
        }