Пример #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();

            objblacklistpersonDto                = new blacklistpersonDto();
            objblacklistpersonDto.v_PersonId     = _PersonId;
            objblacklistpersonDto.v_Comment      = txtComentario.Text;
            objblacklistpersonDto.d_DateRegister = DateTime.Now;
            objblacklistpersonDto.i_Status       = (int)StatusBlackListPerson.Registrado;

            var x = _objBlackListBL.GetBlackListByDay(ref objOperationResult, _PersonId, objblacklistpersonDto.d_DateRegister.Value.Date);

            if (x != null)
            {
                MessageBox.Show("El paciente ya se encuentra registrado el día de hoy en la Lista Negra", "INFORMACION!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            _objBlackListBL.AddBlackList(ref objOperationResult, objblacklistpersonDto, Globals.ClientSession.GetAsList());

            //// Analizar el resultado de la operación
            if (objOperationResult.Success == 1)  // Operación sin error
            {
                MessageBox.Show("Se grabo correctamente.", "INFORMACION!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else  // Operación con error
            {
                MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                // Se queda en el formulario.
            }
        }
Пример #2
0
        public blacklistpersonDto GetBlackList(ref OperationResult pobjOperationResult, string pstrPersonId)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext    = new SigesoftEntitiesModel();
                blacklistpersonDto    objDtoEntity = null;

                var objEntity = (from a in dbContext.blacklistperson
                                 where a.v_PersonId == pstrPersonId && a.i_IsDeleted == 0
                                 select a).FirstOrDefault();

                if (objEntity != null)
                {
                    objDtoEntity = blacklistpersonAssembler.ToDTO(objEntity);
                }

                pobjOperationResult.Success = 1;
                return(objDtoEntity);
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                return(null);
            }
        }
Пример #3
0
        public void AddBlackList(ref OperationResult pobjOperationResult, blacklistpersonDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;
            string NewId = "(No generado)";

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                blacklistperson       objEntity = blacklistpersonAssembler.ToEntity(pobjDtoEntity);

                objEntity.d_InsertDate   = DateTime.Now;
                objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]);
                objEntity.i_IsDeleted    = 0;
                // Autogeneramos el Pk de la tabla
                int intNodeId = int.Parse(ClientSession[0]);
                NewId = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 110), "ZZ");;
                objEntity.v_BlackListPerson = NewId;

                dbContext.AddToblacklistperson(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "BLACKLIST", "v_BlackListPerson=" + NewId.ToString(), Success.Ok, null);
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "BLACKLIST", "v_BlackListPerson=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage);
                return;
            }
        }
Пример #4
0
        public blacklistpersonDto GetBlackListByDay(ref OperationResult pobjOperationResult, string pstrPersonId, DateTime pstrFechaRegistro)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext    = new SigesoftEntitiesModel();
                blacklistpersonDto    objDtoEntity = null;

                var objEntity = (from a in dbContext.blacklistperson
                                 where a.v_PersonId == pstrPersonId && a.d_DateRegister == pstrFechaRegistro && (a.i_IsDeleted == 0 || a.i_Status != (int)StatusBlackListPerson.Eliminado)
                                 select a).FirstOrDefault();

                if (objEntity != null)
                {
                    objDtoEntity = blacklistpersonAssembler.ToDTO(objEntity);
                }

                pobjOperationResult.Success = 1;
                return(objDtoEntity);
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                return(null);
            }
        }
Пример #5
0
        public void UpdateBlackList(ref OperationResult pobjOperationResult, blacklistpersonDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();

                // Obtener la entidad fuente
                var objEntitySource = (from a in dbContext.blacklistperson
                                       where a.v_BlackListPerson == pobjDtoEntity.v_BlackListPerson
                                       select a).FirstOrDefault();

                // Crear la entidad con los datos actualizados
                pobjDtoEntity.d_UpdateDate   = DateTime.Now;
                pobjDtoEntity.i_UpdateUserId = Int32.Parse(ClientSession[2]);
                blacklistperson objEntity = blacklistpersonAssembler.ToEntity(pobjDtoEntity);

                // Copiar los valores desde la entidad actualizada a la Entidad Fuente
                dbContext.blacklistperson.ApplyCurrentValues(objEntity);

                // Guardar los cambios
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "BLACKLIST", "v_AreaId=" + objEntity.v_BlackListPerson.ToString(), Success.Ok, null);
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "BLACKLIST", "v_AreaId=" + pobjDtoEntity.v_BlackListPerson.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage);
                return;
            }
        }