Beispiel #1
0
        protected override void ExecuteEdit(DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs args)
        {
            if (View.CurrentObject.GetType() == typeof(WorkCalendarEvent))
            {
                WorkCalendarEvent workCalendarEvent = this.View.CurrentObject as WorkCalendarEvent;

                if (workCalendarEvent.JobCard != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.JobCard);
                }
                else if (workCalendarEvent.Project != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.Project);
                }
                else if (workCalendarEvent.WorkFlowTask != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.WorkFlowTask);
                }
                else if (workCalendarEvent.Task != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.Task);
                }
                else if (workCalendarEvent.Booking != null)
                {
                    this.LoadDetailView(args, workCalendarEvent.Booking);
                }

                return;
            }

            base.ExecuteEdit(args);
        }
Beispiel #2
0
        public static void Execute(Session Session, Guid Oid, DateTime BookedTime, DateTime BookedTimeEnd, object Status, object Priority, List <object> resources)
        {
            using (UnitOfWork unitOfWork = new UnitOfWork(Session.DataLayer))
            {
                WorkCalendarEvent workCalendarEvent = unitOfWork.FindObject <WorkCalendarEvent>(CriteriaOperator.Parse("Oid == ?", Oid));

                if (workCalendarEvent.Project != null)
                {
                    workCalendarEvent.Project.BookedTime    = BookedTime;
                    workCalendarEvent.Project.BookedTimeEnd = BookedTimeEnd;
                    workCalendarEvent.Project.Status        = unitOfWork.FindObject <Status>(CriteriaOperator.Parse("UniqueID == ?", Status.ToString()));
                    workCalendarEvent.Project.Priority      = (Ignyt.BusinessInterface.Priority)Priority;

                    foreach (object obj in resources)
                    {
                        workCalendarEvent.Project.WorkflowResources.Add(unitOfWork.FindObject <WorkflowResource>(CriteriaOperator.Parse("Oid == ?", Guid.Parse(obj.ToString()))));
                    }
                }
                else if (workCalendarEvent.WorkFlowTask != null)
                {
                    workCalendarEvent.WorkFlowTask.BookedTime    = BookedTime;
                    workCalendarEvent.WorkFlowTask.BookedTimeEnd = BookedTimeEnd;
                    workCalendarEvent.WorkFlowTask.Status        = unitOfWork.FindObject <Status>(CriteriaOperator.Parse("UniqueID == ?", Status.ToString()));
                    workCalendarEvent.WorkFlowTask.Priority      = (Ignyt.BusinessInterface.Priority)Priority;

                    foreach (object obj in resources)
                    {
                        workCalendarEvent.WorkFlowTask.WorkflowResources.Add(unitOfWork.FindObject <WorkflowResource>(CriteriaOperator.Parse("Oid == ?", Guid.Parse(obj.ToString()))));
                    }
                }
                else if (workCalendarEvent.JobCard != null)
                {
                    workCalendarEvent.JobCard.BookedTime    = BookedTime;
                    workCalendarEvent.JobCard.BookedTimeEnd = BookedTimeEnd;
                    workCalendarEvent.JobCard.Status        = unitOfWork.FindObject <Status>(CriteriaOperator.Parse("UniqueID == ?", Status.ToString()));
                    workCalendarEvent.JobCard.Priority      = (Ignyt.BusinessInterface.Priority)Priority;

                    foreach (object obj in resources)
                    {
                        workCalendarEvent.JobCard.WorkflowResources.Add(unitOfWork.FindObject <WorkflowResource>(CriteriaOperator.Parse("Oid == ?", Guid.Parse(obj.ToString()))));
                    }
                }

                unitOfWork.CommitTransaction();
            }
        }