Exemple #1
0
        public void AddDocuments( tDocumentoAlumno Odocument, string NameDocument )
        {
            bool continuar = true;

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

                if ( nameDocumentInGrid == NameDocument )
                {
                    MetroMessageBox.Show( this, "el tipo de Documento: " + " " + NameDocument, ", ya esta asignado al alumno", MessageBoxButtons.OK, MessageBoxIcon.Information );
                    continuar = false;
                    break;
                }
            }

            if ( !continuar ) return;

            string strExpire	= ( string.IsNullOrEmpty( Odocument.ExpirationDate ) ) ? "No expira" : Odocument.ExpirationDate;
            bool hasImage		= ( string.IsNullOrEmpty( Odocument.ImageSrc ) ) ? false : true;

            object[] obj = new object[5] { NameDocument, Odocument.DocumentNumber, strExpire, hasImage, "" };

            this.dgvDocuments.Rows.Add( obj );

            alum.DataDocumento = Odocument;
        }
        private void FindDocumentSelected()
        {
            CheckForIllegalCrossThreadCalls = false;

            this._document = this._documentos.Find( this._codigoAlumno, this._codigo );

            if ( this._document != null )
            {

                Object[] doc = this._data.Select( "Codigo=" + this._document.CodigoTipoDocumento )[0].ItemArray;

                this.lblName.Text = ( string ) doc[1];
                this.lblNumber.Text = this._document.DocumentNumber;
                this.lblFecha_Expiration.Text = ( this._document.ExpirationDate == null ) ? "Documento no expira" : this._document.ExpirationDate;

                if ( ! string.IsNullOrEmpty( this._document.ImageSrc ) )
                {
                    this.pboImage.ImageLocation = this._documentos.ConfigBaseUrl + this._document.ImageSrc;
                }

                this.pgsLoading.Visible = false;
            }
            else
            {
                MetroMessageBox.Show( this, "No hay datos Registrados", "Info!", MessageBoxButtons.OK, MessageBoxIcon.Information );
                this.Close();
            }

            this._hilo.Abort();
        }
        private void SendObjectToDatagrid()
        {
            IFrmAlumno IUAlumno		= this.Owner as IFrmAlumno;

            if ( IUAlumno != null )
            {
                tDocumentoAlumno ObjDocument	= new tDocumentoAlumno();

                ObjDocument.CodigoTipoDocumento = Convert.ToInt32( cboTypeDocument.SelectedValue );
                ObjDocument.DocumentNumber = txtNumberDocument.Text;

                if ( this.pbImageDocument.ImageLocation != null && this.pbImageDocument.Image != null )
                {
                    ObjDocument.ImageSrc = this.pbImageDocument.ImageLocation;
                    ObjDocument.ImageKey = Helper.NameImageRandom( 10 );
                }

                ObjDocument.ExpirationDate = ( this.chboExpira.CheckState == CheckState.Checked ) ? null : dtpExpiryDate.Value.ToString( "yyyy-MM-dd" );

                IUAlumno.AddDocuments( ObjDocument, this.cboTypeDocument.Text );
            }
        }
        private void FindDocumentSelected()
        {
            CheckForIllegalCrossThreadCalls = false;

            this._objDocuments = this._documents.Find( this._idAlumno, this._idDocument );

            if ( this._objDocuments != null )
            {
                this.cbotipoDocument.SelectedValue = this._objDocuments.CodigoTipoDocumento;
                this.cboDocumentotipoDocument_SelectionChangeCommitted( this.cbotipoDocument, null );

                this.txtNrodocumento.Text = this._objDocuments.DocumentNumber;

                if ( this._objDocuments.ExpirationDate != null )
                {
                    this.chboExpira.CheckState = CheckState.Unchecked;
                    this.dtFechaExpiracion.Enabled = true;
                    this.dtFechaExpiracion.Text = this._objDocuments.ExpirationDate;
                }

                if ( !string.IsNullOrEmpty( this._objDocuments.ImageSrc ) )
                {
                    this.pbImageDocument.ImageLocation = this._documents.ConfigBaseUrl + this._objDocuments.ImageSrc;
                    this._objDocuments.ImageSrc = string.Empty;
                    this._objDocuments.ImageKey = string.Empty;
                }

                this.gbDatosDocument.Enabled			= true;
                this.pgshowDocumentos.Visible			= false;
                this.btnagregardocumentos.Enabled		= true;
                this.lvDocumentoNumeroDocumento.Visible = false;

                this.PregistroDocumento.Enabled			= true;
                this.btnSearchImage.Enabled				= true;
                this.pbImageDocument.Enabled			= true;
            }
            else
            {
                this._objDocuments = new tDocumentoAlumno();
            }

            this._hilo.Abort();
        }