Beispiel #1
0
        private void CargarInformacion()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                Reglas.LayoutContacto loLayout = new Reglas.LayoutContacto();

                if (loLayout.Cargar(
                        ((InicioSesion)this.MdiParent.Owner).Sesion, ofdArchivo.FileName, int.Parse(ConfigurationManager.AppSettings["NumeroLineasIgnorar"])
                        ))
                {
                    MessageBox.Show("Información procesada satisfactoriamente!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtArchivo.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\nFuente: " + ex.Source, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Beispiel #2
0
        private void GuardarContacto()
        {
            if (!this.CamposRequeridos())
            {
                txtNombre.Focus();
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            this.Enabled   = false;

            try
            {
                #region Validar máscaras de telefonos

                txtCelular.TextMaskFormat  = MaskFormat.ExcludePromptAndLiterals;
                txtTelefono.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;

                if (txtCelular.Text.Length > 0)
                {
                    txtCelular.TextMaskFormat = MaskFormat.IncludeLiterals;
                }

                if (txtTelefono.Text.Length > 0)
                {
                    txtTelefono.TextMaskFormat = MaskFormat.IncludeLiterals;
                }

                #endregion

                Reglas.LayoutContacto loLayout = new Reglas.LayoutContacto();

                if (loLayout.GuardarContacto(
                        ((InicioSesion)((Contenido)this.Owner).MdiParent.Owner).Sesion, new ContactoCliente()
                {
                    #region Inicializar propiedades

                    ApellidoPaterno = txtApPaterno.Text.ToUpper().Trim(),
                    Apodo = txtApodo.Text.ToUpper().Trim(),
                    Celular = txtCelular.Text.Trim(),
                    ClaveCliente = this._sClaveCliente,
                    Correo = txtCorreo.Text.ToLower().Trim(),
                    Nextel = txtRadio.Text.Trim(),
                    Nombre = txtNombre.Text.ToUpper().Trim(),
                    Puesto = txtPuesto.Text.ToUpper().Trim(),
                    Telefono = txtTelefono.Text.Trim()

                               #endregion
                }) && this._oContactoAgregadoEvento != null)
                {
                    this._oContactoAgregadoEvento(this, new EventArgs());
                }

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\nFuente: " + ex.Source, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtNombre.Focus();
            }
            finally
            {
                this.Enabled               = true;
                Cursor.Current             = Cursors.Default;
                txtCelular.TextMaskFormat  = MaskFormat.IncludeLiterals;
                txtTelefono.TextMaskFormat = MaskFormat.IncludeLiterals;
            }
        }