Beispiel #1
0
        private void View()
        {
            dataGridView1.Rows.Clear();

            try{
                SampleGenericDelegate <int, Document[]> del = new SampleGenericDelegate <int, Document[]>(serverClient.GetAllDocumentPerson);

                IAsyncResult result = del.BeginInvoke(person.Nif, null, null);


                Document[] list = del.EndInvoke(result);

                if (list == null)
                {
                    return;
                }
                documents = new List <Document>(list);
                documents.ForEach(AddDocument);
            }

            catch (Exception exception)
            {
                var info = new InfoForm();
                info.Add(exception.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }
Beispiel #2
0
        public void AddDocument(Document d)
        {
            if (d == null)
            {
                return;
            }
            try
            {
                SampleGenericDelegate2 <DocumentType[]> del = new SampleGenericDelegate2 <DocumentType[]>(serverClient.GetAllDocumentType);

                IAsyncResult result = del.BeginInvoke(null, null);


                DocumentType[] list = del.EndInvoke(result);


                d.Type.Name = list.First(doc => doc.Id == d.Type.Id).Name;
            }
            catch (Exception e)
            {
                var info = new InfoForm();
                info.Add(e.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
            int row =
                dataGridView1.Rows.Add(new object[]
            {
                d.id, d.code, d.emission_date.ToShortDateString(), d.expiration_date.ToShortDateString(), d.Type.Name,
                d.emission_local
            });
        }
Beispiel #3
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            try
            {
                regist             = new Regist();
                regist.Date        = dateTimePicker1.Value;
                regist.Description = richTextBox1.Text;
                regist.Code        = textBox3.Text;

                SampleGenericDelegate <Regist, int> del = new SampleGenericDelegate <Regist, int>(serverClient.InsertRegist);

                IAsyncResult result = del.BeginInvoke(regist, null, null);

                regist.Id = del.EndInvoke(result);

                SarcIntelService.PersonView.PersonEditor person = new SarcIntelService.PersonView.PersonEditor(serverClient, regist);
                person.ShowDialog(this);

                person.Close();
            }
            catch (Exception exc)
            {
                var info = new InfoForm();
                info.Add(exc.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }
Beispiel #4
0
        public PersonView(ServerServiceClient serverClient,Person p)
        {
            InitializeComponent();

            person = p;
            nameBoxText.Text = p.Name;
            birthBoxText.Text = p.Birthday.ToShortDateString();
            moradaBoxText.Text = p.Address;
            textBox3.Text = p.Nif.ToString();
            TimeSpan x = DateTime.Now - p.Birthday;
            idadeBoxText.Text = (x.Days/365).ToString();

            nacioBoxText.Text = p.Birthplace;
            this.serverClient = serverClient;

            try
            {
                SampleGenericDelegate<int, Regist[]> del = new SampleGenericDelegate<int, Regist[]>(serverClient.GetRegists);

                IAsyncResult result = del.BeginInvoke(person.Nif, null, null);

                registos = del.EndInvoke(result);

                if (registos != null)
                    SetRegists();

            }
            catch (Exception e)
            {
                var info = new InfoForm();
                info.Add(e.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }
Beispiel #5
0
        private void search_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();

            try
            {
                string nacionalidade   = this.nacio_text.Text;
                string data_nascimento = this.dateTimePicker1.Text;
                string nome            = this.nome_text.Text;
                // Argumentos 1º name , 2º birthday , 3º nacionalidade
                SearchParams sp = new SearchParams();
                sp.filters = new String[] { nome, data_nascimento, nacionalidade };
                Person[] list = serverClient.GetAllPerson(sp).result;
                if (list == null)
                {
                    return;
                }
                persons = new List <Person>(list);
                persons.ForEach(AddPerson);
            }

            catch (Exception exception)
            {
                var info = new InfoForm();
                info.Add(exception.Message);
                info.ShowDialog(this);
                info.Dispose();
            }

            /*dataGridView1.Rows.Clear();
            *
            *  IEnumerable<Person> list = server.GetAllPerson();
            *  var filter = new PersonFilter(list);
            *
            *
            *  if (!nome_text.Text.Equals(""))
            *  {
            *   filter.Name((nome_text.Text));
            *  }
            *
            *  if (!(dateTimePicker1.Value.Date == DateTime.Now.Date))
            *  {
            *   filter.Data(dateTimePicker1.Value);
            *  }
            *
            *  if (!nacio_text.Text.Equals(""))
            *  {
            *   filter.Nacionalidade((nacio_text.Text));
            *  }
            *  persons = filter.getFilter().ToList();
            *  persons.ForEach(AddPerson);*/
        }
Beispiel #6
0
 private void documentoToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     SetPerson();
     if (!verifyPerson())
     {
         InfoForm info = new InfoForm();
         info.Add("Aviso: Tem que prencher todos os campos pessoa primeiro");
         info.Enabled = false;
         info.Visible = true;
     }
     else {
       DocumentEditor doc = new DocumentEditor(serverClient,this.p);
       doc.Visible = true;
       doc.FormClosed += (o, even) => this.Close();
        }
 }
Beispiel #7
0
        public void saveButton_Click(object sender, EventArgs e)
        {
            var document = new Document();

            document.code            = textBox1.Text;
            document.emission_local  = textBox2.Text;
            document.emission_date   = dateTimePicker2.Value;
            document.expiration_date = dateTimePicker1.Value;

            if (document.emission_date > document.expiration_date)
            {
                InfoForm info = new InfoForm();
                info.Add("Aviso: Data de Emissao é maior do que data de Expiraçao !");
                info.Enabled = false;
                info.Visible = true;
            }

            else
            {
                DocumentType doctype = documents.FirstOrDefault(d => d.Name.Equals(comboBox1.Text));
                if (doctype == null)
                {
                    return;
                }
                document.Type = doctype;
                serverClient.InsertPersonAsync(person);

                document.Person = person;

                try
                {
                    SampleGenericDelegate <Document, int> del = new SampleGenericDelegate <Document, int>(serverClient.InsertDocument);

                    IAsyncResult result = del.BeginInvoke(document, null, null);

                    del.EndInvoke(result);
                    Close();
                }
                catch (Exception exception)
                {
                    var info = new InfoForm();
                    info.Add(exception.Message);
                    info.ShowDialog(this);
                    info.Dispose();
                }
            }
        }
Beispiel #8
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                if (e.RowIndex >= persons.Count)
                {
                    return;
                }

                Person person =
                    persons.FirstOrDefault(p => p.Nif == (int)dataGridView1.Rows[e.RowIndex].Cells[0].Value);

                if (person == null)
                {
                    return;
                }


                var person_view = new PersonView(serverClient, person);

                try
                {
                    /*
                     * serverClient.GetRegistsAsync(person.Id).ContinueWith((r) =>
                     * {
                     *  person_view.SetRegists(r.Result);
                     * });
                     */
                    serverClient.GetBiometricTypeAsync(person.Nif, "face").
                    ContinueWith(b => { person_view.SetImage(b.Result); });
                    person_view.Visible = true;
                    Closing            += (o, args) => person_view.Close();
                }
                catch (Exception exception)
                {
                    if (person_view != null || !person_view.IsDisposed)
                    {
                        person_view.Close();
                    }

                    var info = new InfoForm();
                    info.Add(exception.Message);
                    info.ShowDialog(this);
                    info.Dispose();
                }
            }
        }
Beispiel #9
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            { SetPerson();

              serverClient.InsertPersonAsync(p);
              //   _regist.AddPerson(p);
              SaveButton.Enabled = false;
              Close(); }
            catch (Exception exc)
            {
                var info = new InfoForm();
                info.Add(exc.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }
Beispiel #10
0
 private void documentoToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     SetPerson();
     if (!verifyPerson())
     {
         InfoForm info = new InfoForm();
         info.Add("Aviso: Tem que prencher todos os campos pessoa primeiro");
         info.Enabled = false;
         info.Visible = true;
     }
     else
     {
         DocumentEditor doc = new DocumentEditor(serverClient, this.p);
         doc.Visible     = true;
         doc.FormClosed += (o, even) => this.Close();
     }
 }
Beispiel #11
0
        public PersonView(ServerServiceClient serverClient, Person p)
        {
            InitializeComponent();

            person             = p;
            nameBoxText.Text   = p.Name;
            birthBoxText.Text  = p.Birthday.ToShortDateString();
            moradaBoxText.Text = p.Address;
            textBox3.Text      = p.Nif.ToString();
            TimeSpan x = DateTime.Now - p.Birthday;

            idadeBoxText.Text = (x.Days / 365).ToString();

            nacioBoxText.Text = p.Birthplace;
            this.serverClient = serverClient;

            try
            {
                SampleGenericDelegate <int, Regist[]> del = new SampleGenericDelegate <int, Regist[]>(serverClient.GetRegists);

                IAsyncResult result = del.BeginInvoke(person.Nif, null, null);

                registos = del.EndInvoke(result);

                if (registos != null)
                {
                    SetRegists();
                }
            }
            catch (Exception e)
            {
                var info = new InfoForm();
                info.Add(e.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }
Beispiel #12
0
        public RegistoCriminal(ServerServiceClient serverClient)
        {
            InitializeComponent();
            this.serverClient = serverClient;
            try
            {
                SampleGenericDelegate2 <Regist[]> del = new SampleGenericDelegate2 <Regist[]>(serverClient.GetAllRegists);

                IAsyncResult result = del.BeginInvoke(null, null);

                registos = del.EndInvoke(result);
                if (registos != null)
                {
                    SetRegists();
                }
            }
            catch (Exception e)
            {
                var info = new InfoForm();
                info.Add(e.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }
Beispiel #13
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            try
            {
                regist = new Regist();
                regist.Date = dateTimePicker1.Value;
                regist.Description = richTextBox1.Text;
                regist.Code = textBox3.Text;

                SampleGenericDelegate<Regist,int> del = new SampleGenericDelegate<Regist,int>(serverClient.InsertRegist);

                IAsyncResult result = del.BeginInvoke(regist,null, null);

                regist.Id = del.EndInvoke(result);

                 SarcIntelService.PersonView.PersonEditor person = new SarcIntelService.PersonView.PersonEditor(serverClient,regist);
                 person.ShowDialog(this);

                person.Close();

            }
            catch (Exception exc)
            {
                var info = new InfoForm();
                info.Add(exc.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }
Beispiel #14
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            try
            {    SetPerson();

            serverClient.InsertPersonAsync(p);
             //   _regist.AddPerson(p);
                SaveButton.Enabled = false;
                Close();
            }
            catch (Exception exc)
            {
                var info = new InfoForm();
                info.Add(exc.Message);
                info.ShowDialog(this);
                info.Dispose();
            }
        }