Ejemplo n.º 1
0
        public bool UpdateComments(HistoriaMedica objHmEnt)
        {
            bool flag = false;

            try
            {
                DbTransaction transaction = BaseConnection.GetTransaction();
                try
                {
                    MuestraLaboratorioDao muestraLaboratorioDao = new MuestraLaboratorioDao();
                    HistoriaMedicaDao     historiaMedicaDao     = new HistoriaMedicaDao();
                    if (!historiaMedicaDao.Update(objHmEnt, transaction))
                    {
                        throw new Exception(historiaMedicaDao.Error);
                    }
                    if (!muestraLaboratorioDao.UpdateStatus(objHmEnt, transaction))
                    {
                        throw new Exception(muestraLaboratorioDao.Error);
                    }
                    transaction.Commit();
                    flag = true;
                }
                catch (Exception ex)
                {
                    this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                    transaction.Rollback();
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            return(flag);
        }
Ejemplo n.º 2
0
        public bool Save(MuestraLaboratorio objEnt)
        {
            bool flag = false;

            try
            {
                DbTransaction transaction = BaseConnection.GetTransaction();
                try
                {
                    MuestraLaboratorioDao muestraLaboratorioDao = new MuestraLaboratorioDao();
                    if (objEnt.Id != int.MinValue)
                    {
                        flag       = muestraLaboratorioDao.Update(objEnt, (DbTransaction)null);
                        this.error = muestraLaboratorioDao.Error;
                    }
                    else
                    {
                        flag = muestraLaboratorioDao.Create(objEnt, transaction);
                        if (!flag)
                        {
                            throw new Exception(muestraLaboratorioDao.Error);
                        }
                        HistoriaMedica objHmEnt = new HistoriaMedicaDao().Load(objEnt.IdHistoria, transaction);
                        objHmEnt.IdUltimaModificacion = objEnt.IdUltimaModificacion;
                        if (!muestraLaboratorioDao.UpdateStatus(objHmEnt, transaction))
                        {
                            throw new Exception(muestraLaboratorioDao.Error);
                        }
                    }
                    if (flag)
                    {
                        transaction.Commit();
                    }
                }
                catch (Exception ex)
                {
                    this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                    transaction.Rollback();
                }
            }
            catch (Exception ex)
            {
                this.error = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }
            return(flag);
        }