/// <summary>
 /// Descripción: Actualiza el establecimiento de un examen
 /// Author: Terceros.
 /// Fecha Creacion: 01/01/2017
 /// Fecha Modificación: 02/02/2017.
 /// Modificación: Se agregaron comentarios.
 /// </summary>
 /// <param name="examenLaboratorio"></param>
 public void UpdateExamenByLaboratorio(ExamenLaboratorio examenLaboratorio)
 {
     using (var examenDal = new LaboratorioExamenDal())
     {
         examenDal.UpdateExamenByLaboratorio(examenLaboratorio);
     }
 }
        public bool Delete(ExamenLaboratorio objToProcess)
        {
            bool flag = false;

            try
            {
                DbConnection connection = this.instance.CreateConnection();
                try
                {
                    connection.Open();
                    DbCommand storedProcCommand = this.instance.GetStoredProcCommand("PA_EXAMEN_LABORATORIO_DELETE");
                    storedProcCommand.Connection = connection;
                    this.instance.AddInParameter(storedProcCommand, "@ID", DbType.Int32, (object)objToProcess.Id);
                    this.instance.AddInParameter(storedProcCommand, "@ID_USUARIO", DbType.Int32, (object)objToProcess.IdUltimaModificacion);
                    this.instance.ExecuteNonQuery(storedProcCommand);
                    flag = true;
                }
                catch (Exception ex)
                {
                    this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                }
                finally
                {
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            return(flag);
        }
        public List <ExamenLaboratorio> GetExamenLaboratorios(
            string nombre,
            bool esExterno,
            bool showAllExterno,
            bool requiereVenopuncion,
            bool showAllRequiereVenopuncion,
            bool requiereConsentimiento,
            bool showAllRequiereConsentimiento,
            bool activo,
            bool showAllActivo)
        {
            List <ExamenLaboratorio> examenLaboratorioList = new List <ExamenLaboratorio>();

            try
            {
                foreach (DataRow row in (InternalDataCollectionBase)this.GetList(nombre, esExterno, showAllExterno, requiereVenopuncion, showAllRequiereVenopuncion, requiereConsentimiento, showAllRequiereConsentimiento, activo, showAllActivo).Rows)
                {
                    ExamenLaboratorio objToLoad = new ExamenLaboratorio();
                    this.LoadFromDataRow(ref objToLoad, row);
                    examenLaboratorioList.Add(objToLoad);
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            return(examenLaboratorioList);
        }
 /// <summary>
 /// Descripción: Inserta el establecimiento de un examen
 /// Author: Terceros.
 /// Fecha Creacion: 01/01/2017
 /// Fecha Modificación: 02/02/2017.
 /// Modificación: Se agregaron comentarios.
 /// </summary>
 /// <param name="examenLaboratorio"></param>
 public void InsertExamenByLaboratorio(ExamenLaboratorio examenLaboratorio)
 {
     using (var examenDal = new LaboratorioExamenDal())
     {
         examenDal.InsertExamenByLaboratorio(examenLaboratorio);
     }
 }
        private ExamenLaboratorio GetByPK(int id)
        {
            DbConnection      connection = this.instance.CreateConnection();
            ExamenLaboratorio objToLoad  = new ExamenLaboratorio();

            try
            {
                connection.Open();
                DbCommand storedProcCommand = this.instance.GetStoredProcCommand("PA_GET_EXAMEN_LABORATORIO_BY_PK");
                storedProcCommand.Connection = connection;
                this.instance.AddInParameter(storedProcCommand, "@ID", DbType.Int32, (object)id);
                DbDataAdapter dataAdapter = this.instance.GetDataAdapter();
                DataTable     dataTable   = new DataTable();
                dataAdapter.SelectCommand = storedProcCommand;
                dataAdapter.Fill(dataTable);
                if (dataTable.Rows.Count > 0)
                {
                    this.LoadFromDataRow(ref objToLoad, dataTable.Rows[0]);
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            finally
            {
                connection.Close();
            }
            return(objToLoad);
        }
Ejemplo n.º 6
0
        public bool Save(ExamenLaboratorio objEnt)
        {
            ExamenLaboratorioDao examenLaboratorioDao = new ExamenLaboratorioDao();
            bool flag = objEnt.Id == int.MinValue ? examenLaboratorioDao.Create(objEnt) : examenLaboratorioDao.Update(objEnt);

            this.error = examenLaboratorioDao.Error;
            return(flag);
        }
Ejemplo n.º 7
0
        public bool Delete(ExamenLaboratorio objToProcess)
        {
            ExamenLaboratorioDao examenLaboratorioDao = new ExamenLaboratorioDao();
            bool flag = examenLaboratorioDao.Delete(objToProcess);

            this.error = examenLaboratorioDao.Error;
            return(flag);
        }
Ejemplo n.º 8
0
        public ExamenLaboratorio Load(int id)
        {
            ExamenLaboratorioDao examenLaboratorioDao = new ExamenLaboratorioDao();
            ExamenLaboratorio    examenLaboratorio    = examenLaboratorioDao.Load(id);

            this.error = examenLaboratorioDao.Error;
            return(examenLaboratorio);
        }
Ejemplo n.º 9
0
        public ActionResult AgregarExamen(int idLaboratorio)
        {
            var model = new ExamenLaboratorio
            {
                IdLaboratorio = idLaboratorio
            };

            return(PartialView("_AgregarExamen", model));
        }
Ejemplo n.º 10
0
        public ActionResult GuardarExamen(ExamenLaboratorio model)
        {
            model.IdUsuarioRegistro = Logueado.idUsuario;

            _laboratorioExamenBl.InsertExamenByLaboratorio(model);

            return(PartialView("_AgregarExamen", model));

            //return RedirectToAction("AgregarExamenes", new { id = model.IdLaboratorio });
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Descripción: Inserta el establecimiento de un examen
        /// Author: Terceros.
        /// Fecha Creacion: 01/01/2017
        /// Fecha Modificación: 02/02/2017.
        /// Modificación: Se agregaron comentarios.
        /// </summary>
        /// <param name="examenLaboratorio"></param>
        public void InsertExamenByLaboratorio(ExamenLaboratorio examenLaboratorio)
        {
            var objCommand = GetSqlCommand("pNLI_ExamenLaboratorio");

            InputParameterAdd.Guid(objCommand, "idExamen", examenLaboratorio.IdExamen);
            InputParameterAdd.Int(objCommand, "idLaboratorio", examenLaboratorio.IdLaboratorio);
            InputParameterAdd.Int(objCommand, "diasEmisionResultado", examenLaboratorio.DiasEmision);
            InputParameterAdd.Int(objCommand, "diasEntregaResultado", examenLaboratorio.DiasEntrega);
            InputParameterAdd.Int(objCommand, "idUsuarioRegistro", examenLaboratorio.IdUsuarioRegistro);

            ExecuteNonQuery(objCommand);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Descripción: Actualiza el establecimiento de un examen
        /// Author: Terceros.
        /// Fecha Creacion: 01/01/2017
        /// Fecha Modificación: 02/02/2017.
        /// Modificación: Se agregaron comentarios.
        /// </summary>
        /// <param name="examenLaboratorio"></param>
        public void UpdateExamenByLaboratorio(ExamenLaboratorio examenLaboratorio)
        {
            var objCommand = GetSqlCommand("pNLU_ExamenLaboratorio");

            InputParameterAdd.Guid(objCommand, "idExamen", examenLaboratorio.IdExamen);
            InputParameterAdd.Int(objCommand, "idLaboratorio", examenLaboratorio.IdLaboratorio);
            InputParameterAdd.Int(objCommand, "diasEmisionResultado", examenLaboratorio.DiasEmision);
            InputParameterAdd.Int(objCommand, "diasEntregaResultado", examenLaboratorio.DiasEntrega);
            InputParameterAdd.Int(objCommand, "estado", examenLaboratorio.Estado);
            InputParameterAdd.Int(objCommand, "idUsuarioEdicion", examenLaboratorio.IdUsuarioEdicion);

            ExecuteNonQuery(objCommand);
        }
Ejemplo n.º 13
0
        public ActionResult EditarExamen(ExamenLaboratorio examenLaboratorio)
        {
            try
            {
                examenLaboratorio.IdUsuarioEdicion = Logueado.idUsuario;

                _laboratorioExamenBl.UpdateExamenByLaboratorio(examenLaboratorio);

                return(RedirectToAction("AgregarExamenes", new { id = examenLaboratorio.IdLaboratorio }));
            }
            catch
            {
                return(View("Error"));
            }
        }
        private void SaveInfo(bool isCreate, GridCommandEventArgs e)
        {
            //Capturar la fila que se va a editar

            GridEditableItem editColumn = (GridEditableItem)e.Item;
            Hashtable        newValues  = new Hashtable();

            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editColumn);

            string nombreObj = newValues["NOMBRE"].ToString();
            bool   activoObj = Convert.ToBoolean(newValues["ACTIVO"]);

            ExamenLaboratorioBll objBllSave = new ExamenLaboratorioBll();
            ExamenLaboratorio    objEntity  = new ExamenLaboratorio();

            if (isCreate)
            {
                objEntity.IdCreacion    = this.IdUserCurrent;
                objEntity.FechaCreacion = DateTime.Now;
            }
            else
            {
                int idToUpdate = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[editColumn.ItemIndex]["ID"]);
                objEntity.Id = idToUpdate;
            }

            objEntity.Nombre = nombreObj;
            objEntity.Activo = activoObj;
            objEntity.IdUltimaModificacion    = this.IdUserCurrent;
            objEntity.FechaUltimaModificacion = DateTime.Now;

            if (!objBllSave.Save(objEntity))
            {
                //objBllSave.Error;
                string mensaje = string.Format("{0}", objBllSave.Error);
                erroresCarga.Text = mensaje;
            }
            else
            {
                this.gvExamenLaboratorio.EditIndexes.Clear();
                this.gvExamenLaboratorio.Rebind();
            }
        }
Ejemplo n.º 15
0
        public ActionResult EliminarExamen(Guid idExamen, int idLaboratorio)
        {
            var examenLaboratorio = new ExamenLaboratorio
            {
                IdLaboratorio    = idLaboratorio,
                IdExamen         = idExamen,
                IdUsuarioEdicion = Logueado.idUsuario,
                Estado           = 0
            };

            try
            {
                _laboratorioExamenBl.UpdateExamenByLaboratorio(examenLaboratorio);

                return(RedirectToAction("AgregarExamenes", new { id = idLaboratorio }));
            }
            catch
            {
                return(View("Error"));
            }
        }
 private void LoadFromDataRow(ref ExamenLaboratorio objToLoad, DataRow drData)
 {
     try
     {
         objToLoad.Id                      = Convert.ToInt32(drData["ID"]);
         objToLoad.Nombre                  = drData["NOMBRE"].ToString();
         objToLoad.EsExterno               = Convert.ToBoolean(drData["EXTERNO"]);
         objToLoad.RequiereVenopuncion     = Convert.ToBoolean(drData["REQUIERE_VENOPUNCION"]);
         objToLoad.RequiereConsentimiento  = Convert.ToBoolean(drData["REQUIERE_CONSENTIMIENTO"]);
         objToLoad.Activo                  = Convert.ToBoolean(drData["ACTIVO"]);
         objToLoad.IdCreacion              = Convert.ToInt32(drData["ID_CREACION"]);
         objToLoad.FechaCreacion           = Convert.ToDateTime(drData["FECHA_CREACION"]);
         objToLoad.IdUltimaModificacion    = Convert.ToInt32(drData["ID_ULTIMA_MODIFICACION"]);
         objToLoad.FechaUltimaModificacion = Convert.ToDateTime(drData["FECHA_ULTIMA_MODIFICACION"]);
     }
     catch (Exception ex)
     {
         objToLoad  = new ExamenLaboratorio();
         this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
     }
 }
        protected void gvExamenLaboratorio_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem editColumn = (GridEditableItem)e.Item;
            int idToDelete = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[editColumn.ItemIndex]["ID"]);

            ExamenLaboratorioBll objBllSave = new ExamenLaboratorioBll();
            ExamenLaboratorio    objEntity  = new ExamenLaboratorio();

            objEntity.Id = idToDelete;
            objEntity.IdUltimaModificacion = this.IdUserCurrent;

            if (!objBllSave.Delete(objEntity))
            {
                this.gvExamenLaboratorio.Rebind();
                string mensaje = string.Format("{0}", objBllSave.Error);
                erroresCarga.Text = mensaje;
            }
            else
            {
                this.gvExamenLaboratorio.Rebind();
            }
        }
        public bool Create(ExamenLaboratorio objToProcess)
        {
            bool flag = false;

            try
            {
                DbConnection connection = this.instance.CreateConnection();
                try
                {
                    connection.Open();
                    DbCommand storedProcCommand = this.instance.GetStoredProcCommand("PA_EXAMEN_LABORATORIO_CREATE");
                    storedProcCommand.Connection = connection;
                    this.instance.AddOutParameter(storedProcCommand, "@ID", DbType.Int32, 4);
                    this.instance.AddInParameter(storedProcCommand, "@NOMBRE", DbType.String, (object)objToProcess.Nombre);
                    this.instance.AddInParameter(storedProcCommand, "@EXTERNO", DbType.Boolean, (object)objToProcess.EsExterno);
                    this.instance.AddInParameter(storedProcCommand, "@REQUIERE_VENOPUNCION", DbType.Boolean, (object)objToProcess.RequiereVenopuncion);
                    this.instance.AddInParameter(storedProcCommand, "@REQUIERE_CONSENTIMIENTO", DbType.Boolean, (object)objToProcess.RequiereConsentimiento);
                    this.instance.AddInParameter(storedProcCommand, "@ACTIVO", DbType.Boolean, (object)objToProcess.Activo);
                    this.instance.AddInParameter(storedProcCommand, "@ID_CREACION", DbType.Int32, (object)objToProcess.IdCreacion);
                    this.instance.ExecuteNonQuery(storedProcCommand);
                    objToProcess.Id = Convert.ToInt32(storedProcCommand.Parameters["@ID"].Value);
                    flag            = true;
                }
                catch (Exception ex)
                {
                    this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                }
                finally
                {
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            return(flag);
        }