Example #1
0
        /// <summary>
        /// Generates Material, Deliver, Work and Machine overview of selecteed vatiation
        /// </summary>
        /// <param name="variation">Variation to generate overview from</param>
        public void GenerateMaterialOverview(ConstructionVariation variation)
        {
            // Get data source
            Hashtable result = GetMaterialOverview(variation);

            // get columns
            List<ColumnDefinition> definitions = GenerateMaterialOverViewDatagridDefinition();

            // Show overview
            OverviewForm form = new OverviewForm(result, definitions);
            form.Owner = this.owner;
            form.Show();
        }
        /// <summary>
        /// Creates sumary for whole construction harmonogram
        /// </summary>
        /// <param name="variation">Variation with object definition</param>
        /// <param name="construction">Concstruction with data for header and etap Grid</param>
        /// <param name="save">True to save PDF document, false not to.</param>
        public void CreateHarmonogramOverView(
            ConstructionVariation variation,
            Construction construction,
            bool save = true)
        {
            // For every object in variation ...
            foreach (ConstructionObject obj in variation.ObjectList)
            {
                // ... create Etap overview PDF pages
                new EtapsDrawer(this.document).CreateEtapOverView(
                    obj,
                    construction,
                    false);
            }

            // Save document
            string fileName = string.Format("{0}-{1}", construction.Name, Properties.Resources.TITLE_HARMONOGRAM);
            SaveDocument(fileName, true);
        }
        /// <summary>
        /// Creates sumary for whole construction (from seleted variation)
        /// </summary>
        /// <param name="variation">Variation</param>
        /// <param name="name">Concstruction Name</param>
        /// <param name="investor">Construction Investor</param>
        /// <param name="engineer">Construction Project engineer</param>
        /// <param name="save">True to save PDF document, false not to.</param>
        public void CreateConstructionOverView(
            ConstructionVariation variation,
            string name,
            string investor,
            string engineer,
            bool save = true)
        {
            this.variation = variation;
            this.name = name;
            this.investor = investor;
            this.engineer = engineer;

            try
            {
                PdfPage page = NewPage();

                int y = DrawHeader(page, 0, 0, page.Width.Value);

                y = DrawOverview(page, 0, y, page.Width.Value);

                y = DrawTotalPriceLine(page, 0, y, page.Width.Value);

                // Save document
                SaveDocument(name, this.document.PageCount != 1);
            }
            catch (Exception ex)
            {
                Karafa.Errors.KarafaLogger.LogError(ex);

                // Report error only when this document should be shown
                if (save)
                    KarafaMainWindow.Instance.ReportProcess(
                        Properties.Resources.MESSAGE_ERROR_CONSTRUCTION_OVERVIEW_FAILED
                    );
            }
        }
Example #4
0
        /// <summary>
        /// Searches in depth for all imported items to show them in
        /// <see cref="Karafa.GUI.OverviewForm"/>.
        /// </summary>
        /// <param name="variation">Variation to obtain overview of</param>
        /// <returns>OverView</returns>
        public Hashtable GetMaterialOverview(ConstructionVariation variation)
        {
            if (variation == null)
                return null;

            Hashtable overview = new Hashtable();

            // Browse all objects of variation
            foreach (ConstructionObject obj in variation.ObjectList)
            {
                // Browse all cost calculations of object
                foreach (CostsCalculation cost in obj.CalculationList)
                {
                    // Browse all subsections of costcalculation
                    foreach (SubSection subsection in cost.SubSections)
                    {
                        // Browse all imported main items of costcalculation
                        foreach (MainItem mainItem in subsection.MainItemsList)
                        {
                            // Browse all items in analysis of imported item
                            foreach (ImportItemBase item in mainItem.Analysis.ItemAnalysisList)
                            {
                                // Get key by item type
                                string key =
                                    (item is MaterialItem)
                                    ? Properties.Resources.KEY_MATERIAL_ITEMS
                                    : (item is DeliveryItem)
                                        ? Properties.Resources.KEY_DELIVERY_ITEMS
                                        : (item is WorkItem)
                                            ? Properties.Resources.KEY_WORK_ITEMS
                                            : (item is MachineItem)
                                                ? Properties.Resources.KEY_MACHINE_ITEMS
                                                : null;

                                if (!string.IsNullOrEmpty(key))
                                {
                                    // Add new key
                                    if (!overview.ContainsKey(key))
                                        overview.Add(key, new List<ImportItemBase>());

                                    // Add item to proper list
                                    ((List<ImportItemBase>)overview[key]).Add(item);
                                }
                            }
                        }
                    }
                }
            }

            // Return result
            return overview;
        }
 /// <summary>
 /// Empties etap data grid
 /// </summary>
 /// <param name="variation">Selected Variation</param>
 private void OnVariationSelected(ConstructionVariation variation)
 {
     this.dg_Harmonogram.ItemsSource = "";
 }
 /// <summary>
 /// Reaction on selected variation fired from selection user fontrol
 /// </summary>
 /// <param name="variation">Selected variation</param>
 private void OnVariationSelected(ConstructionVariation variation)
 {
     // No calculation selected, no functionality is enabled
     SetImportedItemsControlsEnability(false);
 }
 private void OnVariationSelected(ConstructionVariation variation)
 {
     DisableDataGrids();
 }