예제 #1
0
파일: Negocio.cs 프로젝트: icpac/cap
        public static void HorasSemana(MateriaGrp mtgrp)
        {
            MateriaGrp obj = mtgrp;

            if (obj != null)
            {
                obj.Hrs = 0;
                foreach (Horario hr in obj.Horarios)
                {
                    hr.TtlLns   = HorasPorDia(hr.Lns);
                    hr.TtlMrts  = HorasPorDia(hr.Mrts);
                    hr.TtlMrcls = HorasPorDia(hr.Mrcls);
                    hr.TtlJvs   = HorasPorDia(hr.Jvs);
                    hr.TtlVrns  = HorasPorDia(hr.Vrns);
                    hr.TtlSbd   = HorasPorDia(hr.Sbd);

                    obj.Hrs += Convert.ToInt16(hr.TtlLns + hr.TtlMrts + hr.TtlMrcls + hr.TtlJvs + hr.TtlVrns + hr.TtlSbd);
                }
            }
        }
예제 #2
0
파일: Negocio.cs 프로젝트: icpac/cap
        public static void ObtenTemas(MateriaGrp mtrGrp, IObjectSpace ojSp)
        {
            MateriaGrp        mg        = mtrGrp;
            SortingCollection sortProps = new SortingCollection();
            TemaMtr           padre     = null;


            sortProps.Add(new SortProperty("Nmr", SortingDirection.Ascending));
            mg.Mtr.Temas.Sorting = sortProps;


            foreach (Tema tm in mg.Mtr.Temas)
            {
                TemaMtr tmM = ojSp.CreateObject <TemaMtr>();

                tmM.Nmr          = tm.Nmr;
                tmM.Dscrpcn      = tm.Dscrpcn;
                tmM.Drcn         = tm.Drcn;
                tmM.FchPrgrmd    = tm.FchAplccn;
                tmM.CmptncEspcfc = tm.CmptncEspcfc;
                tmM.CmptncGnrc   = tm.CmptncGnrc;
                tmM.Actvdds      = tm.Actvdds;


                if (tm.TemaPadre != null)
                {
                    tmM.TemaPadre = padre;
                }
                if (tm.Children.Count > 0)
                {
                    padre = tmM;
                }


                mg.Temas.Add(tmM);
            }
        }
예제 #3
0
파일: Negocio.cs 프로젝트: icpac/cap
        public static void FechasAplicacionTemas(MateriaGrp mtGrp)
        {
            MateriaGrp obj = mtGrp;

            if (obj != null && obj.Temas != null && obj.Temas.Count > 0 &&
                obj.Clndr != null && obj.Horarios != null && obj.Horarios.Count > 0)
            {
                SortingCollection sortProps  = new SortingCollection();
                float             hrsDspnbls = 0;
                float             hrsNecesarias;
                float             hrsCls = 0;
                DateTime          diaIni = obj.Clndr.FchIncl;


                sortProps.Add(new SortProperty("Nmr", SortingDirection.Ascending));
                obj.Temas.Sorting = sortProps;


                hrsDspnbls = HrsDisponibles(ref diaIni,
                                            obj.Horarios[0], obj.Clndr.FchFnl, obj.Clndr);
                hrsCls += hrsDspnbls;

                if (hrsDspnbls > 0)
                {
                    foreach (TemaMtr tm in obj.Temas)
                    {
                        hrsNecesarias = tm.Drcn;
                        tm.FchPrgrmd  = diaIni;

                        if (tm.Children == null ||
                            tm.Children.Count == 0)
                        {
                            // Este día es suficiente
                            if (hrsNecesarias == hrsDspnbls)
                            {
                                diaIni     = diaIni.AddDays(1);
                                hrsDspnbls = HrsDisponibles(ref diaIni,
                                                            obj.Horarios[0], obj.Clndr.FchFnl,
                                                            obj.Clndr);
                                hrsCls += hrsDspnbls;
                            }
                            // Necesito otro día
                            else if (hrsNecesarias > hrsDspnbls)
                            {
                                while (hrsNecesarias > hrsDspnbls && hrsDspnbls > 0)
                                {
                                    hrsNecesarias -= hrsDspnbls;

                                    diaIni     = diaIni.AddDays(1);
                                    hrsDspnbls = HrsDisponibles(ref diaIni, obj.Horarios[0], obj.Clndr.FchFnl, obj.Clndr);

                                    hrsCls += hrsDspnbls;
                                }
                                hrsDspnbls -= hrsNecesarias;
                            }
                            // Este día sobran horas
                            else
                            {
                                hrsDspnbls -= hrsNecesarias;
                            }

                            /*
                             * if (hrsDspnbls <= 0)
                             *  break;*/
                            if (hrsDspnbls <= 0)
                            {
                                diaIni     = diaIni.AddDays(1);
                                hrsDspnbls = Negocio.HrsDisponibles(ref diaIni,
                                                                    obj.Horarios[0], obj.Clndr.FchFnl, obj.Clndr);

                                hrsCls += hrsDspnbls;
                                if (diaIni > obj.Clndr.FchFnl)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #4
0
파일: Negocio.cs 프로젝트: icpac/cap
        public static void HorasCalendario(MateriaGrp mtgrp)
        {
            MateriaGrp obj = mtgrp;

            obj.HrsClndr = 0;
            if (obj != null && obj.Clndr != null && obj.Horarios.Count > 0)
            {
                DateTime dia = obj.Clndr.FchIncl;
                Horario  hrr = obj.Horarios[0];
                bool     excp;

                while (dia <= obj.Clndr.FchFnl)
                {
                    excp = false;
                    foreach (CalendarioEvento evnt in obj.Clndr.Eventos)
                    {
                        if (!excp)
                        {
                            excp = dia == evnt.Fch;
                        }
                    }

                    if (!excp)
                    {
                        if (dia.DayOfWeek == DayOfWeek.Monday)
                        {
                            // Por el momento supondré que sólo hay un horario
                            if (hrr.TtlLns > 0)
                            {
                                obj.HrsClndr += hrr.TtlLns;
                            }
                        }
                        else if (dia.DayOfWeek == DayOfWeek.Tuesday)
                        {
                            if (hrr.TtlMrts > 0)
                            {
                                obj.HrsClndr += hrr.TtlMrts;
                            }
                        }
                        else if (dia.DayOfWeek == DayOfWeek.Wednesday)
                        {
                            if (hrr.TtlMrcls > 0)
                            {
                                obj.HrsClndr += hrr.TtlMrcls;
                            }
                        }
                        else if (dia.DayOfWeek == DayOfWeek.Thursday)
                        {
                            if (hrr.TtlJvs > 0)
                            {
                                obj.HrsClndr += hrr.TtlJvs;
                            }
                        }
                        else if (dia.DayOfWeek == DayOfWeek.Friday)
                        {
                            if (hrr.TtlVrns > 0)
                            {
                                obj.HrsClndr += hrr.TtlVrns;
                            }
                        }
                        else if (dia.DayOfWeek == DayOfWeek.Saturday)
                        {
                            if (hrr.TtlSbd > 0)
                            {
                                obj.HrsClndr += hrr.TtlSbd;
                            }
                        }
                    }
                    dia = dia.AddDays(1);
                }
            }
        }