Ejemplo n.º 1
0
        public LabDetailModel GetByName(string name)
        {
            try
            {
                LabDetailModel model = new LabDetailModel();
                using (var db = new HMSEntities())
                {
                    LabDetail entity = db.LabDetails.FirstOrDefault(t => t.Name == name);
                    if (entity != null)
                    {
                        model.Id              = entity.Id;
                        model.Name            = entity.Name;
                        model.PathelogistName = entity.PathelogistName;
                        model.Address         = entity.Address;
                        model.PhoneNumber     = entity.PhoneNumber;
                        model.IsActive        = entity.IsActive;
                        model.IsDeleted       = entity.IsDeleted;
                        model.CreatedOn       = entity.CreatedOn;
                        model.CreatedBy       = entity.CreatedBy;
                        model.ModifiedOn      = entity.ModifiedOn;
                        model.ModifiedBy      = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public bool Update(Guid?id)
        {
            try
            {
                bool isSaved = false;


                using (var db = new HMSEntities())
                {
                    BillHistory entity = db.BillHistories.FirstOrDefault(t => t.OPDHistoryId == id);

                    entity.PrintCopys    = entity.PrintCopys + 1;
                    entity.LastPrintedOn = DateTime.Now;
                    entity.LastPrintedBy = UserDetailSession.Id;

                    db.SaveChanges();

                    isSaved = true;
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        public List <BillHistoryModel> Get()
        {
            try
            {
                List <BillHistoryModel> list = new List <BillHistoryModel>();

                using (var db = new HMSEntities())
                {
                    list = db.BillHistories
                           .OrderByDescending(c => c.CreatedOn)
                           .Select(t => new BillHistoryModel()
                    {
                        Id            = t.Id,
                        PatientId     = t.PatientId,
                        OPDHistoryId  = t.OPDHistoryId,
                        ReceiptNumber = t.ReceiptNumber,
                        PrintCopys    = t.PrintCopys,
                        LastPrintedOn = t.LastPrintedOn,
                        CreatedOn     = t.CreatedOn,
                        CreatedBy     = t.CreatedBy,
                        LastPrintedBy = t.LastPrintedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        private bool IsExist(LookupModel model)
        {
            try
            {
                Expression <Func <RoomType, bool> > predicate = null;

                using (var db = new HMSEntities())
                {
                    /* Build Predicate according to Create or Update */
                    if (!model.Id.HasValue)
                    {
                        predicate = o => o.Name == model.Name && o.IsActive == true && o.IsDeleted == false;//for Create Record
                    }
                    else
                    {
                        predicate = o => o.Name == model.Name && o.Id != model.Id && o.IsActive == true && o.IsDeleted == false;//for Update Record Record
                    }

                    /* return is Exist or not */
                    if (db.RoomTypes.Any(predicate))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 5
0
        public LookupModel GetById(Guid id)
        {
            try
            {
                LookupModel model = new LookupModel();
                using (var db = new HMSEntities())
                {
                    RoomType entity = db.RoomTypes.Find(id);
                    if (entity != null)
                    {
                        model.Id          = entity.Id;
                        model.Name        = entity.Name;
                        model.Description = entity.Description;
                        model.IsActive    = entity.IsActive;
                        model.IsDeleted   = entity.IsDeleted;
                        model.CreatedOn   = entity.CreatedOn;
                        model.CreatedBy   = entity.CreatedBy;
                        model.ModifiedOn  = entity.ModifiedOn;
                        model.ModifiedBy  = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        public bool Create(List <OPDHistoryUpdateModel> model)
        {
            try
            {
                bool isSaved = false;
                using (var db = new HMSEntities())
                {
                    foreach (OPDHistoryUpdateModel item in model)
                    {
                        OPDHistoryUpdate entity = new OPDHistoryUpdate();

                        entity.OPDHistoryId  = item.OPDHistoryId;
                        entity.UpdatedBy     = UserDetailSession.Id;
                        entity.UpdatedField  = item.UpdatedField;
                        entity.UpdatedValue  = item.UpdatedValue;
                        entity.PreviousValue = item.PreviousValue;
                        entity.CreatedOn     = DateTime.Now;

                        db.OPDHistoryUpdates.Add(entity);
                    }


                    db.SaveChanges();

                    isSaved = true;
                }


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

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        RoomType entity = new RoomType();

                        entity.Name        = model.Name;
                        entity.Description = model.Description;
                        entity.IsActive    = true;
                        entity.IsDeleted   = false;
                        entity.CreatedOn   = DateTime.Now;
                        entity.CreatedBy   = UserDetailSession.Id;

                        db.RoomTypes.Add(entity);
                        db.SaveChanges();

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
        public bool Update(LookupModel model)
        {
            try
            {
                bool isSaved = false;

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        UpdateAllSequence(model.Id, model.Sequence.Value, model.PerentId);
                        Status entity = db.Status.Find(model.Id);

                        entity.Name         = model.Name;
                        entity.DepartmentId = model.PerentId;
                        entity.Description  = model.Description;
                        entity.Sequence     = model.Sequence;
                        entity.ModifiedOn   = DateTime.Now;
                        entity.ModifiedBy   = UserDetailSession.Id;

                        db.SaveChanges();

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 9
0
        public List <LookupModel> AdvanceSearch(string searchText)
        {
            try
            {
                List <LookupModel> list = new List <LookupModel>();

                using (var db = new HMSEntities())
                {
                    list = db.Status
                           .Where(t => t.IsActive == true && t.IsDeleted != true && (t.Name.Contains(searchText) || t.Description.Contains(searchText) || t.Department.Name.Contains(searchText)))
                           .OrderByDescending(c => c.CreatedOn)
                           .Select(t => new LookupModel()
                    {
                        Id          = t.Id,
                        Name        = t.Name,
                        Description = t.Description,
                        Sequence    = t.Sequence,
                        PerentId    = t.DepartmentId,
                        PerentName  = t.Department.Name,
                        IsActive    = t.IsActive,
                        IsDeleted   = t.IsDeleted,
                        CreatedOn   = t.CreatedOn,
                        CreatedBy   = t.CreatedBy,
                        ModifiedOn  = t.ModifiedOn,
                        ModifiedBy  = t.ModifiedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 10
0
        public LookupModel GetByName(string name)
        {
            try
            {
                LookupModel model = new LookupModel();
                using (var db = new HMSEntities())
                {
                    RoleCategory entity = db.RoleCategories.FirstOrDefault(t => t.Name == name);
                    if (entity != null)
                    {
                        model.Id          = entity.Id;
                        model.Name        = entity.Name;
                        model.Description = entity.Description;
                        model.IsActive    = entity.IsActive;
                        model.IsDeleted   = entity.IsDeleted;
                        model.CreatedOn   = entity.CreatedOn;
                        model.CreatedBy   = entity.CreatedBy;
                        model.ModifiedOn  = entity.ModifiedOn;
                        model.ModifiedBy  = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 11
0
        public LookupModel GetByParentId(Guid id)
        {
            try
            {
                LookupModel model = new LookupModel();
                using (var db = new HMSEntities())
                {
                    Status entity = db.Status.FirstOrDefault(t => t.DepartmentId == id);
                    if (entity != null)
                    {
                        model.Id          = entity.Id;
                        model.Name        = entity.Name;
                        model.Description = entity.Description;
                        model.Sequence    = entity.Sequence;
                        model.PerentId    = entity.DepartmentId;
                        model.PerentName  = entity.Department.Name;
                        model.IsActive    = entity.IsActive;
                        model.IsDeleted   = entity.IsDeleted;
                        model.CreatedOn   = entity.CreatedOn;
                        model.CreatedBy   = entity.CreatedBy;
                        model.ModifiedOn  = entity.ModifiedOn;
                        model.ModifiedBy  = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 12
0
        public LabDetailModel GetById(Guid id)
        {
            try
            {
                LabDetailModel model = new LabDetailModel();
                using (var db = new HMSEntities())
                {
                    LabDetail entity = db.LabDetails.Find(id);
                    if (entity != null)
                    {
                        model.Id              = entity.Id;
                        model.Name            = entity.Name;
                        model.PathelogistName = entity.PathelogistName;
                        model.Address         = entity.Address;
                        model.PhoneNumber     = entity.PhoneNumber;
                        model.IsInHouse       = entity.IsInHouse;
                        model.IsActive        = entity.IsActive;
                        model.IsDeleted       = entity.IsDeleted;
                        model.CreatedOn       = entity.CreatedOn;
                        model.CreatedBy       = entity.CreatedBy;
                        model.ModifiedOn      = entity.ModifiedOn;
                        model.ModifiedBy      = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 13
0
        public List <LabDetailModel> Get()
        {
            try
            {
                List <LabDetailModel> list = new List <LabDetailModel>();

                using (var db = new HMSEntities())
                {
                    list = db.LabDetails
                           .Where(t => t.IsActive == true && t.IsDeleted != true)
                           .OrderByDescending(c => c.CreatedOn)
                           .Select(t => new LabDetailModel()
                    {
                        Id              = t.Id,
                        Name            = t.Name,
                        PathelogistName = t.PathelogistName,
                        Address         = t.Address,
                        PhoneNumber     = t.PhoneNumber,
                        IsInHouse       = t.IsInHouse,
                        IsActive        = t.IsActive,
                        IsDeleted       = t.IsDeleted,
                        CreatedOn       = t.CreatedOn,
                        CreatedBy       = t.CreatedBy,
                        ModifiedOn      = t.ModifiedOn,
                        ModifiedBy      = t.ModifiedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 14
0
        public bool Update(LabDetailModel model)
        {
            try
            {
                bool isSaved = false;

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        //UpdateAllSequence(model.Id, model.Sequence.Value, model.PerentId);
                        LabDetail entity = db.LabDetails.Find(model.Id);
                        entity.Name            = model.Name;
                        entity.PathelogistName = model.PathelogistName;
                        entity.Address         = model.Address;
                        entity.PhoneNumber     = model.PhoneNumber;
                        entity.IsInHouse       = model.IsInHouse.HasValue ? model.IsInHouse.Value : false;
                        entity.ModifiedOn      = DateTime.Now;
                        entity.ModifiedBy      = UserDetailSession.Id;

                        db.SaveChanges();

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 15
0
        public LookupModel GetById(Guid id)
        {
            try
            {
                LookupModel model = new LookupModel();
                using (var db = new HMSEntities())
                {
                    OPDRate entity = db.OPDRates.Find(id);
                    if (entity != null)
                    {
                        model.Id         = entity.Id;
                        model.Name       = entity.Type;
                        model.Rate       = entity.Rate;
                        model.IsFlag     = entity.IsDefault;
                        model.IsActive   = entity.IsActive;
                        model.IsDeleted  = entity.IsDeleted;
                        model.CreatedOn  = entity.CreatedOn;
                        model.CreatedBy  = entity.CreatedBy;
                        model.ModifiedOn = entity.ModifiedOn;
                        model.ModifiedBy = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 16
0
        public static List <LookupModel> GetStatus(Expression <Func <Status, bool> > predicate)
        {
            try
            {
                List <LookupModel> list = new List <LookupModel>();
                using (var db = new HMSEntities())
                {
                    list = db.Status
                           .Where(t => t.IsActive == true && t.IsDeleted != true).Where(predicate)
                           .Select(t => new LookupModel()
                    {
                        Id          = t.Id,
                        Name        = t.Name,
                        Description = t.Description,
                        Sequence    = t.Sequence,
                        PerentId    = t.DepartmentId,
                        PerentName  = t.Department.Name,
                        IsActive    = t.IsActive,
                        IsDeleted   = t.IsDeleted,
                        CreatedOn   = t.CreatedOn,
                        CreatedBy   = t.CreatedBy,
                        ModifiedOn  = t.ModifiedOn,
                        ModifiedBy  = t.ModifiedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 17
0
        public static List <OPDHistoryUpdateModel> GetPayingPatient(Guid?opdHistoryId)
        {
            try
            {
                List <OPDHistoryUpdateModel> list = new List <OPDHistoryUpdateModel>();

                using (var db = new HMSEntities())
                {
                    var data = db.OPDHistoryUpdates
                               .Where(t => t.OPDHistoryId == opdHistoryId && t.UpdatedField == "PayingAmount")
                               .OrderBy(c => c.CreatedOn).ToList();
                    foreach (OPDHistoryUpdate t in data)
                    {
                        OPDHistoryUpdateModel model = new OPDHistoryUpdateModel();
                        model.Id            = t.Id;
                        model.OPDHistoryId  = t.OPDHistoryId;
                        model.UpdatedBy     = t.UpdatedBy;
                        model.UpdatedName   = t.UpdatedBy.HasValue ? UserDetail.GetNameById(t.UpdatedBy.Value) : string.Empty;
                        model.UpdatedField  = t.UpdatedField;
                        model.UpdatedValue  = t.UpdatedValue;
                        model.PreviousValue = t.PreviousValue;
                        model.CreatedOn     = t.CreatedOn;
                        list.Add(model);
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 18
0
        public List <LookupModel> GetNextStatus(int sequence)
        {
            try
            {
                List <LookupModel> list = new List <LookupModel>();

                using (var db = new HMSEntities())
                {
                    list = db.Status
                           .Where(t => t.IsActive == true && t.IsDeleted != true && t.Sequence == sequence + 1)
                           .OrderByDescending(c => c.Sequence)
                           .Select(t => new LookupModel()
                    {
                        Id          = t.Id,
                        Name        = t.Name,
                        Description = t.Description,
                        Sequence    = t.Sequence,
                        PerentId    = t.DepartmentId,
                        PerentName  = t.Department.Name,
                        IsActive    = t.IsActive,
                        IsDeleted   = t.IsDeleted,
                        CreatedOn   = t.CreatedOn,
                        CreatedBy   = t.CreatedBy,
                        ModifiedOn  = t.ModifiedOn,
                        ModifiedBy  = t.ModifiedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 19
0
        public List <OPDHistoryUpdateModel> GetByParentId(Guid?opdHistoryId)
        {
            try
            {
                List <OPDHistoryUpdateModel> list = new List <OPDHistoryUpdateModel>();

                using (var db = new HMSEntities())
                {
                    list = db.OPDHistoryUpdates
                           .Where(t => t.OPDHistoryId == opdHistoryId)
                           .OrderBy(c => c.CreatedOn)
                           .Select(t => new OPDHistoryUpdateModel()
                    {
                        Id            = t.Id,
                        OPDHistoryId  = t.OPDHistoryId,
                        UpdatedBy     = t.UpdatedBy,
                        UpdatedField  = t.UpdatedField,
                        UpdatedValue  = t.UpdatedValue,
                        PreviousValue = t.PreviousValue,
                        CreatedOn     = t.CreatedOn
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 20
0
        public bool Create(LookupModel model)
        {
            try
            {
                bool isSaved = false;

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        OPDRate entity = new OPDRate();

                        entity.Type      = model.Name;
                        entity.Rate      = (!model.Rate.HasValue) ? 0.00M : model.Rate;
                        entity.IsDefault = model.IsFlag;
                        entity.IsActive  = true;
                        entity.IsDeleted = false;
                        entity.CreatedOn = DateTime.Now;
                        entity.CreatedBy = UserDetailSession.Id;

                        db.OPDRates.Add(entity);
                        db.SaveChanges();

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 21
0
        public bool Update(LookupModel model)
        {
            try
            {
                bool isSaved = false;

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        RoomType entity = db.RoomTypes.Find(model.Id);

                        entity.Name        = model.Name;
                        entity.Description = model.Description;
                        entity.ModifiedOn  = DateTime.Now;
                        entity.ModifiedBy  = UserDetailSession.Id;

                        db.SaveChanges();

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 22
0
        public bool Update(LookupModel model)
        {
            try
            {
                bool isSaved = false;

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        //UpdateAllSequence(model.Id, model.Sequence.Value, model.PerentId);
                        OPDRate entity = db.OPDRates.Find(model.Id);
                        entity.Type       = model.Name;
                        entity.Rate       = (!model.Rate.HasValue) ? 0.00M : model.Rate;
                        entity.IsDefault  = true;
                        entity.ModifiedOn = DateTime.Now;
                        entity.ModifiedBy = UserDetailSession.Id;

                        db.SaveChanges();

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 23
0
        public List <LookupModel> Get()
        {
            try
            {
                List <LookupModel> list = new List <LookupModel>();

                using (var db = new HMSEntities())
                {
                    list = db.RoomTypes
                           .Where(t => t.IsActive == true && t.IsDeleted != true)
                           .OrderByDescending(c => c.CreatedOn)
                           .Select(t => new LookupModel()
                    {
                        Id          = t.Id,
                        Name        = t.Name,
                        Description = t.Description,
                        IsActive    = t.IsActive,
                        IsDeleted   = t.IsDeleted,
                        CreatedOn   = t.CreatedOn,
                        CreatedBy   = t.CreatedBy,
                        ModifiedOn  = t.ModifiedOn,
                        ModifiedBy  = t.ModifiedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 24
0
        public List <LookupModel> AdvanceSearch(string searchText)
        {
            try
            {
                List <LookupModel> list = new List <LookupModel>();

                using (var db = new HMSEntities())
                {
                    //var query = db.Departments.Join(db.PatientDetails, dep => dep.Id, pa => pa.DepartmentId, (cl, or) => new { Department = cl, PatientDetail = or }).Where(x => x.PatientDetail.DepartmentId == new Guid("7683F25D-3441-4AD4-B704-10BD193A30E9")).ToList();
                    list = db.OPDRates
                           .Where(t => t.IsActive == true && t.IsDeleted != true && (t.Type.Contains(searchText)))
                           .OrderByDescending(c => c.CreatedOn)
                           .Select(t => new LookupModel()
                    {
                        Id         = t.Id,
                        Name       = t.Type,
                        Rate       = t.Rate,
                        IsFlag     = t.IsDefault,
                        IsActive   = t.IsActive,
                        IsDeleted  = t.IsDeleted,
                        CreatedOn  = t.CreatedOn,
                        CreatedBy  = t.CreatedBy,
                        ModifiedOn = t.ModifiedOn,
                        ModifiedBy = t.ModifiedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 25
0
        public bool Create(BillHistoryModel model)
        {
            try
            {
                bool isSaved = false;

                if (!IsExist(model))
                {
                    using (var db = new HMSEntities())
                    {
                        BillHistory entity = new BillHistory();

                        entity.PatientId    = model.PatientId;
                        entity.OPDHistoryId = model.OPDHistoryId;
                        entity.PrintCopys   = 1;
                        int?recpNumber = db.BillHistories.Select(t => t.ReceiptNumber).DefaultIfEmpty(0).Max();
                        entity.ReceiptNumber = recpNumber == null ? 1 : recpNumber.Value + 1;
                        entity.CreatedOn     = DateTime.Now;
                        entity.CreatedBy     = UserDetailSession.Id;

                        db.BillHistories.Add(entity);
                        db.SaveChanges();

                        isSaved = true;
                    }
                }


                return(isSaved);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 26
0
        public static List <LookupModel> GetOPDRates(Expression <Func <OPDRate, bool> > predicate)
        {
            try
            {
                List <LookupModel> list = new List <LookupModel>();
                using (var db = new HMSEntities())
                {
                    list = db.OPDRates
                           .Where(t => t.IsActive == true && t.IsDeleted != true).Where(predicate)
                           .Select(t => new LookupModel()
                    {
                        Id         = t.Id,
                        Name       = t.Type,
                        Rate       = t.Rate,
                        IsFlag     = t.IsDefault,
                        IsActive   = t.IsActive,
                        IsDeleted  = t.IsDeleted,
                        CreatedOn  = t.CreatedOn,
                        CreatedBy  = t.CreatedBy,
                        ModifiedOn = t.ModifiedOn,
                        ModifiedBy = t.ModifiedBy
                    }).ToList();
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 27
0
        private bool IsExist(BillHistoryModel model)
        {
            try
            {
                Expression <Func <BillHistory, bool> > predicate = null;

                using (var db = new HMSEntities())
                {
                    /* Build Predicate according to Create or Update */
                    if (!model.Id.HasValue)
                    {
                        predicate = o => o.OPDHistoryId == model.OPDHistoryId;//for Create Record
                    }
                    else
                    {
                        predicate = o => o.OPDHistoryId == model.OPDHistoryId && o.Id != model.Id;//for Update Record Record
                    }

                    /* return is Exist or not */
                    if (db.BillHistories.Any(predicate))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 28
0
        public static LookupModel GetRatesByType(string type)
        {
            try
            {
                LookupModel model = new LookupModel();
                using (var db = new HMSEntities())
                {
                    OPDRate entity = db.OPDRates.FirstOrDefault(t => t.IsActive == true && t.IsDeleted != true && t.Type == type && t.IsDefault == true);
                    if (entity != null)
                    {
                        model.Id         = entity.Id;
                        model.Name       = entity.Type;
                        model.Rate       = entity.Rate;
                        model.IsFlag     = entity.IsDefault;
                        model.IsActive   = entity.IsActive;
                        model.IsDeleted  = entity.IsDeleted;
                        model.CreatedOn  = entity.CreatedOn;
                        model.CreatedBy  = entity.CreatedBy;
                        model.ModifiedOn = entity.ModifiedOn;
                        model.ModifiedBy = entity.ModifiedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 29
0
        public BillHistoryModel GetByOPDId(Guid id)
        {
            try
            {
                BillHistoryModel model = new BillHistoryModel();
                using (var db = new HMSEntities())
                {
                    BillHistory entity = db.BillHistories.Find(id);
                    if (entity != null)
                    {
                        model.Id            = entity.Id;
                        model.PatientId     = entity.PatientId;
                        model.OPDHistoryId  = entity.OPDHistoryId;
                        model.ReceiptNumber = entity.ReceiptNumber;
                        model.PrintCopys    = entity.PrintCopys;
                        model.CreatedOn     = entity.CreatedOn;
                        model.CreatedBy     = entity.CreatedBy;
                        model.LastPrintedOn = entity.LastPrintedOn;
                        model.LastPrintedBy = entity.LastPrintedBy;
                    }
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 30
0
        public List <LookupModel> GetByOPDId(Guid id)
        {
            try
            {
                List <LookupModel> list = new List <LookupModel>();

                using (var db = new HMSEntities())
                {
                    list = db.TPLabPatientMappings.Where(t => t.OPDHistoryId == id)
                           .OrderByDescending(c => c.CreatedOn)
                           .Select(t => new LookupModel()
                    {
                        Id         = t.Id,
                        Name       = t.LabDetail.Name,
                        Rate       = t.Amount,
                        PerentId   = t.OPDHistoryId,
                        CreatedOn  = t.CreatedOn,
                        CreatedBy  = t.Createdby,
                        ModifiedOn = t.ModifiedOn,
                        ModifiedBy = t.ModifiedBy
                    }).ToList();
                }

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