Ejemplo n.º 1
0
        public void Create(StateView view)
        {
            State state = UnitOfWork.To <State>(view);

            UnitOfWork.Insert(state);
            UnitOfWork.Commit();
        }
Ejemplo n.º 2
0
        public Sungero.Core.StateView GetStateView()
        {
            var stateView           = StateView.Create();
            var skipResolutionBlock = false;

            var statusesCache = new Dictionary <Enumeration?, string>();

            foreach (var task in _obj.ResolutionGroup.ActionItemExecutionTasks)
            {
                var stateViewModel = Structures.ActionItemExecutionTask.StateViewModel.Create();
                stateViewModel.StatusesCache = statusesCache;
                var blocks = PublicFunctions.ActionItemExecutionTask.GetActionItemStateView(task, task, stateViewModel, null, string.Empty, null, null, skipResolutionBlock, false).Blocks;
                statusesCache = stateViewModel.StatusesCache;

                // Убираем первый блок с текстовой информацией по поручению.
                foreach (var block in blocks.Skip(1))
                {
                    stateView.AddBlock(block);
                }

                // Строим блок резолюции только для первого поручения.
                skipResolutionBlock = true;
            }
            return(stateView);
        }
Ejemplo n.º 3
0
        public Sungero.Core.StateView GetStateView()
        {
            var stateView = StateView.Create();

            var comment = Docflow.PublicFunctions.Module.GetTaskUserComment(_obj, Resources.ConsiderationText);

            if (_obj.Status != Workflow.Task.Status.Aborted)
            {
                if (_obj.Started.HasValue)
                {
                    Docflow.PublicFunctions.OfficialDocument
                    .AddUserActionBlock(stateView, _obj.Author, DocumentReviewTasks.Resources.StateViewDocumentSent, _obj.Started.Value, _obj, comment, _obj.StartedBy);
                }
                else
                {
                    Docflow.PublicFunctions.OfficialDocument
                    .AddUserActionBlock(stateView, _obj.Author, Docflow.ApprovalTasks.Resources.StateViewTaskDrawCreated, _obj.Created.Value, _obj, comment, _obj.Author);
                }
            }

            var startDate    = this.GetIterationStartDate();
            var managerBlock = this.AddReviewManagerBlock(stateView, startDate);

            if (managerBlock != null)
            {
                this.AddPreraringDraftResolutionBlock(managerBlock, startDate);
                this.AddReviewResolutionBlock(managerBlock, startDate);
            }
            return(stateView);
        }
Ejemplo n.º 4
0
        public Sungero.Core.StateView GetStateView()
        {
            var stateView = StateView.Create();

            // Добавить блок информации к блоку задачи.
            var taskHeader = VerificationTasks.Resources.StateViewTaskBlockHeader;

            this.AddInformationBlock(stateView, taskHeader, _obj.Started.Value);

            // Блок информации о задаче.
            var taskBlock = this.AddTaskBlock(stateView);

            // Получить все задания по задаче.
            var taskAssignments = VerificationAssignments.GetAll(a => Equals(a.Task, _obj)).OrderBy(a => a.Created).ToList();

            // Статус задачи.
            var status = _obj.Info.Properties.Status.GetLocalizedValue(_obj.Status);

            var lastAssignment = taskAssignments.OrderByDescending(a => a.Created).FirstOrDefault();

            if (!string.IsNullOrWhiteSpace(status))
            {
                Docflow.PublicFunctions.Module.AddInfoToRightContent(taskBlock, status);
            }

            // Блоки информации о заданиях.
            foreach (var assignment in taskAssignments)
            {
                var assignmentBlock = this.GetAssignmentBlock(assignment);

                taskBlock.AddChildBlock(assignmentBlock);
            }

            return(stateView);
        }
Ejemplo n.º 5
0
        // modify a certain state on a certain script
        public static void modifyStateOnCertainScript(StateView stateView, bool makeHistory)
        {
            if (CurrentSelectedScriptIndex < 0)
            {
                return;
            }

            string origContentText = "";

            if (!(mOpenedScriptList[CurrentSelectedScriptIndex].getStateModelById(stateView.Id) is null))
            {
                origContentText = mOpenedScriptList[CurrentSelectedScriptIndex].getStateModelById(stateView.Id).ContentText;
            }

            mOpenedScriptList[CurrentSelectedScriptIndex].modifyState(stateView);
            mOpenedScriptList[CurrentSelectedScriptIndex].HaveUnsavedChanges = true;

            // add a record in its own history management
            if (makeHistory)
            {
                HistoryManager.Do(mOpenedScriptList[CurrentSelectedScriptIndex]);
            }

            Program.form.MarkUnsavedScript();

            // update the cbb at from as well
            if (!(mOpenedScriptList[CurrentSelectedScriptIndex].getStateModelById(stateView.Id) is null) &&
                origContentText != stateView.StateContent)
            {
                Program.form.updateExistedObject(getStateModelByIdAtCurrentScript(stateView.Id));
            }

            // debugPrint();
        }
Ejemplo n.º 6
0
        // select the object in cbb: state
        public void selectExistedObject(StateModel state)
        {
            if (state is null ||
                cbbExistedStates is null ||
                cbbExistedStates.Items is null ||
                scriptsTabControl is null ||
                scriptsTabControl.SelectedTab is null)
            {
                return;
            }

            cbbExistedStates.SelectedIndex = cbbExistedStates.Items.IndexOf(state);

            ScriptCanvas canvas = ((ScriptTabPage)scriptsTabControl.SelectedTab).TheScriptCanvas;

            if (canvas is null)
            {
                return;
            }

            StateView stateView = canvas.getStateViewById(state.Id);

            if (stateView is null)
            {
                return;
            }

            ModelManager.showInfoPanel(stateView);
            //((ScriptTabPage)scriptsTabControl.SelectedTab).TheScriptCanvas.translateToState(stateView);
        }
Ejemplo n.º 7
0
        public Sungero.Core.StateView GetStateView()
        {
            var stateView = StateView.Create();

            stateView.AddDefaultLabel(Docflow.OfficialDocuments.Resources.StateViewDefault);

            var minutes            = Minuteses.GetAll(d => Equals(d.Meeting, _obj));
            var documentsGroupGuid = Docflow.PublicConstants.Module.TaskMainGroup.ActionItemExecutionTask;
            var actionItems        = RecordManagement.ActionItemExecutionTasks.GetAll()
                                     .Where(t => t.AttachmentDetails.Any(g => g.GroupId == documentsGroupGuid && minutes.Any(m => m.Id == g.AttachmentId)))
                                     .OrderBy(task => task.Created);

            var statusesCache = new Dictionary <Enumeration?, string>();

            foreach (var actionItem in actionItems)
            {
                if (stateView.Blocks.Any(b => b.HasEntity(actionItem)))
                {
                    continue;
                }

                var stateViewModel = Sungero.RecordManagement.Structures.ActionItemExecutionTask.StateViewModel.Create();
                stateViewModel.StatusesCache = statusesCache;
                var blocks = RecordManagement.PublicFunctions.ActionItemExecutionTask.GetActionItemStateView(actionItem, actionItem, stateViewModel, null, string.Empty,
                                                                                                             null, null, true, false).Blocks;
                statusesCache = stateViewModel.StatusesCache;

                // Убираем первый блок с текстовой информацией по поручению.
                foreach (var block in blocks.Skip(1))
                {
                    stateView.AddBlock(block);
                }
            }
            return(stateView);
        }
 public ActionResult DeleteConfirmed(int id)
 {
     StateView stateView = db.States.Find(id);
     db.States.Remove(stateView);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
Ejemplo n.º 9
0
        public void Edit(StateView view)
        {
            State state = UnitOfWork.To <State>(view);

            UnitOfWork.Update(state);
            UnitOfWork.Commit();
        }
Ejemplo n.º 10
0
        public void Initialize(StateView stateView)
        {
            this.stateView = stateView;

            // I don't think we need to do anything here yet, but we may want to know
            // when the state stacking mode changes..
        }
Ejemplo n.º 11
0
        public override void handleMousePositionChanged(Point init_position)
        {
            Point position = calcFinalPoint(init_position);

            StateView.changePosition(init_position);
            HoverView.setHoveredObject(handler.hoverCheck(position), scroll_amount - TOP_MARGIN, current_left);
            DragView.updateDragRect(init_position);
        }
Ejemplo n.º 12
0
 protected override void Awake()
 {
     base.Awake();
     stateView       = GetComponentInParent <StateView>();
     buttonAnimation = GetComponent <ButtonAnimation>();
     buttonAnimation?.SetOwner(this);
     buttonAnimation?.ChangeState(buttonAnimation.currentState);
 }
Ejemplo n.º 13
0
        private void stateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form sForm = StateView.Instance();

            sForm.MdiParent = this;
            sForm.Show();
            sForm.Activate();
        }
Ejemplo n.º 14
0
 public void ShowStateView(StateView nextView, bool lockView, UnityAction callback)
 {
     if (this.lockView)
     {
         return;
     }
     this.onNextViewOpen = callback;
     ShowStateView(nextView, lockView);
 }
 public ActionResult Edit([Bind(Include = "StateId,Name,Abbreviation,CountryId")] StateView stateView)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stateView).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(stateView);
 }
Ejemplo n.º 16
0
 public void ShowStateView(StateView nextView, bool lockView)
 {
     if (this.lockView)
     {
         return;
     }
     this.lockView = lockView;
     this.nextView = nextView;
     ChangeState(state.showView);
 }
Ejemplo n.º 17
0
        public void Get_ReturnsViewById()
        {
            StateView actual   = service.Get <StateView>(state.Id);
            StateView expected = Mapper.Map <StateView>(state);

            Assert.Equal(expected.CreationDate, actual.CreationDate);
            Assert.Equal(expected.Id, actual.Id);

            Assert.True(false, "Not all properties tested");
        }
Ejemplo n.º 18
0
        public ActionResult Create([Bind(Exclude = "Id")] StateView state)
        {
            if (!Validator.CanCreate(state))
            {
                return(View(state));
            }

            Service.Create(state);

            return(RedirectIfAuthorized("Index"));
        }
Ejemplo n.º 19
0
        public ActionResult Edit(StateView state)
        {
            if (!Validator.CanEdit(state))
            {
                return(View(state));
            }

            Service.Edit(state);

            return(RedirectIfAuthorized("Index"));
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Построить модель контрола состояния документа.
 /// </summary>
 /// <param name="document">Документ.</param>
 /// <returns>Модель контрола состояния.</returns>
 public Sungero.Core.StateView GetStateView(Sungero.Docflow.IOfficialDocument document)
 {
     if (_obj.AllAttachments.Any(d => Equals(document, d)))
     {
         return(this.GetStateView());
     }
     else
     {
         return(StateView.Create());
     }
 }
Ejemplo n.º 21
0
        public void TestSetSunStatesNoErrors()
        {
            var v = new StateView
            {
                Sun = SunState.Happy
            };

            v.Sun = SunState.Shocked;
            v.Sun = SunState.Cool;
            v.Sun = SunState.Dead;
        }
        public ActionResult Create([Bind(Include = "StateId,Name,Abbreviation,CountryId")] StateView stateView)
        {
            if (ModelState.IsValid)
            {
                db.States.Add(stateView);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(stateView);
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Построить модель состояния процесса ознакомления.
 /// </summary>
 /// <param name="document">Документ.</param>
 /// <returns>Схема модели состояния.</returns>
 public Sungero.Core.StateView GetStateView(IElectronicDocument document)
 {
     if (_obj.DocumentGroup.OfficialDocuments.Any(d => Equals(document, d)) ||
         _obj.AddendaGroup.OfficialDocuments.Any(d => Equals(document, d)))
     {
         return(this.GetStateView());
     }
     else
     {
         return(StateView.Create());
     }
 }
Ejemplo n.º 24
0
        public StatesControllerTests()
        {
            validator = Substitute.For <IStateValidator>();
            service   = Substitute.For <IStateService>();

            state = ObjectFactory.CreateStateView();

            controller = Substitute.ForPartsOf <StatesController>(validator, service);
            controller.ControllerContext = new ControllerContext {
                RouteData = new RouteData()
            };
        }
Ejemplo n.º 25
0
        public Usuario(StateView state)
        {
            InitializeComponent();
            this.state = state;
            user = new User();
            controller = new DCUser();
            this.DataContext = user;
            ConfigureView();
            SetBindings();

            this.Owner = Application.Current.MainWindow;
        }
Ejemplo n.º 26
0
        public void Create_State()
        {
            StateView view = ObjectFactory.CreateStateView(1);

            service.Create(view);

            State     actual   = context.Set <State>().AsNoTracking().Single(model => model.Id != state.Id);
            StateView expected = view;

            Assert.Equal(expected.CreationDate, actual.CreationDate);

            Assert.True(false, "Not all properties tested");
        }
 // GET: StateViews/Delete/5
 public ActionResult Delete(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     StateView stateView = db.States.Find(id);
     if (stateView == null)
     {
         return HttpNotFound();
     }
     return View(stateView);
 }
Ejemplo n.º 28
0
 // not yet implement
 public void translateToState(StateView srcStateView)
 {
     foreach (StateView stateView in mExistedStateViewList)
     {
         int newX = stateView.Location.X - srcStateView.Location.X + Size.Width / 2;
         int newY = stateView.Location.Y - srcStateView.Location.Y + Size.Height / 2;
         stateView.relocateState(newX, newY, false);
         stateView.OutlineGphPath.Reset();
     }
     foreach (LinkView linkView in mExistedIngoingLinks)
     {
     }
     Invalidate();
 }
Ejemplo n.º 29
0
        // drag-dropped, a new state-view added on current script
        protected override void OnDragDrop(DragEventArgs e)
        {
            //var bmp = (Bitmap) e.Data.GetData(DataFormats.Bitmap);

            // get the client point
            Point clientPoint = PointToClient(new Point(e.X, e.Y));

            // add the state at the location of client point
            StateView newStateView = null;

            switch (MouseManager.CurrentHoldingType)
            {
            case StateType.START:
                newStateView = new StartStateView(clientPoint.X, clientPoint.Y, "", true);
                break;

            case StateType.END:
                newStateView = new EndStateView(clientPoint.X, clientPoint.Y, "", true);
                break;

            case StateType.GENERAL:
                // prompt the typing form to get the state content from user
                string newStateContent = promptTypingFormAndGetTypedText();

                // if the result is null, means that user cancels the addition of state
                if (!(newStateContent is null))
                {
                    newStateView = new GeneralStateView(clientPoint.X, clientPoint.Y, newStateContent, true);
                }

                break;
            }
            if (!(newStateView is null))
            {
                // resize the state with current scale
                newStateView.Size = new Size((int)(newStateView.Size.Width * currentScale),
                                             (int)(newStateView.Size.Height * currentScale));
                newStateView.resetPortPositions();

                // add the state-view
                AddStateView(newStateView, textArgb: Color.Black.ToArgb());
            }

            // reset both the holding type and dragging to NONE
            MouseManager.CurrentHoldingType = StateType.NONE;

            // paint on the picture-box
            Invalidate();
        }
Ejemplo n.º 30
0
        // add a new state-view
        public void AddStateView(StateView newStateView, string id = null, int bgArgb = 0, int textArgb = 0)
        {
            // add model
            ModelManager.addNewStateOnCertainScript(new StateModel(ref newStateView, id, bgArgb, textArgb));

            // add view
            Controls.Add(newStateView);
            mExistedStateViewList.Add(newStateView);

            // show info panel
            ModelManager.showInfoPanel(newStateView);

            // invalidate the start-state-view on the shell if needs
            Program.form.getCertainStateViewOnTheShell(0).Invalidate();
        }
Ejemplo n.º 31
0
        public void Edit_State()
        {
            StateView view = ObjectFactory.CreateStateView(state.Id);

            Assert.True(false, "No update made");

            service.Edit(view);

            State actual   = context.Set <State>().AsNoTracking().Single();
            State expected = state;

            Assert.Equal(expected.CreationDate, actual.CreationDate);
            Assert.Equal(expected.Id, actual.Id);

            Assert.True(false, "Not all properties tested");
        }
Ejemplo n.º 32
0
 public Usuario(StateView state, User user)
     : this(state)
 {
     this.user = user;
     this.DataContext = user;
 }