예제 #1
0
        public JsonResult PostTask(Smart.Core.Domain.Tasks.Task task, int id)
        {
            List <Object> Adicionado = new List <Object>();

            task.BusinessEntityId = _currentUser.GetCurrentBusinessEntityId();
            task.ContactId        = id;
            task.DueDate          = task.DueDate + task.Time;

            try
            {
                _taskServices.Add(task);
                Adicionado.Add(new
                {
                    Sucesso = true,
                    Msg     = task.Name
                });
            }
            catch (Exception e)
            {
                Adicionado.Add(new
                {
                    Erro = true,
                    Msg  = e.InnerException.Message
                });
            }


            return(Json(Adicionado));
        }
예제 #2
0
        public IActionResult Add()
        {
            ViewData["ContactName"] = "";
            ViewData["CompanyName"] = "";
            ViewData["DealName"]    = "";


            ViewBag.TaskGroupId       = _taskGroupServices.GetAll(a => a.Deleted == false);
            ViewData["Tempo"]         = new SelectList(Smart.Core.Domain.Tasks.Task.TimeSpansInRange(TimeSpan.Parse("00:00"), TimeSpan.Parse("23:45"), TimeSpan.Parse("00:15")));
            ViewData["UserSettingId"] = new SelectList(_userSettingServices.GetAll(), "UserSettingId", "FirstName", _currentUser.Id());
            var data = new Smart.Core.Domain.Tasks.Task();

            return(View(data));
        }
예제 #3
0
        public IActionResult Edit([Bind("TaskId,TaskGroupId,Name,DueDate,Time,Duration,Comments,UserSettingId,DealId,CompanyId,ContactId,Done,CreateDate,ModifiedDate,Rowguid,Active,Deleted,BusinessEntityId,Required")] Smart.Core.Domain.Tasks.Task task, bool continueAdd, bool addTrash)
        {
            ViewData["ContactName"] = task.Contact != null ? task.Contact.FirstName : "";
            ViewData["CompanyName"] = task.Company != null ? task.Company.FirstName : "";
            ViewData["DealName"]    = task.Deal != null ? task.Deal.Name : "";

            ViewBag.TaskGroupId       = _taskGroupServices.GetAll(a => a.Deleted == false);
            ViewData["UserSettingId"] = new SelectList(_userSettingServices.GetAll(), "UserSettingId", "FirstName", task.UserSettingId);
            ViewData["Tempo"]         = new SelectList(Smart.Core.Domain.Tasks.Task.TimeSpansInRange(TimeSpan.Parse("00:00"), TimeSpan.Parse("23:45"), TimeSpan.Parse("00:15")), task.Time);
            task.DueDate = task.DueDate + task.Time;
            typeof(Smart.Core.Domain.Tasks.Task).GetProperty("Deleted").SetValue(task, addTrash);
            if (!ModelState.IsValid)
            {
                return(View(task));
            }
            _taskServices.Update(task);
            return(continueAdd ? RedirectToAction("Edit", new { id = task.TaskId }) : RedirectToAction("List"));
        }