Ejemplo n.º 1
0
        public ChooseCUPEClient(CUPETool parentForm)
        {
            InitializeComponent();

            cupeForm = parentForm;
            ChooseClientComboBox.Items.AddRange(cupeForm.db.GetClientNames());
            this.Focus();
        }
Ejemplo n.º 2
0
        public override void PopulateCUPEQuestionsForClient(CUPETool cupeForm)
        {
            CLIENT client = ClientDataControl.Client.EntityObject as CLIENT;
            CupeQuestionStringData data = new CupeQuestionStringData();
            List<CupeQuestionStringData> templist = new List<CupeQuestionStringData>();
            if (client.CUPE.Count != 0)
            {
                foreach (CUPE cupe in client.CUPE)
                {
                    data.QuestionText = cupe.NAME.TrimEnd();
                    data.ChoiceA = cupe.COMMODITY.TrimEnd();
                    data.ChoiceB = cupe.UTILITY.TrimEnd();
                    data.ChoiceC = cupe.PARTNER.TrimEnd();
                    data.ChoiceD = cupe.ENABLER.TrimEnd();

                    templist.Add(data);
                    data = new CupeQuestionStringData();
                }
                ClientDataControl.cupeQuestions.RemoveRange(0, templist.Count);
                foreach( CupeQuestionStringData temp in templist)
                {
                    ClientDataControl.AddCupeQuestion(temp);
                }

            }

            else
            {
                foreach (CUPEQUESTION cupeQuestion in dbo.CUPEQUESTION)
                {
                    if (cupeQuestion.INTWENTY == "Y")
                    {
                        data.QuestionText = cupeQuestion.NAME.TrimEnd();
                        data.ChoiceA = cupeQuestion.COMMODITY.TrimEnd();
                        data.ChoiceB = cupeQuestion.UTILITY.TrimEnd();
                        data.ChoiceC = cupeQuestion.PARTNER.TrimEnd();
                        data.ChoiceD = cupeQuestion.ENABLER.TrimEnd();

                        ClientDataControl.AddCupeQuestion(data);
                        ClientDataControl.cupeQuestions.RemoveAt(1);
                        data = new CupeQuestionStringData();
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public abstract void PopulateCUPEQuestionsForClient(CUPETool cupeForm);
Ejemplo n.º 4
0
 public static void LoadNewCUPE20(CUPETool cupeForm)
 {
     db.ClearCUPE(Client.EntityObject);
     cupeQuestions = db.GetCUPEQuestionStringDataTwenty();
     int questionNumber = 1;
     foreach (CupeQuestionStringData cqsd in cupeQuestions)
     {
         db.AddCUPE(cqsd.QuestionText, Client.EntityObject, questionNumber++);
     }
     if (!ClientDataControl.db.SaveChanges())
     {
         MessageBox.Show("Failed to create new CUPE for client", "Error");
     }
 }
Ejemplo n.º 5
0
        public static void LoadCUPEQuestions(CUPETool cupeForm)
        {
            cupeQuestions = db.GetCUPESForClient();

            if(cupeQuestions.Count == 0 && MessageBox.Show("No CUPE was found for this client. Would you like to make one?", "New CUPE", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                cupeQuestions = db.GetCUPEQuestionStringDataTwenty();
                int questionNumber = 1;
                foreach (CupeQuestionStringData cqsd in cupeQuestions)
                {
                    db.AddCUPE(cqsd.QuestionText, Client.EntityObject, questionNumber++);
                }
                if (!ClientDataControl.db.SaveChanges())
                {
                    MessageBox.Show("Failed to create new CUPE for client", "Error");
                }
            }
        }
Ejemplo n.º 6
0
        public override void PopulateCUPEQuestionsForClient(CUPETool cupeForm)
        {
            XElement client = ClientDataControl.Client.EntityObject as XElement;
            CupeQuestionStringData data = new CupeQuestionStringData();
            List<XElement> cupeList = client.Element("CUPES").Elements("CUPE").ToList();
            if (cupeList.Count != 0)
            {
                foreach (XElement cupe in cupeList)
                {
                    data.QuestionText = cupe.Element("NAME").Value;
                    data.ChoiceA = cupe.Element("COMMODITY").Value;
                    data.ChoiceB = cupe.Element("UTILITY").Value;
                    data.ChoiceC = cupe.Element("PARTNER").Value;
                    data.ChoiceD = cupe.Element("ENABLER").Value;

                    ClientDataControl.AddCupeQuestion(data);
                    data = new CupeQuestionStringData();
                }
            }

            else
            {
                List<XElement> cupeQuestionList = dbo.Element("CUPEQUESTIONS").Elements("CUPEQUESTION").ToList();
                foreach (XElement cupeQuestion in cupeQuestionList)
                {
                    if (cupeQuestion.Element("INTWENTY").Value == "Y")
                    {
                        data.QuestionText = cupeQuestion.Element("NAME").Value;
                        data.ChoiceA = cupeQuestion.Element("COMMODITY").Value;
                        data.ChoiceB = cupeQuestion.Element("UTILITY").Value;
                        data.ChoiceC = cupeQuestion.Element("PARTNER").Value;
                        data.ChoiceD = cupeQuestion.Element("ENABLER").Value;

                        ClientDataControl.AddCupeQuestion(data);
                        data = new CupeQuestionStringData();
                    }
                }
            }
        }