Exemple #1
0
        public ShelterDetail()
        {
            InitializeComponent();

            // 1. Get single shelter based on ShelterId
            var shelter = ShelterRepository.GetShelter();

            if (shelter == null)
            {
                return;
            }

            // 2. Set label's text from obtained details of Shelter
            _lblShelterName.Text  = shelter.ShelterName;
            _lblShelterCount.Text = ShelterRepository.PossibleShelterStock(shelter.ShelterId).ToString(CultureInfo.InvariantCulture);
            _lblShelterDesc.Text  = string.Format("List of items that make '{0}' -", shelter.ShelterName);

            // 3. Get shelter's items
            var shelterItems = ShelterRepository.GetShelterItemsForReport(shelter.ShelterId);

            // 4. Set datasource of report
            DataSource = shelterItems;

            // 5. Bind to cells in table
            _xrCvSlNo.DataBindings.AddRange(new[] { new XRBinding("Text", null, "ShelterDescKey") });
            _xrCvItemName.DataBindings.AddRange(new[] { new XRBinding("Text", null, "ItemName") });
            _xrCvSize.DataBindings.AddRange(new[] { new XRBinding("Text", null, "Size") });
            _xrCvMarking.DataBindings.AddRange(new[] { new XRBinding("Text", null, "Marking") });
            _xrCvQtyPerShelter.DataBindings.AddRange(new[] { new XRBinding("Text", null, "ItemQuantity") });
            _xrCvInStock.DataBindings.AddRange(new[] { new XRBinding("Text", null, "InStock") });
            _xrCvLastUpdated.DataBindings.AddRange(new[] { new XRBinding("Text", null, "UpdatedOn", "{0:dd-MM-yyyy}") });
            _xrCvVendor.DataBindings.AddRange(new[] { new XRBinding("Text", null, "Vendor") });
        }