示例#1
0
        private void FormABMClientModify_Load(object sender, EventArgs e)
        {
            this.ControlBox      = false;
            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState     = FormWindowState.Maximized;

            Documentos.fillComboBox(comboBoxDocumentType);
            Nacionalidad.fillComboBox(comboBoxNationality);

            if (edit)
            {
                Cliente clientData = ClienteHelper.getClientData(client);


                this.textBoxName.Text     = clientData.name;
                this.textBoxLastname.Text = clientData.lastname;
                this.comboBoxDocumentType.SelectedIndex = this.comboBoxDocumentType.FindStringExact(clientData.typeDocument);
                this.textBoxDocumentNumber.Text         = clientData.documentNumber.ToString();
                this.textBoxMail.Text                  = clientData.mail;
                this.textBoxTelephone.Text             = clientData.telephone;
                this.textBoxAddress.Text               = clientData.addressName;
                this.textBoxAddressNumber.Text         = clientData.addressNum.ToString();
                this.textBoxAddressFloor.Text          = clientData.addressFloor.ToString();
                this.textBoxAddressDept.Text           = clientData.adressDeptName;
                this.comboBoxNationality.SelectedIndex = this.comboBoxNationality.FindStringExact(clientData.nacionality);
                this.dtBrithdate.Value                 = clientData.birthdate;
            }
        }
示例#2
0
        private void buttonAccept_Click(object sender, EventArgs e)
        {
            Cliente clientData = this.getDataFromForm();

            if (clientData != null)
            {
                Boolean existEqualTypeAndDocumentNumber = ClienteHelper.checkTypeAndDocumentNumber(clientData.id,
                                                                                                   clientData.typeDocument, clientData.documentNumber);
                if (existEqualTypeAndDocumentNumber)
                {
                    DialogResult dialogDocument = MessageBox.Show("Existe ya un usuario con ese tipo y numero de documento. Desea continuar igual?",
                                                                  "Mensaje importante", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogDocument != DialogResult.Yes)
                    {
                        return;
                    }
                }

                Boolean existAnEqualMail = ClienteHelper.checkMail(clientData.id, clientData.mail);
                if (existAnEqualMail)
                {
                    DialogResult dialogMail = MessageBox.Show("Existe ya un usuario con ese mail. Desea continuar igual?",
                                                              "Mensaje importante", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogMail != DialogResult.Yes)
                    {
                        return;
                    }
                }

                this.saveOrUpdateClient(clientData);
            }
        }
示例#3
0
 private void buttonDisable_Click(object sender, EventArgs e)
 {
     if (dgvClient.CurrentRow != null)
     {
         ClienteHelper.enable(Convert.ToInt32(dgvClient.CurrentRow.Cells[0].Value), false);
         buttonSearch.PerformClick();
     }
     else
     {
         MessageBox.Show("Debe seleccionar un cliente a deshabilitar");
     }
 }
示例#4
0
        private void saveOrUpdateClient(Cliente clientData)
        {
            Int32 clientId = ClienteHelper.save(clientData);

            this.client = clientId.ToString();
            if (edit)
            {
                MessageBox.Show("Modificacion de cliente realizada con exito");
            }
            else
            {
                MessageBox.Show("Creacion de cliente realizada con exito");
            }
            this.closeWindow();
        }
示例#5
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            Cliente clientToSearch = this.getDataToSearch();

            ClienteHelper.search(clientToSearch, dgvClient);
        }