public CommInstance(string strValue,
                     ConsultNoteDataConverter.CommunicationDirections direction,
                     string strGuid, DateTime timeStamp)
     : base(strValue)
 {
     Direction = direction;
     Guid      = strGuid ?? System.Guid.NewGuid().ToString();
     TimeStamp = timeStamp;
 }
Example #2
0
        static void DoConsultData(string[] astrFile, ref int nIndexLine, bool bUsingStoryProject,
                                  ConsultNotesDataConverter theCNsD, string strMentorSfm, string strMentorInitials, List <string> astrMenteeSfms,
                                  ConsultNoteDataConverter.CommunicationDirections eMentorToMentee, ConsultNoteDataConverter.CommunicationDirections eMenteeToMentor)
        {
            if (++nIndexLine >= astrFile.Length)
            {
                return;
            }

            int    nConvNumber = 0, nNoteNumber = 0;
            string strMarker, strData;

            ParseLine(astrFile[nIndexLine], out strMarker, out strData);
            if (strMarker == @"\ln")
            {
                return;
            }

            while ((strMarker != @"\ln") && (strMarker != @"\c"))
            {
                ConsultNoteDataConverter con = null;
                if (theCNsD.Count > nConvNumber)
                {
                    con = theCNsD[nConvNumber];
                }

                int nRound = 1;
                if (strMarker == strMentorSfm)
                {
                    try
                    {
                        char chRound = (strData.Substring(0, 2) == strMentorInitials) ? strData[2] : '1';
                        nRound = Convert.ToInt32(chRound.ToString());
                    }
                    catch { }

                    if (con == null)
                    {
                        con = theCNsD.AddEmpty(nRound);
                    }

                    if (con.Count > nNoteNumber)
                    {
                        CommInstance aCI = con[nNoteNumber];
                        System.Diagnostics.Debug.Assert((aCI.ToString() == strData) && (aCI.Direction == eMentorToMentee));
                        aCI.SetValue(strData);
                        aCI.Direction = eMentorToMentee;
                    }
                    else
                    {
                        con.Add(new CommInstance(strData, eMentorToMentee, Guid.NewGuid().ToString()));
                    }

                    nNoteNumber++;
                }
                else if (astrMenteeSfms.Contains(strMarker))
                {
                    // sometimes the CIT has a comment for the coach
                    if (con == null)
                    {
                        con = theCNsD.AddEmpty(nRound);
                    }

                    if (con.Count > nNoteNumber)
                    {
                        CommInstance aCI = con[nNoteNumber];
                        System.Diagnostics.Debug.Assert((aCI.ToString() == strData) && (aCI.Direction == eMenteeToMentor));
                        aCI.SetValue(strData);
                        aCI.Direction = eMenteeToMentor;
                    }
                    else
                    {
                        con.Add(new CommInstance(strData, eMenteeToMentor, Guid.NewGuid().ToString()));
                    }

                    // for now, we just do two per conversation (or maybe 3 if the mentee started the conversation)
                    if (++nNoteNumber >= 2)
                    {
                        nConvNumber++;
                        nNoteNumber = 0;
                    }
                }
                else if (lstSfmsToIgnore.Contains(strMarker))
                {
                    Console.WriteLine("Found, but don't care about marker:" + strMarker);
                }
                else if (!String.IsNullOrEmpty(strMarker) && !String.IsNullOrEmpty(strData))
                {
                    System.Diagnostics.Debug.Assert(false, String.Format("not handling the '{0}' marker", strMarker));
                }

                if (++nIndexLine < astrFile.Length)
                {
                    ParseLine(astrFile[nIndexLine], out strMarker, out strData);
                }
                else
                {
                    break;
                }
            }
        }