/// <summary> /// Saving the updated privilege for the selected Staff. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void cmdOK_Click(object sender, EventArgs e) { string strRedirectUrl = string.Empty; try { objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objStaffData = objTeamStaffRegistrationBLL.GetSelectedStaffDetails(strParentSiteURL, strSelectedID, TEAMSTAFFLIST); objStaffData.PRIVILEGE = cboEditPrivileges.SelectedItem.Text; objTeamStaffRegistrationBLL.UpdateStaffPrivilege(strParentSiteURL, objStaffData, TEAMSTAFFLIST); string strTeamId = objStaffData.TeamID; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ClosePopupAndRefreshParent", "javascript:ClosePopupAndRefreshParent('+ strTeamId + ',' + TEAMSTAFFLIST + ');", true); } catch(WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx, 1); lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch(Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Gets the parent title for the selected item. /// </summary> /// <returns>Title of the selected item.</returns> protected string GetParentTitle() { string strTitle = string.Empty; string strCAMLQuery = string.Empty; string strFieldsToView = string.Empty; DataTable dtResultTable = null; switch (strReportName) { case TEMPLATEPAGESREPORT: { TemplateDetailBLL objTemplateDetail = new TemplateDetailBLL(); strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING] + "</Value></Eq></Where>"; ListEntry objTemplateListEntry = objTemplateDetail.GetTemplateDetail(strSiteURL, TEMPLATELIST, strCAMLQuery); if (objTemplateListEntry != null && objTemplateListEntry.TemplateDetails != null) { strTitle = objTemplateListEntry.TemplateDetails.Title; } break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); ListEntry objTeamListEntry = objTeamStaffRegistrationBLL.GetTeamDetails(strSiteURL, HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING], TEAMLIST); if (objTeamListEntry != null && objTeamListEntry.TeamDetails != null) { strTitle = objTeamListEntry.TeamDetails.TeamName; } break; } case "Audit Trail": { if (HttpContext.Current.Request.QueryString["auditFor"] != null) strTitle = HttpContext.Current.Request.QueryString["auditFor"]; else strTitle = string.Empty; break; } case CHAPTERREPORT: case WELLBOOKPAGEVIEW: case CHAPTERPAGEMAPPINGREPORT: { strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString["BookId"] + "</Value></Eq></Where>"; objCommonBLL = new CommonBLL(); strFieldsToView = "<FieldRef Name='ID'/><FieldRef Name='Title'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, WELLBOOKLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = Convert.ToString(dtResultTable.Rows[0]["Title"]); } break; } case CHAPTERPAGEREPORT: { string strBookId = string.Empty; strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString["ChapterID"] + "</Value></Eq></Where>"; objCommonBLL = new CommonBLL(); strFieldsToView = "<FieldRef Name='Title'/><FieldRef Name='Book_ID'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, CHAPTERLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = Convert.ToString(dtResultTable.Rows[0]["Title"]); strBookId = Convert.ToString(dtResultTable.Rows[0]["Book_ID"]); } if (!string.IsNullOrEmpty(strBookId)) { strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strBookId + "</Value></Eq></Where>"; strFieldsToView = "<FieldRef Name='Title'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, WELLBOOKLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = strTitle + " ( " + Convert.ToString(dtResultTable.Rows[0]["Title"]) + " )"; } } break; } } if (dtResultTable != null) { dtResultTable.Dispose(); } return strTitle; }
/// <summary> /// Sets the UI controls. /// </summary> private void SetUIControls() { /// Call the GetTeam methods From the Team Details assign the Team Name to the heading /// Populate the available Disciplines in the selected Team ListEntry objListEntry = GetDetailsForSelectedID(strSelectedID, TEAMLIST, TEAMREGISTRATION); if (objListEntry != null && objListEntry.TeamDetails != null) { hdnParentID.Value = objListEntry.TeamDetails.RowId.ToString(); hdnParentName.Value = objListEntry.TeamDetails.TeamName; lblParentName.Text = objListEntry.TeamDetails.TeamName; } TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); DataTable dtDiscipline = objTeamStaffRegistrationBLL.GetDisciplinesInTeam(strParentSiteURL, strSelectedID, TEAMSTAFFLIST); cboDiscipline.DataSource = dtDiscipline; cboDiscipline.DataTextField = DISCIPLINECOLUMN; cboDiscipline.DataBind(); ListItem lstSelect = new ListItem(DROPDOWNDEFAULTTEXTNONE, "0"); cboDiscipline.Items.Insert(0, lstSelect); if (dtDiscipline != null) { dtDiscipline.Dispose(); } }
/// <summary> /// Binds the staffs. /// </summary> private void BindStaffs() { dualListPrivileges.RightItems.Clear(); TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); DataTable dtStaffs = objTeamStaffRegistrationBLL.GetStaffsForDiscipline(strParentSiteURL, strSelectedID, cboDiscipline.SelectedItem.Text, TEAMSTAFFLIST); if (dtStaffs != null && dtStaffs.Rows.Count > 0) { foreach (DataRow dtRow in dtStaffs.Rows) { ListItem lstItem = new ListItem(); lstItem.Text = dtRow["User_Rank"].ToString() + "-" + dtRow[DWBTITLECOLUMN].ToString(); lstItem.Value = dtRow[DWBIDCOLUMN].ToString(); dualListPrivileges.RightItems.Add(lstItem); } } if (dtStaffs != null) { dtStaffs.Dispose(); } }
/// <summary> /// Gets the details for selected ID. /// </summary> /// <param name="selectedID">The selected ID.</param> /// <param name="listName">Name of the list.</param> /// <param name="pageType">Type of the page.</param> /// <returns></returns> protected DWBDataObjects.ListEntry GetDetailsForSelectedID(string selectedID, string listName, string pageType) { string strQueryString; DWBDataObjects.ListEntry objListEntry = null; try { strQueryString = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + selectedID + "</Value></Eq></Where>"; switch (pageType) { case MASTERPAGE: { objMasterBLL = new MasterPageBLL(); objListEntry = objMasterBLL.SetMasterPageDetail(strParentSiteURL, listName, strQueryString); break; } case TEMPLATE: { objTemplateBLL = new TemplateDetailBLL(); objListEntry = objTemplateBLL.GetTemplateDetail(strParentSiteURL, listName, strQueryString); break; } case WELLBOOK: { objWellBookBLL = new WellBookBLL(); objListEntry = objWellBookBLL.GetWellBookDetail(strParentSiteURL, listName, strQueryString); break; } case CHAPTER: { objChapterBLL = new ChapterBLL(); objListEntry = objChapterBLL.SetChapterDetail(strParentSiteURL, listName, strQueryString); break; } case USERREGISTRATION: { UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); objListEntry = objUserRegistrationBLL.GetUserDetails(strParentSiteURL, selectedID, listName); break; } case TEAMREGISTRATION: case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objListEntry = objTeamStaffRegistrationBLL.GetTeamDetails(strParentSiteURL, selectedID, listName); break; } } return objListEntry; } catch { throw; } }
/// <summary> /// Updates the list entry. /// </summary> /// <param name="listEntry">The list entry.</param> /// <param name="listName">Name of the list.</param> /// <param name="pageType">Type of the page.</param> /// <param name="actionPerformed">The action performed.</param> /// <returns></returns> protected bool UpdateListEntry(DWBDataObjects.ListEntry listEntry, string listName, string pageType, string actionPerformed) { bool blnUpdateSuccess = false; strUserName = GetUserName(); switch (pageType) { case USERREGISTRATION: { UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); blnUpdateSuccess = objUserRegistrationBLL.UpdateListEntry(strParentSiteURL, listEntry, listName, actionPerformed); break; } case USERPRIVILEGES: { UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); blnUpdateSuccess = objUserRegistrationBLL.UpdatePrivileges(strParentSiteURL, listEntry, listName, actionPerformed); break; } case TEAMREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); blnUpdateSuccess = objTeamStaffRegistrationBLL.UpdateTeamListEntry(strParentSiteURL, listEntry, listName, actionPerformed); break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objTeamStaffRegistrationBLL.UpdateStaffsInTeam(strParentSiteURL, listEntry, listName); blnUpdateSuccess = true; break; } case STAFFRANK: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); blnUpdateSuccess = objTeamStaffRegistrationBLL.UpdateStaffsRank(strParentSiteURL, listEntry, listName); break; } } return blnUpdateSuccess; }
/// <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(); } }
protected void Page_Load(object sender, EventArgs e) { strMode = HttpContext.Current.Request.QueryString[MODEQUERYSTRING]; strSelectedID = HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING]; string strCAMLQuery = string.Empty; string strViewFields = string.Empty; try { if(!IsPostBack) { objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); strViewFields = "<FieldRef Name='Title'/>"; objStaffData = objTeamStaffRegistrationBLL.GetSelectedStaffDetails(strParentSiteURL, strSelectedID, TEAMSTAFFLIST); if(objStaffData != null) { SetListValues(cboEditPrivileges, SYSTEMPRIVILEGESLIST, strCAMLQuery, strViewFields); //cboEditPrivileges.Items.FindByValue(objStaffData.RowID).Selected = true; if(!string.IsNullOrEmpty(objStaffData.PRIVILEGE)) cboEditPrivileges.Items.FindByText(objStaffData.PRIVILEGE).Selected = true; } } } catch(WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch(Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }