/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="item">Item to be shown</param>
        /// <param name="parentMainItem">Parent main item of analysis item or null for MainItem</param>
        public AnalysisItemDetailForm(
            ImportItemBase item,
            MainItem parentMainItem)
        {
            InitializeComponent();

            this.detailedItem = item;
            this.parentMainItem = parentMainItem;

            this.txt_ParentMainItem.Text =
                string.Format(
                    "{0} ({1} {2})",
                    parentMainItem.Name,
                    parentMainItem.Quantity,
                    parentMainItem.MeasureUnit
                );

            if (this.detailedItem is WorkItem)
            {
                this.lbl_WorkDescription.Visibility = System.Windows.Visibility.Visible;
                this.txt_WorkDescription.Visibility = System.Windows.Visibility.Visible;
            }

            this.Title = string.Format("{0} - {1}", this.Title, this.detailedItem.Name);

            this.loaded = false;
            this.recalculateParentUnitPrice = false;
        }
Esempio n. 2
0
 /// <summary>
 /// Add item to ItemAnalysis list
 /// </summary>
 /// <param name="item">Item to add</param>
 public void AddAnalysisItem(ImportItemBase item)
 {
     this.ItemAnalysisList.Add(item);
 }
Esempio n. 3
0
        /// <summary>
        /// Removes given item from ItemAnalysis list
        /// </summary>
        /// <param name="item">Item to remove</param>
        /// <returns>Returns true if item was removed, false if not</returns>
        public bool RemoveItem(ImportItemBase item)
        {
            if (this.ItemAnalysisList == null
                || !this.ItemAnalysisList.Contains(item))
                return false;

            this.ItemAnalysisList.Remove(item);
            return true;
        }
        /// <summary>
        /// Gets proper type text based on item type
        /// </summary>
        /// <param name="item">Item to get type</param>
        /// <returns>Returns string value of item type</returns>
        private string GetItemTypeText(ImportItemBase item)
        {
            if (item is MaterialItem)
                return Properties.Resources.TYPE_MATERIAL;

            if (item is MachineItem)
                return Properties.Resources.TYPE_MACHINE;

            if (item is DeliveryItem)
                return Properties.Resources.TYPE_DELIVERY;

            if (item is WorkItem)
                return Properties.Resources.TYPE_WORK;

            return string.Empty;
        }