示例#1
0
 public Person(int theID)
 {
     id = theID;
     cupeDataHolder = new CupeData(id);
 }
示例#2
0
        public override void LoadParticipants()
        {
            CLIENT client = ClientDataControl.Client.EntityObject as CLIENT;
            GROUP busGrp;
            GROUP itGrp;
            GetGroup("Business", client, out busGrp);
            GetGroup("IT", client, out itGrp);
            Person person;
            CupeData cupeData;
            int id = 1;
            int questionIndex = 1;
            foreach (CONTACT contact in busGrp.CONTACT)
            {
                person = new Person(id);
                person.Type = Person.EmployeeType.Business;
                person.CodeName = "Business" + (id).ToString();
                cupeData = new CupeData(id);
                foreach (CUPERESPONSE response in contact.CUPERESPONSE)
                {
                    questionIndex = ClientDataControl.cupeQuestions.FindIndex(delegate(CupeQuestionStringData question)
                                                                              {
                                                                                  return question.QuestionText == response.CUPE.NAME.TrimEnd();
                                                                              });
                    if (questionIndex != -1)
                    {
                        try
                        {
                            cupeData.CurrentAnswers.Add("Question " + (questionIndex + 1).ToString(), response.CURRENT[0]);
                            cupeData.FutureAnswers.Add("Question " + (questionIndex + 1).ToString(), response.FUTURE[0]);
                        }
                        catch
                        {

                        }

                    }
                }
                person.cupeDataHolder = cupeData;
                ClientDataControl.AddParticipant(person);
                id++;
            }

            foreach (CONTACT contact in itGrp.CONTACT)
            {
                person = new Person(id);
                person.Type = Person.EmployeeType.IT;
                person.CodeName = "IT" + (id).ToString();
                cupeData = new CupeData(id);
                foreach (CUPERESPONSE response in contact.CUPERESPONSE)
                {
                    questionIndex = ClientDataControl.cupeQuestions.FindIndex(delegate(CupeQuestionStringData question)
                                                                              {
                                                                                  return question.QuestionText == response.CUPE.NAME.TrimEnd();
                                                                              });
                    if (questionIndex != -1)
                    {
                        if(response.CURRENT.Length > 0)
                        {
                            cupeData.CurrentAnswers.Add("Question " + (questionIndex + 1).ToString(), response.CURRENT[0]);
                        }
                        if (response.FUTURE.Length > 0)
                        {
                            cupeData.FutureAnswers.Add("Question " + (questionIndex + 1).ToString(), response.FUTURE[0]);
                        }
                    }
                }
                person.cupeDataHolder = cupeData;
                ClientDataControl.AddParticipant(person);
                id++;
            }
        }
示例#3
0
        private void SaveParticipantButton_Click(object sender, EventArgs e)
        {
            int           count    = 1;
            List <Person> tempList = new List <Person>();

            foreach (DataGridViewRow row in participantsGrid.Rows)
            {
                if (Convert.ToBoolean(row.Cells[2].Value) && Convert.ToBoolean(row.Cells[1].Value))
                {
                    MessageBox.Show("Participants must be either Business or IT", "Error");
                    return;
                }
                else if (!Convert.ToBoolean(row.Cells[2].Value) && !Convert.ToBoolean(row.Cells[1].Value))
                {
                    continue;
                }
                try
                {
                    //Create the new person
                    Person tempPerson = new Person(count++);

                    if (row.Cells[0].Value != null)
                    {
                        tempPerson.Email = row.Cells[0].Value.ToString();
                    }

                    if (Convert.ToBoolean(row.Cells[2].Value) == true)
                    {
                        tempPerson.Type     = Person.EmployeeType.IT;
                        tempPerson.CodeName = "Business" + count.ToString();
                    }
                    if (Convert.ToBoolean(row.Cells[1].Value) == true)
                    {
                        tempPerson.Type     = Person.EmployeeType.Business;
                        tempPerson.CodeName = "IT" + count.ToString();
                    }
                    //See if there are answers for the current person

                    CupeData data = null;
                    try
                    {
                        data = ClientDataControl.GetCupeAnswers().Where(x => x.ParticipantId == tempPerson.ID).Single();
                    }
                    catch
                    {
                    }
                    if (data != null)
                    {
                        tempPerson.cupeDataHolder = data;
                    }
                    //If not create new cupedata object
                    else
                    {
                        tempPerson.cupeDataHolder = new CupeData(tempPerson.ID);
                    }

                    tempList.Add(tempPerson);
                }
                catch
                {
                }
            }

            tempList.OrderBy(o => o.ID);

            ClientDataControl.SetParticipants(tempList);
            this.Close();
        }
示例#4
0
        public static bool AddCupeAnswers(CupeData data)
        {
            cupeAnswers.Add(data);

            return(true);
        }
示例#5
0
        public static bool AddCupeAnswers(CupeData data)
        {
            cupeAnswers.Add(data);

            return true;
        }
示例#6
0
 public Person(int theID)
 {
     id             = theID;
     cupeDataHolder = new CupeData(id);
 }
示例#7
0
        public override void LoadParticipants()
        {
            XElement client = ClientDataControl.Client.EntityObject as XElement;
            XElement busGrp;
            XElement itGrp;
            GetGroup("Business", client, out busGrp);
            GetGroup("IT", client, out itGrp);
            Person person;
            CupeData cupeData;
            int id = 1;
            int questionIndex = 0;
            List<XElement> busContacts = busGrp.Element("CONTACTS").Elements("CONTACT").ToList();
            List<XElement> itContacts = itGrp.Element("CONTACTS").Elements("CONTACT").ToList();
            foreach (XElement contact in busContacts)
            {
                person = new Person(id);
                person.Type = Person.EmployeeType.Business;
                person.CodeName = "Business" + (id).ToString();
                cupeData = new CupeData(id);
                foreach (XElement response in contact.Element("CUPERESPONSES").Elements("CUPERESPONSE"))
                {
                    questionIndex = ClientDataControl.cupeQuestions.FindIndex(delegate(CupeQuestionStringData question)
                    {
                        return question.QuestionText == response.Element("CUPE").Value;
                    });
                    if (questionIndex != -1)
                    {
                        cupeData.CurrentAnswers.Add("Question " + (questionIndex+1).ToString(), response.Element("CURRENT").Value != "" ? response.Element("CURRENT").Value[0] : ' ');
                        cupeData.FutureAnswers.Add("Question " + (questionIndex+1).ToString(), response.Element("FUTURE").Value != "" ? response.Element("FUTURE").Value[0] : ' ');
                    }
                }
                person.cupeDataHolder = cupeData;
                ClientDataControl.AddParticipant(person);
                id++;
            }

            foreach (XElement contact in itContacts)
            {
                person = new Person(id);
                person.Type = Person.EmployeeType.IT;
                person.CodeName = "IT" + (id).ToString();
                cupeData = new CupeData(id);
                foreach (XElement response in contact.Element("CUPERESPONSES").Elements("CUPERESPONSE"))
                {
                    questionIndex = ClientDataControl.cupeQuestions.FindIndex(delegate(CupeQuestionStringData question)
                    {
                        return question.QuestionText == response.Element("CUPE").Value;
                    });
                    if (questionIndex != -1)
                    {
                        cupeData.CurrentAnswers.Add("Question " + (questionIndex + 1).ToString(), response.Element("CURRENT").Value != "" ? response.Element("CURRENT").Value[0] : ' ');
                        cupeData.FutureAnswers.Add("Question " + (questionIndex + 1).ToString(), response.Element("FUTURE").Value != "" ? response.Element("FUTURE").Value[0] : ' ');
                    }
                }
                person.cupeDataHolder = cupeData;
                ClientDataControl.AddParticipant(person);
                id++;
            }
        }