Example #1
0
        private void BindDataFields()
        {
            mainDataSet = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet(tableName, formWhereField, formId, string.Empty), tableName);

            DataUtil.FillComboBox(cbCargo.Items, "SELECT * FROM empleado_cargo ORDER BY descripcion", null);

            if (mainDataSet.Tables[0].Rows.Count > 0)
            {
                txtCodigo.Text       = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], formWhereField);
                txtNombres.Text      = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "nombres_empleado");
                txtApellidos.Text    = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "apellidos_empleado");
                txtDireccion.Text    = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "direccion");
                txtTelefono.Text     = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "telefono_fijo");
                txtCelular.Text      = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "celular");
                txtEmail.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "email");
                txtPassword.Text     = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "password");
                txtPassword.Enabled  = false;
                btnVerificar.Enabled = false;
                txtComentarios.Text  = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "comentarios");
                if (DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_nacimiento") != DateTime.MinValue)
                {
                    dtpFechaNacimiento.Value = DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_nacimiento");
                }
                if (DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_ingreso") != DateTime.MinValue)
                {
                    dtpFechaIngreso.Value = DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_ingreso");
                }

                cbCargo.SelectedItem  = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "cargo");
                cbEstado.SelectedItem = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado");
            }
            else
            {
                cbEstado.SelectedItem     = AppConstant.RegistroEstado.Activo;
                btnChangePassword.Enabled = false;
            }
            if (txtCodigo.Text.Equals(AppConstant.CodigoAdministrador))
            {
                btnDelete.Enabled = false;
                cbEstado.Enabled  = false;
                cbCargo.Enabled   = false;
            }
        }
Example #2
0
        private void BindDataFields()
        {
            txtMontoInicial.Text = AppConstant.GeneralInfo.MontoCaja;
            mainDataSet          = DataUtil.FillDataSet(DataBaseQuerys.FillMainDataSet(tableName, formWhereField, formId, string.Empty), tableName);

            DataUtil.FillComboBoxValues(cbEstacion.Items, "SELECT Estacion_descripcion, Estacion_id FROM Estacion WHERE Estado = '" + AppConstant.RegistroEstado.Activo + "' ORDER BY Estacion_descripcion", null);

            if (mainDataSet.Tables[0].Rows.Count > 0)
            {
                txtCodigo.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], formWhereField);
                cbEstado.SelectedItem = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado");
                subTotal = DataUtil.GetDouble(mainDataSet.Tables[0].Rows[0], "Fondo_inicial_total");
                txtFondoInicialTotal.Text = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Fondo_inicial_total");
                txtVentaTotal.Text        = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Venta_total");
                txtOrdenes.Text           = DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "Orden");

                if (DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_apertura") != DateTime.MinValue)
                {
                    lblFechaApetura.Visible = true;
                    dtpFechaApetura.Visible = true;
                    dtpFechaApetura.Value   = DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_apertura");
                }
                if (DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_cierre") != DateTime.MinValue)
                {
                    lblFechaCierre.Visible = true;
                    dtpFechaCierre.Visible = true;
                    dtpFechaCierre.Value   = DataUtil.GetDateTime(mainDataSet.Tables[0].Rows[0], "Fecha_cierre");
                }
                if (DataUtil.GetString(mainDataSet.Tables[0].Rows[0], "estado").Equals("CERRADO"))
                {
                    btnDelete.Enabled    = false;
                    gbEstaciones.Enabled = false;
                    btnDetalle.Visible   = true;
                }
                CargarTurnoEstacion(DataUtil.GetInt(txtCodigo.Text));
                btnBorrar.Enabled = false;
                btnSave.Enabled   = false;
            }
            else
            {
                cbEstado.SelectedItem = "ABIERTO";
            }
        }
Example #3
0
        private void GetOrders()
        {
            ClearObjects();
            btnSiguiente.Enabled = false;

            string stringSQL = "p.Pedido_id, " +
                               "p.Mesa_id," +
                               "p.Fecha_Pedido, " +
                               "p.Turno_id, " +
                               "p.Orden_turno, " +
                               "up.Apellidos_empleado+', '+up.Nombres_empleado AS Mozo, " +
                               "p.Tipo_venta" +
                               " FROM ((pedido AS p LEFT JOIN empleado AS up ON p.Atendido_por = up.codigo_empleado) " +
                               " LEFT JOIN cliente AS c ON p.Cliente_id = c.Cliente_id) ";

            DataSet dsSearch = new DataSet();

            if (currentLastPedidoId == 0)
            {
                dsSearch = DataUtil.FillDataSet("SELECT TOP 6 " + stringSQL + " WHERE p.Estado = 'A' ORDER BY p.Fecha_Pedido", "pedido");
            }
            else
            {
                dsSearch = DataUtil.FillDataSet("SELECT TOP 6 " + stringSQL + " WHERE p.Estado = 'A' AND p.Pedido_id > " + currentLastPedidoId + " ORDER BY p.Fecha_Pedido", "pedido");
            }

            lastPedidoId = 0;
            if (dsSearch.Tables[0].Rows.Count > 0)
            {
                int count = 0;
                foreach (DataRow row in dsSearch.Tables[0].Rows)
                {
                    count++;
                    DateTime fechaPedido = DataUtil.GetDateTime(row["Fecha_Pedido"]);
                    DateTime fechaActual = DateTime.Now;

                    string pedidoId = DataUtil.GetString(row["Pedido_id"]);
                    string order    = "Order #: " + DataUtil.GetString(row["Pedido_id"]) + " - Mesa #: " + DataUtil.GetString(row["Mesa_id"]) + " - " + DataUtil.GetString(row["Tipo_venta"]);
                    string mozo     = "Mozo :" + DataUtil.GetString(row["Mozo"]);
                    string tiempo   = "Tiempo Transcurrido: " + Math.Truncate(fechaActual.Subtract(fechaPedido).TotalMinutes);

                    switch (count)
                    {
                    case 1:
                        txtOrder1.Text  = order;
                        txtMesero1.Text = mozo;
                        txtTiempo1.Text = tiempo;
                        lblOrder1.Text  = pedidoId;
                        GetOrderById(pedidoId, lb1);
                        break;

                    case 2:
                        txtOrder2.Text  = order;
                        txtMesero2.Text = mozo;
                        txtTiempo2.Text = tiempo;
                        lblOrder2.Text  = pedidoId;
                        GetOrderById(pedidoId, lb2);
                        break;

                    case 3:
                        txtOrder3.Text  = order;
                        txtMesero3.Text = mozo;
                        txtTiempo3.Text = tiempo;
                        lblOrder3.Text  = pedidoId;
                        GetOrderById(pedidoId, lb3);
                        break;

                    case 4:
                        txtOrder4.Text  = order;
                        txtMesero4.Text = mozo;
                        txtTiempo4.Text = tiempo;
                        lblOrder4.Text  = pedidoId;
                        GetOrderById(pedidoId, lb4);
                        break;

                    case 5:
                        txtOrder5.Text  = order;
                        txtMesero5.Text = mozo;
                        txtTiempo5.Text = tiempo;
                        lblOrder5.Text  = pedidoId;
                        GetOrderById(pedidoId, lb5);
                        break;

                    case 6:
                        txtOrder6.Text  = order;
                        txtMesero6.Text = mozo;
                        txtTiempo6.Text = tiempo;
                        lblOrder6.Text  = pedidoId;
                        GetOrderById(pedidoId, lb6);
                        lastPedidoId         = DataUtil.GetInt(pedidoId);
                        btnSiguiente.Enabled = true;
                        break;
                    }
                }
            }
            else
            {
                currentLastPedidoId = 0;
            }
        }