예제 #1
0
        private void FindParents()
        {
            CheckForIllegalCrossThreadCalls = false;

            this._apoderados = this._parent.Find( this._codigoAlumno, this._codigo );

            if ( this._apoderados != null )
            {
                this.lblNames.Text = this._apoderados.Names;
                this.lblLastNames.Text = this._apoderados.LastNames;
                this.lblGenero.Text = ( this._apoderados.Gender ) ? "Femenino" : "Masculino";
                this.lblBirthday.Text = this._apoderados.Birthday;
                this.lblAge.Text = Convert.ToInt32( ( ( ( DateTime.Now - Convert.ToDateTime( this._apoderados.Birthday ) ).TotalDays ) / 365 ) ).ToString();

                Object[] Parent = this._data.Tables["TipoApoderado"].Select( "Codigo=" + this._apoderados.CodigoTipoApoderado )[0].ItemArray;
                this.lblParent.Text = ( string ) Parent[1];

                Object[] Doc = this._data.Tables["TipoDocumento"].Select( "Codigo=" + this._apoderados.CodigoTipoDocumento )[0].ItemArray;
                this.lblType_Document.Text = ( string ) Doc[1];

                this.lblNumber_Document.Text = this._apoderados.DocumentNumber;
                this.lblAddress.Text = this._apoderados.Address;

                this.lblPhone.Text = ( string.IsNullOrEmpty(this._apoderados.Phone) ) ? " no registrado" : this._apoderados.Phone;
                this.lblEmail.Text = ( string.IsNullOrEmpty(this._apoderados.Email) ) ? " no registrado" : this._apoderados.Email;

                this.pgParent.Visible = false;
                this.panelmain.Enabled = true;
            }

            this._hilo.Abort();
        }
예제 #2
0
        public void SendObjectToDatagrid()
        {
            tApoderado ObjParent = new tApoderado();

            IFrmAlumno IUAlumno = this.Owner as IFrmAlumno;

            if ( IUAlumno != null )
            {
                ObjParent.Names = txtNames.Text;
                ObjParent.LastNames = TxtLasName.Text;
                ObjParent.Gender = ( cboSexo.SelectedIndex == 0 ) ? false : true;
                ObjParent.Birthday = dtpBirthday.Value.ToString( "yyyy-MM-dd" );
                ObjParent.CodigoTipoDocumento = Convert.ToInt32( cboTypeDocument.SelectedValue );
                ObjParent.DocumentNumber = txtDocumentNumber.Text;
                ObjParent.CodigoTipoApoderado = Convert.ToInt32( cboparentesco.SelectedValue );
                ObjParent.Phone = txtPhones.Text;
                ObjParent.Email = txtEmail.Text;
                ObjParent.Address = txtAddress.Text;

                IUAlumno.AddParent( ObjParent, cboparentesco.Text, this.txtDocumentNumber.Text );

            }
        }
예제 #3
0
        private void SubmitInsertOrUpdate()
        {
            CheckForIllegalCrossThreadCalls = false;
            this._inAction = true;

            if ( ! this._gotoModify )
            {
                int codigo = this._parent.Insert( this._codAlumno );

                if ( codigo > 0 )
                {
                    object[] temp = new object[4]
                    {
                        codigo,
                        this._objParent.Names + " " + this._objParent.LastNames,
                        this.cboparentesco.Text,
                        DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                    };

                    this.dgvListado.Rows.Add( temp );

                    this.pgsLoading.Visible = false;
                    MetroMessageBox.Show( this, "El Apoderado a sido registrado correctamente", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Question );

                    this.ResetControls();
                    this.tabControl.SelectedTab = this.tabPageListado;
                }
                else
                {
                    this.pgsLoading.Visible = false;
                    MetroMessageBox.Show( this, "Error al intentar registrar al apoderado", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error );
                    this.tabControl.SelectedTab = this.tabPageRegistro;
                    this.panelRegistros.Enabled = false;
                    this._objParent = new tApoderado();
                }
            }
            else
            {
                if ( this._parent.Update( this._codAlumno, this._codParient ) )
                {
                    this.dgvListado.CurrentRow.Cells[1].Value = this._objParent.Names + " " + this._objParent.LastNames;
                    this.dgvListado.CurrentRow.Cells[2].Value = this.cboparentesco.Text;
                    this.dgvListado.CurrentRow.Cells[3].Value = DateTime.Now.ToString( "yyyy-MM-dd HH:mm:ss" );

                    this.pgsLoading.Visible = false;

                    MetroMessageBox.Show( this, "El Apoderado a sido Modificado correctamente", "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Question );

                    this.ResetControls();
                    this.tabControl.SelectedTab = this.tabPageListado;
                }
                else
                {
                    this.pgsLoading.Visible = false;
                    MetroMessageBox.Show( this, "Error al intentar Modificar al apoderado", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error );
                    this.tabControl.SelectedTab = this.tabPageRegistro;
                    this._objParent = new tApoderado();
                }
            }

            this._inAction = false;
            this._hilo.Abort();
        }
예제 #4
0
        void ResetControls()
        {
            this.txtNames.Clear();
            this.TxtLasName.Clear();
            this.txtDocumentNumber.Clear();
            this.txtEmail.Clear();
            this.txtPhones.Clear();
            this.txtAddress.Clear();

            this.cboparentesco.Text = "Seleccione...";

            this.cboSexo.SelectedIndex = -1;
            this.cboSexo.Text = "Seleccione...";

            this.cboTypeDocument.SelectedIndex = -1;
            this.cboTypeDocument.Text = "Seleccione...";

            this.dtpBirthday.Value = dtpBirthday.MaxDate;

            this._codParient = 0;
            this._gotoModify = false;
            this._objParent = new tApoderado();

            this._isExactLength = false;
            this._isNumeric = false;
            this._lengthAllowed = 0;

            this.panelRegistros.Enabled = false;
            this.panelListado.Enabled = true;
            this.btnSearchStudent.Enabled = true;
            this.pgsLoading.Visible = false;

            if ( dgvListado.Rows.Count == 0 )
            {
                this.btnModificar.Enabled = false;
                this.btnEliminar.Enabled = false;
            }
            else
            {
                this.btnModificar.Enabled = true;
                this.btnEliminar.Enabled = true;
            }

            this.tabControl.SelectedTab = this.tabPageListado;
        }
예제 #5
0
        private void FindParents()
        {
            CheckForIllegalCrossThreadCalls = false;
            this._inAction = true;

            this._objParent = this._parent.Find( this._codAlumno, this._codParient );

            if ( this._objParent != null )
            {
                this.txtNames.Text = this._objParent.Names;
                this.TxtLasName.Text = this._objParent.LastNames;

                this.cboSexo.SelectedIndex = ( this._objParent.Gender ) ? 1 : 0;
                this.cboSexo_SelectionChangeCommitted( this.cboSexo, EventArgs.Empty );

                this.dtpBirthday.Value = Convert.ToDateTime( this._objParent.Birthday );
                this.cboparentesco.SelectedValue = this._objParent.CodigoTipoApoderado;

                this.cboTypeDocument.SelectedValue = this._objParent.CodigoTipoDocumento;
                this.cboTypeDocument_SelectionChangeCommitted( this.cboTypeDocument, null );

                this.txtDocumentNumber.Text = this._objParent.DocumentNumber;
                this.txtPhones.Text = this._objParent.Phone;
                this.txtEmail.Text = this._objParent.Email;
                this.txtAddress.Text = this._objParent.Address;

                this.pgsLoading.Visible = false;
                this.panelRegistros.Enabled = true;
                this.txtNames.Focus();
            }
            else
            {
                this.pgsLoading.Visible = false;
                MetroMessageBox.Show( this, this._parent.MsgExceptionParents, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }

            this._inAction = false;
            this._hilo.Abort();
        }
예제 #6
0
        public void AddParent( tApoderado Parient, string NameParent, string NameDocument )
        {
            bool continua	= true;

            foreach( DataGridViewRow row in this.dgvParents.Rows )
            {
                string nameParentInGrid = row.Cells[0].Value.ToString();

                if ( nameParentInGrid == NameParent )
                {
                    MetroMessageBox.Show( this, "el tipo de Apoderado: " + " " + NameParent, ", ya esta asignado al alumno.", MessageBoxButtons.OK, MessageBoxIcon.Error );
                    continua = false;
                    break;
                }
            }

            if ( ! continua ) return;

            object[] obj = new object[4] { NameParent, ( Parient.Names + " " + Parient.LastNames ), NameDocument, "" };

            this.dgvParents.Rows.Add(obj);

            alum.DataApoderado = Parient;
        }