private async Task SendNoticeToAuthor() { TaskClaim taskClaim = await TaskClaim.Get(TaskClaimId); string hostname = ConfigurationManager.AppSettings["hostname"]; string body = $"Новый комментарий по задаче \"{taskClaim.Name}\" в проекте {taskClaim.Project.Name}.<br />{AdHelper.GetUserBySid(CreatorSid).DisplayName} пишет:<br />{Text}<p>Ссылка - <a href='{hostname}/Task/Card/{taskClaim.TaskId}'>{hostname}/Task/Card/{taskClaim.TaskId}</a></p>"; string mailToSid = null; if (taskClaim.CreatorSid.Equals(CreatorSid)) { if (String.IsNullOrEmpty(taskClaim.SpecialistSid)) { mailToSid = taskClaim.Project.ManagerSid; } else { mailToSid = taskClaim.SpecialistSid; } } else { mailToSid = taskClaim.CreatorSid; } MailAddress to = new MailAddress(AdHelper.GetUserBySid(mailToSid).Email); MessageHelper.SendNotice($"Новый комментарий", body, true, null, to); }
public async Task <ActionResult> Card(int?id) { if (!id.HasValue) { return(HttpNotFound()); } var task = await TaskClaim.Get(id.Value); ViewBag.StateHistory = await task.GetStateHistoryAsync(); if (CurUser.Is(AdGroup.TaskTrackerManager, AdGroup.TaskTrackerProg)) { ViewBag.Checkpoints = await TaskCheckpoint.GetListAsync(id.Value); ViewBag.TaskFiles = await TaskFile.GetListAsync(id.Value); ViewBag.TaskComments = await TaskComment.GetListAsync(id.Value); return(View("CardPerf", task)); } else { return(View("CardUser", task)); } }
public async Task <ActionResult> Edit(int?id) { if (!id.HasValue) { return(HttpNotFound()); } var task = await TaskClaim.Get(id.Value); return(View(task)); }
public async Task <ActionResult> GetTaskListUserItem(int?id) { //int tid = int.Parse(id); if (!id.HasValue) { return(HttpNotFound()); } var task = await TaskClaim.Get(id.Value); return(PartialView("TaskListUserItem", task)); }
public async Task <JsonResult> SetTaskSpecialist(int id, string sid) { try { await TaskClaim.SetSpecialist(id, sid, CurUser.Sid); } catch (Exception ex) { return(Json(new { error = ex.Message })); } return(Json(new { })); }
public async Task <ActionResult> List(string tsts, string spec = null, string author = null, string prjs = null) { string[] statesStr = String.IsNullOrEmpty(tsts) ? new string[0] : tsts.Split(','); int[] states = Array.ConvertAll <string, int>(statesStr, int.Parse); string[] projectsStr = String.IsNullOrEmpty(prjs) ? new string[0] : prjs.Split(','); int[] projects = Array.ConvertAll <string, int>(projectsStr, int.Parse); if (CurUser.Is(AdGroup.TaskTrackerManager)) { //if (states == null || !states.Any()) //{ // states = TaskState.GetManagerDefaultList().Select(x=>x.TaskStateId).ToArray(); //} var list = await TaskClaim.GetListAsync(CurUser, spec, author, states, projects); list = list.OrderByDescending(x => x.DateCreate); return(View("ListManager", list)); } else if (CurUser.Is(AdGroup.TaskTrackerProg)) { //if (states == null || !states.Any()) //{ // states = TaskState.GetProgDefaultList().Select(x => x.TaskStateId).ToArray(); //} //spec = CurUser.Sid; var list = await TaskClaim.GetListAsync(CurUser, spec, author, states, projects); list = list.OrderByDescending(x => x.DateCreate); return(View("ListProg", list)); } else { //if (states == null || !states.Any()) //{ // states = TaskState.GetUserDefaultList().Select(x => x.TaskStateId).ToArray(); //} //author = CurUser.Sid; var list = await TaskClaim.GetListAsync(CurUser, spec, author, states, projects); list = list.OrderByDescending(x => x.DateCreate); return(View("ListUser", list)); } }
public async Task <ActionResult> New(TaskClaim model) { try { int taskId = await model.Add(CurUser.Sid); await SaveFile2Task(taskId); //if (Request.Files.Count > 0) //{ // for (int i =0; i< Request.Files.Count ; i++) // { // var file = Request.Files[i]; // if (file != null && file.ContentLength > 0) // { // //string ext = Path.GetExtension(file.FileName).ToLower(); // //if (ext != ".png" && ext != ".jpeg" && ext != ".jpg" && ext != ".gif") throw new Exception("Формат фотографии должен быть .png .jpeg .gif"); // byte[] data = null; // using (var br = new BinaryReader(file.InputStream)) // { // data = br.ReadBytes(file.ContentLength); // } // var taskFile = new TaskFile() {TaskClaimId = taskId, Data = data, Name=file.FileName}; // await taskFile.Add(CurUser.Sid); // } // } //} if (!String.IsNullOrEmpty(Request.Form["Continue"])) { return(RedirectToAction("Card", new { id = taskId })); } else { return(View("WindowClose")); } } catch (Exception ex) { TempData["error"] = ex.Message; return(View("New", model)); } return(RedirectToAction("List")); }
// GET: Planing public async Task <ActionResult> Index() { var list = new List <TaskClaimPlanItem>(); var tasks = await TaskClaim.GetActiveTaskListAsync(CurUser); foreach (var task in tasks) { var chkp = await TaskCheckpoint.GetActiveChkpListAsync(task.TaskId); var item = new TaskClaimPlanItem() { TaskClaim = task, Checkpoints = chkp }; list.Add(item); } return(View(list)); }
public ActionResult New() { var task = new TaskClaim(); return(View(task)); }
public async Task <JsonResult> SetTaskQuickly(int id, int qid) { await TaskClaim.SetTaskQuickly(id, qid, CurUser.Sid); return(Json(new { })); }
public async Task <JsonResult> SetTaskImportant(int id, int iid) { await TaskClaim.SetTaskImportant(id, iid, CurUser.Sid); return(Json(new { })); }
public async Task <JsonResult> SetTaskCategory(int id, int cid) { await TaskClaim.SetCategory(id, cid, CurUser.Sid); return(Json(new { })); }
public IEnumerable <Task> GetHaulTasks() { var itemClaim = query.TaskClaim(haulRemaining); yield return(itemClaim); var haulClaim = new TaskClaim(game, (work) => { BB.AssertNotNull(itemClaim.claim); ItemClaim item = itemClaim.claim; if (item.amt > haulRemaining) { return(null); } amtClaimed += item.amt; return(new ClaimLambda(() => amtClaimed -= item.amt)); }); yield return(haulClaim); yield return(new TaskGoTo(game, taskDesc, PathCfg.Point(itemClaim.claim.pos))); yield return(new TaskPickupItem(itemClaim)); yield return(new TaskGoTo(game, taskDesc, dst)); yield return(new TaskLambda(game, "dropoff item", (work) => { if (!work.agent.carryingItem) { return false; } work.Unclaim(haulClaim); Item item = work.agent.RemoveItem(); // Should never happen int haulAmt = itemClaim.claim.amt; if (haulAmt > haulRemaining) { haulAmt = haulRemaining; } if (item.info.amt > haulAmt) { game.DropItems( game.Tile(work.agent.pos), item.info.WithAmount(item.info.amt - haulAmt).Enumerate()); } // Also should never happen else if (item.info.amt < haulAmt) { haulAmt = item.info.amt; } item.Destroy(); amtStored += haulAmt; return true; })); }
public async Task <JsonResult> SetWorkState(int id) { await TaskClaim.SetWork(id, CurUser.Sid); return(Json(new { })); }
public ActionResult New() { var task = new TaskClaim(); return View(task); }
public async Task<ActionResult> New(TaskClaim model) { try { int taskId = await model.Add(CurUser.Sid); await SaveFile2Task(taskId); //if (Request.Files.Count > 0) //{ // for (int i =0; i< Request.Files.Count ; i++) // { // var file = Request.Files[i]; // if (file != null && file.ContentLength > 0) // { // //string ext = Path.GetExtension(file.FileName).ToLower(); // //if (ext != ".png" && ext != ".jpeg" && ext != ".jpg" && ext != ".gif") throw new Exception("Формат фотографии должен быть .png .jpeg .gif"); // byte[] data = null; // using (var br = new BinaryReader(file.InputStream)) // { // data = br.ReadBytes(file.ContentLength); // } // var taskFile = new TaskFile() {TaskClaimId = taskId, Data = data, Name=file.FileName}; // await taskFile.Add(CurUser.Sid); // } // } //} if (!String.IsNullOrEmpty(Request.Form["Continue"])) { return RedirectToAction("Card", new { id = taskId }); } else { return View("WindowClose"); } } catch (Exception ex) { TempData["error"] = ex.Message; return View("New", model); } return RedirectToAction("List"); }
public async Task <JsonResult> SetReworkState(int id, string descr) { await TaskClaim.SetRework(id, descr, CurUser.Sid); return(Json(new { })); }