public bool Create(DoctorDetailModel model) { try { bool isSaved = false; //if (!IsExist(model)) //{ using (var db = new HMSEntities()) { DoctorDetail entity = new DoctorDetail(); entity.FullName = model.FullName; entity.Address = model.Address; entity.Gender = model.Gender; entity.PhoneNumber = model.PhoneNumber; entity.MobileNumber = model.MobileNumber; entity.Age = model.Age; entity.IsInHouse = model.IsInHouse; entity.IsCounsalting = model.IsCounsalting; entity.Qualification = model.Qualification; entity.ClinicName = model.ClinicName; entity.ClinicContact = model.ClinicContact; entity.IsActive = true; entity.IsDeleted = false; entity.CreatedOn = DateTime.Now; entity.CreatedBy = UserDetailSession.Id; db.DoctorDetails.Add(entity); db.SaveChanges(); isSaved = true; } // } return(isSaved); } catch (Exception ex) { throw ex; } }
public DoctorDetailModel GetByParentId(Guid id) { try { DoctorDetailModel model = new DoctorDetailModel(); using (var db = new HMSEntities()) { DoctorDetail entity = db.DoctorDetails.FirstOrDefault(); if (entity != null) { model.Id = entity.Id; model.FullName = entity.FullName; model.Address = entity.Address; model.Gender = entity.Gender; model.PhoneNumber = entity.PhoneNumber; model.MobileNumber = entity.MobileNumber; model.Age = entity.Age; model.IsInHouse = entity.IsInHouse; model.IsCounsalting = entity.IsCounsalting; model.Qualification = entity.Qualification; model.ClinicName = entity.ClinicName; model.ClinicContact = entity.ClinicContact; 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; } }
public DashboardModel getDashboardCounts() { try { DashboardModel model = new DashboardModel(); Guid? StatusId = Status.GetIdByName(OPD_STATUS.Waiting.ToString()); using (var db = new HMSEntities()) { DateTime today = DateTime.Today; model.WaitingPatient = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today && t.StatusId == Status.GetIdByName(OPD_STATUS.Waiting.ToString())).Count(); model.InprogressPending = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today && t.StatusId == Status.GetIdByName(OPD_STATUS.Done.ToString())).Count(); model.MadamPatient = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today && t.ConsultingDoctorId == DoctorDetail.GetInHouse("MADAM")).Count(); model.SirPatient = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today && t.ConsultingDoctorId == DoctorDetail.GetInHouse("SIR")).Count(); decimal?opdCollection = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today).Sum(t => t.Amount); decimal?labCollection = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today).Sum(t => t.LabTestingAmount); decimal?ecgCollection = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today).Sum(t => t.ECGAmount); decimal?xrayCollection = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today).Sum(t => t.XRAYAmount); decimal?thirdPartyLab = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today).Sum(t => t.ThirdPartyLabAmoumt); model.OPDCollection = opdCollection != null?Convert.ToDecimal(opdCollection) : Convert.ToDecimal(0.00); model.LabCollection = labCollection != null?Convert.ToDecimal(labCollection) : Convert.ToDecimal(0.00); model.ECGCollection = ecgCollection != null?Convert.ToDecimal(ecgCollection) : Convert.ToDecimal(0.00); model.XRAYCollection = xrayCollection != null?Convert.ToDecimal(xrayCollection) : Convert.ToDecimal(0.00); model.ThirePartyLabCollection = thirdPartyLab != null?Convert.ToDecimal(thirdPartyLab) : Convert.ToDecimal(0.00); model.TotalCollection = model.OPDCollection + model.LabCollection + model.ECGCollection + model.XRAYCollection + model.ThirePartyLabCollection; decimal?paidCollection = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today).Sum(t => t.PaidAmount); decimal?duesCollection = db.OPDHistories.AsEnumerable().Where(t => t.InTime.Value.Date == today).Sum(t => t.DueAmount); model.DuesCollection = duesCollection != null ? duesCollection : Convert.ToDecimal(0.00); model.ReceivedCollection = paidCollection != null ? paidCollection : Convert.ToDecimal(0.00); } return(model); } catch (Exception ex) { throw ex; } }