Exemplo n.º 1
0
        public static AdjusterNote Get(int id)
        {
            AdjusterNote note = (from x in DbContextHelper.DbContext.AdjusterNote
                                 where x.NoteID == id
                                 select x).FirstOrDefault <AdjusterNote>();

            return(note);
        }
Exemplo n.º 2
0
        public static AdjusterNote Save(AdjusterNote note)
        {
            if (note.NoteID == 0)
            {
                note.NoteDate = DateTime.Now;
                DbContextHelper.DbContext.Add(note);
            }

            DbContextHelper.DbContext.SaveChanges();

            return(note);
        }
Exemplo n.º 3
0
        private void addNote(int adjusterID, string noteText)
        {
            AdjusterNote note = new AdjusterNote();

            note.AdjusterID = adjusterID;

            note.NoteDate = DateTime.Now;

            note.UserID = userID;

            note.Notes = noteText;

            AdjusterNoteManager.Save(note);
        }
Exemplo n.º 4
0
        public static void Delete(int id)
        {
            // Create an entity to represent the Entity you wish to delete
            // Notice you don't need to know all the properties, in this
            // case just the ID will do.
            AdjusterNote note = new AdjusterNote {
                NoteID = id
            };

            // Now attach the category stub object to the "Categories" set.
            // This puts the Entity into the context in the unchanged state,
            // This is same state it would have had if you made the query
            DbContextHelper.DbContext.AttachTo("AdjusterNotes", note);


            // Do the delete the category
            DbContextHelper.DbContext.DeleteObject(note);

            // Apply the delete to the database
            DbContextHelper.DbContext.SaveChanges();
        }
Exemplo n.º 5
0
        private void addNote(int adjusterID, string noteText)
        {
            AdjusterNote note = new AdjusterNote();

            note.AdjusterID = adjusterID;

            note.NoteDate = DateTime.Now;

            note.UserID = userID;

            note.Notes = noteText;

            AdjusterNoteManager.Save(note);
        }
Exemplo n.º 6
0
        protected void btnNoteSave_Click(object sender, EventArgs e)
        {
            int adjusterID = Convert.ToInt32(hdId.Value);
            int noteID = 0;

            AdjusterNote note = null;

            int.TryParse(ViewState["noteID"].ToString(), out noteID);

            if (noteID == 0)
                note = new AdjusterNote();
            else
                note = AdjusterNoteManager.Get(noteID);

            if (note != null) {
                note.AdjusterID = adjusterID;

                note.UserID = Core.SessionHelper.getUserId();

                note.Notes = txtNote.Text;

                note.NoteID = noteID;

                try {
                    AdjusterNoteManager.Save(note);

                    bindNotes();

                    showAdjusterNotes();

                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }