示例#1
0
        public static void Run()
        {
            // ExStart:RefreshTimeLine
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Load diagram
            Diagram diagram = new Diagram(dataDir + "DrawingTimeLine.vsdx");

            int shapeid = 1;
            // Get timeline shape
            Shape timeline = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid);

            // Initialize TimeLineHlper object
            TimeLineHelper timelineHelper = new TimeLineHelper(timeline);

            // Set start time
            timelineHelper.TimePeriodStart = new DateTime(2014, 12, 21);
            // Set end time
            timelineHelper.TimePeriodFinish = new DateTime(2015, 2, 19);

            // Set date format
            timelineHelper.DateFormatForBE = 21;

            // Revive milestones on the timeline
            timelineHelper.RefreshTimeLine();

            // Save to VDX format
            diagram.Save(dataDir + "RefreshTimeLine_Out.vsdx", SaveFileFormat.VSDX);
            // ExEnd:RefreshTimeLine
        }
        public static void Run()
        {
            // ExStart:RefreshTimeLine
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Load diagram
            Diagram diagram = new Diagram(dataDir + "DrawingTimeLine.vsdx");

            int shapeid = 1;
            // Get timeline shape
            Shape timeline = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid);

            // Initialize TimeLineHlper object
            TimeLineHelper timelineHelper = new TimeLineHelper(timeline);

            // Set start time
            timelineHelper.TimePeriodStart = new DateTime(2014, 12, 21);
            // Set end time
            timelineHelper.TimePeriodFinish = new DateTime(2015, 2, 19);

            // Set date format
            timelineHelper.DateFormatForBE = 21;

            // Revive milestones on the timeline
            timelineHelper.RefreshTimeLine();

            // Save to VDX format
            diagram.Save(dataDir + "RefreshTimeLine_out.vsdx", SaveFileFormat.VSDX);
            // ExEnd:RefreshTimeLine
        }
        public ActionResult UpdateTicket(AdmIssueViewModel model, int id)
        {
            string result = _ticketAdapter.UpdateTicket(model, id);

            if (result == "ok")
            {
                TimeLineHelper.TicketOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, id);
            }
            else
            {
                TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, result, id);
            }
            return(RedirectToAction("UpdateTicket", new { id = id }));
        }
        public ActionResult AddTicket(CreateIssueViewModel model)
        {
            string result = _ticketAdapter.AddTicket(model, User.Identity.GetUserId(), User.Identity.GetUserName());

            if (result.Contains("error"))
            {
                TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.New, result);
            }
            else
            {
                TimeLineHelper.TicketOperations(User.Identity.Name, TimeLineHelper.Operations.New, int.Parse(result));
            }
            return(RedirectToAction("ViewTickets"));
        }
        public ActionResult EditTicket(UpdateTicket model)
        {
            string result = _ticketAdapter.EditTicket(model, User.Identity.GetUserId(), User.Identity.GetUserName());

            if (result.Contains("error"))
            {
                TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, result);
            }
            else
            {
                TimeLineHelper.TicketOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, model.IssueId);
            }


            return(RedirectToAction("ViewTickets"));
        }
        // This is used to update/add technician, the only differenct is that if it is a create, the userName will be null
        public ActionResult AddUpdateTech(AdmUserViewModel model, string userId)
        {
            string result = _ticketAdapter.AddUpdateUser(model, userId);

            if (result == "NewOk")
            {
                TimeLineHelper.UserOperations(model.FirstName + model.LastName, User.Identity.Name, TimeLineHelper.Operations.Edit);
            }
            else if (result == "EditOk")
            {
                TimeLineHelper.UserOperations(model.FirstName + model.LastName, User.Identity.Name, TimeLineHelper.Operations.New);
            }
            else
            {
                TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, result);
            }

            return(RedirectToAction("Users", new { role = model.Role }));
        }
示例#7
0
        public void AssignTech(AdmIssueViewModel model, int issueId)
        {
            if (model.AssignToId == null)
            {
                return;
            }

            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                // first see if there is already an assignment with issue and tech, if so don't create another
                Assignment assignment = db.Assignments.FirstOrDefault(a => a.IssueId == issueId && a.UserId == model.AssignToId);
                if (assignment == null)  // did not find assignment
                {
                    // create assignment
                    assignment = new Assignment()
                    {
                        IssueId = issueId,
                        UserId  = model.AssignToId,
                    };
                    db.Assignments.Add(assignment);

                    Issue issue = db.Issues.FirstOrDefault(i => i.IssueId == issueId);
                    if (issue != null && issue.IsAssigned == false)
                    {
                        issue.IsAssigned = true;
                    }

                    string tech_name = db.Users.Find(model.AssignToId).FirstName;
                    TimeLineHelper.AssigmentOperations(issue.User.UserName, TimeLineHelper.Operations.New, issue.IssueId, tech_name);
                    string           ticketId = issue.IssueId.ToString();
                    AdmUserViewModel tech     = GetUserById(model.AssignToId);

                    string tech_email = tech.Email;
                    // email user and tell them that the issue has been updated
                    EmailManager.SendEmailAdminAssignTicket(ticketId, tech_email, issue.IssueDesc);
                }

                db.SaveChanges();
            }

            return;
        }
        // Need to 1. Remove resolution, 2. Remove assignments, 3. Remove Ticket
        public ActionResult DeleteTicket(int id, string userId)
        {
            string result = _ticketAdapter.DeleteTicket(id, userId);

            if (result == "ok")
            {
                TimeLineHelper.TicketOperations(User.Identity.Name, TimeLineHelper.Operations.Delete, id);
            }
            else
            {
                TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.Delete, result, id);
            }
            // Came from ticket list return
            if (userId == "none")
            {
                return(RedirectToAction("Tickets"));
            }
            else // came from userpage return there
            {
                return(RedirectToAction("Technician", new { userId = userId }));
            }
        }
        public ActionResult DeleteTech(string userId)
        {
            string userRole = _ticketAdapter.GetUserRole(userId);
            string result   = _ticketAdapter.DeleteUser(userId);

            if (result == "ok")
            {
                TimeLineHelper.UserOperations(userId, User.Identity.Name, TimeLineHelper.Operations.Delete);
            }
            else
            {
                TimeLineHelper.ErrorOperations(User.Identity.Name, TimeLineHelper.Operations.Edit, result);
            }

            if (userRole != null)
            {
                return(RedirectToAction("Users", new { role = userRole }));
            }
            else
            {
                return(RedirectToAction("Users", new { role = "All" }));
            }
        }
        public static void Run()
        {
            // ExStart:ConfigureTimeLine
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Load diagram
            Diagram diagram = new Diagram(dataDir + "DrawingTimeLine.vsdx");
            int shapeid = 1;
            // Get timeline shape
            Shape timeline = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid);

            // Initialize TimeLineHlper object
            Aspose.Diagram.TimeLineHelper timelineHelper = new TimeLineHelper(timeline);

            // Set start time
            timelineHelper.TimePeriodStart = new DateTime(2014, 12, 21);
            // Set end time
            timelineHelper.TimePeriodFinish = new DateTime(2015, 2, 19);

            // Set date format
            // TimelineHelper.DateFormatForBE = 21;
            // Set date format for intm of timeline shape   
            // TimelineHelper.DateFormatForIntm = 21;

            // Or

            // Set date format string for start and finish of timeline shape
            timelineHelper.DateFormatStringForBE = "yyyy-MM-dd";
            // Set date format string for intm of timeline shape
            timelineHelper.DateFormatStringForIntm = "yyyy-MM-dd";

            // Save to VDX format
            diagram.Save(dataDir + "ConfigureTimeLine_out.vsdx", SaveFileFormat.VSDX);
            // ExEnd:ConfigureTimeLine
        }
示例#11
0
        public static void Run()
        {
            //ExStart:ConfigureTimeLine
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Load diagram
            Diagram diagram = new Diagram(dataDir + "DrawingTimeLine.vsdx");
            int     shapeid = 1;
            // Get timeline shape
            Shape timeline = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid);

            // Initialize TimeLineHlper object
            Aspose.Diagram.TimeLineHelper timelineHelper = new TimeLineHelper(timeline);

            // Set start time
            timelineHelper.TimePeriodStart = new DateTime(2014, 12, 21);
            // Set end time
            timelineHelper.TimePeriodFinish = new DateTime(2015, 2, 19);

            // Set date format
            //timelineHelper.DateFormatForBE = 21;
            // Set date format for intm of timeline shape
            //timelineHelper.DateFormatForIntm = 21;

            // Or

            // Set date format string for start and finish of timeline shape
            timelineHelper.DateFormatStringForBE = "yyyy-MM-dd";
            // Set date format string for intm of timeline shape
            timelineHelper.DateFormatStringForIntm = "yyyy-MM-dd";

            // Save to VDX format
            diagram.Save(dataDir + "ConfigureTimeLine_Out.vsdx", SaveFileFormat.VSDX);
            //ExEnd:ConfigureTimeLine
        }