public void InsureExtraBox(StoryStageLogic theStoryStage,
                                   TeamMemberData.UserTypes eLoggedOnMember,
                                   TeamMemberData.UserTypes eMentorType, TeamMemberData.UserTypes eMenteeType,
                                   string strValue)
        {
            // in case the user re-logs in, we might have extra boxes here. So remove any null ones before
            //  "insuring" the one(s) we need
            if (Count > 1)
            {
                while (!this[Count - 1].HasData)
                {
                    RemoveAt(Count - 1);
                }
            }

            // don't bother, though, if the user has ended the conversation
            if (IsFinished || !theStoryStage.IsEditAllowed(eLoggedOnMember))
            {
                return;
            }

            if (((eLoggedOnMember & eMentorType) == eLoggedOnMember) && ((Count == 0) || (this[Count - 1].Direction == MenteeDirection)))
            {
                Add(new CommInstance(strValue, MentorDirection, null, DateTime.Now));
            }
            else if (((eLoggedOnMember & eMenteeType) == eLoggedOnMember) && ((Count == 0) || (this[Count - 1].Direction == MentorDirection)))
            {
                Add(new CommInstance(strValue, MenteeDirection, null, DateTime.Now));
            }
        }
Exemplo n.º 2
0
            public StateTransition
            (
                ProjectStages thisStage,
                ProjectStages theNextStage,
                TeamMemberData.UserTypes eMemberTypeWithEditToken,
                string strDisplayString,
                string strInstructions,
                List <AllowablePreviousStateWithConditions> lstAllowableBackwardsStages,
                bool bRequiresBiblicalStory,
                bool bRequiresNonBiblicalStory
            )
            {
                CurrentStage            = thisStage;
                NextState               = theNextStage;
                MemberTypeWithEditToken = eMemberTypeWithEditToken;
                StageDisplayString      = strDisplayString;
                StageInstructions       = strInstructions;
                AllowableBackwardsTransitions.AddRange(lstAllowableBackwardsStages);
                string strMethodName = thisStage.ToString().Substring(1);

#if !DataDllBuild
                IsReadyForTransition = (CheckEndOfStateTransition.CheckForValidEndOfState)Delegate.CreateDelegate(
                    typeof(CheckEndOfStateTransition.CheckForValidEndOfState),
                    typeof(CheckEndOfStateTransition), strMethodName);
#endif
                RequiresBiblicalStory    = bRequiresBiblicalStory;
                RequiresNonBiblicalStory = bRequiresNonBiblicalStory;
            }
 public CoachNoteData(int nRound, StoryStageLogic theStoryStage,
                      TeamMemberData.UserTypes eLoggedOnMember,
                      TeamMemberData.UserTypes eMentorType, TeamMemberData.UserTypes eMenteeType,
                      string strValue)
     : base(nRound)
 {
     InsureExtraBox(theStoryStage, eLoggedOnMember, eMentorType, eMenteeType, strValue);
 }
Exemplo n.º 4
0
        public MemberPicker(StoryProjectData theStoryProjectData, TeamMemberData.UserTypes eWantedType)
        {
            _theStoryProjectData = theStoryProjectData;
            _eWantedType         = eWantedType;

            InitializeComponent();

            InitializeListBox(eWantedType);
        }
        public override ConsultNoteDataConverter Add(int nRound,
                                                     StoryStageLogic theStoryStage, TeamMemberData.UserTypes eLoggedOnMember,
                                                     string strValue)
        {
            // always add closest to the verse label
            ConsultNoteDataConverter theNewCN = new CoachNoteData(nRound,
                                                                  theStoryStage, eLoggedOnMember, MentorType, MenteeType, strValue);

            Add(theNewCN);
            return(theNewCN);
        }
Exemplo n.º 6
0
 static string MemberGuid(TeamMembersData members, string strName, TeamMemberData.UserTypes eType)
 {
     if (String.IsNullOrEmpty(strName))
     {
         return(strName);
     }
     if (!members.ContainsKey(strName))
     {
         members.Add(strName, new TeamMemberData(strName, eType, "mem-" + Guid.NewGuid(), null, null, null, null, null, null));
     }
     return(members[strName].MemberGuid);
 }
 // if the coach tries to add a note in the consultant's pane, that should fail.
 // (but it's okay for a project facilitator to add one if they have a question
 //  for the consultant)
 public bool CheckAddNotePrivilege(StoryEditor theSE,
                                   TeamMemberData.UserTypes eLoggedOnMember)
 {
     if (!HasAddNotePrivilege(eLoggedOnMember))
     {
         theSE.SetStatusBar("Error: " + String.Format("You must be logged in as a '{0}' or a '{1}' to add a note here",
                                                      TeamMemberData.GetMemberTypeAsDisplayString(MentorType),
                                                      TeamMemberData.GetMemberTypeAsDisplayString(MenteeType)));
         return(false);
     }
     return(true);
 }
Exemplo n.º 8
0
        protected void InitializeListBox(TeamMemberData.UserTypes eType)
        {
            listBoxUNSs.Items.Clear();
            foreach (TeamMemberData aTMD in _theStoryProjectData.TeamMembers.Values)
            {
                if (aTMD.MemberType == eType)
                {
                    listBoxUNSs.Items.Add(aTMD.Name);
                }
            }

            if (listBoxUNSs.Items.Count > 0)
            {
                listBoxUNSs.SelectedIndex = 0;
            }
        }
        public override ConsultNoteDataConverter Add(int nRound,
                                                     StoryStageLogic theStoryStage, TeamMemberData.UserTypes eLoggedOnMember,
                                                     string strValue)
        {
            /*
             * TeamMemberData.UserTypes eMentorType = MentorType;
             * if (eLoggedOnMember == TeamMemberData.UserTypes.eFirstPassMentor)
             *      eMentorType = TeamMemberData.UserTypes.eFirstPassMentor;
             * else if (eLoggedOnMember == TeamMemberData.UserTypes.eIndependentConsultant)
             *      eMentorType = TeamMemberData.UserTypes.eIndependentConsultant;
             */
            ConsultNoteDataConverter theNewCN = new ConsultantNoteData(nRound,
                                                                       theStoryStage, eLoggedOnMember, MentorType, MenteeType, strValue);

            Add(theNewCN);
            return(theNewCN);
        }
Exemplo n.º 10
0
        public ConsultNoteControl(VerseControl ctrlVerse, StoryStageLogic storyStageLogic, ConsultNotesDataConverter theCollection,
                                  ConsultNoteDataConverter aCNDC, TeamMemberData.UserTypes eLoggedOnMemberType)
            : base(storyStageLogic)
        {
            _myCNDC       = aCNDC;
            _myCollection = theCollection;

            m_nRoundNum = aCNDC.RoundNum;
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            InsertColumn(2);

            labelRound.Text = CstrRoundLabel + m_nRoundNum.ToString();
            tableLayoutPanel.SetColumnSpan(labelRound, 2);
            tableLayoutPanel.Controls.Add(labelRound, 0, 0);
            tableLayoutPanel.Controls.Add(buttonDragDropHandle, 1, 0);

            System.Diagnostics.Debug.Assert(tableLayoutPanel.RowCount == 1, "otherwise, fix this assumption: ConsultNoteControl.cs.28");

            // finally populate the buttons on that tool strip
            theCollection.InsureExtraBox(aCNDC, eLoggedOnMemberType);
            int nNumRows = 1;

            foreach (CommInstance aCI in aCNDC)
            {
                if ((aCI.Direction == ConsultNoteDataConverter.CommunicationDirections.eConsultantToProjFac) ||
                    (aCI.Direction == ConsultNoteDataConverter.CommunicationDirections.eCoachToConsultant))
                {
                    InitRow(ctrlVerse, aCNDC.MentorLabel, aCI, aCNDC.CommentColor, aCNDC.ThrowIfWrongEditor,
                            aCNDC.MentorRequiredEditor, ref nNumRows);
                }
                else
                {
                    InitRow(ctrlVerse, aCNDC.MenteeLabel, aCI, aCNDC.ResponseColor, aCNDC.ThrowIfWrongEditor,
                            aCNDC.MenteeRequiredEditor, ref nNumRows);
                }
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
Exemplo n.º 11
0
        public ConsultNotesControl(StoryEditor theSE,
                                   LineFlowLayoutPanel parentFlowLayoutPanel,
                                   StoryStageLogic storyStageLogic,
                                   ConsultNotesDataConverter aCNsDC, int nVerseNumber,
                                   TeamMemberData.UserTypes eLoggedOnMemberType)
            : base(storyStageLogic, nVerseNumber, theSE, parentFlowLayoutPanel)
        {
            _theCNsDC = aCNsDC;
            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            labelReference.Text = (VerseNumber == 0) ? CstrZerothVerseName : CstrVerseName + VerseNumber;
            tableLayoutPanel.Controls.Add(labelReference, 0, 0);
            tableLayoutPanel.Controls.Add(buttonDragDropHandle, 1, 0);

            if (aCNsDC.Count > 0)
            {
                int nRowIndex = 1;
                foreach (ConsultNoteDataConverter aCNDC in aCNsDC)
                {
                    if (aCNDC.Visible || theSE.hiddenVersesToolStripMenuItem.Checked)
                    {
                        ConsultNoteControl aCNCtrl = new ConsultNoteControl(this, storyStageLogic, aCNsDC, aCNDC, eLoggedOnMemberType);
                        aCNCtrl.Name          = CstrFieldNameConsultantNote + nRowIndex;
                        aCNCtrl.ParentControl = this;

                        InsertRow(nRowIndex);
                        tableLayoutPanel.SetColumnSpan(aCNCtrl, 2);
                        tableLayoutPanel.Controls.Add(aCNCtrl, 0, nRowIndex);
                        nRowIndex++;
                    }
                }
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }
        protected override bool CanDoConversationButtons(TeamMemberData.UserTypes eLoggedOnMember, TeamMemberData.UserTypes eRequiredEditor)
        {
            // if it's the *mentor* that we're supposed to be checking for... (this will get called for the mentee check
            //  as well, but the special case is only for FirstPassMentor; not ProjFac)
            if (eRequiredEditor == MentorRequiredEditor)
            {
                // ... and if the logged in member isn't that mentor, nor the First Pass
                //  Mentor, nor an independent consultant... or an English BTr
                if ((eLoggedOnMember == eRequiredEditor)
                    ||
                    (eLoggedOnMember == TeamMemberData.UserTypes.eFirstPassMentor)
                    ||
                    (eLoggedOnMember == TeamMemberData.UserTypes.eIndependentConsultant))
                {
                    return(true);
                }
            }

            // otherwise, let the base class handle it
            // I really want this to be base.IsWrongEditorbase (we don't want to call back to
            //  *our* version of IsWro...)
            return(!base.IsWrongEditor(eLoggedOnMember, eRequiredEditor) || AllowButtonsOverride);
        }
        protected override bool IsWrongEditor(TeamMemberData.UserTypes eLoggedOnMember, TeamMemberData.UserTypes eRequiredEditor)
        {
            // if it's the *mentor* that we're supposed to be checking for... (this will get called for the mentee check
            //  as well, but the special case is only for FirstPassMentor; not ProjFac)
            if (eRequiredEditor == MentorRequiredEditor)
            {
                // ... and if the logged in member isn't that mentor, nor the First Pass
                //  Mentor, nor an independent consultant... or an English BTr
                if ((eLoggedOnMember == eRequiredEditor)
                    ||
                    (eLoggedOnMember == TeamMemberData.UserTypes.eFirstPassMentor)
                    ||
                    (eLoggedOnMember == TeamMemberData.UserTypes.eIndependentConsultant)
                    ||
                    (eLoggedOnMember == TeamMemberData.UserTypes.eEnglishBacktranslator)
                    )
                {
                    return(false);
                }
            }

            // otherwise, let the base class handle it
            return(base.IsWrongEditor(eLoggedOnMember, eRequiredEditor));
        }
 public bool HasAddNotePrivilege(TeamMemberData.UserTypes eLoggedOnMember)
 {
     return(((eLoggedOnMember & MentorType) == eLoggedOnMember) ||
            ((eLoggedOnMember & MenteeType) == eLoggedOnMember));
 }
Exemplo n.º 15
0
            protected void InitStateTransitionsFromXml(bool bHasIndependentConsultant)
            {
                try
                {
                    XmlDocument         doc;
                    XPathNavigator      navigator;
                    XmlNamespaceManager manager;
                    GetXmlDocument(out doc, out navigator, out manager);

                    XPathNodeIterator xpStageTransition = navigator.Select("/ProjectStates/StateTransition", manager);
                    while (xpStageTransition.MoveNext())
                    {
                        ProjectStages            eThisStage  = (ProjectStages)Enum.Parse(typeof(ProjectStages), xpStageTransition.Current.GetAttribute("stage", navigator.NamespaceURI));
                        TeamMemberData.UserTypes eMemberType = (TeamMemberData.UserTypes)Enum.Parse(typeof(TeamMemberData.UserTypes), xpStageTransition.Current.GetAttribute("MemberTypeWithEditToken", navigator.NamespaceURI));
                        if (eMemberType == TeamMemberData.UserTypes.eConsultantInTraining &&
                            bHasIndependentConsultant)
                        {
                            eMemberType = TeamMemberData.UserTypes.eIndependentConsultant;
                        }

                        ProjectStages eNextStage = (ProjectStages)Enum.Parse(typeof(ProjectStages), xpStageTransition.Current.GetAttribute("NextState", navigator.NamespaceURI));

                        bool bRequiresBiblicalStory =
                            (xpStageTransition.Current.GetAttribute("RequiresBiblicalStory", navigator.NamespaceURI) ==
                             "true");
                        bool bRequiresNonBiblicalStory =
                            (xpStageTransition.Current.GetAttribute("RequiresNonBiblicalStory", navigator.NamespaceURI) ==
                             "true");

                        XPathNodeIterator xpNextElement         = xpStageTransition.Current.Select("StageDisplayString");
                        string            strStageDisplayString = null;
                        if (xpNextElement.MoveNext())
                        {
                            strStageDisplayString = xpNextElement.Current.Value;
                        }

                        System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(strStageDisplayString));

                        xpNextElement = xpStageTransition.Current.Select("StageInstructions");
                        string strStageInstructions = null;
                        if (xpNextElement.MoveNext())
                        {
                            strStageInstructions = xpNextElement.Current.Value;
                        }

                        System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(strStageInstructions));

                        xpNextElement = xpStageTransition.Current.Select("AllowableBackwardsTransitions/AllowableBackwardsTransition");
                        List <AllowablePreviousStateWithConditions> lstAllowableBackwardsStages = new List <AllowablePreviousStateWithConditions>();
                        while (xpNextElement.MoveNext())
                        {
                            AllowablePreviousStateWithConditions aps = new AllowablePreviousStateWithConditions
                            {
                                ProjectStage               = (ProjectStages)Enum.Parse(typeof(ProjectStages), xpNextElement.Current.Value),
                                RequiresUsingVernacular    = (xpNextElement.Current.GetAttribute("RequiresUsingVernacular", navigator.NamespaceURI) == "true"),
                                RequiresUsingNationalBT    = (xpNextElement.Current.GetAttribute("RequiresUsingNationalBT", navigator.NamespaceURI) == "true"),
                                RequiresUsingEnglishBT     = (xpNextElement.Current.GetAttribute("RequiresUsingEnglishBT", navigator.NamespaceURI) == "true"),
                                UsingOtherEnglishBTer      = xpNextElement.Current.GetAttribute("RequiresUsingOtherEnglishBTer", navigator.NamespaceURI),
                                RequiresBiblicalStory      = (xpNextElement.Current.GetAttribute("RequiresBiblicalStory", navigator.NamespaceURI) == "true"),
                                RequiresFirstPassMentor    = (xpNextElement.Current.GetAttribute("RequiresFirstPassMentor", navigator.NamespaceURI) == "true"),
                                RequiresManageWithCoaching = (xpNextElement.Current.GetAttribute("RequiresManageWithCoaching", navigator.NamespaceURI) == "true")
                            };
                            lstAllowableBackwardsStages.Add(aps);
                        }

                        StateTransition st = new StateTransition(eThisStage, eNextStage,
                                                                 eMemberType, strStageDisplayString, strStageInstructions,
                                                                 lstAllowableBackwardsStages, bRequiresBiblicalStory,
                                                                 bRequiresNonBiblicalStory);

                        /*
                         * <BackwardsProcessing ButtonLabel="Send back for revision">eConsultantCauseRevisionBeforeUnsTest</BackwardsProcessing>
                         * <ForwardsProceessing ButtonLabel="Send forward for UNS test">eConsultantReviseRound1Notes</ForwardsProceessing>
                         */
                        xpNextElement = xpStageTransition.Current.Select("BackwardsProcessing");
                        if (xpNextElement.MoveNext())
                        {
                            st.PreviousStateButtonLabel = xpNextElement.Current.GetAttribute("ButtonLabel",
                                                                                             navigator.NamespaceURI);
                            st.PreviousButtonState = (ProjectStages)Enum.Parse(typeof(ProjectStages), xpNextElement.Current.Value);
                        }

                        xpNextElement = xpStageTransition.Current.Select("ForwardsProceessing");
                        if (xpNextElement.MoveNext())
                        {
                            st.NextStateButtonLabel = xpNextElement.Current.GetAttribute("ButtonLabel",
                                                                                         navigator.NamespaceURI);
                            System.Diagnostics.Debug.Assert(st.NextState == (ProjectStages)Enum.Parse(typeof(ProjectStages), xpNextElement.Current.Value));
                        }

                        xpNextElement = xpStageTransition.Current.Select("ViewSettings");
                        if (xpNextElement.MoveNext())
                        {
                            st.IsVernacularVisible      = (xpNextElement.Current.GetAttribute("viewVernacularLangField", navigator.NamespaceURI) == "true");
                            st.IsNationalBTVisible      = (xpNextElement.Current.GetAttribute("viewNationalLangField", navigator.NamespaceURI) == "true");
                            st.IsEnglishBTVisible       = (xpNextElement.Current.GetAttribute("viewEnglishBTField", navigator.NamespaceURI) == "true");
                            st.IsAnchorVisible          = (xpNextElement.Current.GetAttribute("viewAnchorField", navigator.NamespaceURI) == "true");
                            st.IsStoryTestingQuestion   = (xpNextElement.Current.GetAttribute("viewStoryTestingQuestionField", navigator.NamespaceURI) == "true");
                            st.IsRetellingVisible       = (xpNextElement.Current.GetAttribute("viewRetellingField", navigator.NamespaceURI) == "true");
                            st.IsConsultantNotesVisible = (xpNextElement.Current.GetAttribute("viewConsultantNoteField", navigator.NamespaceURI) == "true");
                            st.IsCoachNotesVisible      = (xpNextElement.Current.GetAttribute("viewCoachNotesField", navigator.NamespaceURI) == "true");
                            st.IsNetBibleVisible        = (xpNextElement.Current.GetAttribute("viewNetBible", navigator.NamespaceURI) == "true");
                        }

                        Add(eThisStage, st);
                    }
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(String.Format("Unable to process the xml file containing the State Transitions (i.e. {0})... Reinstall.", CstrStateTransitionsXmlFilename), ex);
                }
            }
Exemplo n.º 16
0
 public bool IsEditAllowed(TeamMemberData.UserTypes loggedOnMemberType)
 {
     return(MemberTypeWithEditToken == loggedOnMemberType);
 }
Exemplo n.º 17
0
        protected void InitRow(VerseControl ctrlVerse, string strRowLabel, StringTransfer strRowData, Color clrText,
                               CtrlTextBox.ThrowIfNotCorrectEditor delegateCheckEditor, TeamMemberData.UserTypes eReqEditor, ref int nNumRows)
        {
            int nLayoutRow = nNumRows++;

            Label label = new Label();

            label.Anchor   = AnchorStyles.Left;
            label.AutoSize = true;
            label.Name     = strRowLabel + nNumRows;
            label.Text     = strRowLabel;

            CtrlTextBox tb = new CtrlTextBox(
                strRowLabel + CstrSuffixTextBox + nNumRows,
                ctrlVerse, this, strRowData, delegateCheckEditor, eReqEditor);

            tb.ForeColor = clrText;

            // add the label and tool strip as a new row to the table layout panel
            InsertRow(nLayoutRow);
            tableLayoutPanel.Controls.Add(label, 0, nLayoutRow);
            tableLayoutPanel.SetColumnSpan(tb, 2);
            tableLayoutPanel.Controls.Add(tb, 1, nLayoutRow);
        }
 /*
  * // do this here, because we need to sub-class it to allow for FirstPassMentor working as well in addition to CIT
  * public virtual void ThrowIfWrongEditor(TeamMemberData.UserTypes eLoggedOnMember, TeamMemberData.UserTypes eRequiredEditor)
  * {
  *      if (IsWrongEditor(eLoggedOnMember, eRequiredEditor))
  *              throw new ApplicationException(String.Format("Only a '{0}' can edit this field", TeamMemberData.GetMemberTypeAsDisplayString(eRequiredEditor)));
  * }
  */
 protected virtual bool IsWrongEditor(TeamMemberData.UserTypes eLoggedOnMember, TeamMemberData.UserTypes eRequiredEditor)
 {
     return(eLoggedOnMember != eRequiredEditor);
 }
 protected virtual bool CanDoConversationButtons(TeamMemberData.UserTypes eLoggedOnMember, TeamMemberData.UserTypes eRequiredEditor)
 {
     return(!IsWrongEditor(eLoggedOnMember, eRequiredEditor) || AllowButtonsOverride);
 }
 public abstract ConsultNoteDataConverter Add(int nRound,
                                              StoryStageLogic theStoryStage, TeamMemberData.UserTypes eLoggedOnMember,
                                              string strValue);
 public void InsureExtraBox(ConsultNoteDataConverter aCNDC,
                            StoryStageLogic theStoryStage, TeamMemberData.UserTypes eLoggedOnMemberType)
 {
     aCNDC.InsureExtraBox(theStoryStage, eLoggedOnMemberType, MentorType, MenteeType, null);
 }