示例#1
0
 //Обновление сцен
 void update_window()
 {
     //условие на скрытие кнопок и их заполнение
     if (current.MassageButton1 != null)
     {
         Option1.Show();
         Option1.Text = current.MassageButton1;
     }
     else
     {
         Option1.Hide();
     }
     if (current.MassageButton2 != null)
     {
         Option2.Show();
         Option2.Text = current.MassageButton2;
     }
     else
     {
         Option2.Hide();
     }
     if (current.MassageButton3 != null)
     {
         Option3.Show();
         Option3.Text = current.MassageButton3;
     }
     else
     {
         Option3.Hide();
     }
     this.BackgroundImage = current.Image;//обновление фона
 }
示例#2
0
 public void ShowOptions()
 {
     Console.WriteLine("a. " + Option1.ToString());
     Console.WriteLine("b. " + Option2.ToString());
     Console.WriteLine("c. " + Option3.ToString());
     Console.WriteLine("d. " + Option4.ToString());
 }
示例#3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Option1 option1 = db.Options1.Find(id);

            db.Options1.Remove(option1);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
 public ActionResult Edit([Bind(Include = "codeOption,libelleOption,qteDispo,prixOption")] Option1 option1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(option1).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(option1));
 }
示例#5
0
        public ActionResult Create([Bind(Include = "codeOption,libelleOption,qteDispo,prixOption")] Option1 option1)
        {
            if (ModelState.IsValid)
            {
                db.Options1.Add(option1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(option1));
        }
示例#6
0
        // GET: Option1/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Option1 option1 = db.Options1.Find(id);

            if (option1 == null)
            {
                return(HttpNotFound());
            }
            return(View(option1));
        }
示例#7
0
        public ConsoleMenu()
        {
            string Option1;


            do
            {
                Displaymenu();
                Option1 = Console.ReadLine();
                //Option1 = Convert.ToInt32(val);
                Console.WriteLine("You selected option -> " + Option1);

                switch (Option1)
                {
                case "1":
                    DataSetup setup1 = new DataSetup();
                    Console.ReadKey();
                    break;

                case "2":
                    Transaction trans = new Transaction();
                    Console.ReadKey();
                    break;

                case "3":
                    Console.ReadKey();
                    break;

                default:
                    Console.WriteLine("No function defined");
                    Console.ReadKey();
                    break;
                }
                //Console.ReadLine();
                Console.WriteLine("! =====              XYZ Company              ===== ! ");
                Console.WriteLine("! ===== Supply Chain Management and Logistics ===== ! ");
                Console.WriteLine("! =====       Business Rules Engine           ===== ! ");
                Console.WriteLine("Choose an option - 1 -> Setup ; 2 -> Payment Transaction ; 3 -> Exit ");

                Option1 = Console.ReadLine();
                //Option1 = Convert.ToInt32(val);
                Console.WriteLine("You selected option -> " + Option1);
            } while (!(Option1.Equals("3")));
        }
示例#8
0
文件: MyRegex.cs 项目: RyanB156/Regex
 public override Parser GetParser()
 {
     return(Parsers.Or(Option1.GetParser(), Option2.GetParser()));
 }
        public ActionResult AddQuestionnaire(QuestionnairesViewModel Model, string[] BlankOptions, string[] AnswerOptions)
        {
            try
            {
                VTSDBEntities objDB = new VTSDBEntities();

                if (Model.QuestionType == DAL.Model.QuestionType.SingleLine)
                {
                    Question1 question1 = new Question1();
                    question1.QuestionSentence = Model.QuestionText;
                    question1.OriginalSentence = "";
                    List <Option1> QuesOptions = new List <Option1>();
                    foreach (string OptionText in BlankOptions)
                    {
                        Option1 EachOption = new Option1();
                        EachOption.OptionText = OptionText;
                        EachOption.Question1  = question1;
                        QuesOptions.Add(EachOption);
                    }

                    List <Answer1> AllAnswers = new List <Answer1>();
                    foreach (string AnswerText in AnswerOptions)
                    {
                        Answer1 EachAnswer = new Answer1();
                        EachAnswer.AnswerText = AnswerText;
                        EachAnswer.Question1  = question1;
                        AllAnswers.Add(EachAnswer);
                    }

                    question1.Answer1 = AllAnswers;
                    question1.Option1 = QuesOptions;
                    objDB.Question1.Add(question1);
                    objDB.SaveChanges();
                    ViewBag.SuccessMsg = "Questionnaire added successfully.";
                }
                else if (Model.QuestionType == DAL.Model.QuestionType.MultiLine)
                {
                    Question2 question2 = new Question2();
                    question2.QuestionText = Model.QuestionText;

                    List <Option2> QuesOptions = new List <Option2>();
                    foreach (string OptionText in BlankOptions)
                    {
                        Option2 EachOption = new Option2();
                        EachOption.OptionText = OptionText;
                        EachOption.Question2  = question2;
                        QuesOptions.Add(EachOption);
                    }

                    List <Answer2> AllAnswers = new List <Answer2>();
                    Answer2        EachAnswer = new Answer2();
                    EachAnswer.Answer    = Model.AnswerText;
                    EachAnswer.Question2 = question2;
                    AllAnswers.Add(EachAnswer);


                    question2.Answer2 = AllAnswers;
                    question2.Option2 = QuesOptions;
                    objDB.Question2.Add(question2);
                    objDB.SaveChanges();
                    ViewBag.SuccessMsg = "Questionnaire added successfully.";
                }
                else if (Model.QuestionType == DAL.Model.QuestionType.SingleOption)
                {
                    Question3 question3 = new Question3();
                    question3.QuestionText = Model.QuestionText;

                    List <Answer3> AllAnswers = new List <Answer3>();
                    foreach (string AnswerText in AnswerOptions)
                    {
                        Answer3 EachAnswer = new Answer3();
                        EachAnswer.Answer    = AnswerText;
                        EachAnswer.Question3 = question3;
                        AllAnswers.Add(EachAnswer);
                    }


                    question3.Answer3 = AllAnswers;
                    objDB.Question3.Add(question3);
                    objDB.SaveChanges();
                    ViewBag.SuccessMsg = "Questionnaire added successfully.";
                }
                else if (Model.QuestionType == DAL.Model.QuestionType.MultiOption)
                {
                    Question4 question4 = new Question4();
                    question4.QuestionText = Model.QuestionText;

                    List <Answer4> AllAnswers = new List <Answer4>();
                    foreach (string AnswerText in AnswerOptions)
                    {
                        Answer4 EachAnswer = new Answer4();
                        EachAnswer.Answer    = AnswerText;
                        EachAnswer.Question4 = question4;
                        AllAnswers.Add(EachAnswer);
                    }

                    question4.Answer4 = AllAnswers;
                    objDB.Question4.Add(question4);
                    objDB.SaveChanges();
                    ViewBag.SuccessMsg = "Questionnaire added successfully.";
                }
                else if (Model.QuestionType == DAL.Model.QuestionType.Date)
                {
                    Question5 question5 = new Question5();
                    question5.QuestionText = Model.QuestionText;

                    List <Answer5> AllAnswers = new List <Answer5>();
                    foreach (string AnswerText in AnswerOptions)
                    {
                        Answer5 EachAnswer = new Answer5();
                        EachAnswer.Answer    = AnswerText;
                        EachAnswer.Question5 = question5;
                        AllAnswers.Add(EachAnswer);
                    }

                    question5.Answer5 = AllAnswers;
                    objDB.Question5.Add(question5);
                    objDB.SaveChanges();
                    ViewBag.SuccessMsg = "Questionnaire added successfully.";
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
            {
                Exception raise = dbEx;
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        string message = string.Format("{0}:{1}",
                                                       validationErrors.Entry.Entity.ToString(),
                                                       validationError.ErrorMessage);
                        // raise a new exception nesting
                        // the current instance as InnerException
                        raise = new InvalidOperationException(message, raise);
                    }
                }
                //throw raise;
                ViewBag.ErrorMsg = "An error occurred while saving the questionnaire.";
            }

            ModelState.Clear();
            return(View());
        }