コード例 #1
0
        private void FrmGetProfesorMaterias_Load(object sender, EventArgs e)
        {
            try
            {
                TxtNombreProfe.Text = NombreProfe;

                ProfesorMaterias prMat = new ProfesorMaterias();
                prMat.Profesor.CodigoProfesor = CodProfesor;
                DataTable dt1 = new DataTable();

                dt1 = CtrlProfesorMaterias.GetMateNoAsigNadas(prMat).Tables[0];

                LueMateria.Properties.DataSource    = dt1;
                LueMateria.Properties.DisplayMember = "Nombre";
                LueMateria.Properties.ValueMember   = "CodMateria";

                DevExpress.XtraEditors.Controls.LookUpColumnInfo col;
                col = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Nombre", "Nombre", 100);
                LueMateria.Properties.Columns.Add(col);
                LueMateria.ItemIndex = -1;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                return;
            }
        }
コード例 #2
0
        public void EliminarMaterias()
        {
            ProfesorMaterias prM = new ProfesorMaterias();

            prM.Profesor.CodigoProfesor = codProfesor;

            CtrlProfesorMaterias.EliminarTodas(prM);
        }
コード例 #3
0
        public void InsertarMaterias()
        {
            for (int i = 0; i < DgvMaterias.RowCount; i++)
            {
                string codMateria = DgvMaterias.GetRowCellValue(i, DgvMaterias.Columns["CodMateria"]).ToString();

                ProfesorMaterias prM = new ProfesorMaterias();
                prM.Materia.CodMateria      = codMateria;
                prM.Profesor.CodigoProfesor = codProfesor;

                CtrlProfesorMaterias.Insertar(prM);
            }
        }
コード例 #4
0
        public void Añadir()
        {
            FrmGetProfesorMaterias prMat = new FrmGetProfesorMaterias();

            prMat.CodMateria  = DgvMaterias.GetFocusedRowCellDisplayText(DgvMaterias.Columns["CodigoProfesor"]);
            prMat.NombreProfe = TxtNombre.Text;
            prMat.CodProfesor = codProfesor;
            prMat.ShowDialog();

            if (prMat.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (ValidarAddMat(prMat.CodMateria))
                {
                    ProfesorMaterias prMa = new ProfesorMaterias();
                    prMa.Profesor.CodigoProfesor = prMat.CodProfesor;
                    prMa.Materia.CodMateria      = prMat.CodMateria;

                    DataRow dr = CtrlProfesorMaterias.GetProfesorMateriasRow(prMa).Tables[0].Rows[0];
                    dtConsulta.Rows.Add(dr.ItemArray);
                    DgvMaterias.RefreshData();
                }
            }
        }
コード例 #5
0
        private void LlenarDsConsulta(string codProfesor)
        {
            try
            {
                ProfesorMaterias profMat = new ProfesorMaterias();
                profMat.Profesor.CodigoProfesor = codProfesor;

                DataSet ds = CtrlProfesorMaterias.GetProfesorMaterias(profMat);

                dtConsulta = new DataTable();
                dsConsulta = new DataSet();

                dtConsulta = ds.Tables[0].Copy();
                dsConsulta.Tables.Clear();
                if (dsConsulta.Tables.Count == 0)
                {
                    dsConsulta.Tables.Add(dtConsulta);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
コード例 #6
0
        private void LueMateria_EditValueChanged(object sender, EventArgs e)
        {
            if (LueMateria.EditValue != null)
            {
                LueProfesor.Enabled = true;
                codMateria          = LueMateria.EditValue.ToString();

                Materia mat = new Materia();
                mat.CodMateria = codMateria;
                DataSet ds = CtrlMaterias.GetMateriaOneCod(mat);
                TxtNombreArea.Text = ds.Tables[0].Rows[0]["NombreArea"].ToString();
                codArea            = ds.Tables[0].Rows[0]["CodArea"].ToString();

                try
                {
                    ProfesorMaterias prMat = new ProfesorMaterias();
                    prMat.Materia.CodMateria = codMateria;

                    DataTable dt2 = CtrlProfesorMaterias.GetProfesorMat(prMat).Tables[0];
                    LueProfesor.Properties.DataSource    = dt2;
                    LueProfesor.Properties.DisplayMember = "Nombre";
                    LueProfesor.Properties.ValueMember   = "CodigoProfesor";

                    DevExpress.XtraEditors.Controls.LookUpColumnInfo col1;
                    col1 = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Nombre", "Nombre", 100);
                    LueProfesor.Properties.Columns.Clear();
                    LueProfesor.Properties.Columns.Add(col1);
                    LueProfesor.ItemIndex = -1;
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                    return;
                }
            }
        }