コード例 #1
0
        /// <summary>
        /// Metodo para modificar los clientes de la base de datos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnModificar_Click(object sender, EventArgs e)
        {
            IBLLCliente _BLLCliente = new BLLCliente();

            erpErrores.Clear();
            try
            {
                if (string.IsNullOrEmpty(txtNombreMod.Text))
                {
                    erpErrores.SetError(txtNombre, "Debe contener un valor");
                }
                else
                {
                    if (string.IsNullOrEmpty(txtApellidoMod.Text))
                    {
                        erpErrores.SetError(txtApellido, "Debe contener un valor");
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(mskTelefonoMod.Text))
                        {
                            erpErrores.SetError(mskTelefonoMod, "Debe contener un valor");
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(txtCorreoMod.Text))
                            {
                                erpErrores.SetError(txtCorreoMod, "Debe contener un valor");
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(rctDireccionMod.Text))
                                {
                                    erpErrores.SetError(rctDireccionMod, "Debe contener un valor");
                                }
                                else
                                {
                                    bool activo = false;
                                    activo = (rbActivoSiMod.Checked) ? true : false;
                                    _BLLCliente.ModificarCliente(FactoryCliente.ConstruirCliente(mskNumeroCedulaMod.Text, txtNombreMod.Text, txtApellidoMod.Text, mskTelefonoMod.Text, txtCorreoMod.Text, Convert.ToString(cboProvinciasMod.SelectedItem), rctDireccionMod.Text, activo));
                                    MessageBox.Show("Se modificó con éxito");
                                    EspaciosBlancoMod();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        public void ModificarCliente()
        {
            IBLLCliente _BLLCliente = new BLLCliente();
            Cliente     oCliente    = new Cliente();

            oCliente.IDCliente         = "2-332-444";
            oCliente.Nombre            = "ClientTestMod";
            oCliente.Apellidos         = "Test Tester";
            oCliente.CorreoElectronico = "@test";
            oCliente.Telefono          = "65651";
            oCliente.Provincia         = "Test";
            oCliente.Direccion         = "Test";
            oCliente.Activo            = false;

            Cliente pCliente = new Cliente();

            pCliente = _BLLCliente.ModificarCliente(oCliente);
            System.Diagnostics.Debug.Write(oCliente.IDCliente);
        }