Exemple #1
0
        void btnScript_Click(object sender, RoutedEventArgs e)
        {
            ClsQuestionCollectionR objQueCollection = ClsQuestionCollectionR.GetAll(int.Parse(txtScript.Text));

            if (objQueCollection.Count > 0)
            {
                FncSetInnerCanvas();
            }
        }
 void btnScript_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ClsQuestionCollectionR objQueCollection = ClsQuestionCollectionR.GetAll(int.Parse(txtScript.Text));
         if (objQueCollection.Count > 0)
         {
             FncSetInnerCanvas();
         }
     }
     catch (Exception exp)
     {
         VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "btnScript_Click()", "CtlDynamicScript.xaml.cs");
     }
 }
 public void SetQuestionsCombo(ClsQuestionCollectionR o)
 {
     for (int i = 0; i < o.Count; i++)
     {
         ComboBoxItem cbi = new ComboBoxItem();
         cbi.Content = o[i].QuestionName.ToString();
         cbi.Tag = o[i].ID.ToString();
         cmbQuest.Items.Add(cbi);
     }
 }
Exemple #4
0
        void btnYes_Click(object sender, RoutedEventArgs e)
        {
            ClsQuestionCollectionR objQueCollection = ClsQuestionCollectionR.GetAll(int.Parse(txtScript.Text));

            if (((Button)sender).Tag.ToString().ToLower() == "radiobutton")
            {
                foreach (object r in cnvPaint.Children)
                {
                    if (r.GetType() == typeof(RadioButton))
                    {
                        if (((RadioButton)r).IsChecked == true)
                        {
                            string[] str = ((RadioButton)r).Tag.ToString().Split(',');
                            CurrentQueCount = int.Parse(str[0]);
                            int optID = int.Parse(str[1]);
                            //MessageBox.Show("Option ID = " + optID.ToString());

                            //ClsAnswerR objAns = new ClsAnswerR();
                            //objAns.CallID = int.Parse(txtCall.Text.ToString());
                            //objAns.QusOptionID = int.Parse(optID.ToString());
                            //objAns.Save();

                            for (int k = 0; k < objQueCollection.Count; k++)
                            {
                                if (objQueCollection[k].ID == CurrentQueCount)
                                {
                                    //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml" , UriKind.RelativeOrAbsolute));
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            else if (varType == "CheckBox")
            {
                foreach (object r in cnvPaint.Children)
                {
                    if (r.GetType() == typeof(CheckBox))
                    {
                        if (((CheckBox)r).IsChecked == true)
                        {
                            string[] str = ((CheckBox)r).Tag.ToString().Split(',');
                            CurrentQueCount = int.Parse(str[0]);
                            int optID = int.Parse(str[1]);
                            //MessageBox.Show("Option ID = " + optID.ToString());

                            //ClsAnswerR objAns = new ClsAnswerR();
                            //objAns.CallID = int.Parse(txtCall.Text.ToString());
                            //objAns.QusOptionID = int.Parse(optID.ToString());
                            //objAns.Save();

                            for (int k = 0; k < objQueCollection.Count; k++)
                            {
                                if (objQueCollection[k].ID == CurrentQueCount)
                                {
                                    //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml", UriKind.RelativeOrAbsolute));
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            else if (((Button)sender).Tag.ToString().ToLower() == "listbox")
            {
                foreach (object r in cnvPaint.Children)
                {
                    if (r.GetType() == typeof(ListBox))
                    {
                        for (int i = 0; i < ((ListBox)r).Items.Count; i++)
                        {
                            if (((ListBoxItem)((ListBox)r).Items[i]).IsSelected == true)
                            {
                                string[] str             = ((ListBoxItem)r).Tag.ToString().Split(',');
                                int      CurrentQueCount = int.Parse(str[0]);
                                int      optID           = int.Parse(str[1]);
                                //MessageBox.Show("Option ID = " + optID.ToString());

                                //ClsAnswerR objAns = new ClsAnswerR();
                                //objAns.CallID = int.Parse(txtCall.Text.ToString());
                                //objAns.QusOptionID = int.Parse(optID.ToString());
                                //objAns.Save();

                                for (int k = 0; k < objQueCollection.Count; k++)
                                {
                                    if (objQueCollection[k].ID == CurrentQueCount)
                                    {
                                        //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml", UriKind.RelativeOrAbsolute));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            else if (((Button)sender).Tag.ToString().ToLower() == "combobox")
            {
                foreach (object r in cnvPaint.Children)
                {
                    if (r.GetType() == typeof(ComboBox))
                    {
                        for (int i = 0; i < ((ComboBox)r).Items.Count; i++)
                        {
                            if (((ComboBoxItem)((ComboBox)r).Items[i]).IsSelected == true)
                            {
                                string[] str             = ((ComboBoxItem)r).Tag.ToString().Split(',');
                                int      CurrentQueCount = int.Parse(str[0]);
                                int      optID           = int.Parse(str[1]);
                                //MessageBox.Show("Option ID = " + optID.ToString());

                                //ClsAnswerR objAns = new ClsAnswerR();
                                //objAns.CallID = int.Parse(txtCall.Text.ToString());
                                //objAns.QusOptionID = int.Parse(optID.ToString());
                                //objAns.Save();

                                for (int k = 0; k < objQueCollection.Count; k++)
                                {
                                    if (objQueCollection[k].ID == CurrentQueCount)
                                    {
                                        //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml", UriKind.RelativeOrAbsolute));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #5
0
        void btnYes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ClsQuestionCollectionR objQueCollection = ClsQuestionCollectionR.GetAll(int.Parse(txtScript.Text));

                if (((Button)sender).Tag.ToString().ToLower() == "radiobutton")
                {
                    foreach (object r in cnvPaint.Children)
                    {
                        if (r.GetType() == typeof(RadioButton))
                        {
                            if (((RadioButton)r).IsChecked == true)
                            {
                                string[] str = ((RadioButton)r).Tag.ToString().Split(',');
                                CurrentQueCount = int.Parse(str[0]);
                                int optID = int.Parse(str[1]);
                                //MessageBox.Show("Option ID = " + optID.ToString());

                                //ClsAnswerR objAns = new ClsAnswerR();
                                //objAns.CallID = int.Parse(txtCall.Text.ToString());
                                //objAns.QusOptionID = int.Parse(optID.ToString());
                                //objAns.Save();

                                for (int k = 0; k < objQueCollection.Count; k++)
                                {
                                    if (objQueCollection[k].ID == CurrentQueCount)
                                    {
                                        //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml" , UriKind.RelativeOrAbsolute));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                else if (varType == "CheckBox")
                {
                    foreach (object r in cnvPaint.Children)
                    {
                        if (r.GetType() == typeof(CheckBox))
                        {
                            if (((CheckBox)r).IsChecked == true)
                            {
                                string[] str = ((CheckBox)r).Tag.ToString().Split(',');
                                CurrentQueCount = int.Parse(str[0]);
                                int optID = int.Parse(str[1]);
                                //MessageBox.Show("Option ID = " + optID.ToString());

                                //ClsAnswerR objAns = new ClsAnswerR();
                                //objAns.CallID = int.Parse(txtCall.Text.ToString());
                                //objAns.QusOptionID = int.Parse(optID.ToString());
                                //objAns.Save();

                                for (int k = 0; k < objQueCollection.Count; k++)
                                {
                                    if (objQueCollection[k].ID == CurrentQueCount)
                                    {
                                        //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml", UriKind.RelativeOrAbsolute));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                else if (((Button)sender).Tag.ToString().ToLower() == "listbox")
                {
                    foreach (object r in cnvPaint.Children)
                    {
                        if (r.GetType() == typeof(ListBox))
                        {
                            for (int i = 0; i < ((ListBox)r).Items.Count; i++)
                            {
                                if (((ListBoxItem)((ListBox)r).Items[i]).IsSelected == true)
                                {
                                    string[] str             = ((ListBoxItem)r).Tag.ToString().Split(',');
                                    int      CurrentQueCount = int.Parse(str[0]);
                                    int      optID           = int.Parse(str[1]);
                                    //MessageBox.Show("Option ID = " + optID.ToString());

                                    //ClsAnswerR objAns = new ClsAnswerR();
                                    //objAns.CallID = int.Parse(txtCall.Text.ToString());
                                    //objAns.QusOptionID = int.Parse(optID.ToString());
                                    //objAns.Save();

                                    for (int k = 0; k < objQueCollection.Count; k++)
                                    {
                                        if (objQueCollection[k].ID == CurrentQueCount)
                                        {
                                            //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml", UriKind.RelativeOrAbsolute));
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                else if (((Button)sender).Tag.ToString().ToLower() == "combobox")
                {
                    foreach (object r in cnvPaint.Children)
                    {
                        if (r.GetType() == typeof(ComboBox))
                        {
                            for (int i = 0; i < ((ComboBox)r).Items.Count; i++)
                            {
                                if (((ComboBoxItem)((ComboBox)r).Items[i]).IsSelected == true)
                                {
                                    string[] str             = ((ComboBoxItem)r).Tag.ToString().Split(',');
                                    int      CurrentQueCount = int.Parse(str[0]);
                                    int      optID           = int.Parse(str[1]);
                                    //MessageBox.Show("Option ID = " + optID.ToString());

                                    //ClsAnswerR objAns = new ClsAnswerR();
                                    //objAns.CallID = int.Parse(txtCall.Text.ToString());
                                    //objAns.QusOptionID = int.Parse(optID.ToString());
                                    //objAns.Save();

                                    for (int k = 0; k < objQueCollection.Count; k++)
                                    {
                                        if (objQueCollection[k].ID == CurrentQueCount)
                                        {
                                            //this.NavigationService.Navigate(new Uri(objQueCollection[k].QuestionName + ".Xaml", UriKind.RelativeOrAbsolute));
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "btnYes_Click()--:--CtlDynamicScript.xaml.cs--:--" + exp.Message + " :--:--");
                //ClsException.LogError(ex);
                //ClsException.WriteToErrorLogFile(ex);
                System.Text.StringBuilder sb = new StringBuilder();
                sb.AppendLine(exp.Message);
                sb.AppendLine();
                sb.AppendLine("StackTrace : " + exp.StackTrace);
                sb.AppendLine();
                sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
                sb.AppendLine();
                sb1 = CreateTressInfo();
                sb.Append(sb1.ToString());
                VMuktiAPI.ClsLogging.WriteToTresslog(sb);
            }
        }
        public void GetQuestions()
        {
            btnNext.Content = "Next";

            if (load == 0)
            {
                try
                {
                    FncLoadScript();
                }
                catch (Exception e)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(e, "GetQuestions", "ctlScriptdesigner.xaml.cs");
                }
                load++;
            }
            CurrentQueCount = 0;
            startQuestion = "";
            startQuestionID = 0;

            objQueCollection = ClsQuestionCollectionR.GetAll(_ScriptID);

            SetQuestionsCombo(objQueCollection);
            try
            {
            if (objQueCollection.Count > 0)
            {
                    //FncSetInnerCanvas();
                    FncSetCanvas();
                if (btnNext.Parent == null)
                {
                    if (objQueCollection.Count > 1)
                    {
                        btnNext.Content = "Next";
                    }
                    else if (objQueCollection.Count == 1)
                    {
                        btnNext.Content = "Finished";
                        btnPrev.IsEnabled = false;
                    }

                    btnNext.Height = 25;
                    btnNext.Width = 50;
                    btnNext.Click += new RoutedEventHandler(btnYes_Click);
                    Canvas.SetLeft(btnNext, 130.0);
                    Canvas.SetTop(btnNext, 2.0);
                    cnvHead.Children.Add(btnNext);

                    btnPrev.Content = "Previous";
                    btnPrev.Height = 25;
                    btnPrev.Width = 70;
                    btnPrev.Click += new RoutedEventHandler(btnPrev_Click);
                    Canvas.SetLeft(btnPrev, 200.0);
                    Canvas.SetTop(btnPrev, 2.0);
                    cnvHead.Children.Add(btnPrev);
                    btnPrev.IsEnabled = false;
                }

                if (btnStartQue.Parent == null)
                {
                    btnStartQue.Content = "StartQuestion";
                    btnStartQue.Height = 25;
                    btnStartQue.Width = 90;
                    btnStartQue.Click += new RoutedEventHandler(btnStartQue_Click);
                    Canvas.SetLeft(btnStartQue, 290.0);
                    Canvas.SetTop(btnStartQue, 2.0);
                    cnvHead.Children.Add(btnStartQue);
                }
                CurrentQueCount = 0;
            }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "GetQuestions", "ctlScriptdesigner.xaml.cs");
            }

            try
            {
                if (Directory.Exists(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", "SS")))
                {
                    Directory.Delete(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", @"SS"), true);
                }
                Directory.CreateDirectory(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", "SS"));
            }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "GetQuestions", "ctlScriptdesigner.xaml.cs");
            }

            //MessageBox.Show(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", "ScriptBase"));
            //MessageBox.Show(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", "SS"));
            try
            {
            copyDirectory(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", "ScriptBase"), Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", "SS"));
            if (!Directory.Exists(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", @"SS\Script.DataAccess\ReferencedAssemblies")))
            {
                Directory.CreateDirectory(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", @"SS\Script.DataAccess\ReferencedAssemblies"));
            }

            if (!Directory.Exists(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", @"SS\Script.Presentation\ReferencedAssemblies")))
            {
                Directory.CreateDirectory(Assembly.GetAssembly(this.GetType()).Location.Replace("ScriptDesigner.Presentation.dll", @"SS\Script.Presentation\ReferencedAssemblies"));
                }
            }
            catch (Exception ert)
            {

                VMuktiAPI.VMuktiHelper.ExceptionHandler(ert, "GetQuestions", "ctlScriptdesigner.xaml.cs");
            }
        }