Esempio n. 1
0
        public bool Update(LookupModel model)
        {
            try
            {
                bool isSaved = false;


                using (var db = new HMSEntities())
                {
                    //UpdateAllSequence(model.Id, model.Sequence.Value, model.PerentId);
                    TPLabPatientMapping entity = db.TPLabPatientMappings.Find(model.Id);
                    entity.LabId        = model.SubPerentId;
                    entity.OPDHistoryId = model.PerentId;
                    entity.Amount       = (!model.Rate.HasValue) ? 0.00M : model.Rate;
                    entity.ModifiedOn   = DateTime.Now;
                    entity.ModifiedBy   = UserDetailSession.Id;

                    db.SaveChanges();

                    isSaved = true;
                    UpdateTPOPDAmount(model.PerentId.Value);
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public LookupModel GetById(Guid id)
        {
            try
            {
                LookupModel model = new LookupModel();
                using (var db = new HMSEntities())
                {
                    TPLabPatientMapping entity = db.TPLabPatientMappings.Find(id);
                    if (entity != null)
                    {
                        model.Id          = entity.Id;
                        model.PerentId    = entity.OPDHistoryId;
                        model.Name        = entity.LabDetail.Name;
                        model.SubPerentId = entity.LabId;
                        model.Rate        = entity.Amount;;
                        model.CreatedOn   = entity.CreatedOn;
                        model.CreatedBy   = entity.Createdby;
                        model.ModifiedOn  = entity.ModifiedOn;
                        model.ModifiedBy  = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public bool Create(LookupModel model)
        {
            try
            {
                bool isSaved = false;


                using (var db = new HMSEntities())
                {
                    TPLabPatientMapping entity = new TPLabPatientMapping();
                    entity.LabId        = model.SubPerentId;
                    entity.OPDHistoryId = model.PerentId;
                    entity.Amount       = (!model.Rate.HasValue) ? 0.00M : model.Rate;
                    entity.CreatedOn    = DateTime.Now;
                    entity.Createdby    = UserDetailSession.Id;
                    db.TPLabPatientMappings.Add(entity);
                    db.SaveChanges();

                    isSaved = true;
                    UpdateTPOPDAmount(model.PerentId.Value);
                }



                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public List <OPDHistoryModel> GetGenericReport(Expression <Func <OPDHistory, bool> > predicate)
        {
            try
            {
                List <OPDHistoryModel> list = new List <OPDHistoryModel>();

                using (var db = new HMSEntities())
                {
                    var data = db.OPDHistories.Where(predicate).OrderBy(t => t.InTime).ToList();
                    foreach (OPDHistory t in data)
                    {
                        OPDHistoryModel model = new OPDHistoryModel();
                        model.Id                  = t.Id;
                        model.PatientId           = t.PatientId;
                        model.PatientName         = t.PatientDetail != null ? t.PatientDetail.FullName : "";
                        model.CasePaperNumber     = t.PatientDetail != null ? t.PatientDetail.CasePaperNumber : "";
                        model.Sequence            = t.Sequence;
                        model.InTime              = t.InTime;
                        model.OutTime             = t.OutTime;
                        model.IsCharity           = t.IsCharity;
                        model.IsLabCharity        = t.IsLabCharity;
                        model.ECGAmount           = t.ECGAmount;
                        model.ConsultingDoctorId  = t.ConsultingDoctorId;
                        model.DoctorNames         = t.DoctorDetail.FullName;
                        model.IsECG               = t.IsECG.HasValue ? t.IsECG : false;
                        model.IsXRAY              = t.IsXRAY.HasValue ? t.IsXRAY : false;
                        model.XRAYAmount          = t.XRAYAmount;
                        model.NumberofXRAY        = t.NumberofXRAY.HasValue ? t.NumberofXRAY : 0;
                        model.ThirdPartyLabId     = t.ThirdPartyLabId;
                        model.ThirdPartyLabAmoumt = t.ThirdPartyLabAmoumt;
                        model.StatusId            = t.StatusId;
                        model.StatusName          = t.Status != null ? t.Status.Name : "";
                        model.Amount              = t.Amount;
                        model.PaidAmount          = t.PaidAmount;
                        model.DueAmount           = t.DueAmount;
                        model.TotalAmount         = t.TotalAmount;
                        model.LabTestingAmount    = t.LabTestingAmount;
                        model.ReceivedBy          = t.ReceivedBy;
                        model.Diagnose            = t.Diagnose;
                        model.Madicines           = t.Madicines;
                        model.CreatedBy           = t.CreatedBy;
                        model.ModifiedBy          = t.ModifiedBy;
                        model.OPDHistoryUpdates   = new List <OPDHistoryUpdateModel>();
                        model.OPDHistoryUpdates.AddRange(OPDHistoryUpdate.GetPayingPatient(model.Id.Value));
                        model.TPLabs = new List <LookupModel>();
                        model.TPLabs.AddRange(TPLabPatientMapping.GetLabByOPD(model.Id.Value));
                        list.Add(model);
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }