//JIRA-961 Changes by Ravi -- End #endregion Events #region Methods private void LoadData(string catNo) { catalogueMaintenanceBL = new CatalogueMaintenanceBL(); DataSet initialData = catalogueMaintenanceBL.GetInitialData(catNo, out trackListingCount, out errorId); catalogueMaintenanceBL = null; if (initialData.Tables.Count != 0 && errorId != 2) { ddlMurOwner.DataSource = initialData.Tables[1]; ddlMurOwner.DataTextField = "mur_owner_desc"; ddlMurOwner.DataValueField = "mur_owner_code"; ddlMurOwner.DataBind(); ddlMurOwner.Items.Insert(0, new ListItem("-")); ddlConfiguration.DataSource = initialData.Tables[2]; ddlConfiguration.DataTextField = "config_desc"; ddlConfiguration.DataValueField = "config_group_code"; ddlConfiguration.DataBind(); ddlConfiguration.Items.Insert(0, new ListItem("-")); ddlTimeTrackShare.DataSource = initialData.Tables[3]; ddlTimeTrackShare.DataTextField = "dropdown_desc"; ddlTimeTrackShare.DataValueField = "dropdown_value"; ddlTimeTrackShare.DataBind(); ddlTimeTrackShare.Items.Insert(0, new ListItem("-")); ddlCatStatus.DataSource = initialData.Tables[4]; ddlCatStatus.DataTextField = "item_text"; ddlCatStatus.DataValueField = "item_value"; ddlCatStatus.DataBind(); ddlCatStatus.Items.Insert(0, new ListItem("-")); BindData(initialData.Tables[0], trackListingCount); //for new catalogue, select default value to 'No Participants' if (catNo == string.Empty) { hdnStatusCode.Value = "0"; ddlCatStatus.SelectedValue = "0"; } } else { ExceptionHandler("Error in loading catalogue data", string.Empty); } }
/// <summary> ///1. When updating the CATNO.STATUS_CODE, /// 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.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) // 3.Participant Status will be updated to the Product Status if the existing Participant Status is < new Product Status /// 4.Participant Status will not be updated to the Product Status if the existing Participant Status is > new Product Status /// 5.Only update Participant Status if no end date // 6.If not legacy, Track Status will be updated to the Product Status if the existing Track Status is < new Product Status // 7.If not legacy, Track Status will not be updated to the Product Status if the existing Track Status is > new Product Status ///2.(This is handled on client side)If Status is moved from Manager Sign Off (3) then /// display warning 'This update will prevent the generation of Statement details for all Participants' ///3.If the Participants will be updated, a confirmation message will be displayed /// ‘This will update the Status of all Participants and Tracks to this Catalogue Status. Confirm or Cancel’ ///4. (WUIN-909) Cannot change 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) /// </summary> private bool ValidateCatalogueDetails(bool overrideParticipUpdate, out bool isParticipUpdate) { bool isValid = true; isParticipUpdate = false; Page.Validate("valGrpSave"); if (!Page.IsValid) { msgView.SetMessage("Catalogue details not saved – invalid or missing data!", MessageType.Warning, PositionType.Auto); return(false); } if (hdnIsValidArtist.Value != "Y") { msgView.SetMessage("Please select valid artist from list.", MessageType.Success, PositionType.Auto); return(false); } if (!string.IsNullOrWhiteSpace(txtProject.Text)) { if (hdnIsValidProject.Value != "Y") { msgView.SetMessage("Please select valid project from list.", MessageType.Success, PositionType.Auto); return(false); } } if (!string.IsNullOrWhiteSpace(txtExceptionRateProject.Text)) { if (hdnIsValidExcRateProject.Value != "Y") { msgView.SetMessage("Please select valid exception rate project from list.", MessageType.Success, PositionType.Auto); return(false); } } if (hdnIsNewCatNo.Value == "N" && hdnIsEditable.Value == "Y" && ddlCatStatus.SelectedValue == "0") { msgView.SetMessage("As there are active participants, status cannot be set to 'No Participants'", MessageType.Success, PositionType.Auto); 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 (!overrideParticipUpdate) { catalogueMaintenanceBL = new CatalogueMaintenanceBL(); DataSet dsParticips = catalogueMaintenanceBL.GetCatnoParticipants(hdnCatalogueNo.Value, out errorId); catalogueMaintenanceBL = null; if (errorId == 2 || dsParticips.Tables.Count == 0) { ExceptionHandler("Error in saving catalogue at fetching participant list.", string.Empty); return(false); } DataTable dtParticips = dsParticips.Tables[0]; DataTable dtTrackParticips = dsParticips.Tables[1]; if ((dtParticips.Select("status_code < " + ddlCatStatus.SelectedValue + " AND end_date IS NULL").Count() > 0) || (!cbLegacy.Checked && (dtTrackParticips.Select("status_code < " + ddlCatStatus.SelectedValue).Count() > 0))) { isParticipUpdate = true; if (!overrideParticipUpdate) { return(false); } else { return(true); } } } return(isValid); }
private void SaveChanges(bool overrideParticipUpdate) { if (hdnIsStatusChange.Value == "Y") { bool isParticipUpdate; if (!ValidateCatalogueDetails(overrideParticipUpdate, out isParticipUpdate)) { //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) { lblConfirmMsg.Text = "This will update the Status of all Participants and Tracks to this Catalogue Status"; mpeConfirmation.Show(); } return; } } else { //WUIN-1167 Any changes made to the catalogue which is at manager sign off/team sign off should move back to under review irrespective of the user role if (hdnStatusCode.Value == "3" || hdnStatusCode.Value == "2") { ddlCatStatus.SelectedValue = "1"; } } string userCode = Convert.ToString(Session["UserCode"]); Array catalogueDetails = CatalogueDetails(); if (hdnIsNewCatNo.Value == "Y") { catalogueMaintenanceBL = new CatalogueMaintenanceBL(); DataSet updatedData = catalogueMaintenanceBL.SaveCatalogueDetails(string.Empty, catalogueDetails, userCode, out trackListingCount, out errorId); catalogueMaintenanceBL = null; if (errorId == 1) { msgView.SetMessage("Catalogue deatils exists with entered cataloge number!", MessageType.Warning, PositionType.Auto); } else if (updatedData.Tables.Count != 0 && errorId != 2) { hdnIsNewCatNo.Value = "N"; txtCatalogueNumber.Font.Bold = true; txtCatalogueNumber.ReadOnly = true; txtCatalogueNumber.Attributes.Add("onFocus", "MoveCatNoFocus()"); txtCatalogueNumber.CssClass = "textboxStyle_readonly"; if (updatedData.Tables[0].Rows.Count != 0) { BindData(updatedData.Tables[0], trackListingCount); } else { ExceptionHandler("Error in saving catalogue", string.Empty); return; } msgView.SetMessage("New catalogue created successfully.", MessageType.Warning, PositionType.Auto); } else { ExceptionHandler("Error in saving catalogue", string.Empty); } } else if (hdnIsNewCatNo.Value == "N") { catalogueMaintenanceBL = new CatalogueMaintenanceBL(); DataSet updatedData = catalogueMaintenanceBL.SaveCatalogueDetails(txtCatalogueNumber.Text.Trim().ToUpper(), catalogueDetails, userCode, out trackListingCount, out errorId); catalogueMaintenanceBL = null; if (updatedData.Tables.Count != 0 && errorId != 2) { if (updatedData.Tables[0].Rows.Count != 0) { BindData(updatedData.Tables[0], trackListingCount); hdnIsStatusChange.Value = "N"; } else { ExceptionHandler("Error in saving catalogue", string.Empty); return; } msgView.SetMessage("Catalogue details updated successfully.", MessageType.Warning, PositionType.Auto); } else { ExceptionHandler("Error in saving catalogue", string.Empty); } } }