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 btnMove_Click(object sender, EventArgs e) { bool found1 = false, found2 = false; int Position = Convert.ToInt32(ddlPosition.SelectedValue); int ItemToMove = Convert.ToInt32(ddlItemToMove.SelectedValue); BPDisciplineLevels bp = new BPDisciplineLevels(); BECompetencies ds = bp.SelectAll(); BECompetencies.tbl_DisciplineLevelsRow[] disciplinerows = (BECompetencies.tbl_DisciplineLevelsRow[])ds.tbl_DisciplineLevels.Select("", "DisciplineLevelOrder"); BECompetencies.tbl_DisciplineLevelsRow movediscipline = ds.tbl_DisciplineLevels.FindByDisciplineLevelID(ItemToMove); foreach (BECompetencies.tbl_DisciplineLevelsRow discipline in disciplinerows) { if (found1 && found2) break; if (discipline.DisciplineLevelID == movediscipline.DisciplineLevelID) { found1 = true; if (discipline.DisciplineLevelID == Position) found2 = true; } else if (discipline.DisciplineLevelID == Position) { found2 = true; if (rblBeforeAfter.SelectedValue == "0") { movediscipline.DisciplineLevelOrder = discipline.DisciplineLevelOrder; discipline.DisciplineLevelOrder++; } else { if (found1) discipline.DisciplineLevelOrder--; movediscipline.DisciplineLevelOrder = discipline.DisciplineLevelOrder + 1; } } else if (found1 && !found2) discipline.DisciplineLevelOrder--; else if (found2 && !found1) discipline.DisciplineLevelOrder++; } bp.Update(ds); dgDisciplineLevels.DataSource = GetData(); dgDisciplineLevels.DataBind(); }
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(); }