/// <summary> /// Add courses to the criteria list via a csv list of course id's /// </summary> /// <param name="strClassifications">Csv list of classifications</param> public void AddClassifications(string strClassifications) { // Local variables string[] astrClassificationIDs = strClassifications.Split(','); string strClassificationNames = ""; int intClassificationType; string strClassificationType; // Get Classification Type for the user's organisation BusinessServices.Classification objClassification = new BusinessServices.Classification(); DataTable dtbClassificationType = objClassification.GetClassificationType(Utilities.UserContext.UserData.OrgID); intClassificationType = (int)dtbClassificationType.Rows[0]["ClassificationTypeID"]; strClassificationType = dtbClassificationType.Rows[0]["Name"].ToString(); // Get Classification List DataTable dtbClassification = objClassification.GetClassificationList(intClassificationType); // Loop through all Classifications foreach (DataRow drwClassification in dtbClassification.Rows) { // loop through all required Classifications for (int intClassification = 0; intClassification <= astrClassificationIDs.GetUpperBound(0); intClassification++) { // if they match if (astrClassificationIDs[intClassification] == drwClassification["ClassificationID"].ToString()) { // Add it to the string. strClassificationNames += drwClassification["Value"].ToString(); strClassificationNames += ", "; } } } // Remove trailing command if it exists and replace with a full stop if (strClassificationNames.Length > 0) { strClassificationNames = strClassificationNames.Substring(0, strClassificationNames.Length - 2); strClassificationNames += "."; } // add to the criteria list this.Criteria.Add(strClassificationType, strClassificationNames); }
/// <summary> /// /// </summary> private void DisplayClassifications() { try { // Get Classification Type for the dsiplayed user's organisation Classification objClassification = new BusinessServices.Classification(); DataTable dtbClassificationType = objClassification.GetClassificationType(UserContext.UserData.OrgID); if (dtbClassificationType.Rows.Count > 0) { this.lblCustomClassification.Text = dtbClassificationType.Rows[0]["Name"].ToString(); DataTable dtbClassificationList = objClassification.GetClassificationList((int)Convert.ToInt32(dtbClassificationType.Rows[0][CTypeColumnID].ToString())); // Add blank row to the datatable DataRow drwBlank; drwBlank = dtbClassificationList.NewRow(); // Add a blank value drwBlank[CListColumnClassificationID] = 0; drwBlank[CListColumnClassificationTypeID] = 0; drwBlank[CListColumnValue] = ResourceManager.GetString("lblAny"); drwBlank[CListColumnActive] = 1; dtbClassificationList.Rows.InsertAt(drwBlank, 0); this.cboCustomClassification.DataSource = dtbClassificationList; // Add blank item this.cboCustomClassification.DataTextField = CListColumnValue; this.cboCustomClassification.DataValueField = CListColumnClassificationID; this.cboCustomClassification.DataBind(); } else { this.lblCustomClassification.Visible = false; this.cboCustomClassification.Visible = false; } } catch (Exception Ex) { throw new Exception(Ex.Message); } }