示例#1
0
        public List <DC_VitalSingsDetails> GetVitalDetails(DC_VitalDetails_Search _objSearch)
        {
            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    var search = from a in context.tbl_VitalSingsDetails select a;
                    if (_objSearch.TestReportID.HasValue)
                    {
                        search = from a in search where a.TestReportID == (_objSearch.TestReportID.HasValue ? _objSearch.TestReportID.Value : Guid.Empty) select a;
                    }
                    if (_objSearch.PatientID.HasValue && _objSearch.PatientID != Guid.Empty)
                    {
                        search = from a in search where a.PatientID == (_objSearch.PatientID.HasValue ? _objSearch.PatientID.Value : Guid.Empty) select a;
                    }

                    int total;

                    total = search.Count();

                    if (_objSearch.PageSize == 0)
                    {
                        _objSearch.PageSize = 10;
                    }

                    int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0);

                    var canPage = skip < total;

                    var result = from a in search
                                 join p in context.tbl_PatientDetails on a.PatientID equals p.ID
                                 orderby a.CreatedDate
                                 select new DC_VitalSingsDetails
                    {
                        TestReportID = a.TestReportID,
                        PatientName  = p.Name,
                        BP           = a.BP,
                        Pluse        = a.Pluse,
                        Temperature  = a.Temperature,
                        Weight       = a.Weight,
                        TestDate     = a.TestDate,
                        CreatedBy    = a.CreatedBy,
                        CreatedDate  = a.CreatedDate,
                        EditedBy     = a.EditedBy,
                        EditedDate   = a.EditedDate
                    };
                    return(result.OrderBy(p => p.CreatedDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#2
0
        public DC_Message AddUpdateVitalSignDetails(DC_VitalSingsDetails _objSave)
        {
            DC_Message _msg = new DC_Message();

            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    if (_objSave.TestReportID != null && _objSave.TestReportID != Guid.Empty) //Edit
                    {
                        var isExist = (from p in context.tbl_VitalSingsDetails
                                       where p.TestReportID != _objSave.TestReportID
                                       select p).Count() == 0 ? false : true;
                    }
                    else //Add
                    {
                        tbl_VitalSingsDetails _objP = new tbl_VitalSingsDetails
                        {
                            TestReportID = Guid.NewGuid(),
                            PatientID    = _objSave.PatientID,
                            BP           = _objSave.BP,
                            Weight       = Convert.ToDecimal(_objSave.Weight),
                            Temperature  = Convert.ToDecimal(_objSave.Temperature),
                            Pluse        = _objSave.Pluse,
                            CreatedBy    = _objSave.CreatedBy,
                            CreatedDate  = DateTime.Now,
                            IsActive     = _objSave.IsActive,
                        };
                        context.tbl_VitalSingsDetails.Add(_objP);
                        if (context.SaveChanges() == 1)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAddedSuccessfully;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                        }
                        else
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strFailed;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                        }
                    }
                }
            }
            catch (Exception)
            {
                _msg.StatusMessage = ReadOnlyMessage.strFailed;
                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
            }
            return(_msg);
        }
示例#3
0
        public DC_Message AddUpdatePatientDetails(DC_PatientDetails _objSave)
        {
            DC_Message _msg = new DC_Message();

            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    if (_objSave.ID != null && _objSave.ID != Guid.Empty) //Edit
                    {
                        var isduplicate = (from p in context.tbl_PatientDetails
                                           where p.ID != _objSave.ID && p.Name == _objSave.Name && p.Mobile == _objSave.Mobile
                                           select p).Count() == 0 ? false : true;

                        if (isduplicate)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAlreadyExist;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Duplicate;
                            return(_msg);
                        }
                        var patient = context.tbl_PatientDetails.Find(_objSave.ID);
                        if (patient != null)
                        {
                            patient.Name       = _objSave.Name;
                            patient.Mobile     = _objSave.Mobile;
                            patient.Age        = _objSave.Age;
                            patient.Address    = _objSave.Address;
                            patient.Occupation = _objSave.Occupation;
                            patient.Gender     = _objSave.Gender;
                            patient.EditedBy   = _objSave.EditedBy;
                            patient.EditedDate = DateTime.Now;
                            patient.IsActive   = _objSave.IsActive;
                            if (context.SaveChanges() == 1)
                            {
                                _msg.StatusMessage = strClassFor + ReadOnlyMessage.strUpdatedSuccessfully;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                            }
                            else
                            {
                                _msg.StatusMessage = strClassFor + ReadOnlyMessage.strFailed;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                            }
                        }
                        else
                        {
                        }
                    }
                    else //Add
                    {
                        var isduplicate = (from p in context.tbl_PatientDetails
                                           where p.Name == _objSave.Name && p.Mobile == _objSave.Mobile
                                           select p).Count() == 0 ? false : true;

                        if (isduplicate)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAlreadyExist;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Duplicate;
                            return(_msg);
                        }

                        tbl_PatientDetails _objP = new tbl_PatientDetails
                        {
                            ID          = Guid.NewGuid(),
                            Name        = _objSave.Name,
                            Mobile      = _objSave.Mobile,
                            Age         = _objSave.Age,
                            Occupation  = _objSave.Occupation,
                            Address     = _objSave.Address,
                            Gender      = _objSave.Gender,
                            CreatedBy   = _objSave.CreatedBy,
                            CreatedDate = DateTime.Now,
                            IsActive    = _objSave.IsActive,
                        };
                        context.tbl_PatientDetails.Add(_objP);
                        if (context.SaveChanges() == 1)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAddedSuccessfully;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                        }
                        else
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strFailed;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                        }
                    }
                }
            }
            catch (Exception)
            {
                _msg.StatusMessage = ReadOnlyMessage.strFailed;
                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
            }
            return(_msg);
        }
示例#4
0
        public List <DC_PatientDetails> GetPatientDetails(DC_PaitentDetails_Search _objSearch)
        {
            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    var search = from a in context.tbl_PatientDetails select a;
                    if (_objSearch.ID.HasValue)
                    {
                        if (_objSearch.ID.Value != Guid.Empty)
                        {
                            Guid _PatientID = Guid.Parse(Convert.ToString(_objSearch.ID));
                            search = from a in search where a.ID == _PatientID select a;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(_objSearch.Name))
                    {
                        search = from a in search where a.Name.Contains(_objSearch.Name) select a;
                    }
                    if (!string.IsNullOrWhiteSpace(_objSearch.MobileNo))
                    {
                        search = from a in search where a.Mobile == _objSearch.MobileNo select a;
                    }
                    int total;

                    total = search.Count();

                    if (_objSearch.PageSize == 0)
                    {
                        _objSearch.PageSize = 10;
                    }

                    int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0);

                    var canPage = skip < total;

                    var result = from a in search
                                 orderby a.Name
                                 select new DC_PatientDetails
                    {
                        ID          = a.ID,
                        Name        = a.Name,
                        Mobile      = a.Mobile,
                        Age         = a.Age,
                        Occupation  = a.Occupation,
                        Address     = a.Address,
                        Gender      = a.Gender,
                        CreatedBy   = a.CreatedBy,
                        CreatedDate = a.CreatedDate,
                        EditedBy    = a.EditedBy,
                        EditedDate  = a.EditedDate,
                        IsActive    = a.IsActive,
                        TotalRecord = total
                    };
                    return(result.OrderBy(p => p.Name).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#5
0
        public DC_Message AddUpdateVitalDetails(DC_VitalSingsDetails _objSave)
        {
            DC_Message _msg = new DC_Message();

            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    if ((_objSave.PatientID != null && _objSave.PatientID != Guid.Empty) && (_objSave.TestReportID != null && _objSave.TestReportID != Guid.Empty)) //Edit
                    {
                        //var isduplicate = (from p in context.tbl_VitalSingsDetails
                        //                   where p.PatientID != _objSave.PatientID && p.TestReportID ==
                        //                   select p).Count() == 0 ? false : true;

                        //if (isduplicate)
                        //{
                        //    _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAlreadyExist;
                        //    _msg.StatusCode = ReadOnlyMessage.StatusCode.Duplicate;
                        //    return _msg;
                        //}
                        var Vital = context.tbl_VitalSingsDetails.Where(p => p.PatientID == _objSave.PatientID && p.TestReportID == _objSave.TestReportID).FirstOrDefault();
                        if (Vital != null)
                        {
                            Vital.TestDate    = _objSave.TestDate;
                            Vital.BP          = _objSave.BP;
                            Vital.Pluse       = _objSave.Pluse;
                            Vital.Weight      = 232;
                            Vital.Temperature = Convert.ToDecimal(_objSave.Temperature);
                            Vital.EditedBy    = _objSave.EditedBy;
                            Vital.EditedDate  = DateTime.Now;
                            Vital.IsActive    = _objSave.IsActive;
                            if (context.SaveChanges() == 1)
                            {
                                _msg.StatusMessage = strClassFor + ReadOnlyMessage.strUpdatedSuccessfully;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                            }
                            else
                            {
                                _msg.StatusMessage = strClassFor + ReadOnlyMessage.strFailed;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                            }
                        }
                        else
                        {
                        }
                    }
                    else //Add
                    {
                        tbl_VitalSingsDetails _objnew = new tbl_VitalSingsDetails();
                        _objnew.TestReportID = Guid.NewGuid();
                        _objnew.TestDate     = _objSave.TestDate;
                        _objnew.PatientID    = _objSave.PatientID;
                        _objnew.BP           = _objSave.BP;
                        _objnew.Pluse        = _objSave.Pluse;
                        _objnew.Weight       = 232;
                        _objnew.Temperature  = Convert.ToDecimal(_objSave.Temperature);
                        _objnew.CreatedBy    = _objSave.CreatedBy;
                        _objnew.CreatedDate  = DateTime.Now;
                        _objnew.IsActive     = _objSave.IsActive;
                        context.tbl_VitalSingsDetails.Add(_objnew);
                        if (context.SaveChanges() == 1)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAddedSuccessfully;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                        }
                        else
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strFailed;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _msg.StatusMessage = ReadOnlyMessage.strFailed;
                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
            }
            return(_msg);
        }
        public DC_Message AddUpdateFileDetails(DC_FileUploadDetails _objSave)
        {
            DC_Message _msg = new DC_Message();

            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    if (_objSave.FileUploadID != null && _objSave.FileUploadID != Guid.Empty) //Edit
                    {
                        var isduplicate = (from p in context.tbl_FileUploadDetails
                                           where p.FileUploadID != _objSave.FileUploadID && p.PatientID == _objSave.PatientID && p.TestReportID == _objSave.TestReportID
                                           select p).Count() == 0 ? false : true;

                        if (isduplicate)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAlreadyExist;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Duplicate;
                            return(_msg);
                        }
                        var FileUpload = context.tbl_FileUploadDetails.Find(_objSave.TestReportID);
                        if (FileUpload != null)
                        {
                            FileUpload.TestName        = _objSave.TestName;
                            FileUpload.TestDate        = _objSave.TestDate;
                            FileUpload.TestType        = _objSave.TestType;
                            FileUpload.FilePath        = _objSave.FilePath;
                            FileUpload.FileDispalyName = _objSave.FileDispalyName;
                            FileUpload.EditedBy        = _objSave.EditedBy;
                            FileUpload.EditedDate      = DateTime.Now;
                            FileUpload.IsActive        = _objSave.IsActive;
                            if (context.SaveChanges() == 1)
                            {
                                _msg.StatusMessage = strClassFor + ReadOnlyMessage.strUpdatedSuccessfully;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                            }
                            else
                            {
                                _msg.StatusMessage = strClassFor + ReadOnlyMessage.strFailed;
                                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                            }
                        }
                        else
                        {
                        }
                    }
                    else //Add
                    {
                        var isduplicate = (from p in context.tbl_FileUploadDetails
                                           where p.FileUploadID != _objSave.FileUploadID && p.PatientID == _objSave.PatientID && p.TestReportID == _objSave.TestReportID
                                           select p).Count() == 0 ? false : true;

                        if (isduplicate)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAlreadyExist;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Duplicate;
                            return(_msg);
                        }

                        var patientID = (from x in context.tbl_VitalSingsDetails where x.TestReportID == _objSave.TestReportID select x.PatientID).FirstOrDefault();

                        tbl_FileUploadDetails _objP = new tbl_FileUploadDetails
                        {
                            FileUploadID    = Guid.NewGuid(),
                            PatientID       = _objSave.PatientID,
                            TestReportID    = _objSave.TestReportID,
                            FileDispalyName = _objSave.FileDispalyName,
                            FilePath        = _objSave.FilePath,
                            FileName        = _objSave.FileName,
                            TestName        = _objSave.TestName,
                            TestDate        = _objSave.TestDate,
                            TestType        = _objSave.TestType,
                            CreatedBy       = _objSave.CreatedBy,
                            CreatedDate     = DateTime.Now,
                            IsActive        = _objSave.IsActive,
                        };
                        context.tbl_FileUploadDetails.Add(_objP);
                        if (context.SaveChanges() == 1)
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strAddedSuccessfully;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Success;
                        }
                        else
                        {
                            _msg.StatusMessage = strClassFor + ReadOnlyMessage.strFailed;
                            _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
                        }
                    }
                }
            }
            catch (Exception)
            {
                _msg.StatusMessage = ReadOnlyMessage.strFailed;
                _msg.StatusCode    = ReadOnlyMessage.StatusCode.Failed;
            }
            return(_msg);
        }
        public List <DC_FileUploadDetails> GetTestFileDetails(DC_FileUploadDetails_Search _objSearch)
        {
            try
            {
                using (CLMS_DBEntities context = new CLMS_DBEntities())
                {
                    var search = from a in context.tbl_FileUploadDetails select a;
                    if (_objSearch.FileUploadID.HasValue)
                    {
                        if (_objSearch.FileUploadID.Value != Guid.Empty)
                        {
                            Guid _FileUploadID = Guid.Parse(Convert.ToString(_objSearch.FileUploadID));
                            search = from a in search where a.FileUploadID == _FileUploadID select a;
                        }
                    }
                    if (_objSearch.PatientID.HasValue)
                    {
                        if (_objSearch.PatientID.Value != Guid.Empty)
                        {
                            Guid _PatientID = Guid.Parse(Convert.ToString(_objSearch.PatientID));
                            search = from a in search where a.PatientID == _PatientID select a;
                        }
                    }
                    if (_objSearch.TestReportID.HasValue)
                    {
                        if (_objSearch.TestReportID.Value != Guid.Empty)
                        {
                            Guid _TestReportID = Guid.Parse(Convert.ToString(_objSearch.TestReportID));
                            search = from a in search where a.TestReportID == _TestReportID select a;
                        }
                    }
                    //if (!string.IsNullOrWhiteSpace(_objSearch.FileName))
                    //{
                    //    search = from a in search where a.Name.Contains(_objSearch.Name) select a;
                    //}
                    //if (!string.IsNullOrWhiteSpace(_objSearch.MobileNo))
                    //{
                    //    search = from a in search where a.Mobile == _objSearch.MobileNo select a;
                    //}

                    int total;

                    total = search.Count();

                    if (_objSearch.PageSize == 0)
                    {
                        _objSearch.PageSize = 10;
                    }

                    int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0);

                    var canPage = skip < total;

                    var result = from a in search
                                 orderby a.TestDate
                                 select new DC_FileUploadDetails
                    {
                        TestReportID    = a.TestReportID.HasValue ? a.TestReportID.Value : Guid.Empty,
                        TestName        = a.TestName,
                        TestType        = a.TestType,
                        FileDispalyName = a.FileDispalyName,
                        FileName        = a.FileName,
                        PatientID       = a.PatientID.HasValue ? a.PatientID.Value : Guid.Empty,
                        FilePath        = a.FilePath,
                        TestDate        = a.TestDate,
                        CreatedBy       = a.CreatedBy,
                        CreatedDate     = a.CreatedDate,
                        EditedBy        = a.EditedBy,
                        EditedDate      = a.EditedDate,
                        IsActive        = a.IsActive.HasValue ? a.IsActive.Value : false,
                        TotalRecord     = total
                    };
                    return(result.OrderBy(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }