private void ConfigureDocketTerminology() { Facade.IReferenceData facReferenceData = new Facade.ReferenceData(); string docketNumberText = facReferenceData.GetDocketNumberTextForIdentityId(m_job.IdentityId); if (docketNumberText == String.Empty) { docketNumberText = "Docket Number"; } // Details of added Dockets lblDocketNumber.Text = docketNumberText; if (m_instruction.CollectDrops != null) { if (m_instruction.CollectDrops.Count != 0) { lblAddedDockets.Text = "Added " + docketNumberText + "s"; lblAddedDockets.Visible = true; } else { lblAddedDockets.Visible = false; } } rfvDocket.ErrorMessage = "Please select a " + docketNumberText + "."; rfvDocket.Text = rfvDocket.Text.Replace("Docket Number.", docketNumberText + "."); lblSelectDocket.Text = "Select " + docketNumberText; rfvDockets.InitialValue = "-- Please select a " + docketNumberText + " --"; rfvDockets.ErrorMessage = "Please enter a " + docketNumberText + "."; rfvDockets.Text = rfvDockets.Text.Replace("Docket Number.", docketNumberText + "."); chkAddAnotherDocket.Text = chkAddAnotherDocket.Text.Replace("docket number", docketNumberText.ToLower()); }
private void PopulateDockets() { cboDockets.Items.Clear(); Facade.IReferenceData facReferenceData = new Facade.ReferenceData(); string docketNumberText = facReferenceData.GetDocketNumberTextForIdentityId(m_job.IdentityId); if (docketNumberText != String.Empty) { cboDockets.Items.Add(new ListItem("-- Please select a " + docketNumberText + " --")); } else { cboDockets.Items.Add(new ListItem("-- Please select a Docket Number --")); } if (m_isUpdate) { #region Display the dockets that have not been been assigned to a drop foreach (Entities.Instruction instruction in m_job.Instructions) { if (instruction.InstructionTypeId == (int)eInstructionType.Load) { foreach (Entities.CollectDrop collectDrop in instruction.CollectDrops) { bool collectDropHasBeenDropped = false; foreach (Entities.Instruction dropInstruction in m_job.Instructions) { if (dropInstruction.InstructionTypeId == (int)eInstructionType.Drop) { foreach (Entities.CollectDrop dropCollectDrop in dropInstruction.CollectDrops) { if (dropCollectDrop.Docket == collectDrop.Docket) { collectDropHasBeenDropped = true; } } } } if (m_instruction.InstructionTypeId == (int)eInstructionType.Drop) { foreach (Entities.CollectDrop dropCollectDrop in m_instruction.CollectDrops) { if (dropCollectDrop.Docket == collectDrop.Docket) { collectDropHasBeenDropped = true; } } } if (!collectDropHasBeenDropped) { cboDockets.Items.Add(DocketItem(collectDrop)); } } } } #endregion if (m_isAmendment) { cboDockets.ClearSelection(); cboDockets.Items.Insert(1, DocketItem(m_collectdrop)); cboDockets.Items[1].Selected = true; } } else { #region Display a list of dockets that have not been assigned to a drop // Check both within the m_job.Instructions collection, but also the new collection being built-up. Entities.InstructionCollection insCollection = new Entities.InstructionCollection(); foreach (Entities.Instruction instruction in m_job.Instructions) { insCollection.Add(instruction); } insCollection.Add(m_instruction); foreach (Entities.Instruction instruction in insCollection) { if (instruction.InstructionTypeId == (int)eInstructionType.Load) { foreach (Entities.CollectDrop collectDrop in instruction.CollectDrops) { bool collectDropHasBeenDropped = false; foreach (Entities.Instruction dropInstruction in insCollection) { if (dropInstruction.InstructionTypeId == (int)eInstructionType.Drop) { foreach (Entities.CollectDrop dropCollectDrop in dropInstruction.CollectDrops) { if (collectDrop.Docket == dropCollectDrop.Docket) { collectDropHasBeenDropped = true; } } } } if (!collectDropHasBeenDropped) { cboDockets.Items.Add(DocketItem(collectDrop)); } } } } #endregion if (m_isAmendment) { cboDockets.ClearSelection(); // Add and select the docket cboDockets.Items.Insert(1, DocketItem(m_collectdrop)); cboDockets.Items[1].Selected = true; } } if (m_instruction.InstructionTypeId == (int)eInstructionType.Drop && cboDockets.Items.Count == 2) { chkAddAnotherDocket.Enabled = false; } }