/// <summary> /// 終了処理 /// </summary> public void Dispose() { if (_Model != null) { _Model.Dispose(); _Model = null; } }
public bool AddCalendar(Model.Calendar entity) { using (var db = new Model.PhysicManagementEntities()) { db.Calendar.Add(entity); return(db.SaveChanges() == 1); } }
public bool DeleteCalendar(Model.Calendar entityId) { using (var db = new Model.PhysicManagementEntities()) { var Entity = db.Calendar.Find(entityId); if (Entity == null) { throw new ValidationException("این رکورد در پایگاه داده وجود ندارد"); } db.Calendar.Remove(Entity); return(db.SaveChanges() == 1); } }
public ActionResult Get(string mailName, DateTime?from, DateTime?to) { if (!from.HasValue) { from = DateTime.Now; } if (!to.HasValue) { to = from.Value.Date.AddDays(1); } if (from.Value > to.Value) { return(BadRequest($"Invalid appointments period {from.Value:s}-{to.Value:s}")); } string email; ActionResult errorResult; var service = GetService(mailName, out email, out errorResult); if (service == null) { return(errorResult); } var folder = Folder.Bind( service, new FolderId(WellKnownFolderName.Calendar, new Mailbox(email)), new PropertySet(BasePropertySet.FirstClassProperties)); var name = service.ResolveName(email).First().Mailbox.Name; var cal = new Model.Calendar() { UniqueId = folder.Id.UniqueId, Owner = new Model.Mailbox() { EMail = email, Name = name }, From = from.Value, To = to.Value, CanCreate = folder.EffectiveRights.HasFlag(EffectiveRights.CreateContents), CanDelete = folder.EffectiveRights.HasFlag(EffectiveRights.Modify), CanModify = folder.EffectiveRights.HasFlag(EffectiveRights.Delete), Appointments = service .FindAppointments(folder.Id, new CalendarView(from.Value, to.Value)) .Select(a => ConvertAppointment(service, a.Id.UniqueId)).Where(a => a != null).ToArray() }; return(Ok(cal)); }
public bool UpdateCalendar(Model.Calendar entity) { var validtion = new CalendarValidation.CalendarEntityValidate().Validate(entity); if (!validtion.IsValid) { throw new ValidationException(validtion.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.Calendar.Find(entity.Id); Entity.PatientFullName = entity.PatientFullName; Entity.DoctorFullName = entity.DoctorFullName; Entity.SessionNumber = entity.SessionNumber; Entity.PhysicTreatmentId = entity.PhysicTreatmentId; return(db.SaveChanges() == 1); } }
/// <summary> /// Calendar.ViewModel /// </summary> public Calendar() { _Model = new Model.Calendar(); }