/// <summary> /// updates the status of catalogues fetched out of search criteria - /// (not just the one displayed in the current page of the gridbut all the catalogues fetched) /// </summary> private void UpdateCatalogueStatus(bool overrideInvalidCatnoUpdate, bool overrideParticipUpdate, bool overrideTrackStatus0) { bool isParticipUpdate; bool isTrackStatus0; Array UpdateCatnoList; if (ValidateCatToUpdateStatus(overrideInvalidCatnoUpdate, overrideParticipUpdate, overrideTrackStatus0, out isParticipUpdate, out isTrackStatus0, out UpdateCatnoList)) { if (UpdateCatnoList.Length > 0) { catalogueSearchBL = new CatalogueSearchBL(); //JIRA-1048 --Changes to handle single quote -- Start DataSet searchedData = catalogueSearchBL.UpdateCatalogueDetails(txtCatalogueNo.Text.Replace("'", "").Trim().ToUpper(), txtTitle.Text.Replace("'", "").Trim(), txtArtist.Text.Replace("'", "").Trim(), ddlConfiguration.SelectedValue, txtISRC.Text.Replace("'", "").Trim(), ddlTeamResponsibility.SelectedValue, ddlTeamResponsibilitybyTrack.SelectedValue, ddlManagerResponsibility.SelectedValue, ddlManagerResponsibilitybyTrack.SelectedValue, ddlCatnoStatus.SelectedValue, ddlUpdateStatus.SelectedValue, ddlTrackStatus.SelectedValue, CatNoListForParticips(), UpdateCatnoList, Convert.ToString(Session["UserCode"]), out errorId); //JIRA-1048 --Changes to handle single quote --ENd if (searchedData.Tables.Count != 0 && errorId != 2) { Session["CatSrchCatDetails"] = searchedData.Tables[0]; gvCatalogueDetails.PageIndex = 0; BindGrid(searchedData.Tables[0]); msgView.SetMessage("Bulk status update successful", MessageType.Success, PositionType.Auto); // WUIN-1234 } else { ExceptionHandler("Error in updating catalogue status", string.Empty); } } } else { if (isTrackStatus0) //WUIN-1005 { lblMessage.Text = "There are products in the list where some of the tracks have a status of No participants. Do you want to continue?"; btnYesConfirm.Text = "Yes"; btnNoConfirm.Text = "No"; btnYesConfirm.CommandName = "Tracks"; } else { //If the Participants will be updated, a message will be displayed ‘This will update the Status of all Participants and Tracks to this Catalogue Status. Confirm or Cancel’ if (isParticipUpdate) { lblMessage.Text = "This will update the Status of all Participants and Tracks to this Catalogue Status"; btnYesConfirm.Text = "Confirm"; btnNoConfirm.Text = "Cancel"; } else { lblMessage.Text = "One or more catalogue status cannot be updated. Do you want to continue for the rest?"; btnYesConfirm.Text = "Yes"; btnNoConfirm.Text = "No"; btnYesConfirm.CommandName = "Participants"; } } mpeConfirmation.Show(); } }
private void SearchData() { //Create a table to hold the filter values DataTable dtSearchedFilters = new DataTable(); dtSearchedFilters.Columns.Add("filter_name", typeof(string)); dtSearchedFilters.Columns.Add("filter_value", typeof(string)); //Add the filter values to the above created table dtSearchedFilters.Rows.Add("txtCatalogueNo", txtCatalogueNo.Text); dtSearchedFilters.Rows.Add("txtTitle", txtTitle.Text); dtSearchedFilters.Rows.Add("txtArtist", txtArtist.Text); dtSearchedFilters.Rows.Add("ddlConfiguration", ddlConfiguration.SelectedValue); dtSearchedFilters.Rows.Add("txtISRC", txtISRC.Text); dtSearchedFilters.Rows.Add("ddlTeamResponsibility", ddlTeamResponsibility.SelectedValue); dtSearchedFilters.Rows.Add("ddlTeamResponsibilitybyTrack", ddlTeamResponsibilitybyTrack.SelectedValue); dtSearchedFilters.Rows.Add("ddlManagerResponsibility", ddlManagerResponsibility.SelectedValue); dtSearchedFilters.Rows.Add("ddlManagerResponsibilitybyTrack", ddlManagerResponsibilitybyTrack.SelectedValue); dtSearchedFilters.Rows.Add("ddlCatnoStatus", ddlCatnoStatus.SelectedValue); dtSearchedFilters.Rows.Add("ddlTrackStatus", ddlTrackStatus.SelectedValue); dtSearchedFilters.Rows.Add("txtUploadPrdList", txtUploadPrdList.Text); Session["CSSearchedFilters"] = dtSearchedFilters; catalogueSearchBL = new CatalogueSearchBL(); //JIRA-1048 Changes to handle single quote while searching --Start DataSet searchedData = catalogueSearchBL.GetSearchedCatData(txtCatalogueNo.Text.Replace("'", "").Trim().ToUpper(), txtTitle.Text.Replace("'", "").Trim(), txtArtist.Text.Replace("'", "").Trim(), ddlConfiguration.SelectedValue, txtISRC.Text.Replace("'", "").Trim(), ddlTeamResponsibility.SelectedValue, ddlTeamResponsibilitybyTrack.SelectedValue, ddlManagerResponsibility.SelectedValue, ddlManagerResponsibilitybyTrack.SelectedValue, ddlCatnoStatus.SelectedValue, ddlTrackStatus.SelectedValue, txtUploadPrdList.Text.ToUpper().Trim().Replace("\r\n", string.Empty).Split(';').ToArray(), out errorId); //JIRA-1048 Changes to handle single quote while searching --End catalogueSearchBL = null; if (searchedData.Tables.Count != 0 && errorId != 2) { Session["CatSrchCatDetails"] = searchedData.Tables[0]; gvCatalogueDetails.PageIndex = 0; if (searchedData.Tables[0].Rows.Count == 0) { gvCatalogueDetails.EmptyDataText = "No data found for the selected filter criteria"; } BindGrid(searchedData.Tables[0]); if (searchedData.Tables[0].Rows.Count == 1 && hdnIsNewRequest.Value == "Y") { Response.Redirect("../Participants/CatalogueMaintenance.aspx?catNo=" + searchedData.Tables[0].Rows[0]["catno"].ToString() + "", false); } //WUIN-710 - reset bulk update flag hdnOverrideInvalidCatnoUpdate.Value = "N"; hdnOverrideParticipUpdate.Value = "N"; } else { ExceptionHandler("Error in fetching data", string.Empty); } }
/// <summary> ///1.No update allowed if (legacy = 'Y' and no active Participants (PARTICIPATION_TYPE = 'A' and end_date null)) OR (legacy = 'N' and no active Track Participants(ISRC participants)) ///2. When updating the CATNO.STATUS_CODE, /// 1.The check for updating only one level at a time will be removed (eg will be able to update from Under Review to Manager Sign Off) // 2.Participant Status will be updated to the Product Status if the existing Participant Status is < new Product Status /// 3.Participant Status will not be updated to the Product Status if the existing Participant Status is > new Product Status /// 4.Only update Participant Status if no end date // 5.If not legacy, Track Status will be updated to the Product Status if the existing Track Status is < new Product Status /// 6.If not legacy, Track Status will not be updated to the Product Status if the existing Track Status is > new Product Status ///3.If Status is moved from Manager Sign Off (3) then /// display warning 'This update will prevent the generation of Statement details for all Participants' ///4.If the Participants will be updated, a message will be displayed ‘This will update the Status of all Participants and Tracks to this Catalogue Status. Confirm or Cancel’ ///5. (WUIN-909) Cannot update status to 'No Participants' if there are active participants /// if legacy = 'Y' and active Participants (PARTICIPATION_TYPE = 'A' and end_date null) /// if legacy = 'N' and active Track Participants(ISRC participants) ///6. WUIN-1005 - if any tracks with status 'No Participants' found for the catno's for which status is being updated, display confirm box. /// </summary> private bool ValidateCatToUpdateStatus(bool overrideInvalidCatnoUpdate, bool overrideParticipUpdate, bool overrideTrackStatus0, out bool isParticipUpdate, out bool isTrackStatus0, out Array UpdateCatnoList) { List <string> UpdateCatnos = new List <string>(); UpdateCatnoList = UpdateCatnos.ToArray(); string catno; string legacy; bool isValid; isParticipUpdate = false; isTrackStatus0 = false; DataTable dtCatDetails = Session["CatSrchCatDetails"] as DataTable; if (ddlUpdateStatus.SelectedIndex == 0) { msgView.SetMessage("Please select valid catalogue status", MessageType.Success, PositionType.Auto); return(false); } if (dtCatDetails == null || dtCatDetails.Rows.Count == 0) { msgView.SetMessage("No catalogues to update the status", MessageType.Success, PositionType.Auto); return(false); } //get list of participants and Track participants (ISRC participants) and tracks of the catnos DataTable dtParticips; DataTable dtTrackParticips; DataTable dtTracks; catalogueSearchBL = new CatalogueSearchBL(); DataSet dsCatnoParticipants = catalogueSearchBL.GetCatnoParticipants(CatNoListForParticips(), out errorId); catalogueSearchBL = null; if (errorId == 2 || dsCatnoParticipants.Tables.Count == 0) { ExceptionHandler("Error in fetching participation details of the selected catalogues", string.Empty); return(false); } dtParticips = dsCatnoParticipants.Tables[0]; dtTrackParticips = dsCatnoParticipants.Tables[1]; dtTracks = dsCatnoParticipants.Tables[2]; //WUIN-1005 // WUIN-1005 - No update allowed if status Participants and Tracks is No Participants. if (!overrideTrackStatus0) { foreach (DataRow drCat in dtCatDetails.Rows) { isTrackStatus0 = false; catno = drCat["catno"].ToString(); legacy = drCat["legacy"].ToString(); if (legacy == "N" && (dtTracks.Select("catno = '" + catno + "' AND status_code = 0").Count() > 0)) { isTrackStatus0 = true; if (!overrideTrackStatus0) { return(false); } } } } foreach (DataRow drCat in dtCatDetails.Rows) { isValid = true; isParticipUpdate = false; isTrackStatus0 = false; catno = drCat["catno"].ToString(); legacy = drCat["legacy"].ToString(); //1.No update allowed if (legacy = 'Y' and no active Participants (PARTICIPATION_TYPE = 'A' and end_date null)) OR (legacy = 'N' and no active Track Participants(ISRC participants)) if ((legacy == "Y" && (dtParticips.Select("catno = '" + catno + "' AND participation_type = 'A' AND end_date IS NULL").Count() == 0)) || (legacy == "N" && (dtTrackParticips.Select("catno = '" + catno + "' AND active = 'Y'").Count() == 0))) { isValid = false; if (!overrideInvalidCatnoUpdate) { return(false); } } //5.Cannot update status to 'No Participants' if there are active participants if (ddlUpdateStatus.SelectedValue == "0" && ((legacy == "Y" && (dtParticips.Select("catno = '" + catno + "' AND participation_type = 'A' AND end_date IS NULL").Count() > 0)) || (legacy == "N" && (dtTrackParticips.Select("catno = '" + catno + "' AND active = 'Y'").Count() > 0)))) { isValid = false; if (!overrideInvalidCatnoUpdate) { return(false); } } //4.If the Participants(either participation participants or if not legacy and isrc participants) will be updated, //a message will be displayed ‘This will update the Status of all Participants and Tracks to this Catalogue Status. Confirm or Cancel’ if ((dtParticips.Select("catno = '" + catno + "' AND status_code < " + ddlUpdateStatus.SelectedValue + " AND end_date IS NULL").Count() > 0) || (legacy == "N" && (dtTrackParticips.Select("catno = '" + catno + "' AND status_code < " + ddlUpdateStatus.SelectedValue).Count() > 0)) ) { isParticipUpdate = true; if (!overrideParticipUpdate) { return(false); } } if (isValid) { UpdateCatnos.Add(catno + Global.DBDelimiter + legacy); } } UpdateCatnoList = UpdateCatnos.ToArray(); //4.If Status is moved from Manager Sign Off (3) then // display warning 'This update will prevent the generation of Statement details for all Participants' // (if selected status is not Manager sign off, display warning if any catalogue is Manager signed off) if ((ddlUpdateStatus.SelectedValue != "3" && ddlUpdateStatus.SelectedValue != "0") && (dtCatDetails.Select("status_code = 3").Count() > 0)) { msgView.SetMessage("This update will prevent the generation of Statement details for all Participants of catalogues that are Manager signed off!", MessageType.Success, PositionType.Auto); } return(true); }
private void LoadData() { dtEmpty = new DataTable(); catalogueSearchBL = new CatalogueSearchBL(); DataSet initialData = catalogueSearchBL.GetInitialData(out errorId); gvCatalogueDetails.EmptyDataText = "<br />"; gvCatalogueDetails.DataSource = dtEmpty; gvCatalogueDetails.DataBind(); ddlConfiguration.DataTextField = "config_name"; ddlConfiguration.DataValueField = "config_code"; ddlConfiguration.DataSource = initialData.Tables[0]; ddlConfiguration.DataBind(); ddlConfiguration.Items.Insert(0, new ListItem("-", null)); ddlTeamResponsibility.DataTextField = "responsibility_desc"; ddlTeamResponsibility.DataValueField = "responsibility_code"; ddlTeamResponsibility.DataSource = initialData.Tables[1]; ddlTeamResponsibility.DataBind(); ddlTeamResponsibility.Items.Insert(0, new ListItem("-", null)); ddlTeamResponsibilitybyTrack.DataTextField = "responsibility_desc"; ddlTeamResponsibilitybyTrack.DataValueField = "responsibility_code"; ddlTeamResponsibilitybyTrack.DataSource = initialData.Tables[1]; ddlTeamResponsibilitybyTrack.DataBind(); ddlTeamResponsibilitybyTrack.Items.Insert(0, new ListItem("-", null)); ddlManagerResponsibility.DataTextField = "responsibility_desc"; ddlManagerResponsibility.DataValueField = "responsibility_code"; ddlManagerResponsibility.DataSource = initialData.Tables[1]; ddlManagerResponsibility.DataBind(); ddlManagerResponsibility.Items.Insert(0, new ListItem("-", null)); ddlManagerResponsibilitybyTrack.DataTextField = "responsibility_desc"; ddlManagerResponsibilitybyTrack.DataValueField = "responsibility_code"; ddlManagerResponsibilitybyTrack.DataSource = initialData.Tables[1]; ddlManagerResponsibilitybyTrack.DataBind(); ddlManagerResponsibilitybyTrack.Items.Insert(0, new ListItem("-", null)); ddlCatnoStatus.DataTextField = "item_text"; ddlCatnoStatus.DataValueField = "item_value"; ddlCatnoStatus.DataSource = initialData.Tables[2]; ddlCatnoStatus.DataBind(); ddlCatnoStatus.Items.Insert(0, new ListItem("-", null)); ddlTrackStatus.DataTextField = "item_text"; ddlTrackStatus.DataValueField = "item_value"; ddlTrackStatus.DataSource = initialData.Tables[3]; ddlTrackStatus.DataBind(); ddlTrackStatus.Items.Insert(0, new ListItem("-", null)); ddlUpdateStatus.DataTextField = "item_text"; ddlUpdateStatus.DataValueField = "item_value"; ddlUpdateStatus.DataSource = initialData.Tables[2]; ddlUpdateStatus.DataBind(); ddlUpdateStatus.Items.Insert(0, new ListItem("-")); if (Request.QueryString != null && Request.QueryString.Count > 0) { hdnIsNewRequest.Value = Request.QueryString[0]; if (hdnIsNewRequest.Value == "N") { if (Session["CSSearchedFilters"] != null) { DataTable dtSearchedFilters = Session["CSSearchedFilters"] as DataTable; foreach (DataRow dRow in dtSearchedFilters.Rows) { if (dRow["filter_name"].ToString() == "txtCatalogueNo") { txtCatalogueNo.Text = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "txtTitle") { txtTitle.Text = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "txtArtist") { txtArtist.Text = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "ddlConfiguration") { ddlConfiguration.SelectedValue = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "txtISRC") { txtISRC.Text = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "ddlTeamResponsibility") { ddlTeamResponsibility.SelectedValue = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "ddlTeamResponsibilitybyTrack") { ddlTeamResponsibilitybyTrack.SelectedValue = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "ddlManagerResponsibility") { ddlManagerResponsibility.SelectedValue = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "ddlManagerResponsibilitybyTrack") { ddlManagerResponsibilitybyTrack.SelectedValue = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "ddlCatnoStatus") { ddlCatnoStatus.SelectedValue = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "ddlTrackStatus") { ddlTrackStatus.SelectedValue = dRow["filter_value"].ToString(); } else if (dRow["filter_name"].ToString() == "txtUploadPrdList") { txtUploadPrdList.Text = dRow["filter_value"].ToString(); } } SearchData(); } } } else { Session["CSSearchedFilters"] = null; } }