コード例 #1
0
        internal bool MoverMulti(ListBox lbI, ListBox lbF)
        {
            ListBox LBI = lbI as ListBox;
            ListBox LBF = lbF as ListBox;

            if (LBI.Items.Count > 0)
            {
                for (int i = 0; i < LBI.Items.Count; i++)
                {
                    string g = ProdTraslado.rer[LBI.GetItemText(LBI.Items[i])].ToString();
                    F2.PropiedadMaestro actual = new F2.PropiedadMaestro();
                    actual = ProdTraslado.profes[int.Parse(g)];
                    string nombre = actual.Nombre;

                    LBF.Items.Add(nombre);
                }

                LBI.Items.Clear();
                LBF.Sorted = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public void Recuperar(F2.PropiedadMaestro n)
        {
            SqlConnection conn = Conexion.Cnn();

            F2.PropiedadMaestro item = n as F2.PropiedadMaestro;

            try
            {
                if (item.Grado != 1 && item.Seccion != 1)
                {
                    item.Tutor = 1;
                }

                string        cadena = "SELECT * FROM Maestros WHERE IdMaestro='" + item.IdMaestro + "'";
                SqlCommand    cmm    = new SqlCommand(cadena, conn);
                SqlDataReader reader;

                reader = cmm.ExecuteReader();
                if (reader.HasRows)
                {
                    profesR.Add(item);
                    return;
                }
                reader.Close();

                item.Estado     = 1;
                cmm             = new SqlCommand("DocenteRetorno", conn);
                cmm.CommandType = CommandType.StoredProcedure;
                cmm.Parameters.AddWithValue("@tutor", item.Tutor);
                cmm.Parameters.AddWithValue("@idMaestro", item.IdMaestro);
                cmm.Parameters.AddWithValue("@Nombre", item.Nombre);
                cmm.Parameters.AddWithValue("@fecha", item.Fecha);
                cmm.Parameters.AddWithValue("@telefono", item.Telefono);
                cmm.Parameters.AddWithValue("@direccion", item.Direccion);
                if (item.Tutor == 0)
                {
                    cmm.Parameters.AddWithValue("@Grado", "");
                    cmm.Parameters.AddWithValue("@seccion", "");
                }
                else
                {
                    cmm.Parameters.AddWithValue("@Grado", item.Grado);
                    cmm.Parameters.AddWithValue("@seccion", item.Seccion);
                }
                cmm.Parameters.AddWithValue("@estado", char.Parse("1"));


                cmm.ExecuteNonQuery();
                conn.Close();
            }
            catch (Exception ex)
            {
                conn.Close();
                MessageBox.Show(ex.Message, "Error retornando maestros", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        public DocenteR(F2.PropiedadMaestro n, NGM ma)
        {
            InitializeComponent();
            maestro  = n as F2.PropiedadMaestro;
            materias = ma as NGM;
            LlenarCampos();
            mtd.LlenarData(DGV_g_m, ma);
            RecuperarProfesores g = new RecuperarProfesores();

            this.Width  = g.Width;
            this.Height = g.Height;
        }
コード例 #4
0
        internal void LlenarData1()
        {
            int c = ProdTraslado.profesR.Count;

            F2.PropiedadMaestro actual;
            if (c > 0)
            {
                for (int i = 0; i < c; i++)
                {
                    actual = new F2.PropiedadMaestro();
                    actual = ProdTraslado.profesR[i];

                    dataGridView1.Rows.Add(actual.IdMaestro, actual.Nombre, "Ya se encuentra en la base de datos");
                }
            }
            else
            {
                textBox1.Visible = true;
            }
        }
コード例 #5
0
        private void BtnRecuper_Click(object sender, EventArgs e)
        {
            string profSelected;


            foreach (string item in listBox2.Items)
            {
                profSelected = ProdTraslado.rer[item].ToString();
                F2.PropiedadMaestro temp = ProdTraslado.profes[int.Parse(profSelected)];
                NGM temp1 = ProdTraslado.pNGM[int.Parse(profSelected)];
                mtd.Recuperar(temp);
                mtd.RecuperarNGM(temp1);
            }

            RPro fh = new RPro();

            this.Visible = false;
            fh.ShowDialog();
            this.Close();
        }
コード例 #6
0
        internal List <F2.PropiedadMaestro> getProf(string año)
        {
            try
            {
                List <F2.PropiedadMaestro> profes = new List <F2.PropiedadMaestro>();
                F2.PropiedadMaestro        p;
                cmm             = new SqlCommand("GetRP", conn);
                cmm.CommandType = CommandType.StoredProcedure;
                cmm.Parameters.AddWithValue("@ano", año);
                conn.Open();
                reader = cmm.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        p           = new F2.PropiedadMaestro();
                        p.IdMaestro = reader["IdMaestro"].ToString().Trim();

                        p.Nombre    = reader["Nombre"].ToString().Trim();
                        p.Fecha     = reader["Fecha"].ToString().Trim();
                        p.Direccion = reader["Direccion"].ToString().Trim();
                        p.Grado     = int.Parse(reader["IdGrado"].ToString().Trim());
                        p.Seccion   = int.Parse(reader["IdSeccion"].ToString().Trim());
                        p.Telefono  = reader["Telefono"].ToString().Trim();

                        profes.Add(p);
                    }
                }



                conn.Close();
                return(profes);
            }
            catch
            {
                conn.Close();
                return(null);
            }
        }
コード例 #7
0
        private void BtnVer_Click(object sender, EventArgs e)
        {
            if (listBox2.Text != "")
            {
                string profSelected;

                profSelected = ProdTraslado.rer[listBox2.Text].ToString();
                F2.PropiedadMaestro temp = ProdTraslado.profes[int.Parse(profSelected)];



                try
                {
                    DocenteR fh = new DocenteR(ProdTraslado.profes[int.Parse(profSelected)], ProdTraslado.pNGM[int.Parse(profSelected)]);
                    fh.ShowDialog();
                }
                catch
                {
                    DocenteR fh = new DocenteR(ProdTraslado.profes[int.Parse(profSelected)], null);
                    fh.ShowDialog();
                }
            }
        }
コード例 #8
0
        internal bool MoverSimple(ListBox lbI, ListBox lbF)
        {
            ListBox LBI = lbI as ListBox;
            ListBox LBF = lbF as ListBox;

            if (LBI.Items.Count > 0)
            {
                List <string> nombres = new List <string>();
                for (int i = 0; i < LBI.Items.Count; i++)
                {
                    if (LBI.GetSelected(i) == true)
                    {
                        string g = ProdTraslado.rer[LBI.GetItemText(LBI.Items[i])].ToString();
                        F2.PropiedadMaestro actual = new F2.PropiedadMaestro();
                        actual = ProdTraslado.profes[int.Parse(g)];
                        string nombre = actual.Nombre;

                        LBI.SetSelected(i, false);
                        LBF.Items.Add(nombre);
                        nombres.Add(nombre);
                    }
                }

                foreach (string item in nombres)
                {
                    LBI.Items.Remove(item);
                }


                LBF.Sorted = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }