コード例 #1
0
        public void AddParent(Parent Parient, string NameParent, string NameDocument)
        {
            int cantRows = this.dgvParents.Rows.Count;
            bool continua = true;

            if (cantRows > 0)
            {
                for (int i = 0; i < cantRows; i++)
                {
                    string dgTexto = dgvParents.Rows[i].Cells[0].Value.ToString();

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

                    }

                }
            }

            if (!continua) return;

            this.dgvParents.Rows.Add();

            dgvParents.Rows[cantRows].Cells[0].Value = NameParent;
            dgvParents.Rows[cantRows].Cells[1].Value = Parient.Names + " " + Parient.LastName;
            dgvParents.Rows[cantRows].Cells[2].Value = NameDocument;
            alum.DataParent = Parient;
        }
コード例 #2
0
ファイル: frmParents.cs プロジェクト: AlejoVM/LawraDesktop
        public void SendObjectToDatagrid()
        {
            Parent ObjParent = new Parent();

            Layouts.regAlumno.IFrmAlumno IUAlumno = this.Owner as IFrmAlumno;

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

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

            }
        }