public bool UpdateDoctorAdviceDetail(CommContracts.DoctorAdviceDetail DoctorAdviceDetail) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.DoctorAdviceDetails.FirstOrDefault(m => m.ID == DoctorAdviceDetail.ID); if (temp != null) { temp.DoctorAdviceItemID = DoctorAdviceDetail.DoctorAdviceItemID; temp.TotalNum = DoctorAdviceDetail.TotalNum; temp.SignalDose = DoctorAdviceDetail.SignalDose; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool SaveClinicVistTime(CommContracts.SignalTime ClinicVistTime) { using (DAL.HisContext ctx = new DAL.HisContext()) { var replicequery = from u in ctx.SignalTimes where u.ShiftID == ClinicVistTime.ShiftID select u; if (replicequery.Count() > 0) { return(false); } var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.SignalTime, DAL.SignalTime>(); }); var mapper = config.CreateMapper(); DAL.SignalTime temp = new DAL.SignalTime(); temp = mapper.Map <DAL.SignalTime>(ClinicVistTime); ctx.SignalTimes.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public List <CommContracts.MaterialInStore> getAllMaterialInStore(int StoreID, CommContracts. InStoreEnum inStoreEnum, DateTime StartInStoreTime, DateTime EndInStoreTime, string InStoreNo = "") { List <CommContracts.MaterialInStore> list = new List <CommContracts.MaterialInStore>(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from a in ctx.MaterialInStores where a.ToStoreID == StoreID && a.InStoreEnum == (DAL.InStoreEnum)inStoreEnum && a.OperateTime > StartInStoreTime && a.OperateTime < EndInStoreTime && a.NO.StartsWith(InStoreNo) orderby a.OperateTime descending select a; foreach (DAL.MaterialInStore ass in query) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.MaterialInStore, CommContracts.MaterialInStore>(); }); var mapper = config.CreateMapper(); CommContracts.MaterialInStore temp = mapper.Map <CommContracts.MaterialInStore>(ass); list.Add(temp); } } return(list); }
public bool Authenticate() { using (DAL.HisContext ctx = new DAL.HisContext()) { Trace.WriteLine("Querying database..." + "usename: " + user.Username + ", password: "******"Query database finished, record number: " + queryResult.Count()); if (queryResult.Count() == 1) { var u = queryResult.First(); u.LastLogin = DateTime.Now; u.Status = DAL.User.LoginStatus.login; ctx.SaveChanges(); return(true); } return(false); } }
public bool SaveShift(CommContracts.Shift Shift) { Shift.ModifiedDate = DateTime.Now; using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.Shift, DAL.Shift>(); }); var mapper = config.CreateMapper(); DAL.Shift temp = new DAL.Shift(); temp = mapper.Map <DAL.Shift>(Shift); ctx.Shifts.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public List <CommContracts.OtherServiceCharge> GetAllClinicOtherServiceCharge(int RegistrationID) { List <CommContracts.OtherServiceCharge> list = new List <CommContracts.OtherServiceCharge>(); using (DAL.HisContext context = new DAL.HisContext()) { var query = from m in context.OtherServiceCharges where m.OtherServiceDoctorAdvice.RegistrationID == RegistrationID select m; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.OtherServiceCharge, CommContracts.OtherServiceCharge>(); }); var mapper = config.CreateMapper(); foreach (var tem in query) { var charge = mapper.Map <CommContracts.OtherServiceCharge>(tem); list.Add(charge); } } return(list); }
public bool SaveSickRoom(CommContracts.SickRoom sickRoom) { using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.SickRoom, DAL.SickRoom>(); }); var mapper = config.CreateMapper(); DAL.SickRoom temp = new DAL.SickRoom(); temp = mapper.Map <DAL.SickRoom>(sickRoom); ctx.SickRooms.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool UpdateRegistrationDitch(CommContracts.RegistrationDitch RegistrationDitch) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.RegistrationDitchs.FirstOrDefault(m => m.ID == RegistrationDitch.ID); if (temp != null) { temp.Name = RegistrationDitch.Name; temp.Priority = (DAL.PriorityEnum)RegistrationDitch.Priority; temp.Proportion = RegistrationDitch.Proportion; temp.Status = (DAL.RegistrationDitchStatusEnum)RegistrationDitch.Status; temp.StartTime = RegistrationDitch.StartTime; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public List <CommContracts.TherapyItem> GetAllTherapyItem(string strName = "") { List <CommContracts.TherapyItem> list = new List <CommContracts.TherapyItem>(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from t in ctx.TherapyItems where t.Name.StartsWith(strName) || t.AbbrPY.StartsWith(strName) || t.AbbrWB.StartsWith(strName) select t; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.TherapyItem, CommContracts.TherapyItem>(); }); var mapper = config.CreateMapper(); foreach (DAL.TherapyItem tem in query) { var dto = mapper.Map <CommContracts.TherapyItem>(tem); list.Add(dto); } } return(list); }
public List <CommContracts.MedicineCharge> GetAllInHospitalMedicineCharge(int InpatientID) { List <CommContracts.MedicineCharge> list = new List <CommContracts.MedicineCharge>(); using (DAL.HisContext context = new DAL.HisContext()) { var query = from m in context.MedicineCharges where m.MedicineDoctorAdvice.InpatientID == InpatientID select m; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.MedicineCharge, CommContracts.MedicineCharge>(); }); var mapper = config.CreateMapper(); foreach (var tem in query) { var charge = mapper.Map <CommContracts.MedicineCharge>(tem); list.Add(charge); } } return(list); }
public bool UpdateDepartment(CommContracts.Department department) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.Departments.FirstOrDefault(m => m.ID == department.ID); if (temp != null) { //temp = mapper.Map<DAL.Department>(department); // 这里使用mapper来更新数据之后保存不上,不知为何 temp.Name = department.Name; temp.Abbr = department.Abbr; temp.DepartmentEnum = (DAL.DepartmentEnum)department.DepartmentEnum; temp.DepartmentAddress = department.DepartmentAddress; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool UpdateInHospitalApply(CommContracts.InHospitalApply InHospitalApply) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.InHospitalApplys.FirstOrDefault(m => m.ID == InHospitalApply.ID); if (temp != null) { temp.ApplyTime = InHospitalApply.ApplyTime; temp.PatientID = InHospitalApply.PatientID; temp.UserID = InHospitalApply.UserID; temp.InHospitalApplyEnum = (DAL.InHospitalApplyEnum)InHospitalApply.InHospitalApplyEnum; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool SaveInHospitalApply(CommContracts.InHospitalApply InHospitalApply) { using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.InHospitalApply, DAL.InHospitalApply>(); }); var mapper = config.CreateMapper(); DAL.InHospitalApply temp = new DAL.InHospitalApply(); temp = mapper.Map <DAL.InHospitalApply>(InHospitalApply); ctx.InHospitalApplys.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public List <CommContracts.InHospitalApply> GetAllInHospitalApply(CommContracts.InHospitalApplyEnum inHospitalApplyEnum, string strName = "") { List <CommContracts.InHospitalApply> list = new List <CommContracts.InHospitalApply>(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from t in ctx.InHospitalApplys where t.Patient.Name.StartsWith(strName) && t.InHospitalApplyEnum == (DAL.InHospitalApplyEnum) inHospitalApplyEnum select t; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.InHospitalApply, CommContracts.InHospitalApply>(); }); var mapper = config.CreateMapper(); foreach (DAL.InHospitalApply tem in query) { var dto = mapper.Map <CommContracts.InHospitalApply>(tem); list.Add(dto); } } return(list); }
public List <CommContracts.Employee> GetAllEmployee(string strName = "") { List <CommContracts.Employee> list = new List <CommContracts.Employee>(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from a in ctx.Employees join b in ctx.EmployeeDepartmentHistorys on a.ID equals b.EmployeeID into tt from b in tt.DefaultIfEmpty() where !b.EndDate.HasValue && a.Name.StartsWith(strName) select new { a, b.Department }; foreach (var ass in query) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Employee, CommContracts.Employee>(); }); var mapper = config.CreateMapper(); CommContracts.Employee temp = mapper.Map <CommContracts.Employee>(ass.a); list.Add(temp); } } return(list); }
public bool UpdateTherapyItem(CommContracts.TherapyItem TherapyItem) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.TherapyItems.FirstOrDefault(m => m.ID == TherapyItem.ID); if (temp != null) { temp.Name = TherapyItem.Name; temp.AbbrPY = TherapyItem.AbbrPY; temp.AbbrWB = TherapyItem.AbbrWB; temp.Unit = TherapyItem.Unit; temp.YiBaoEnum = (DAL.YiBaoEnum)TherapyItem.YiBaoEnum; temp.Price = TherapyItem.Price; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool UpdateHospitalMsg(CommContracts.HospitalMsg HospitalMsg) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.HospitalMsgs.FirstOrDefault(m => m.ID == HospitalMsg.ID); if (temp != null) { temp.HospitalName = HospitalMsg.HospitalName; temp.YiBaoNo = HospitalMsg.YiBaoNo; temp.bIsYiBao = HospitalMsg.bIsYiBao; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public List <CommContracts.AdministrationRoute> GetAllAdministrationRoute(string strName) { List <CommContracts.AdministrationRoute> list = new List <CommContracts.AdministrationRoute>(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from t in ctx.AdministrationRoutes where t.Name.StartsWith(strName) || t.Abbr.StartsWith(strName) || t.WuBi.StartsWith(strName) select t; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.AdministrationRoute, CommContracts.AdministrationRoute>(); }); var mapper = config.CreateMapper(); foreach (DAL.AdministrationRoute tem in query) { var dto = mapper.Map <CommContracts.AdministrationRoute>(tem); list.Add(dto); } } return(list); }
public List <CommContracts.SickRoom> GetAllSickRoom(string strName = "") { List <CommContracts.SickRoom> list = new List <CommContracts.SickRoom>(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from a in ctx.SickRooms where a.Name.StartsWith(strName) select a; foreach (DAL.SickRoom ass in query) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.SickRoom, CommContracts.SickRoom>(); }); var mapper = config.CreateMapper(); //CommContracts.Department department = new CommContracts.Department(); //department.ID = ass.Department.ID; //department.Name = ass.Department.Name; //department.ParentID = ass.Department.ParentID; //department.IsDoctorDepartment = (ass.Department.DepartmentEnum == DAL.DepartmentEnum.临床科室); CommContracts.SickRoom temp = mapper.Map <CommContracts.SickRoom>(ass); //temp.Department = department; list.Add(temp); } } return(list); }
public bool UpdateAdministrationRoute(CommContracts.AdministrationRoute AdministrationRoute) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.AdministrationRoutes.FirstOrDefault(m => m.ID == AdministrationRoute.ID); if (temp != null) { temp.Name = AdministrationRoute.Name; temp.Abbr = AdministrationRoute.Abbr; temp.WuBi = AdministrationRoute.WuBi; temp.Remarks = AdministrationRoute.Remarks; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool UpdateSickRoom(CommContracts.SickRoom sickRoom) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.SickRooms.FirstOrDefault(m => m.ID == sickRoom.ID); if (temp != null) { temp.Name = sickRoom.Name; temp.SickRoomEnum = (DAL.SickRoomEnum)sickRoom.SickRoomEnum; temp.DepartmentID = sickRoom.DepartmentID; temp.Address = sickRoom.Address; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool SaveEmployee(CommContracts.Employee employee, ref int employeeID) { employee.ModifiedDate = DateTime.Now; using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.Employee, DAL.Employee>(); }); var mapper = config.CreateMapper(); DAL.Employee temp = new DAL.Employee(); temp = mapper.Map <DAL.Employee>(employee); ctx.Employees.Add(temp); try { ctx.SaveChanges(); employeeID = temp.ID; } catch (Exception ex) { string str = ex.Message; return(false); } } return(true); }
public List <CommContracts.Shift> GetAllShift(string strName) { List <CommContracts.Shift> list = new List <CommContracts.Shift>(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from t in ctx.Shifts where t.Name.StartsWith(strName) select t; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Shift, CommContracts.Shift>(); }); var mapper = config.CreateMapper(); foreach (DAL.Shift tem in query) { var dto = mapper.Map <CommContracts.Shift>(tem); list.Add(dto); } } return(list); }
public bool UpdateEmployee(CommContracts.Employee employee) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.Employees.FirstOrDefault(m => m.ID == employee.ID); if (temp != null) { temp.Name = employee.Name; temp.Gender = (DAL.GenderEnum)employee.Gender; temp.LoginName = employee.LoginName; temp.Password = employee.Password; temp.ModifiedDate = DateTime.Now; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool UpdateShift(CommContracts.Shift Shift) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.Shifts.FirstOrDefault(m => m.ID == Shift.ID); if (temp != null) { temp.Name = Shift.Name; temp.StartTime = Shift.StartTime; temp.EndTime = Shift.EndTime; temp.ModifiedDate = DateTime.Now; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public CommContracts.Department GetCurrentDepartment(int employeeID) { using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from u in ctx.EmployeeDepartmentHistorys where u.EmployeeID == employeeID && !u.EndDate.HasValue select u.Department; if (query.Count() == 1) { DAL.Department department = query.First() as DAL.Department; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Department, CommContracts.Department>(); }); var mapper = config.CreateMapper(); CommContracts.Department temp = new CommContracts.Department(); temp = mapper.Map <CommContracts.Department>(department); return(temp); } return(null); } }
public bool UpdateClinicVistTime(CommContracts.SignalTime ClinicVistTime) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.SignalTimes.FirstOrDefault(m => m.ID == ClinicVistTime.ID); if (temp != null) { temp.ID = ClinicVistTime.ID; temp.ShiftID = ClinicVistTime.ShiftID; temp.StartWaitTime = ClinicVistTime.StartWaitTime; temp.EndWaitTime = ClinicVistTime.EndWaitTime; temp.LastSellTime = ClinicVistTime.LastSellTime; } else { return(false); } try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public CommContracts.Job GetCurrentJob(int employeeID) { using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from u in ctx.EmployeeJobHistorys where u.EmployeeID == employeeID && !u.EndDate.HasValue select u.Job; if (query.Count() == 1) { DAL.Job Job = query.First() as DAL.Job; var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Job, CommContracts.Job>(); }); var mapper = config.CreateMapper(); CommContracts.Job temp = new CommContracts.Job(); temp = mapper.Map <CommContracts.Job>(Job); return(temp); } return(null); } }
public bool SaveCancelRegistration(CommContracts.CancelRegistration cancelRegistration) { using (DAL.HisContext ctx = new DAL.HisContext()) { cancelRegistration.LastUpdateTime = DateTime.Now; var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.CancelRegistration, DAL.CancelRegistration>(). ForMember(x => x.Registration, opt => opt.Ignore()); }); var mapper = config.CreateMapper(); DAL.CancelRegistration temp = new DAL.CancelRegistration(); temp = mapper.Map <DAL.CancelRegistration>(cancelRegistration); ctx.CancelRegistrations.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
public bool SaveDoctorAdviceDetail(CommContracts.DoctorAdviceDetail DoctorAdviceDetail) { using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.DoctorAdviceDetail, DAL.DoctorAdviceDetail>(); }); var mapper = config.CreateMapper(); DAL.DoctorAdviceDetail temp = new DAL.DoctorAdviceDetail(); temp = mapper.Map <DAL.DoctorAdviceDetail>(DoctorAdviceDetail); ctx.DoctorAdviceDetails.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }