Exemplo n.º 1
0
        public ActionResult Add(NoteViewModel model, FormCollection form)
        {
            model.Note.ItemID = model.ItemID;
            model.Note.Type = model.NoteType;
            model.Note.AuthorID = _membershipService.GetCurrentMember().UserId;
            model.Note.Action = (NoteActionType)Convert.ToInt32(form["ActionType"]);
            _noteService.Save(model.Note);

            TempData.Add("Message", "Note added");

            int itemID = model.Note.ItemID;
            int type = (int)model.Note.Type;

            switch (model.NoteType)
            {
                case NoteType.Lead:
                    return RedirectToAction("View", "Lead", new { id = model.ItemID });
                case NoteType.Contact:
                    return RedirectToAction("View", "Contacts", new { id = model.ItemID });
                case NoteType.Sale:
                    return RedirectToAction("View", "Sale", new { id = model.ItemID });
                case NoteType.Quote:
                    return RedirectToAction("View", "Quotes", new { id = model.ItemID });
                default:
                    return Redirect(Request.UrlReferrer.AbsoluteUri);
            }
        }
Exemplo n.º 2
0
        public ActionResult Add(NoteViewModel model, FormCollection form)
        {
            model.Note.ItemID = model.ItemID;
            model.Note.Type = model.NoteType;
            model.Note.AuthorID = _membershipService.GetCurrentMember().UserId;
            _noteService.Save(model.Note);

            TempData.Add("Message", "Note added");

            int itemID = model.Note.ItemID;
            int type = (int)model.Note.Type;

            return Redirect(Request.UrlReferrer.AbsoluteUri);
        }
Exemplo n.º 3
0
        public ActionResult Add(int id, string type)
        {
            var model = new NoteViewModel();
            model.ItemID = id;
            model.NoteType = (NoteType)Enum.Parse(typeof(CrumbCRM.NoteType), type, true);
            model.ParentItem = _leadService.GetByID(model.ItemID);

            switch (model.NoteType)
            {
                case NoteType.Contact:
                    model.ParentItem = _contactService.GetByID(id);
                    break;
                case NoteType.Quote:
                    model.ParentItem = _quoteService.GetByID(id);
                    break;
                default:
                    model.ParentItem = _leadService.GetByID(id);
                    break;
            }

            return View("Add", model);
        }
Exemplo n.º 4
0
        public ActionResult View(int id, string type)
        {
            string message = (string)TempData["StatusMessage"];
            ViewBag.message = message;

            var model = new NoteViewModel();
            var noteType = (NoteType)Enum.Parse(typeof(CrumbCRM.NoteType), type, true);
            model.Notes = _noteService.GetByType(id, noteType);

            switch (noteType)
            {
                case NoteType.Contact:
                    model.ParentItem = _contactService.GetByID(id);
                    break;
                case NoteType.Quote:
                    model.ParentItem = _quoteService.GetByID(id);
                    break;
                default:
                    model.ParentItem = _leadService.GetByID(id);
                    break;
            }

            model.NoteType = (NoteType)Enum.Parse(typeof(CrumbCRM.NoteType), type, true);

            return View("Index", model);
        }
Exemplo n.º 5
0
        public ActionResult Edit(int id)
        {
            var model = new NoteViewModel();
            model.Note = _noteService.GetByID(id);
            var noteType = model.Note.Type;
            model.ItemID = model.Note.ItemID;
            model.NoteType = model.Note.Type;
            switch (noteType)
            {
                case NoteType.Contact:
                    model.ParentItem = _contactService.GetByID(model.Note.ItemID);
                    break;
                case NoteType.Quote:
                    model.ParentItem = _quoteService.GetByID(model.Note.ItemID);
                    break;
                default:
                    model.ParentItem = _leadService.GetByID(model.Note.ItemID);
                    break;
            }

            return View("Add", model);
        }
Exemplo n.º 6
0
        public ActionResult Edit(int id)    
        {
            var model = new NoteViewModel();
            model.Note = _noteService.GetByID(id);
            var noteType = model.Note.Type;
            model.ItemID = model.Note.ItemID;
            model.NoteType = model.Note.Type; 
            switch (noteType)
            {
                case NoteType.Contact:
                    model.ParentItem = _contactService.GetByID(model.Note.ItemID);
                    break;
                case NoteType.Quote:
                    model.ParentItem = _quoteService.GetByID(model.Note.ItemID);
                    break;
                default:
                    model.ParentItem = _leadService.GetByID(model.Note.ItemID);
                    break;
            }

            ViewData.SelectListEnumViewData<NoteActionType>("ActionType", true, (int?)model.Note.Action);

            return View("Add", model); 
        }