示例#1
0
 //
 private void BindingGrid()
 {
     using (CajaService _service = new CajaService())
     {
         this.gvListadodeColas.DataSource = _service.GetRevisionLista();
     }
 }
        // PUT api/<controller>/5
        //public void Put(int id, [FromBody]string value)
        //{
        //}

        // DELETE api/<controller>/5
        public HttpResponseMessage Delete(long id)
        {
            HttpResponseMessage response;

            try
            {
                CajaService service = (CajaService) new CajaService().setDatabase(db);
                Caja        c       = service.find(id);
                service.delete(id);

                if (c.Estado == "D")
                {
                    response = this.getSuccessResponse(c);
                }
                else
                {
                    response = this.getSuccessResponse("No se puede eliminar porque existe una compra o hay stock disponible");
                }
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
示例#3
0
 //
 private void TiempoEnCaja(int Opcion)
 {
     using (CajaService service = new CajaService())
     {
         int IdCaja = service.GetCajaByIdUsuario(Session.Intance.CurrentSession.IdUsuario).IdCaja;
         //
         service.TiempoEnCaja(IdCaja, _ticketTrabajado.IdTicket, Opcion);
     }
 }
示例#4
0
        //
        private void FrmCajero_Load(object sender, EventArgs e)
        {
            lblNombreCajero.Text = "";
            lblNombreCajero.Text = String.Format("Cajero {0} {1}", Session.Intance.CurrentSession.Nombres, Session.Intance.CurrentSession.Apellidos);

            using (CajaService service = new CajaService())
            {
                lblCaja.Text = "";
                lblCaja.Text = service.GetCajaByIdUsuario(Session.Intance.CurrentSession.IdUsuario).Descripcion;
            }
            //
            BindingGrid();
            //
            DesavilitaButtom(false);
        }
示例#5
0
 private void CloseCaja(object sender, EventArgs e)
 {
     try
     {
         if (ValidaSeleccionCaja())
         {
             CajaService cajaService = new CajaService();
             int         cajaID      = int.Parse(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells["CajaID"].Value.ToString());
             cajaService.CloseCaja(cajaID);
             this.RefreshDataGridView();
         }
     }
     catch (Exception err)
     {
         MessageBox.Show($"{err.Message}");
     }
 }
示例#6
0
        private void OpenCaja(object sender, EventArgs e)
        {
            try
            {
                Caja caja = new Caja(EnumEstadoCaja.Abierta);

                CajaService cajaService = new CajaService();
                cajaService.CreateCaja(caja);

                RefreshDataGridView();
                MessageBox.Show($"Se agrego la caja {caja.CajaID}");
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}");
            }
        }
        public HttpResponseMessage GetDate(DateTime p_desde, DateTime p_hasta)
        {
            HttpResponseMessage response;

            try
            {
                CajaService service = (CajaService) new CajaService().setDatabase(db);
                List <Caja> c       = service.getFecha(p_desde, p_hasta);



                response = this.getSuccessResponse(c);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
        // GET api/GetCaja/5
        public HttpResponseMessage GetCaja(long id)
        {
            HttpResponseMessage response;

            try
            {
                CajaService service = (CajaService) new CajaService().setDatabase(db);
                Caja        c       = service.find(id);



                response = this.getSuccessResponse(c);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
        // GET api/Caja
        public HttpResponseMessage Get()
        {
            HttpResponseMessage response;

            try
            {
                CajaService service = (CajaService) new CajaService().setDatabase(db);
                List <Caja> caja    = service.getAll();



                response = this.getSuccessResponse(caja);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
示例#10
0
        //
        private void SiguienteTurno(IdTipoServicio TipoServicio)
        {
            switch (TipoServicio)
            {
            case IdTipoServicio.FP:
                using (CajaService service = new CajaService())
                {
                    int IdCaja = service.GetCajaByIdUsuario(Session.Intance.CurrentSession.IdUsuario).IdCaja;

                    _ticketTrabajado = service.TurnoSiguiente(1, IdCaja);

                    if (_ticketTrabajado != null)
                    {
                        this.lblNumTicket.Text = string.Format("FP-{0}", FormatNumero(_ticketTrabajado.Secuencia));
                    }
                }
                break;

            case IdTipoServicio.RV:
                break;

            case IdTipoServicio.RL:
                using (CajaService service = new CajaService())
                {
                    int IdCaja = service.GetCajaByIdUsuario(Session.Intance.CurrentSession.IdUsuario).IdCaja;

                    _ticketTrabajado = service.TurnoSiguiente(3, IdCaja);

                    if (_ticketTrabajado != null)
                    {
                        this.lblNumTicket.Text = string.Format("RL-{0}", FormatNumero(_ticketTrabajado.Secuencia));
                    }
                }
                break;

            case IdTipoServicio.AC:
                break;

            default:
                break;
            }
        }
        // POST api/<controller>
        public HttpResponseMessage Post([FromBody] Caja c)
        {
            HttpResponseMessage response;

            try
            {
                CajaService service = (CajaService) new CajaService().setDatabase(db);
                c.FechaAlta   = DateTime.Today;
                c.UsuarioAlta = 1;
                c.Estado      = "A";
                c             = service.saveOrUpdate(c);

                response = this.getSuccessResponse(c);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
示例#12
0
        //
        private void BindingPantalla()
        {
            List <TurnosPantalla> _list = null;

            using (CajaService service = new CajaService())
            {
                _list = service.GetTurnosPantalla();
            }

            ClearCajas();

            if (_list != null)
            {
                foreach (TurnosPantalla row in _list)
                {
                    switch (row.IdCaja)
                    {
                    case 1:
                    {
                        this.lblNumCaja1.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }

                    case 2:
                    {
                        this.lblNumCaja2.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }

                    case 3:
                    {
                        this.lblNumCaja3.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }

                    case 4:
                    {
                        this.lblNumCaja4.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }

                    case 5:
                    {
                        this.lblNumCaja5.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }

                    case 6:
                    {
                        this.lblNumCaja6.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }

                    case 7:
                    {
                        this.lblNumCaja7.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }

                    case 8:
                    {
                        this.lblNumCaja8.Text = this.FormatNumero(row.NumTicket);
                        break;
                    }
                    }
                }
            }
        }