예제 #1
0
        private void ActualizaPedido(int _pedidoID)
        {
            try
            {
                BLL.Tables.EST_LABORATORIOCAB      _cabLab  = new BLL.Tables.EST_LABORATORIOCAB();
                Entities.Tables.EST_LABORATORIOCAB _itemCab = new Entities.Tables.EST_LABORATORIOCAB();

                BLL.Tables.EST_LABORATORIOITEMS             _itemLab      = new BLL.Tables.EST_LABORATORIOITEMS();
                List <Entities.Tables.EST_LABORATORIOITEMS> _itemLabItems = new List <Entities.Tables.EST_LABORATORIOITEMS>();
                //Entities.Tables.EST_LABORATORIOITEMS _itemItems = new Entities.Tables.EST_LABORATORIOITEMS();

                _itemCab.FECHASOLICITUD    = this.dateFecha.Value;
                _itemCab.ESTADO_ID         = 1;
                _itemCab.OBSERVACIONESMED  = this.txtObsMedico.Text;
                _itemCab.OTROSESTUDIOS     = this.txtOtrosAnalisis.Text;
                _itemCab.OBSERVACIONESBIOQ = this.txtObsBioq.Text;
                if (chckUrgente.Checked)
                {
                    _itemCab.TIPO = 2;
                }
                else
                {
                    _itemCab.TIPO = 1;
                }
                _itemCab.PACIENTE_ID  = Clases.Paciente.PacienteIngresado;
                _itemCab.ID_SOLICITUD = _NSolicitud;
                _itemCab.USUARIO_ID   = Clases.Usuario.UsuarioLogeado.id_usuario_Logeado;

                for (int i = 0; i < this.dataGridViewPedido.Rows.Count; i++)
                {
                    Entities.Tables.EST_LABORATORIOITEMS _itemItems = new Entities.Tables.EST_LABORATORIOITEMS();
                    _itemItems.ESTUDIO_ID   = Convert.ToInt32(dataGridViewPedido.Rows[i].Cells[(int)Col_Estudios.ESTUDIO_ID].Value);
                    _itemItems.ID_SOLICITUD = _NSolicitud;
                    _itemItems.NROITEM      = Convert.ToInt32(dataGridViewPedido.Rows[i].Cells[(int)Col_Estudios.NRO_ITEM].Value);
                    _itemLabItems.Add(_itemItems);
                }

                _cabLab.ActualizaLaboratorio(_itemLabItems, _itemCab);//Graba lista de Items y cabecera
                MetroMessageBox.Show(this, "Se actualizo correctamente el pedido", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void GuardaPedido(int _Estudio)
        {
            try
            {
                BLL.Tables.EST_LABORATORIOCAB      _cabLab  = new BLL.Tables.EST_LABORATORIOCAB();
                Entities.Tables.EST_LABORATORIOCAB _itemCab = new Entities.Tables.EST_LABORATORIOCAB();

                BLL.Tables.EST_LABORATORIOITEMS             _itemLab      = new BLL.Tables.EST_LABORATORIOITEMS();
                List <Entities.Tables.EST_LABORATORIOITEMS> _itemLabItems = new List <Entities.Tables.EST_LABORATORIOITEMS>();
                //Entities.Tables.EST_LABORATORIOITEMS _itemItems = new Entities.Tables.EST_LABORATORIOITEMS();

                _itemCab.FECHASOLICITUD = DateTime.Now;
                _itemCab.ESTADO_ID      = 1;
                if (chckUrgente.Checked)
                {
                    _itemCab.TIPO = 2;
                }
                else
                {
                    _itemCab.TIPO = 1;
                }
                _itemCab.PACIENTE_ID = Clases.Paciente.PacienteIngresado;
                _itemCab.USUARIO_ID  = Clases.Usuario.UsuarioLogeado.id_usuario_Logeado;

                int _NroItem;
                _NroItem = 1;
                Entities.Tables.EST_LABORATORIOITEMS _itemItems = new Entities.Tables.EST_LABORATORIOITEMS();
                _itemItems.ESTUDIO_ID = _Estudio;
                _itemItems.NROITEM    = _NroItem;
                _itemLabItems.Add(_itemItems); // Cargo la lista


                _cabLab.GrabaLaboratorio(_itemLabItems, _itemCab);//Graba lista de Items y cabecera
                MetroMessageBox.Show(this, "Se realizo correctamente el pedido", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }