/// <summary>
        /// Updates the LabValues
        /// </summary>
        /// <param name="LabValues">LabValues</param>
        public void UpdateLabValues(LabValues labValues)
        {
            if (labValues == null)
            {
                throw new ArgumentNullException(nameof(labValues));
            }

            _labValuesRepository.Update(labValues);
        }
        /// <summary>
        /// Insert a LabValues
        /// </summary>
        /// <param name="LabValues">LabValues</param>
        public void InsertLabValues(LabValues labValue)
        {
            if (labValue == null)
            {
                throw new ArgumentNullException(nameof(labValue));
            }

            _labValuesRepository.Insert(labValue);
        }
Esempio n. 3
0
 public static LabValuesModel ToModel(this LabValues entity)
 {
     return(entity.MapTo <LabValues, LabValuesModel>());
 }
Esempio n. 4
0
 public static LabValues ToEntity(this LabValuesModel model, LabValues destination)
 {
     return(model.MapTo(destination));
 }
        public IActionResult Create(LabValuesModel model)
        {
            ResultModel resultModel = new ResultModel();

            try
            {
                if (model.Id == 0)
                {
                    var labValues = new LabValues();
                    labValues.EBV    = model.EBV;
                    labValues.ECV10  = model.ECV10;
                    labValues.ECV15  = model.ECV15;
                    labValues.EPV    = model.EPV;
                    labValues.Height = model.Height;
                    labValues.HGB    = model.HGB;
                    labValues.HTC    = model.HTC;
                    labValues.PLT    = model.PLT;
                    labValues.TreatmentRecordMasterId = model.TreatmentRecordMasterId;
                    labValues.WBC    = model.WBC;
                    labValues.Weight = model.Weight;
                    //Mark Complete
                    labValues.MarkComplete = model.MarkComplete;
                    labValues.Deleted      = false;
                    labValues.CreatedOn    = DateTime.UtcNow;
                    _treatmentRecordServices.InsertLabValues(labValues);
                    //Bhawana(09/10/2019)
                    //Change treatment Record Status
                    _reportService.UpdateTreatmentStatusID((int)labValues.TreatmentRecordMasterId);
                    //Add other Lab Values
                    foreach (var otherLabValues in model.OtherLabValues)
                    {
                        var otherlabvalues = new OtherLabValues();
                        otherlabvalues.LabValuesId  = labValues.Id;
                        otherlabvalues.ContentName  = otherLabValues.ContentName;
                        otherlabvalues.ContentValue = otherLabValues.ContentValue;
                        labValues.OtherLabValues.Add(otherlabvalues);
                        _treatmentRecordServices.UpdateLabValues(labValues);
                    }
                    //12/10/19 aakansha
                    //model response
                    model.Id = labValues.Id;
                    model.TreatmentRecordMasterId = labValues.TreatmentRecordMasterId;
                    //16/10/19 aakansha
                    var labvalues = _treatmentRecordServices.GetLabValuesById(labValues.Id);
                    foreach (var otherlabvalue in labvalues.OtherLabValues)
                    {
                        var Otherlabvalue = new OtherLabValuesModel();
                        Otherlabvalue.Id           = otherlabvalue.Id;
                        Otherlabvalue.LabValuesId  = otherlabvalue.LabValuesId;
                        Otherlabvalue.ContentValue = otherlabvalue.ContentValue;
                        Otherlabvalue.ContentName  = otherlabvalue.ContentName;
                        model.OtherLabValues.Clear();
                        model.OtherLabValues.Add(Otherlabvalue);
                    }
                    resultModel.Message  = ValidationMessages.Success;
                    resultModel.Status   = 1;
                    resultModel.Response = model;
                    return(Ok(resultModel));
                }
                else
                {
                    var labValues = _treatmentRecordServices.GetLabValuesById(model.Id);
                    labValues.Id     = model.Id;
                    labValues.EBV    = model.EBV;
                    labValues.ECV10  = model.ECV10;
                    labValues.ECV15  = model.ECV15;
                    labValues.EPV    = model.EPV;
                    labValues.Height = model.Height;
                    labValues.HGB    = model.HGB;
                    labValues.HTC    = model.HTC;
                    labValues.PLT    = model.PLT;
                    //Mark Complete
                    labValues.MarkComplete            = model.MarkComplete;
                    labValues.TreatmentRecordMasterId = model.TreatmentRecordMasterId;
                    labValues.WBC    = model.WBC;
                    labValues.Weight = model.Weight;

                    labValues.LastUpdated = DateTime.UtcNow;
                    _treatmentRecordServices.UpdateLabValues(labValues);
                    //Bhawana(09/10/2019)
                    //Change treatment Record Status
                    _reportService.UpdateTreatmentStatusID((int)labValues.TreatmentRecordMasterId);

                    //Add other lab Values
                    foreach (var otherLabValues in model.OtherLabValues)
                    {
                        if (otherLabValues.Id == 0)
                        {
                            var otherlabvalues = new OtherLabValues();
                            otherlabvalues.LabValuesId  = labValues.Id;
                            otherlabvalues.ContentName  = otherLabValues.ContentName;
                            otherlabvalues.ContentValue = otherLabValues.ContentValue;
                            labValues.OtherLabValues.Add(otherlabvalues);
                            _treatmentRecordServices.UpdateLabValues(labValues);
                        }
                        else
                        {
                            var otherlabvalues = _treatmentRecordServices.GetOtherLabValueById(otherLabValues.Id);

                            otherlabvalues.ContentName  = otherLabValues.ContentName;
                            otherlabvalues.ContentValue = otherLabValues.ContentValue;

                            _treatmentRecordServices.UpdateOtherLabValues(otherlabvalues);
                        }
                    }
                    //12/10/19 aakansha
                    //model response
                    model.Id = labValues.Id;
                    model.TreatmentRecordMasterId = labValues.TreatmentRecordMasterId;
                    //16/10/19 aakansha
                    var labvalues = _treatmentRecordServices.GetLabValuesById(labValues.Id);
                    foreach (var otherlabvalue in labvalues.OtherLabValues)
                    {
                        var Otherlabvalue = new OtherLabValuesModel();
                        Otherlabvalue.Id           = otherlabvalue.Id;
                        Otherlabvalue.LabValuesId  = otherlabvalue.LabValuesId;
                        Otherlabvalue.ContentValue = otherlabvalue.ContentValue;
                        Otherlabvalue.ContentName  = otherlabvalue.ContentName;
                        model.OtherLabValues.Clear();
                        model.OtherLabValues.Add(Otherlabvalue);
                    }
                    resultModel.Message  = ValidationMessages.Success;
                    resultModel.Status   = 1;
                    resultModel.Response = model;
                    return(Ok(resultModel));
                }
            }
            catch (Exception e)
            {
                resultModel.Message  = ValidationMessages.Failure;
                resultModel.Status   = 0;
                resultModel.Response = null;
                return(Ok(resultModel));
            }
        }