Пример #1
0
        private ResultDto InsertUpdateOccupation(OccupationDto occupation)
        {
            ResultDto resultDto = new ResultDto();
            string    obectName = "occupation";

            try
            {
                ObjectParameter prmOccupationID     = new ObjectParameter("OccupationID", occupation.OccupationID);
                ObjectParameter paramOccupationCode = new ObjectParameter("OccupationCode", string.Empty);
                int             effectcount         = _dbContext.uspOccupationInsertUpdate(prmOccupationID, paramOccupationCode, occupation.OccupationCategory, occupation.Occupation, occupation.UserId);

                resultDto.ObjectId   = (int)prmOccupationID.Value;
                resultDto.ObjectCode = string.IsNullOrEmpty((string)paramOccupationCode.Value) ? occupation.OccupationCode : (string)paramOccupationCode.Value;

                if (resultDto.ObjectId > 0)
                {
                    resultDto.Message = string.Format("{0} details saved successfully with code : {1}", obectName, resultDto.ObjectCode);
                }
                else if (resultDto.ObjectId == -1)
                {
                    resultDto.Message = string.Format("Error occured while generating {0} code", obectName);
                }
                else
                {
                    resultDto.Message = string.Format("Error occured while saving {0} details", obectName);
                }
            }
            catch (Exception)
            {
                resultDto.Message  = string.Format("Service layer error occured while saving the {0} details", obectName);
                resultDto.ObjectId = -98;
            }
            return(resultDto);
        }
Пример #2
0
        public OccupationDto GetByID(int OccupationID)
        {
            List <uspOccupationGetByOccupationID_Result> lstuspOccupationGetByOccupationID_Result = _dbContext.uspOccupationGetByOccupationID(OccupationID).ToList();
            OccupationDto objOccupationDto = Mapper.Map <uspOccupationGetByOccupationID_Result, OccupationDto>(lstuspOccupationGetByOccupationID_Result.FirstOrDefault());

            return(objOccupationDto);
        }
        public async Task <PatientDto> GetPatientAsync(int id)
        {
            var patientDto = new PatientDto();
            var patient    = await _context.Patient.FirstOrDefaultAsync(x => x.PatientId == id);

            if (patient != null)
            {
                patientDto.PatientDtoId = patient.PatientId;
                patientDto.Name         = patient.Name;
                patientDto.Age          = patient.Age;
                patientDto.Gender       = patient.Gender;
                patientDto.AadharId     = patient.AadharId;
                patientDto.Addresses    = new List <AddressDto>();
                foreach (var item in patient.Address)
                {
                    var address = new AddressDto();
                    address.AddressDtoId = item.AddressId;
                    address.AddressType  = item.AddressType;
                    address.Hno          = item.Hno;
                    address.Street       = item.Street;
                    address.City         = item.City;
                    address.State        = item.State;
                    address.Country      = item.Country;
                    address.Pincode      = item.Pincode;

                    patientDto.Addresses.Add(address);
                }
                patientDto.Occupations = new List <OccupationDto>();
                foreach (var item in patient.Occupation)
                {
                    var occupation = new OccupationDto();
                    occupation.Name     = item.Name;
                    occupation.Phone    = item.Phone;
                    occupation.StreetNo = item.StreetNo;
                    occupation.Area     = item.Area;
                    occupation.City     = item.City;
                    occupation.State    = item.State;
                    occupation.Country  = item.Country;
                    occupation.Pincode  = item.Pincode;
                    patientDto.Occupations.Add(occupation);
                }
                patientDto.Treatments = new List <TreatmentDto>();
                foreach (var item in patientDto.Treatments)
                {
                    var treatment = new TreatmentDto();
                    treatment.AdmittedDate   = item.AdmittedDate;
                    treatment.PercentageCure = item.PercentageCure;
                    treatment.RelievingDate  = item.RelievingDate;
                    treatment.Isfatility     = item.Isfatility;
                }
            }
            return(patientDto);
        }
Пример #4
0
        public ActionResult CreateOccupation(string ID)
        {
            //SelectList occupationCategory = GetDropDownListByMasterCode(Enums.RefMasterCodes.OCCUPATION_TYPE);



            int occupationId = string.IsNullOrEmpty(ID.DecryptString()) ? default(int) : Convert.ToInt32(ID.DecryptString());

            SelectList occupationCategory = GetDropDownListByMasterCode(Enums.RefMasterCodes.OCCUPATION_TYPE);

            ViewBag.OccupationCategory = occupationCategory;


            OccupationDto occupationDto = new OccupationDto();

            if (occupationId > 0)
            {
                occupationDto = _OccupationService.GetByID(occupationId);
            }
            OccupationModel occupationmodel = Mapper.Map <OccupationDto, OccupationModel>(occupationDto);

            ViewBag.Result = new ResultDto();
            return(View(occupationmodel));
            //OccupationModel occupationModel = new OccupationModel();
            //if (ID.HasValue)
            //{
            //    occupationDto = _OccupationService.GetByID(ID.Value);
            //    occupationModel = Mapper.Map<OccupationDto, OccupationModel>(occupationDto);
            //  //}
            //  if (occupationId>0)
            //      occupationDto= _OccupationService.GetByID(occupationId);


            //  ViewBag.Result = new ResultDto();

            ////  SelectList occupationCategory = GetDropDownListByMasterCode(Enums.RefMasterCodes.OCCUPATION_TYPE);
            //  ViewBag.OccupationCategory = occupationCategory;
            //  return View(occupationmodel);
        }
Пример #5
0
 public ResultDto Update(OccupationDto occupation)
 {
     return(InsertUpdateOccupation(occupation));
 }