コード例 #1
0
        public bool DeleteContour(Model.Contour entityId)
        {
            using (var db = new Model.PhysicManagementEntities())
            {
                var Entity = db.Contour.Find(entityId);
                if (Entity == null)
                {
                    throw new ValidationException("این رکورد در پایگاه داده وجود ندارد");
                }

                db.Contour.Remove(Entity);
                return(db.SaveChanges() == 1);
            }
        }
コード例 #2
0
        public bool AddContour(Model.Contour entity)
        {
            var validtion = new ContourValidation.ContourEntityValidate().Validate(entity);

            if (!validtion.IsValid)
            {
                throw new ValidationException(validtion.Errors);
            }

            using (var db = new Model.PhysicManagementEntities())
            {
                db.Contour.Add(entity);
                return(db.SaveChanges() == 1);
            }
        }
コード例 #3
0
        //public object SetContourAsAcceptedByDoctor(long countorId)
        //{
        //    var UserData = Logic.Services.AuthenticatedUserService.GetUserId();

        //    using (var db = new Model.PhysicManagementEntities())
        //    {
        //        var Entity = db.Contour.Find(countorId);
        //        Entity.ModifyDate = DateTime.Now;
        //        Entity.DoctorUserId = UserData.UserId.ToString();
        //        Entity.DoctorFullName = UserData.FullName;
        //        return db.SaveChanges() == 1;
        //    }
        //}

        public bool UpdateContour(Model.Contour entity)
        {
            var validtion = new ContourValidation.ContourEntityValidate().Validate(entity);

            if (!validtion.IsValid)
            {
                throw new ValidationException(validtion.Errors);
            }

            using (var db = new Model.PhysicManagementEntities())
            {
                var Entity = db.Contour.Find(entity.Id);
                Entity.DoctorDescription   = entity.DoctorDescription;
                Entity.ResidentDescription = entity.ResidentDescription;
                Entity.DoctorFullName      = entity.DoctorFullName;
                Entity.ActionDate          = entity.ActionDate;
                Entity.DoctorUserId        = entity.DoctorUserId;
                Entity.IsAccepted          = entity.IsAccepted;
                Entity.ModifyDate          = entity.ModifyDate;
                return(db.SaveChanges() == 1);
            }
        }