/// <summary> /// Gets the items already included /// </summary> /// <param name="lbxMasterPageList">DualList object</param> /// <param name="strListName">List name from where the Right box to populated</param> /// <param name="strPageType">Page where the Dual list control is used (Template/User Privileges/Staff Privileges)</param> protected void SetDualListRightBox(DualList dualLstMasterPages, string strListName, string strSelectedID, string strPageType) { DataTable objListData = null; DataRow objListRow; ListItem lstItem; DataView objlistSortedView; string strCAMLQuery = string.Empty; string strViewFields = string.Empty; try { switch (strPageType) { case TEMPLATEMASTERPAGES: { objTemplateBLL = new TemplateDetailBLL(); strCAMLQuery = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><Eq><FieldRef Name='Template_ID' /><Value Type='Number'>" + strSelectedID + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Master_Page_Name' /><FieldRef Name='Master_Page_ID' />"; objListData = objTemplateBLL.GetMasterPageList(strParentSiteURL, strListName, strCAMLQuery, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { objlistSortedView = objListData.DefaultView; dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = string.Format("{0:0000}", objListRow["Page_Sequence"]) + "-" + objListRow["Master_Page_Name"].ToString(); lstItem.Value = objListRow[DWBIDCOLUMN].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } break; } case USERPRIVILEGES: { /// Get the Privileges string from DWB User List - strSelectedID string contains the Privileges from User List / Team Staff List /// Split the String with splitter ";" /// For each Privilege in User Record get Privilege from DWB System Privileges list / DWB Team Privileges List string[] privileges = strSelectedID.Split(SPLITTER, StringSplitOptions.None); /// Privilege_Abbr - Title column is used strViewFields = @"<FieldRef Name='Title'/><FieldRef Name='Privilege_Description'/><FieldRef Name='ID'/>"; if (privileges != null && privileges.Length > 0) { string strTempCAML = string.Empty; strCAMLQuery = string.Empty; if (privileges.Length == 1) { strCAMLQuery = @"<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[0] + "</Value></Eq>"; } else { for (int intIndex = privileges.Length; intIndex > 0; intIndex--) { if (intIndex == privileges.Length) { strTempCAML = string.Empty; strTempCAML = @"<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>"; strCAMLQuery = strTempCAML; } else if (intIndex == privileges.Length - 1) { strTempCAML = string.Empty; strTempCAML = @"<Or>" + strCAMLQuery + "<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>" + "</Or>"; strCAMLQuery = strTempCAML; } else { strTempCAML = string.Empty; strTempCAML = @"<Or>" + strCAMLQuery + "<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>" + "</Or>"; strCAMLQuery = strTempCAML; } } } strCAMLQuery = @"<Where>" + strCAMLQuery + "</Where>"; objCommonBLL = new CommonBLL(); objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strCAMLQuery, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { /// Loop through the values in Country List and finds the index of country user preference in List. dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[PRIVILEGEDESCRIPTIONCOLUMN].ToString(); lstItem.Value = objListRow[DWBTITLECOLUMN].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } } break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objListData = objTeamStaffRegistrationBLL.GetStaffs(strParentSiteURL, strSelectedID, strListName); if (objListData != null && objListData.Rows.Count > 0) { /// Title column is renamed as User_Name dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[DWBTITLECOLUMN].ToString(); lstItem.Value = objListRow[DWBIDCOLUMN].ToString() + SPLITTER_STRING + objListRow["User_ID"].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } break; } } } catch { throw; } finally { if (objListData != null) objListData.Dispose(); } }
/// <summary> /// Gets the items which are not included /// </summary> /// <param name="dualLstMasterPages">DualList object</param> /// <param name="strListName">List name from where the Right box to populated</param> /// <param name="strPageType">Page where the Dual list control is used (Template/User Privileges/Staff Privileges)</param> /// <param name="assetType">Asset Type if the Dual list box is used in Templates pages else string.Empty</param> protected void SetDualListLeftBox(DualList dualListBox, string strListName, string strPageType, string assetType) { DataTable objListData = null; DataRow objListRow; string strQuerystring = string.Empty; string strViewFields = string.Empty; ListItem lstItem; try { switch (strPageType) { case TEMPLATEMASTERPAGES: { objTemplateBLL = new TemplateDetailBLL(); strQuerystring = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Asset_Type' /><Value Type='Lookup'>" + assetType + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>"; strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' />"; objListData = objTemplateBLL.GetMasterPageList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { //Loop through the values in Country List and finds the index of country user preference in List. dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = string.Format("{0:0000}", objListRow["Page_Sequence"]) + "-" + objListRow[DWBTITLECOLUMN].ToString(); lstItem.Value = string.Format("New{0}", objListRow[DWBIDCOLUMN].ToString()); dualListBox.LeftItems.Add(lstItem); } } break; } case USERPRIVILEGES: { /// Call the Team Privileges / System Privileges List to get the details objCommonBLL = new CommonBLL(); strQuerystring = string.Empty; /// Privilege_Abbr - Title column is used strViewFields = @"<FieldRef Name='Title'/><FieldRef Name='Privilege_Description'/><FieldRef Name='ID'/>"; objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[PRIVILEGEDESCRIPTIONCOLUMN].ToString(); lstItem.Value = objListRow[DWBTITLECOLUMN].ToString(); dualListBox.LeftItems.Add(lstItem); } } break; } case STAFFREGISTRATION: { /// Call the DWB User List and populate with Active Users objCommonBLL = new CommonBLL(); strQuerystring = string.Empty; strViewFields = string.Empty; //strQuerystring = @"<Where><Eq><FieldRef Name='Terminate_Status'/><Value Type='Choice'>" + STATUSACTIVE + "</Value></Eq></Where>"; strQuerystring = @"<Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + STATUSACTIVE + "</Value></Eq><Neq><FieldRef Name='Discipline' /><Value Type='Lookup'>Administrator</Value></Neq></And></Where><OrderBy><FieldRef Name='DWBUserName' Ascending='True'/></OrderBy>"; strViewFields = @"<FieldRef Name='Terminate_Status'/><FieldRef Name='ID'/><FieldRef Name='DWBUserName'/>"; objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = Convert.ToString(objListRow["DWBUserName"]); lstItem.Value = Convert.ToString(objListRow[DWBIDCOLUMN]); dualListBox.LeftItems.Add(lstItem); } } break; } } } catch { throw; } finally { if (objListData != null) objListData.Dispose(); } }