コード例 #1
0
        private void frmListCita_Load(object sender, EventArgs e)
        {
            var tabla = new NCita();

            tabla.ListadoDgv(dgvCita);

            estiloDgv();

            dgvCita.Columns[0].HeaderCell.Style.Alignment  = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[1].HeaderCell.Style.Alignment  = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[2].HeaderCell.Style.Alignment  = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[4].HeaderCell.Style.Alignment  = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[5].HeaderCell.Style.Alignment  = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[8].HeaderCell.Style.Alignment  = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[9].HeaderCell.Style.Alignment  = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[11].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter;
            dgvCita.Columns[12].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter;

            dgvCita.Columns[0].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleCenter;
            dgvCita.Columns[1].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleCenter;
            dgvCita.Columns[2].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleCenter;
            dgvCita.Columns[4].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleLeft;
            dgvCita.Columns[10].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dgvCita.Columns[5].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleCenter;
            dgvCita.Columns[8].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleCenter;
            dgvCita.Columns[9].DefaultCellStyle.Alignment  = DataGridViewContentAlignment.MiddleCenter;
            dgvCita.Columns[11].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dgvCita.Columns[12].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            dgvCita.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI", 11, FontStyle.Bold);
        }
コード例 #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            string rptadetalle = "";

            if (string.IsNullOrEmpty(txtCliente.Text))
            {
                txtBuscar.Focus();
                epCita.SetError(txtBuscar, "Busque un cliente por el dni");
            }
            else if (string.IsNullOrEmpty(txtSerie.Text))
            {
                epCita.Clear();
                txtSerie.Focus();
                epCita.SetError(cboTipoDoc, "Indique el comprobante a generar");
            }
            else if (string.IsNullOrEmpty(txtSerie.Text))
            {
                epCita.Clear();
                txtCorrelativo.Focus();
                epCita.SetError(cboTipoDoc, "Indique el comprobante a generar");
            }
            else
            {
                int ultimoPagoServicio = NPagoServicio.InsertarPagoServicio(cboTipoDoc.Text, txtSerie.Text);

                int ultimoidCita = NCita.InsertarCita(ultimoPagoServicio, Program.idUsuario, Convert.ToDecimal(txtTotal.Text));

                int numfilas = dgvDetalleCita.Rows.Count;

                for (int i = 0; i < numfilas; i++)
                {
                    int     id        = ultimoidCita;
                    string  fecha     = dgvDetalleCita.Rows[i].Cells[4].Value.ToString();
                    string  hora      = dgvDetalleCita.Rows[i].Cells[5].Value.ToString();
                    decimal dscto     = Convert.ToDecimal(dgvDetalleCita.Rows[i].Cells[7].Value.ToString());
                    decimal importe   = Convert.ToDecimal(dgvDetalleCita.Rows[i].Cells[8].Value.ToString());
                    string  motivo    = dgvDetalleCita.Rows[i].Cells[9].Value.ToString();
                    string  sintoma   = dgvDetalleCita.Rows[i].Cells[10].Value.ToString();
                    int     idservis  = Convert.ToInt32(dgvDetalleCita.Rows[i].Cells[13].Value.ToString());
                    int     idmascota = Convert.ToInt32(dgvDetalleCita.Rows[i].Cells[11].Value.ToString());

                    rptadetalle = NDetalleCita.insertarDetalleCita(id, idmascota, idservis, fecha, hora, motivo, sintoma, dscto, importe);
                    if (rptadetalle != "Ok")
                    {
                        MessageBox.Show("Error");
                    }
                }
                IdComprobante = ultimoidCita;
                MessageBox.Show("okk--" + rptadetalle);
                btnGeneraComprobante.Enabled = true;
                LimpiarGuardar();
                NumeroComprobante();
                var tabla = new NCita();
                tabla.ListadoDgv(frmListCita.MiFormListCita.dgvCita);
            }
        }
コード例 #3
0
        private void txtBuscar_KeyPress(object sender, KeyPressEventArgs e)
        {
            NCita objcita = new NCita();

            if (Char.IsLetter(e.KeyChar) || char.IsSymbol(e.KeyChar) || char.IsSeparator(e.KeyChar) || char.IsPunctuation(e.KeyChar))
            {
                e.Handled = true;
            }
            if (Char.IsNumber(e.KeyChar))
            {
                e.Handled = false;
            }
            if ((int)e.KeyChar == (int)Keys.Enter)
            {
                objcita.ListarBusquedaCita(dgvCita, txtBuscar.Text);
            }
            else
            {
                objcita.ListadoDgv(dgvCita);
            }
        }
コード例 #4
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            var tabla = new NCita();

            tabla.ListadoDgv(dgvCita);
        }