Files
ayanova7/source/ri/ri/Controllers/FollowUpController.cs
2018-06-29 19:47:36 +00:00

103 lines
5.0 KiB
C#

using System;
using System.Web.Mvc;
using GZTW.AyaNova.BLL;
using ri.util;
namespace ri.Controllers
{
public class FollowUpController : Controller
{
//
// GET: /FollowUp/
public ActionResult Index(Guid followId, int followType)
{
try
{
FollowUpList c = FollowUpList.GetList(followId);
formInit(followId, followType);
ViewBag.titleName = NameFetcher.GetItem((RootObjectTypes)followType, followId, true).RecordName;
return View(c);
}
catch (Exception ex)
{
ay.setGeneralError(TempData, ex);
formInit(followId, followType);
return View();
}
}
//
// GET: /FollowUp/Create
public ActionResult Create(Guid followId, int followType)
{
//create new FollowUp with defaults
//note: this mirrors how it's created in windows UI for consistency
ScheduleMarker c = ScheduleMarker.NewItem();
c.FollowID = followId;
c.FollowType = (RootObjectTypes)followType;
c.ScheduleMarkerSourceType = ScheduleMarkerSourceTypes.User;
c.SourceID = GZTW.AyaNova.BLL.User.CurrentThreadUserID;
c.StartDate = DBUtil.CurrentWorkingDateTime;
c.StopDate = DBUtil.CurrentWorkingDateTime.AddHours(1);
c.Name = DateTime.Now.ToString();
c.Save();
return RedirectToAction("Edit", "ScheduleMarker", new { id = c.ID });
}
#region Menu and rights
private void formInit(Guid followId, int followType)
{
//set rights and urls
util.ay.setViewBagRights(ViewBag, RootObjectTypes.ScheduleMarker);
ViewBag.newItemUrl = ay.genBaseSiteUrl(Url) + "FollowUp/Create?followId=" + followId + "&followType=" + followType;
//set followup object ID
ViewBag.followId=followId.ToString();
ViewBag.followType = followType.ToString();
#region Generate menu
//ayMenu m = new ayMenu();
//m.title = "ScheduleMarker.Label.FollowUp";
//m.icon = "icon-FollowUp";
//m.menuItems.Add(new ayMenuItem("header", "UI.Label.ShowAll", "", ""));
//m.menuItems.Add(new ayMenuItem("navitem", "WorkorderService.Label.List", ay.genBaseSiteUrl(Url) + "ShowAll/ClientServiceWO?id=" + c.ID.ToString(), "icon-Workorder"));
//m.menuItems.Add(new ayMenuItem("navitem", "WorkorderQuote.Label.List", ay.genBaseSiteUrl(Url) + "ShowAll/ClientQuote?id=" + c.ID.ToString(), "icon-WorkorderQuote"));
//m.menuItems.Add(new ayMenuItem("navitem", "WorkorderPreventiveMaintenance.Label.List", ay.genBaseSiteUrl(Url) + "ShowAll/ClientPM?id=" + c.ID.ToString(), "icon-WorkorderPreventiveMaintenance"));
//m.menuItems.Add(new ayMenuItem("navitem", "ClientServiceRequest.Label.List", ay.genBaseSiteUrl(Url) + "ShowAll/ClientCSR?id=" + c.ID.ToString(), "icon-ClientServiceRequest"));
//m.menuItems.Add(new ayMenuItem("navitem", "Unit.Label.List", ay.genBaseSiteUrl(Url) + "ShowAll/ClientUnit?id=" + c.ID.ToString(), "icon-WorkorderItemUnit"));
//m.menuItems.Add(new ayMenuItem("divider", "", "", ""));
//m.menuItems.Add(new ayMenuItem("navitem", "ClientNote.Label.List", ay.genBaseSiteUrl(Url) + "Client/Notes?id=" + c.ID.ToString(), "icon-ClientNote"));
//if (c.CanWiki)
//{
// m.menuItems.Add(new ayMenuItem("navitem", "O.WikiPage", ay.WikiUrl(RootObjectTypes.Client, c.ID, Url), "icon-WikiPage"));
// m.menuItems.Add(new ayMenuItem("navitem", "O.AyaFile", ay.WikiFileUrl(RootObjectTypes.Client, c.ID, Url), "icon-WikiFile"));
//}
//if (AyaBizUtils.Right("Object.ScheduleMarker") > (int)SecurityLevelTypes.NoAccess)
// m.menuItems.Add(new ayMenuItem("navitem", "ScheduleMarker.Label.FollowUp", ay.genBaseSiteUrl(Url) + "FollowUp?id=" + c.ID.ToString(), "icon-FollowUp"));
//m.menuItems.Add(new ayMenuItem("scriptitem", "UI.Command.RecordHistory", "alert('" +
// ay.RecordHistoryText(c.Creator, c.Modifier, c.Created, c.Modified) +
// "')", "icon-RecordHistory"));
//if (c.CanDuplicate)
// m.menuItems.Add(new ayMenuItem("navitem", "UI.Command.Duplicate", ay.genBaseSiteUrl(Url) + "Client/Duplicate?id=" + c.ID.ToString(), "icon-Duplicate"));
//if (ViewBag.ayCanDelete)
//{
// m.menuItems.Add(new ayMenuItem("divider", "", "", ""));
// m.menuItems.Add(new ayMenuItem("navitem", "UI.Command.Delete", ay.genBaseSiteUrl(Url) + "Client/Delete?id=" + c.ID.ToString(), "icon-Delete", ay.PromptForDelete()));
//}
//ViewBag.ayMenu = m;
#endregion generate menu
}
#endregion
}//eoc
}//ens