Esempio n. 1
0
        public void UpdAdultoMayor(ref OperationResult objOperationResult, adultomayorDto objAdultMayDto, List <string> ClientSession)
        {
            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();

                var objEntitySource = (from a in dbContext.adultomayor
                                       where a.v_AdultoMayorId == objAdultMayDto.v_AdultoMayorId
                                       select a).FirstOrDefault();
                objAdultMayDto.d_UpdateDate   = DateTime.Now;
                objAdultMayDto.i_UpdateUserId = Int32.Parse(ClientSession[2]);

                var objStrongEntity = adultomayorAssembler.ToEntity(objAdultMayDto);
                dbContext.adultomayor.ApplyCurrentValues(objStrongEntity);

                objOperationResult.Success = 1;
                dbContext.SaveChanges();

                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "AM / UPD", "v_AdultoId=" + objAdultMayDto.v_AdultoMayorId, Success.Ok, null);
                return;
            }
            catch (Exception ex)
            {
                objOperationResult.Success          = 0;
                objOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);

                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.ACTUALIZACION, "AM / UPD", "v_AdultoId=" + objAdultMayDto.v_AdultoMayorId, Success.Failed, objOperationResult.ExceptionMessage);
                return;
            }
        }
Esempio n. 2
0
        public adultomayorDto GetAdultoMayor(ref OperationResult objOperationResult, string _PersonId)
        {
            try
            {
                SigesoftEntitiesModel dbContext    = new SigesoftEntitiesModel();
                adultomayorDto        objDtoEntity = null;

                var objEntity = (from a in dbContext.adultomayor
                                 where a.v_PersonId == _PersonId
                                 select a).FirstOrDefault();

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

                objOperationResult.Success = 1;
                return(objDtoEntity);
            }
            catch (Exception ex)
            {
                objOperationResult.Success          = 0;
                objOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                return(null);
            }
        }
Esempio n. 3
0
        public string AddAdultoMayor(ref OperationResult objOperationResult, adultomayorDto objAdultMayDto, List <string> ClientSession)
        {
            string NewId0 = null;

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                adultomayor           objEntity = adultomayorAssembler.ToEntity(objAdultMayDto);
                objEntity.d_InsertDate   = DateTime.Now;
                objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]);
                objEntity.i_IsDeleted    = 0;

                int intNodeId = int.Parse(ClientSession[0]);
                NewId0 = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 355), "AM");;
                objEntity.v_AdultoMayorId = NewId0;

                dbContext.AddToadultomayor(objEntity);
                dbContext.SaveChanges();

                objOperationResult.Success = 1;
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "AM", "v_AdultoMayorId=" + NewId0.ToString(), Success.Ok, null);
            }
            catch (Exception ex)
            {
                objOperationResult.Success          = 0;
                objOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);

                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "AM", "v_AdultoMayorId=" + NewId0.ToString(), Success.Failed, objOperationResult.ExceptionMessage);
            }
            return(NewId0);
        }