コード例 #1
0
        private void AdminDespacho_Load(object sender, EventArgs e)
        {
            try
            {
                horario_inhabil = new List <clistItems>();
                DataSet ds = new z_bloque_horario().Getz_bloque_horario();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    horario_inhabil.Add(new clistItems((int)dr["id_bloque_horario"], false));
                    listBloques.Items.Add((string)dr["descripcion"] + " (" +
                                          ((DateTime)dr["hora_inicio"]).ToString("T") + " - " +
                                          ((DateTime)dr["hora_termino"]).ToString("T") + ")");
                }

                // tipos de carro
                tc = new z_tipo_carro().Getz_tipo_carro();
                int i = 0;
                foreach (DataRow dr in tc.Tables[0].Rows)
                {
                    var l = new Label {
                        AutoSize = true, Text = ((string)dr["tipo_carro_letra"])
                    };
                    var t = new TextBox {
                        Size = new Size(29, 21), Name = ((string)dr["columna_despacho"])
                    };
                    dbInhabil.Controls.Add(l, i, 0);
                    dbInhabil.Controls.Add(t, i, 1);
                    i++;
                }
                foreach (DataRow dr in tc.Tables[0].Rows)
                {
                    var l = new Label {
                        AutoSize = true, Text = ((string)dr["tipo_carro_letra"])
                    };
                    var t = new TextBox {
                        Size = new Size(29, 21), Name = ((string)dr["columna_despacho"])
                    };
                    dbHabil.Controls.Add(l, i, 0);
                    dbHabil.Controls.Add(t, i, 1);
                    i++;
                }

                // datos
                comboClaves.DisplayMember = "desc";
                comboClaves.ValueMember   = "codigo_llamado";
                comboClaves.DataSource    = new z_llamados().Getz_llamados_principal().Tables[0];

                comboArea.DisplayMember = "id_area";
                comboArea.ValueMember   = "id_area";
                comboArea.DataSource    = new k_areas().Getk_areas().Tables[0];

                listCarro.DisplayMember = "nombre";
                listCarro.ValueMember   = "id_carro";
                listCarro.DataSource    = new z_carros().Getz_carros().Tables[0];
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
コード例 #2
0
        private static bool EnBloqueHorario(string bloques)
        {
            string[] Bloques  = bloques.Split(',');
            var      bh       = new z_bloque_horario();
            int      bloque   = bh.GetBloqueActual();
            bool     enbloque = false;

            foreach (string s in Bloques)
            {
                if (s == bloque.ToString())
                {
                    enbloque = true;
                }
            }
            return(enbloque);
        }