Ejemplo n.º 1
0
        private void CLB_3_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (CLB_3.SelectedIndex)
            {
            case 0:
            {
                Entity.HS0 = !Entity.HS0;
                CLB_3.SetItemChecked(0, Entity.HS0);
            } break;

            case 1:
            {
                Entity.HS1 = !Entity.HS1;
                CLB_3.SetItemChecked(1, Entity.HS1);
            } break;

            case 2:
            {
                Entity.HS2 = !Entity.HS2;
                CLB_3.SetItemChecked(2, Entity.HS2);
            } break;

            case 3:
            {
                Entity.HS3 = !Entity.HS3;
                CLB_3.SetItemChecked(3, Entity.HS3);
            } break;

            case 4:
            {
                Entity.HS4 = !Entity.HS4;
                CLB_3.SetItemChecked(4, Entity.HS4);
            } break;
            }
        }
        /// <summary>
        /// Asigna los datos de origen para controles que dependen de otros
        /// </summary>
        /// <param name="controlName"></param>
        protected override void SetDependentControlSource(string controlName)
        {
            switch (controlName)
            {
            case "Semana_GB":
            {
                CLB_1.Items[0] = "8:00 - 9:00";
                CLB_1.Items[1] = "9:00 - 10:00";
                CLB_1.Items[2] = "10:00 - 11:00";
                CLB_1.Items[3] = "11:00 - 12:00";
                CLB_1.Items[4] = "12:00 - 13:00";
                CLB_1.Items[5] = "13:00 - 14:00";
                CLB_1.Items[6] = "14:00 - 15:00";
                CLB_1.Items[7] = "15:00 - 16:00";
                CLB_2.Items[0] = "16:00 - 17:00";
                CLB_2.Items[1] = "17:00 - 18:00";
                CLB_2.Items[2] = "18:00 - 19:00";
                CLB_2.Items[3] = "19:00 - 20:00";
                CLB_2.Items[4] = "20:00 - 21:00";
                CLB_2.Items[5] = "21:00 - 22:00";

                CLB_1.SetItemChecked(0, EntityInfo.H8AM);
                CLB_1.SetItemChecked(1, EntityInfo.H0);
                CLB_1.SetItemChecked(2, EntityInfo.H1);
                CLB_1.SetItemChecked(3, EntityInfo.H2);
                CLB_1.SetItemChecked(4, EntityInfo.H3);
                CLB_1.SetItemChecked(5, EntityInfo.H4);
                CLB_1.SetItemChecked(6, EntityInfo.H5);
                CLB_1.SetItemChecked(7, EntityInfo.H6);
                CLB_2.SetItemChecked(0, EntityInfo.H7);
                CLB_2.SetItemChecked(1, EntityInfo.H8);
                CLB_2.SetItemChecked(2, EntityInfo.H9);
                CLB_2.SetItemChecked(3, EntityInfo.H10);
                CLB_2.SetItemChecked(4, EntityInfo.H11);
                CLB_2.SetItemChecked(5, EntityInfo.H12);
            } break;

            case "Sabado_GB":
            {
                CLB_3.Items[0] = "9:00 - 10:00";
                CLB_3.Items[1] = "10:00 - 11:00";
                CLB_3.Items[2] = "11:00 - 12:00";
                CLB_3.Items[3] = "12:00 - 13:00";
                CLB_3.Items[4] = "13:00 - 14:00";

                CLB_3.SetItemChecked(0, EntityInfo.HS0);
                CLB_3.SetItemChecked(1, EntityInfo.HS1);
                CLB_3.SetItemChecked(2, EntityInfo.HS2);
                CLB_3.SetItemChecked(3, EntityInfo.HS3);
                CLB_3.SetItemChecked(4, EntityInfo.HS4);
            } break;
            }
        }
        /// <summary>
        /// Asigna los datos de origen para controles que dependen de otros
        /// </summary>
        /// <param name="controlName"></param>
        protected override void SetDependentControlSource(string controlName)
        {
            switch (controlName)
            {
            case "Plan_CB":
            {
                //moleQule.Library.Timer t = new moleQule.Library.Timer();
                if (Datos_Planes.Current != null && Plan_CB.SelectedItem != null)
                {
                    Datos_Promociones.DataSource = _combo_planes.GetFilteredChilds(((ComboBoxSource)Plan_CB.SelectedItem).Oid);
                    Generar_BT.Enabled           = true;
                }
                // t.Record("Plan_CB");
                //MessageBox.Show(t.GetCronos());
            } break;

            case "Promocion_CB":
            {
                //moleQule.Library.Timer t = new moleQule.Library.Timer();
                if (Datos_Promociones.Current != null)
                {
                    if (Promocion_CB.SelectedItem != null)
                    {
                        _entity.OidPromocion = ((ComboBoxSource)Promocion_CB.SelectedItem).Oid;
                    }
                    Generar_BT.Enabled = true;
                }
                //t.Record("Promocion_CB");
                //MessageBox.Show(t.GetCronos());
            } break;

            case "Semana_GB":
            {
                PromocionInfo promo = null;
                if (Promocion_CB.SelectedItem != null)
                {
                    promo = PromocionInfo.Get(((ComboBoxSource)Promocion_CB.SelectedItem).Oid, true);
                }

                if (promo != null)
                {
                    CLB_1.Items[0] = "08:00 - 9:00";
                    CLB_1.Items[1] = "09:00 - 10:00";
                    CLB_1.Items[2] = "10:00 - 11:00";
                    CLB_1.Items[3] = "11:00 - 12:00";
                    CLB_1.Items[4] = "12:00 - 13:00";
                    CLB_1.Items[5] = "13:00 - 14:00";
                    CLB_1.Items[6] = "14:00 - 15:00";
                    CLB_1.Items[7] = "15:00 - 16:00";
                    CLB_2.Items[0] = "16:00 - 17:00";
                    CLB_2.Items[1] = "17:00 - 18:00";
                    CLB_2.Items[2] = "18:00 - 19:00";
                    CLB_2.Items[3] = "19:00 - 20:00";
                    CLB_2.Items[4] = "20:00 - 21:00";
                    CLB_2.Items[5] = "21:00 - 22:00";

                    CLB_1.SetItemChecked(0, promo.H8AM);
                    CLB_1.SetItemChecked(1, promo.H0);
                    CLB_1.SetItemChecked(2, promo.H1);
                    CLB_1.SetItemChecked(3, promo.H2);
                    CLB_1.SetItemChecked(4, promo.H3);
                    CLB_1.SetItemChecked(5, promo.H4);
                    CLB_1.SetItemChecked(6, promo.H5);
                    CLB_1.SetItemChecked(7, promo.H6);
                    CLB_2.SetItemChecked(0, promo.H7);
                    CLB_2.SetItemChecked(1, promo.H8);
                    CLB_2.SetItemChecked(2, promo.H9);
                    CLB_2.SetItemChecked(3, promo.H10);
                    CLB_2.SetItemChecked(4, promo.H11);
                    CLB_2.SetItemChecked(5, promo.H12);

                    _entity.Configuracion = Sesiones_Promociones.NewChildList();

                    foreach (Sesion_PromocionInfo item in promo.Sesiones)
                    {
                        Sesion_Promocion copia_conf = Sesion_Promocion.NewChild(_entity);
                        copia_conf.HoraInicio = item.HoraInicio;
                        copia_conf.Sabado     = item.Sabado;
                        copia_conf.NHoras     = item.NHoras;
                        copia_conf.Hora       = item.Hora;
                        _entity.Configuracion.AddItem(copia_conf);
                    }

                    Datos_Sesiones.DataSource = _entity.Configuracion;
                }
            } break;

            case "Sabado_GB":
            {
                PromocionInfo promo = null;
                if (Promocion_CB.SelectedItem != null)
                {
                    promo = _promociones.GetItem(((ComboBoxSource)Promocion_CB.SelectedItem).Oid);
                }

                if (promo != null)
                {
                    CLB_3.Items[0] = "09:00 - 10:00";
                    CLB_3.Items[1] = "10:00 - 11:00";
                    CLB_3.Items[2] = "11:00 - 12:00";
                    CLB_3.Items[3] = "12:00 - 13:00";
                    CLB_3.Items[4] = "13:00 - 14:00";

                    CLB_3.SetItemChecked(0, promo.HS0);
                    CLB_3.SetItemChecked(1, promo.HS1);
                    CLB_3.SetItemChecked(2, promo.HS2);
                    CLB_3.SetItemChecked(3, promo.HS3);
                    CLB_3.SetItemChecked(4, promo.HS4);
                }
            } break;
            }
        }