Example #1
0
        public string BuildTabHeader(int codigoComunidad, EjercicioDLOParaSideTool DLO, TabType tabType)
        {
            string    tabEjercicioHeader = BuildTabEjercicioHeader(DLO);
            TabHeader TabHeaders         = new TabHeader();

            return($"{codigoComunidad} - {tabEjercicioHeader} - {TabHeaders[this.LastTabType]}");
        }
Example #2
0
 public SideToolEjercicioItem(VMSideTool parent, EjercicioDLOParaSideTool DLO)
 {
     this._Ejercicio   = DLO;
     this._ItemHeader  = $"{DLO.FechaComienzo} - {DLO.FechaFinal}";
     this._Name       += this._ItemHeader;
     this._ButtonClick = new Command_EjercicioItemButtonClick(this, parent);
 }
Example #3
0
        private string BuildTabEjercicioHeader(EjercicioDLOParaSideTool DLO)
        {
            DateTime comienzo           = DateTime.ParseExact(DLO.FechaComienzo, "d", null);
            DateTime final              = DateTime.ParseExact(DLO.FechaFinal, "d", null);
            string   tabEjercicioHeader = "";

            //Regla de 3: 12 meses son M para 4(trimestre) meses son X => 12/M = 4/X => X = 4M/12 (si se utiliza el Ășltimo mes no es necesario redondear)
            //para cuatrimestres y semestres es lo mismo cambiando el 4
            if (comienzo.AreAnOfficialTrimester(final))
            {
                tabEjercicioHeader = $"{(4 * final.Month) / 12} Trimestre {final.Year}";
            }
            else if (comienzo.AreAnOfficialFourMonth(final))
            {
                tabEjercicioHeader = $"{(3 * final.Month) / 12} Cuatrimestre {final.Year}";
            }
            else if (comienzo.AreAnOfficialSemester(final))
            {
                tabEjercicioHeader = $"{(2 * final.Month) / 12} Semestre {final.Year}";
            }
            else if (comienzo.Year == final.Year)
            {
                tabEjercicioHeader = comienzo.Year.ToString();
            }
            else
            {
                tabEjercicioHeader = $"{DLO.FechaComienzo} a {DLO.FechaFinal}";
            }
            return(tabEjercicioHeader);
        }
Example #4
0
        public void SetNewTabEjercicio(EjercicioDLOParaSideTool DLO)
        {
            this.LastTabCodigoEjercicio = DLO.Id;
            Messenger.Messenger.RegisterMsg("LastEjerCod", DLO.Id);

            if (!this.TabComunidadClickResuelto)
            {
                this.TabComunidadClickResuelto = true;
                AddTab(DLO);
            }
            else
            {
                var selectedTab = this.Tabs[this.SelectedTab];
                selectedTab.TabCodigoEjercicio = DLO.Id;
                selectedTab.Header             = BuildTabHeader(selectedTab.TabCodigoComunidad, DLO, selectedTab.TabType);
            }
        }
Example #5
0
        public void FillEjercicioItems()
        {
            this.EjercicioItemsSource.Clear();
            SideToolEjercicioItem    min    = null;
            EjercicioDLOParaSideTool minDLO = null;

            foreach (EjercicioDLOParaSideTool DLO in this.EjercicioRepo.DLOs2)
            {
                SideToolEjercicioItem item = new SideToolEjercicioItem(this, DLO);
                if (EjercicioDLOParaSideTool.Min(min.EjercicioDLO, DLO) == DLO)
                {
                    minDLO = DLO;
                    min    = item;
                }
                this.EjercicioItemsSource.Add(item);
            }

            min.IsSelected = true;
            VMMain mainVM = App.Current.MainWindow.DataContext as VMMain;

            mainVM.SetNewTabEjercicio(minDLO);
        }
Example #6
0
        public async Task OnEjercicioItemButtonClickAsync(EjercicioDLOParaSideTool DLO)
        {
            VMMain mainVM = App.Current.MainWindow.DataContext as VMMain;

            mainVM.SetNewTabEjercicio(DLO);
        }
Example #7
0
        /// <summary>
        /// Add new tab of type to abletabcontrol.
        /// </summary>
        /// <param name="type">See enum</param>
        public void AddTab(EjercicioDLOParaSideTool DLO)
        {
            aVMTabBase tab;

            AbleTabControl.AbleTabControl ATC = (App.Current.MainWindow as MainWindow).AbleTabControl;
            TabbedExpander TopTabExp          = ATC.FindVisualChild <TabbedExpander>(x => (x as TabbedExpander).Name == "TopTabbedExpander");
            TabbedExpander BottomTabExp       = ATC.FindVisualChild <TabbedExpander>(x => (x as TabbedExpander).Name == "BottomTabbedExpander");

            ATC.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Loaded, (Action)(() =>
            {
                Grid BTEGrid = ATC.FindVisualChild <Grid>(x => (x as Grid).Name == "TabControlGrid");
                RowDefinition rowDef = BTEGrid.RowDefinitions[3];
                string standardHeader = BuildTabHeader(this.LastTabCodigoComunidad, DLO, this.LastTabType);//  $"{this.LastTabCodigoComunidad} - {this.LastTabEjerHeader} - {TabHeaders[this.LastTabType]}";

                switch (this.LastTabType)
                {
                case TabType.Mayor:
                    tab = new VMTabMayor();
                    tab.Header = standardHeader;
                    TabbedExpanderFiller_Mayor TabExpFillerM = new TabbedExpanderFiller_Mayor(
                        tab as VMTabMayor,
                        ref TopTabExp,
                        ref BottomTabExp,
                        ref rowDef,
                        true);
                    break;

                case TabType.Diario:
                    tab = new VMTabDiario();
                    tab.Header = standardHeader;
                    TabbedExpanderFiller_Diario TabExpFillerD = new TabbedExpanderFiller_Diario(
                        tab as VMTabDiario,
                        ref TopTabExp,
                        ref BottomTabExp,
                        ref rowDef,
                        true);
                    break;

                case TabType.Props:
                    tab = new VMTabProps();
                    tab.Header = standardHeader;
                    break;

                case TabType.Cdad:
                    tab = new VMTabCdad();
                    tab.Header = standardHeader;
                    break;

                default:
                    tab = new VMTabMayor();
                    tab.Header = standardHeader;
                    TabExpFillerM = new TabbedExpanderFiller_Mayor(
                        tab as VMTabMayor,
                        ref TopTabExp,
                        ref BottomTabExp,
                        ref rowDef,
                        true);
                    break;
                }
                this.Tabs.Add(tab);
                NotifyPropChanged("Tabs");
            }));
        }