public bool SaveTreatmentMatrail(IEnumerable <MatrailToSaveViewModel> matrailList, int treatmentID) { int count = 0; using (Entities.Entities ctx = new Entities.Entities()) { foreach (var item in matrailList) { MaterialTreatment materialTreatment = ctx.MaterialTreatments.Where(x => x.TeratmentID == treatmentID && x.MaterialID == item.MatrailID).FirstOrDefault(); if (materialTreatment == null) { materialTreatment = ctx.MaterialTreatments.Create(); materialTreatment.TeratmentID = treatmentID; materialTreatment.MaterialID = item.MatrailID; materialTreatment.MaterialCost = ctx.Materials.Find(item.MatrailID).MaterialCost; materialTreatment.Quantity = item.Quantity; ctx.MaterialTreatments.Add(materialTreatment); } else { materialTreatment.Quantity = item.Quantity; ctx.Entry(materialTreatment).State = System.Data.Entity.EntityState.Modified; } count += ctx.SaveChanges(); } } return(count > 0 ? true : false); }
public SupplierInvestmentManager() { _aRepository = new GenericRepositoryMms <SupplierInvestment>(); _aSupplierRepository = new GenericRepositoryMms <Supplier>(); _aModel = new ResponseModel(); _db = new Entities.Entities(); }
public PeriodController() { var entities = new Entities.Entities(); PeriodRepository = new PeriodRepository(entities); YearRepository = new YearRepository(entities); }
public decimal?GetAllCostTreatmentByClinicByPeriod(int clinicID, DateTime from, DateTime to) { decimal?TotalCost = 0; decimal treatmentCost = 0; decimal?opperationCost = 0; decimal?materialCost = 0; decimal?customMatrialCost = 0; using (Entities.Entities ctx = new Entities.Entities()) { //customMatrialCost = ctx.CustomMaterials.Where(c => c.ClinicID == clinicID && c.RequestDate >= from && c.RequestDate <= to ).ToList().Select(c => c.Cost).Sum(); IEnumerable <Treatment> patientTreatmentList = ctx.Treatments.Join (ctx.Appointments, tr => tr.AppointmentID, a => a.AppointmentID, (tr, a) => new { Treatment = tr, Appointment = a } ).Select(ta => ta.Treatment).Where(t => t.ClinicID == clinicID && t.Appointment.Start_date >= from && t.Appointment.Start_date <= to).ToList(); treatmentCost = patientTreatmentList.Select(t => t.TeratmentCost).Sum(); opperationCost = patientTreatmentList.Select(t => t.OpperationCost).Sum(); foreach (Treatment treatment in patientTreatmentList) { IEnumerable <MaterialTreatment> matrialTreatmentList = treatment.MaterialTreatments; foreach (MaterialTreatment matrialTreatment in matrialTreatmentList) { materialCost += matrialTreatment.MaterialCost * (int)matrialTreatment.Quantity; } } TotalCost = treatmentCost + opperationCost + materialCost + customMatrialCost; } return(TotalCost); }
public bool addTreatmentList(IEnumerable <TreatmentPresntViewModel> treatmentList, int AppointmentID, int DoctorID, int PatientID, int clinecID) { // enhance int count = 0; using (Entities.Entities ctx = new Entities.Entities()) { foreach (var item in treatmentList) { Treatment treatment = ctx.Treatments.Create(); treatment.PatientID = PatientID; treatment.DoctorID = DoctorID; treatment.ClinicID = clinecID; treatment.AppointmentID = AppointmentID; treatment.OpperationID = item.OpperationID; treatment.TeratmentCost = item.TeratmentCost; treatment.ToothNumber = item.toothNumber; treatment.ToothSideNumber = item.toothSideNumber; treatment.Description = item.Description; treatment.OpperationCost = ctx.opperations.Find(item.OpperationID).Price; ctx.Treatments.Add(treatment); count += ctx.SaveChanges(); } } return(count > 0 ? true : false); }
// if the patient id is not exist return first patient public PatientMiniData getPatinetMiniInfo(int patientID) { PatientMiniData patientMini = null; using (Entities.Entities ctx = new Entities.Entities()) { Patient patient = ctx.Patients.Find(patientID); if (patient == null) { patient = ctx.Patients.FirstOrDefault(); } if (patient != null) { patientMini = new PatientMiniData { PatientID = patient.PatientID, Name = patient.Name, Phone = patient.Phone, Mobile = patient.Mobile, Address = patient.Address } } ; //var patientIQ = ctx.Patients; //patient = (from p in patientIQ // where p.PatientID == patientID // select new PatientMiniData { PatientID = p.PatientID, Name = p.Name, Mobile = p.Mobile, Phone = p.Phone, Address = p.Address }).; } return(patientMini); }
public CoaManager() { _aGlAccount = new GenericRepositoryAccount <A_GlAccount>(); _coaVM = new A_GlAccountViewModel(); _aModel = new ResponseModel(); _db = new Entities.Entities(); }
public bool alterAppointment(AppointmentViewModelFull appointment) { int count = 0; using (Entities.Entities ctx = new Entities.Entities()) { Appointment appointmentEntity = ctx.Appointments.Find(appointment.id); if (appointmentEntity == null) { return(false); } appointmentEntity.ClinicID = appointment.ClinicID; appointmentEntity.DoctorID = appointment.DoctorID; appointmentEntity.PatientID = appointment.PatientID; appointmentEntity.Reason = appointment.Reason; appointmentEntity.Status = appointment.Status; appointmentEntity.Start_date = appointment.start_date; appointmentEntity.End_date = appointment.end_date; appointmentEntity.Text = appointment.text; ctx.Entry(appointmentEntity).State = System.Data.Entity.EntityState.Modified; count = ctx.SaveChanges(); } return(count > 0 ? true : false); }
public bool updatePatinetBasicInfo(Entities.Patient patient) { int count = 0; using (Entities.Entities ctx = new Entities.Entities()) { Patient patientEntity = ctx.Patients.Find(patient.PatientID); if (patientEntity == null) { return(false); } patientEntity.Name = patient.Name; patientEntity.Mobile = patient.Mobile; patientEntity.Notice = patient.Notice; patientEntity.Phone = patient.Phone; patientEntity.Address = patient.Address; patientEntity.BrithDate = patient.BrithDate; patientEntity.E_mail = patient.E_mail; patientEntity.gender = patient.gender; ctx.Entry(patientEntity).State = System.Data.Entity.EntityState.Modified; count = ctx.SaveChanges(); } return(count > 0 ? true : false); }
public IEnumerable <PatientMiniData> getPatientListSearchResult(int patientID, string mobileNumber, string phoneNumber, string Name, int clinectID) { using (Entities.Entities ctx = new Entities.Entities()) { IEnumerable <PatientMiniData> patientList; var patients = ctx.Patients; patientList = (from p in patients orderby p.Name where p.PatientID == patientID || p.Mobile == mobileNumber || p.Phone == phoneNumber && p.ClinicID == clinectID select new PatientMiniData { PatientID = p.PatientID, Address = p.Address, Mobile = p.Mobile, Name = p.Name, Phone = p.Phone }).Take(20).ToList(); if (patientList.Count() == 0 && Name != string.Empty) { patientList = (from p in patients orderby p.Name where p.Name.Contains(Name) select new PatientMiniData { PatientID = p.PatientID, Address = p.Address, Mobile = p.Mobile, Name = p.Name, Phone = p.Phone }).Take(20).ToList(); } return(patientList); } }
public TutorController() { var entities = new Entities.Entities(); PupilRepository = new PupilRepository(entities); TutorRepository = new TutorRepository(entities); }
public decimal?GetAllTeratmentByPatient(int DoctorID, int ClinicID, int PatientID) { decimal?TotalCost = 0; decimal treatmentCost = 0; decimal?opperationCost = 0; decimal?materialCost = 0; decimal?customMatrialCost = 0; using (Entities.Entities ctx = new Entities.Entities()) { //customMatrialCost = ctx.CustomMaterials.Where(c => c.ClinicID == ClinicID && c.DoctorID == DoctorID && c.PatientID == PatientID).ToList().Select(c => c.Cost).Sum(); IEnumerable <Treatment> patientTreatmentList = ctx.Treatments.Where(t => t.ClinicID == ClinicID && t.DoctorID == DoctorID && t.PatientID == PatientID).ToList(); treatmentCost = patientTreatmentList.Select(t => t.TeratmentCost).Sum(); opperationCost = patientTreatmentList.Select(t => t.OpperationCost).Sum(); foreach (Treatment treatment in patientTreatmentList) { IEnumerable <MaterialTreatment> matrialTreatmentList = treatment.MaterialTreatments; foreach (MaterialTreatment matrialTreatment in matrialTreatmentList) { materialCost += matrialTreatment.MaterialCost * (int)matrialTreatment.Quantity; } } TotalCost = treatmentCost + opperationCost + materialCost + customMatrialCost; } return(TotalCost); }
public BackupRestoreManager() { _db = new Entities.Entities(); _aModel = new ResponseModel(); _aRepository = new GenericRepositoryMms <DataConfig>(); }
public PrescriptionPresnetViewModel getPrescriptionDetails(int prescriptiontID) { PrescriptionPresnetViewModel prescriptionViewModel; using (Entities.Entities ctx = new Entities.Entities()) { Prescription prescriptionEntity = ctx.Prescriptions.Find(prescriptiontID); if (prescriptionEntity != null) { prescriptionViewModel = new PrescriptionPresnetViewModel { PrescriptionID = prescriptionEntity.PrescriptionID, Notice = prescriptionEntity.Notice, DoctorName = prescriptionEntity.Doctor.Name, MedicineName = prescriptionEntity.Medicine.Name, AppointmentDate = prescriptionEntity.Appointment.Start_date, Dose = prescriptionEntity.Dose }; } else { prescriptionViewModel = null; } } return(prescriptionViewModel); }
public List <StorageMatrailViewModel> getStrogesMatrailsQuantity(IEnumerable <int> storagesIDList, int matrailID) { using (Entities.Entities ctx = new Entities.Entities()) { List <StorageMatrailViewModel> storageMatrailList = new List <StorageMatrailViewModel> (); var warehouseIQ = ctx.Warehouses; StorageMatrailViewModel storageMatrailViewModel; foreach (int item in storagesIDList) { storageMatrailViewModel = (from w in warehouseIQ where w.StorageID == item select new StorageMatrailViewModel { StorageID = item, Quantity = w.Available }).FirstOrDefault(); if (storageMatrailViewModel != null) { storageMatrailList.Add(storageMatrailViewModel); } } storageMatrailList.TrimExcess(); return(storageMatrailList); } }
// for api public IEnumerable <patientAppoInfo> getPatientAppountmenInfo(int patientID, string mobile) { using (Entities.Entities ctx = new Entities.Entities()) { Patient patient = ctx.Patients.Where(x => x.PatientID == patientID && x.Mobile == mobile).FirstOrDefault(); if (patient == null) { return(null); } IEnumerable <patientAppoInfo> appointmentViewModel; var appointmentsIQ = ctx.Appointments; var doctorIQ = ctx.Doctors; appointmentViewModel = (from a in appointmentsIQ join d in doctorIQ on a.DoctorID equals d.DoctorID where a.PatientID == patientID select new patientAppoInfo { AppDate = a.Start_date, DoctorName = d.Name }).ToList(); return(appointmentViewModel); } }
public IEnumerable <Treatment> getPatientTreatmentList(int patientID, int clinecID) { using (Entities.Entities ctx = new Entities.Entities()) { IEnumerable <Treatment> treatmentList = ctx.Treatments.Include("MaterialTreatments").Where(x => x.PatientID == patientID && x.ClinicID == clinecID).ToList(); return(treatmentList); } }
public SessionValue getSessionValue(int sessionID, string probertyName) { using (Entities.Entities ctx = new Entities.Entities()) { SessionValue sessionValue = ctx.SessionValues.Where(x => x.SessionID == sessionID && x.PrortyName == probertyName).FirstOrDefault(); return(sessionValue); } }
public IEnumerable <int> getClinecStorgesList(int clinecID) { using (Entities.Entities ctx = new Entities.Entities()) { IEnumerable <int> storages = ctx.Storages.Where(x => x.ClinicID == clinecID && x.Active == true).Select(x => x.StorageID).ToList(); return(storages); } }
public IEnumerable <Treatment> getPatientTreatmentList(int patientID, int clinecID, DateTime from, DateTime to) { using (Entities.Entities ctx = new Entities.Entities()) { IEnumerable <Treatment> treatmentList = ctx.Treatments.Include("MaterialTreatments").Where(x => x.PatientID == patientID && x.ClinicID == clinecID && x.Appointment.Start_date >= from && x.Appointment.Start_date <= to).ToList(); return(treatmentList); } }
public ResultController() { var entities = new Entities.Entities(); ResultRepository = new ResultRepository(entities); EvaluationRepository = new EvaluationRepository(entities); PupilRepository = new PupilRepository(entities); }
public JournalManager() { _db = new Entities.Entities(); _aModel = new ResponseModel(); _aGlAccount = new GenericRepositoryAccount <A_GlAccount>(); _aGlTransaction = new GenericRepositoryAccount <A_GlTransaction>(); _aGlTranDetails = new GenericRepositoryAccount <A_GlTransactionDetails>(); }
public EstablishmentController() { var entities = new Entities.Entities(); EstablishmentRepository = new EstablishmentRepository(entities); AcademyRepository = new AcademyRepository(entities); UserRepository = new UserRepository(entities); }
public EvaluationController() { var entities = new Entities.Entities(); EvaluationRepository = new EvaluationRepository(entities); ClassroomRepository = new ClassroomRepository(entities); UserRepository = new UserRepository(entities); PeriodRepository = new PeriodRepository(entities); }
public PupilController() { var entities = new Entities.Entities(); PupilRepository = new PupilRepository(entities); ClassroomRepository = new ClassroomRepository(entities); LevelRepository = new LevelRepository(entities); TutorRepository = new TutorRepository(entities); }
public ClassroomController() { var entities = new Entities.Entities(); ClassroomRepository = new ClassroomRepository(entities); EstablishmentRepository = new EstablishmentRepository(entities); UserRepository = new UserRepository(entities); YearRepository = new YearRepository(entities); }
public Warehouse Getwarehouse(Warehouse warehouse) { using (Entities.Entities ctx = new Entities.Entities()) { var Warehouse = ctx.Warehouses; warehouse = Warehouse.Where(w => w.ItemID == warehouse.ItemID && w.StorageID == warehouse.StorageID).FirstOrDefault(); } return(warehouse); }
public string getDoctorNameByID(int doctorID) { string Name; using (Entities.Entities ctx = new Entities.Entities()) { Name = ctx.Doctors.Find(doctorID).Name; } return(Name); }
public Patient getPatinetBasicInfo(int patientID) { Patient patient; using (Entities.Entities ctx = new Entities.Entities()) { patient = ctx.Patients.Find(patientID); } return(patient); }
public int getPatientTotal(int clinectID) { int total = 0; using (Entities.Entities ctx = new Entities.Entities()) { total = ctx.Patients.Where(x => x.ClinicID == clinectID).Count(); } return(total); }