Exemple #1
0
        private void Save(MemberNoteEditVM.EditInput input)
        {
            MemberNote membernote;

            if (input.Id == 0)
            {
                membernote = new MemberNote();
            }
            else
            {
                membernote = MemberNoteBD.Get(input.Id);
            }

            membernote.Member     = input.Member.ToReferencedDO(MemberBD);
            membernote.Seq        = input.Seq;
            membernote.ActionTime = input.ActionTime;
            membernote.Note       = input.Note;
            membernote.User       = input.User.ToReferencedDO(UserBD);
            membernote.Result     = input.Result;
            membernote.NoteClass  = input.NoteClass;
            membernote.Memo       = input.Memo;
            membernote.IsActive   = input.IsActive;
            membernote.CreditSum  = input.CreditSum;
            MemberNoteBD.Save(membernote);
        }
        public static List <ChangeRecord> FromDTO(this Member member, IEnumerable <NoteDTO> nlist, string userName)
        {
            var changes = new List <ChangeRecord>();

            if (nlist != null && nlist.Count() > 0)
            {
                Debug.Assert(nlist.Count() >= member.MemberNotes.Count());
                foreach (var n in nlist.Where(x => x.Id == 0))
                {
                    var newNote = new Note
                    {
                        CreatedOn = n.CreatedOn.StripTimeAndZone(),
                        UserName  = userName
                    };
                    var mn = new MemberNote {
                        Member = member, Note = newNote
                    };
                    member.MemberNotes.Add(mn);
                    foreach (var nl in n.NoteLines.OrderBy(x => x.Index))
                    {
                        newNote.NoteLines.Add(new NoteLine {
                            Note = newNote, Index = nl.Index, Line = nl.Line
                        });
                    }
                    changes.Add(new ChangeRecord {
                        Time = DateTimeOffset.Now, By = userName, Description = $"new member note added"
                    });
                }
            }
            return(changes);
        }
Exemple #3
0
        public MemberNoteModel(MemberNote memberNote)
        {
            _memberNote = memberNote;

            CanEditNote = AccessService.Current.User.ID == memberNote.AddedByID || AccessService.Current.UserHasPermissions(Resources.PERMISSION_MEMBERSHIP_NOTE_OVERRIDE);

            CanDeleteNote = AccessService.Current.User.ID == memberNote.AddedByID;
        }
Exemple #4
0
    public static void ListsMemberNotes_FillRow(object resultObj, out SqlInt32 id, out SqlString note, out SqlDateTime created, out SqlDateTime updated,
                                                out SqlString created_by_name)
    {
        MemberNote row = (MemberNote)resultObj;

        id              = row.Id;
        note            = row.Note;
        created         = DateTime.Parse(row.Created);
        updated         = DateTime.Parse(row.Updated);
        created_by_name = row.CreatedByName;
    }
Exemple #5
0
        private void ProcessNote(MemberNoteModel noteModel)
        {
            _isEditMode = (noteModel != null);

            MemberNote = (_isEditMode) ? noteModel : GetNote();

            if (_isEditMode)
            {
                _originalMemberNote = MemberNote.Clone();
            }

            MemberNote.PropertyChanged += MemberNoteOnPropertyChanged;
        }
 public ActionResult EditMemberNotes(FormCollection form, MemberNoteViewModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var memberNote = new MemberNote();
             Mapper.DynamicMap(model, memberNote);
             memberProvider.UpdateMemberNote(memberNote);
             return(Json(new AjaxViewModel(true, model, null)));
         }
         catch (Exception ex)
         {
             return(Json(new AjaxViewModel(false, null, ex.Message)));
         }
     }
     return(View(model));
 }
 public void UpdateMemberNote(MemberNote memberNote)
 {
     context.Entry(memberNote).State = System.Data.Entity.EntityState.Modified;
     SetAuditFields(memberNote);
     context.SaveChanges();
 }