public List <DC_BloodCountReports> GetBloodCountReports(DC_BloodCountReports_Search _objSearch) { try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { var search = from x in context.tbl_BloodCountReports select x; if (_objSearch.PatientID.HasValue) { search = from x in search where x.PatientID == _objSearch.PatientID.Value select x; } if (_objSearch.BCR_TestReportID.HasValue) { search = from x in search where x.BCR_TestReportID == _objSearch.BCR_TestReportID.Value select x; } int total; total = search.Count(); _objSearch.PageSize = _objSearch.PageSize == 0 ? 10 : _objSearch.PageSize; int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0); var canPage = skip < total; var result = (from rs in search orderby rs.TestDate select new DC_BloodCountReports { BCR_TestReportID = rs.BCR_TestReportID, PatientID = rs.PatientID, TestDate = rs.TestDate, CBC = rs.CBC, WBC = rs.WBC, PLATELET = rs.PLATELET, MCV = rs.MCV, Neutrophils = rs.Neutrophils, Lymphocytes = rs.Lymphocytes, Eosinophil = rs.Eosinophil, Monocytes = rs.Monocytes, Basophils = rs.Basophils, ESR = rs.ESR, CreatedBy = rs.CreatedBy, CreatedDate = rs.CreatedDate, EditedBy = rs.EditedBy, EditedDate = rs.EditedDate, IsActive = rs.IsActive ?? false, TotalRecord = total }); return(result.OrderByDescending(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList()); } } catch (Exception ex) { throw; } }
public List <DC_LiverFunctionReports> GetLiverFunReports(DC_LiverFunctionReports_Search _objSearch) { try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { var search = from x in context.tbl_LiverFunctionReports select x; if (_objSearch.PatientID.HasValue) { search = from x in search where x.PatientID == _objSearch.PatientID.Value select x; } if (_objSearch.LFR_TestReportID.HasValue) { search = from x in search where x.LFR_TestReportID == _objSearch.LFR_TestReportID.Value select x; } int total; total = search.Count(); _objSearch.PageSize = _objSearch.PageSize == 0 ? 10 : _objSearch.PageSize; int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0); var canPage = skip < total; var result = (from rs in search orderby rs.TestDate select new DC_LiverFunctionReports { LFR_TestReportID = rs.LFR_TestReportID, TestDate = rs.TestDate, PatientID = rs.PatientID, CreatedBy = rs.CreatedBy, CreatedDate = rs.CreatedDate, EditedBy = rs.EditedBy, EditedDate = rs.EditedDate, IsActive = rs.IsActive ?? false, SBilirubin = rs.SBilirubin, SGOT = rs.SGOT, SGPT = rs.SGPT, GGT = rs.GGT, SAlkPhosphate = rs.SAlkPhosphate, SProtein = rs.SProtein, Albumin = rs.Albumin, Globulin = rs.Globulin, AGRatio = rs.AGRatio, TotalRecord = total }); return(result.OrderByDescending(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList()); } } catch (Exception ex) { throw; } }
public List <DC_BoneProfileReports> GetBoneProfileReports(DC_BoneProfileReports_Search _objSearch) { try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { var search = from x in context.tbl_BoneProfileReports select x; if (_objSearch.PatientID.HasValue) { search = from x in search where x.PatientID == _objSearch.PatientID.Value select x; } if (_objSearch.BPR_TestReportID.HasValue) { search = from x in search where x.BPR_TestReportID == _objSearch.BPR_TestReportID.Value select x; } int total; total = search.Count(); _objSearch.PageSize = _objSearch.PageSize == 0 ? 10 : _objSearch.PageSize; int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0); var canPage = skip < total; var result = (from rs in search orderby rs.TestDate select new DC_BoneProfileReports { BPR_TestReportID = rs.BPR_TestReportID, VitaminD = rs.VitaminD, ParathyroidHormone = rs.ParathyroidHormone, PatientID = rs.PatientID, Calcium = rs.Calcium, Magnesium = rs.Magnesium, Neutrophils = rs.Neutrophils, TestDate = rs.TestDate, CreatedBy = rs.CreatedBy, CreatedDate = rs.CreatedDate, EditedBy = rs.EditedBy, EditedDate = rs.EditedDate, IsActive = rs.IsActive ?? false, TotalRecord = total }); return(result.OrderByDescending(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList()); } } catch (Exception ex) { throw; } }
public List <DC_LipidProfileReports> GetLipidProfileReports(DC_LipidProfileReports_Search _objSearch) { try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { var search = from x in context.tbl_LipidProfileReports select x; if (_objSearch.PatientID.HasValue) { search = from x in search where x.PatientID == _objSearch.PatientID.Value select x; } if (_objSearch.LPR_TestReportID.HasValue) { search = from x in search where x.LPR_TestReportID == _objSearch.LPR_TestReportID.Value select x; } int total; total = search.Count(); _objSearch.PageSize = _objSearch.PageSize == 0 ? 10 : _objSearch.PageSize; int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0); var canPage = skip < total; var result = (from rs in search orderby rs.TestDate select new DC_LipidProfileReports { LPR_TestReportID = rs.LPR_TestReportID, TestDate = rs.TestDate, CreatedBy = rs.CreatedBy, CreatedDate = rs.CreatedDate, EditedBy = rs.EditedBy, EditedDate = rs.EditedDate, IsActive = rs.IsActive ?? false, TChol = rs.TChol, Triglycerides = rs.Triglycerides, HDLChol = rs.HDLChol, LDLChol = rs.LDLChol, TCholHDL = rs.TCholHDL, LDLHDLRatio = rs.LDLHDLRatio, TotalRecord = total }); return(result.OrderByDescending(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList()); } } catch (Exception ex) { throw; } }
public List <DC_VitalSignsReports> GetVitalSingsReports(DC_VitalSignsReports_Search _objSearch) { try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { var search = from x in context.tbl_VitalSignsReports select x; if (_objSearch.PatientID.HasValue) { search = from x in search where x.PatientID == _objSearch.PatientID.Value select x; } if (_objSearch.VSR_TestReportID.HasValue) { search = from x in search where x.VSR_TestReportID == _objSearch.VSR_TestReportID.Value select x; } int total; total = search.Count(); _objSearch.PageSize = _objSearch.PageSize == 0 ? 10 : _objSearch.PageSize; int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0); var canPage = skip < total; var result = (from rs in search orderby rs.TestDate select new DC_VitalSignsReports { VSR_TestReportID = rs.VSR_TestReportID, Weight = rs.Weight.ToString(), DBP = rs.DBP, PatientID = rs.PatientID, Pulse = rs.Pulse, SBP = rs.SBP, TestDate = rs.TestDate, CreatedBy = rs.CreatedBy, CreatedDate = rs.CreatedDate, EditedBy = rs.EditedBy, EditedDate = rs.EditedDate, IsActive = rs.IsActive ?? false, TotalRecord = total }); return(result.OrderByDescending(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList()); } } catch (Exception ex) { throw; } }
public List <DC_KidneyFunctionsReports> GetKidneyFunctionsReports(DC_KidneyFunctionsReports_Search _objSearch) { try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { var search = from x in context.tbl_KidneyFunctionsReports select x; if (_objSearch.PatientID.HasValue) { search = from x in search where x.PatientID == _objSearch.PatientID.Value select x; } if (_objSearch.KFR_TestReportID.HasValue) { search = from x in search where x.KFR_TestReportID == _objSearch.KFR_TestReportID.Value select x; } int total; total = search.Count(); _objSearch.PageSize = _objSearch.PageSize == 0 ? 10 : _objSearch.PageSize; int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0); var canPage = skip < total; var result = (from rs in search orderby rs.TestDate select new DC_KidneyFunctionsReports { KFR_TestReportID = rs.KFR_TestReportID, SCreatinine = rs.SCreatinine, UrineACR = rs.UrineACR, Urea = rs.Urea, Bun = rs.Bun, SUricAcid = rs.SUricAcid, TestDate = rs.TestDate, CreatedBy = rs.CreatedBy, CreatedDate = rs.CreatedDate, EditedBy = rs.EditedBy, EditedDate = rs.EditedDate, IsActive = rs.IsActive ?? false, TotalRecord = total }); return(result.OrderByDescending(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList()); } } catch (Exception ex) { throw; } }
public List <DC_ElectrolytesReports> GetElectrolytesReports(DC_ElectrolytesReports_Search _objSearch) { try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { var search = from x in context.tbl_ElectrolytesReports select x; if (_objSearch.PatientID.HasValue) { search = from x in search where x.PatientID == _objSearch.PatientID.Value select x; } if (_objSearch.ER_TestReportID.HasValue) { search = from x in search where x.ER_TestReportID == _objSearch.ER_TestReportID.Value select x; } int total; total = search.Count(); _objSearch.PageSize = _objSearch.PageSize == 0 ? 10 : _objSearch.PageSize; int skip = (_objSearch.PageNo ?? 0) * (_objSearch.PageSize ?? 0); var canPage = skip < total; var result = (from rs in search orderby rs.TestDate select new DC_ElectrolytesReports { ER_TestReportID = rs.ER_TestReportID, PatientID = rs.PatientID, TestDate = rs.TestDate, CreatedBy = rs.CreatedBy, CreatedDate = rs.CreatedDate, EditedBy = rs.EditedBy, EditedDate = rs.EditedDate, IsActive = rs.IsActive ?? false, TotalRecord = total, Sodium = rs.Sodium, Potassium = rs.Potassium, Chloride = rs.Chloride }); return(result.OrderByDescending(p => p.TestDate).Skip(skip).Take((_objSearch.PageSize ?? total)).ToList()); } } catch (Exception ex) { throw; } }
public DC_Message AddUpdateVitalSingsReports(DC_VitalSignsReports _objSave) { DC_Message _msg = new DC_Message(); try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { if (_objSave.VSR_TestReportID != null && _objSave.VSR_TestReportID != Guid.Empty) { var isDuplicate = (from x in context.tbl_VitalSignsReports where x.VSR_TestReportID != _objSave.VSR_TestReportID && x.PatientID == x.PatientID && x.TestDate == _objSave.TestDate select x).Count() == 0 ? false : true; if (isDuplicate) { _msg.StatusMessage = "Report " + ReadOnlyMessage.strAlreadyExist; _msg.StatusCode = ReadOnlyMessage.StatusCode.Duplicate; return(_msg); } var report = context.tbl_VitalSignsReports.Find(_objSave.VSR_TestReportID); if (report != null) { report.TestDate = _objSave.TestDate; report.IsActive = _objSave.IsActive; report.EditedBy = _objSave.EditedBy; report.EditedDate = _objSave.EditedDate; report.Pulse = _objSave.Pulse; report.SBP = _objSave.SBP; report.DBP = _objSave.DBP; report.Weight = Convert.ToDecimal(_objSave.Weight); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strUpdatedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } else { tbl_VitalSignsReports _objnew = new tbl_VitalSignsReports(); _objnew.VSR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.Weight = Convert.ToDecimal(_objSave.Weight); _objnew.SBP = _objSave.SBP; _objnew.DBP = _objSave.DBP; _objnew.Pulse = _objSave.Pulse; _objnew.IsActive = _objSave.IsActive; _objnew.TestDate = _objSave.TestDate; context.tbl_VitalSignsReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } else { tbl_VitalSignsReports _objnew = new tbl_VitalSignsReports(); _objnew.VSR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.Weight = Convert.ToDecimal(_objSave.Weight); _objnew.SBP = _objSave.SBP; _objnew.DBP = _objSave.DBP; _objnew.Pulse = _objSave.Pulse; _objnew.IsActive = _objSave.IsActive; _objnew.TestDate = _objSave.TestDate; context.tbl_VitalSignsReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } } catch (Exception ex) { } return(_msg); }
public DC_Message AddUpdateKidneyFunctionsReports(DC_KidneyFunctionsReports _objSave) { DC_Message _msg = new DC_Message(); try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { if (_objSave.KFR_TestReportID != null && _objSave.KFR_TestReportID != Guid.Empty) { var isDuplicate = (from x in context.tbl_KidneyFunctionsReports where x.KFR_TestReportID != _objSave.KFR_TestReportID && x.PatientID == x.PatientID && x.TestDate == _objSave.TestDate select x).Count() == 0 ? false : true; if (isDuplicate) { _msg.StatusMessage = "Report " + ReadOnlyMessage.strAlreadyExist; _msg.StatusCode = ReadOnlyMessage.StatusCode.Duplicate; return(_msg); } var report = context.tbl_KidneyFunctionsReports.Find(_objSave.KFR_TestReportID); if (report != null) { report.TestDate = _objSave.TestDate; report.IsActive = _objSave.IsActive; report.EditedBy = _objSave.EditedBy; report.EditedDate = _objSave.EditedDate; report.KFR_TestReportID = _objSave.KFR_TestReportID; report.SCreatinine = _objSave.SCreatinine; report.UrineACR = _objSave.UrineACR; report.Urea = _objSave.Urea; report.Bun = _objSave.Bun; report.SUricAcid = _objSave.SUricAcid; if (context.SaveChanges() == 1) { _msg.StatusMessage = "Kidney Function Report has been" + ReadOnlyMessage.strUpdatedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Kidney Function Report has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } else { tbl_KidneyFunctionsReports _objnew = new tbl_KidneyFunctionsReports(); _objnew.KFR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.TestDate = _objSave.TestDate; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.KFR_TestReportID = _objSave.KFR_TestReportID; _objnew.SCreatinine = _objSave.SCreatinine; _objnew.UrineACR = _objSave.UrineACR; _objnew.Urea = _objSave.Urea; _objnew.Bun = _objSave.Bun; _objnew.SUricAcid = _objSave.SUricAcid; context.tbl_KidneyFunctionsReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Kidney Function Report has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Kidney Function Report has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } else { tbl_KidneyFunctionsReports _objnew = new tbl_KidneyFunctionsReports(); _objnew.KFR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.TestDate = _objSave.TestDate; _objnew.KFR_TestReportID = _objSave.KFR_TestReportID; _objnew.SCreatinine = _objSave.SCreatinine; _objnew.UrineACR = _objSave.UrineACR; _objnew.Urea = _objSave.Urea; _objnew.Bun = _objSave.Bun; _objnew.SUricAcid = _objSave.SUricAcid; context.tbl_KidneyFunctionsReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Kidney Function Report has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Kidney Function Report has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } } catch (Exception ex) { } return(_msg); }
public DC_Message AddUpdateBloodCountReports(DC_BloodCountReports _objSave) { DC_Message _msg = new DC_Message(); try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { if (_objSave.BCR_TestReportID != null && _objSave.BCR_TestReportID != Guid.Empty) { var isDuplicate = (from x in context.tbl_BloodCountReports where x.BCR_TestReportID != _objSave.BCR_TestReportID && x.PatientID == x.PatientID && x.TestDate == _objSave.TestDate select x).Count() == 0 ? false : true; if (isDuplicate) { _msg.StatusMessage = "Report " + ReadOnlyMessage.strAlreadyExist; _msg.StatusCode = ReadOnlyMessage.StatusCode.Duplicate; return(_msg); } var report = context.tbl_BloodCountReports.Find(_objSave.BCR_TestReportID); if (report != null) { report.TestDate = _objSave.TestDate; report.IsActive = _objSave.IsActive; report.EditedBy = _objSave.EditedBy; report.EditedDate = _objSave.EditedDate; report.CBC = _objSave.CBC; report.WBC = _objSave.WBC; report.PLATELET = _objSave.PLATELET; report.MCV = _objSave.MCV; report.Neutrophils = _objSave.Neutrophils; report.Lymphocytes = _objSave.Lymphocytes; report.Eosinophil = _objSave.Eosinophil; report.Monocytes = _objSave.Monocytes; report.Basophils = _objSave.Basophils; report.ESR = _objSave.ESR; if (context.SaveChanges() == 1) { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strUpdatedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } else { tbl_BloodCountReports _objnew = new tbl_BloodCountReports(); _objnew.BCR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; report.TestDate = _objSave.TestDate; report.IsActive = _objSave.IsActive; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; report.CBC = _objSave.CBC; report.WBC = _objSave.WBC; report.PLATELET = _objSave.PLATELET; report.MCV = _objSave.MCV; report.Neutrophils = _objSave.Neutrophils; report.Lymphocytes = _objSave.Lymphocytes; report.Eosinophil = _objSave.Eosinophil; report.Monocytes = _objSave.Monocytes; report.Basophils = _objSave.Basophils; report.ESR = _objSave.ESR; context.tbl_BloodCountReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } else { tbl_BloodCountReports _objnew = new tbl_BloodCountReports(); _objnew.BCR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.TestDate = _objSave.TestDate; _objnew.IsActive = _objSave.IsActive; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.CBC = _objSave.CBC; _objnew.WBC = _objSave.WBC; _objnew.PLATELET = _objSave.PLATELET; _objnew.MCV = _objSave.MCV; _objnew.Neutrophils = _objSave.Neutrophils; _objnew.Lymphocytes = _objSave.Lymphocytes; _objnew.Eosinophil = _objSave.Eosinophil; _objnew.Monocytes = _objSave.Monocytes; _objnew.Basophils = _objSave.Basophils; _objnew.ESR = _objSave.ESR; context.tbl_BloodCountReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Vital Sign has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } } catch (Exception ex) { } return(_msg); }
public DC_Message AddUpdateLiverFunReports(DC_LiverFunctionReports _objSave) { DC_Message _msg = new DC_Message(); try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { if (_objSave.LFR_TestReportID != null && _objSave.LFR_TestReportID != Guid.Empty) { var isDuplicate = (from x in context.tbl_LiverFunctionReports where x.LFR_TestReportID != _objSave.LFR_TestReportID && x.PatientID == x.PatientID && x.TestDate == _objSave.TestDate select x).Count() == 0 ? false : true; if (isDuplicate) { _msg.StatusMessage = "Report " + ReadOnlyMessage.strAlreadyExist; _msg.StatusCode = ReadOnlyMessage.StatusCode.Duplicate; return(_msg); } var report = context.tbl_LiverFunctionReports.Find(_objSave.LFR_TestReportID); if (report != null) { report.TestDate = _objSave.TestDate; report.IsActive = _objSave.IsActive; report.EditedBy = _objSave.EditedBy; report.EditedDate = _objSave.EditedDate; report.SBilirubin = _objSave.SBilirubin; report.SGOT = _objSave.SGOT; report.SGPT = _objSave.SGPT; report.GGT = _objSave.GGT; report.SAlkPhosphate = _objSave.SAlkPhosphate; report.SProtein = _objSave.SProtein; report.Albumin = _objSave.Albumin; report.Globulin = _objSave.Globulin; report.AGRatio = _objSave.AGRatio; if (context.SaveChanges() == 1) { _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strUpdatedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } else { tbl_LiverFunctionReports _objnew = new tbl_LiverFunctionReports(); _objnew.LFR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.IsActive = _objSave.IsActive; _objnew.TestDate = _objSave.TestDate; _objnew.SBilirubin = _objSave.SBilirubin; _objnew.SGOT = _objSave.SGOT; _objnew.SGPT = _objSave.SGPT; _objnew.GGT = _objSave.GGT; _objnew.SAlkPhosphate = _objSave.SAlkPhosphate; _objnew.SProtein = _objSave.SProtein; _objnew.Albumin = _objSave.Albumin; _objnew.Globulin = _objSave.Globulin; _objnew.AGRatio = _objSave.AGRatio; context.tbl_LiverFunctionReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } else { tbl_LiverFunctionReports _objnew = new tbl_LiverFunctionReports(); _objnew.LFR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.IsActive = _objSave.IsActive; _objnew.TestDate = _objSave.TestDate; _objnew.SBilirubin = _objSave.SBilirubin; _objnew.SGOT = _objSave.SGOT; _objnew.SGPT = _objSave.SGPT; _objnew.GGT = _objSave.GGT; _objnew.SAlkPhosphate = _objSave.SAlkPhosphate; _objnew.SProtein = _objSave.SProtein; _objnew.Albumin = _objSave.Albumin; _objnew.Globulin = _objSave.Globulin; _objnew.AGRatio = _objSave.AGRatio; context.tbl_LiverFunctionReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Liver Function has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } } catch (Exception ex) { } return(_msg); }
public DC_Message AddUpdateThyroidProfileReports(DC_ThyroidProfileReports _objSave) { DC_Message _msg = new DC_Message(); try { using (CLMS_DBEntities context = new CLMS_DBEntities()) { if (_objSave.TPR_TestReportID != null && _objSave.TPR_TestReportID != Guid.Empty) { var isDuplicate = (from x in context.tbl_ThyroidProfileReports where x.TPR_TestReportID != _objSave.TPR_TestReportID && x.PatientID == x.PatientID && x.TestDate == _objSave.TestDate select x).Count() == 0 ? false : true; if (isDuplicate) { _msg.StatusMessage = "Report " + ReadOnlyMessage.strAlreadyExist; _msg.StatusCode = ReadOnlyMessage.StatusCode.Duplicate; return(_msg); } var report = context.tbl_ThyroidProfileReports.Find(_objSave.TPR_TestReportID); if (report != null) { report.TestDate = _objSave.TestDate; report.IsActive = _objSave.IsActive; report.EditedBy = _objSave.EditedBy; report.EditedDate = _objSave.EditedDate; report.FreeT3 = _objSave.FreeT3; report.FreeT4 = _objSave.FreeT4; report.TSH = _objSave.TSH; if (context.SaveChanges() == 1) { _msg.StatusMessage = "Thyroid Profile Reports has been" + ReadOnlyMessage.strUpdatedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Thyroid Profile Reports has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } else { tbl_ThyroidProfileReports _objnew = new tbl_ThyroidProfileReports(); _objnew.TPR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.FreeT3 = _objSave.FreeT3; _objnew.FreeT4 = _objSave.FreeT4; _objnew.TSH = _objSave.TSH; _objnew.IsActive = _objSave.IsActive; _objnew.TestDate = _objSave.TestDate; context.tbl_ThyroidProfileReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Thyroid Profile Reports has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Thyroid Profile Reports has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } else { tbl_ThyroidProfileReports _objnew = new tbl_ThyroidProfileReports(); _objnew.TPR_TestReportID = Guid.NewGuid(); _objnew.PatientID = _objSave.PatientID; _objnew.CreatedBy = _objSave.CreatedBy; _objnew.CreatedDate = _objSave.CreatedDate; _objnew.FreeT3 = _objSave.FreeT3; _objnew.FreeT4 = _objSave.FreeT4; _objnew.TSH = _objSave.TSH; _objnew.IsActive = _objSave.IsActive; _objnew.TestDate = _objSave.TestDate; context.tbl_ThyroidProfileReports.Add(_objnew); if (context.SaveChanges() == 1) { _msg.StatusMessage = "Thyroid Profile Reports has been" + ReadOnlyMessage.strAddedSuccessfully; _msg.StatusCode = ReadOnlyMessage.StatusCode.Success; } else { _msg.StatusMessage = "Thyroid Profile Reports has been" + ReadOnlyMessage.strFailed; _msg.StatusCode = ReadOnlyMessage.StatusCode.Failed; } } } } catch (Exception ex) { } return(_msg); }