Esempio n. 1
0
        public void Test2()
        {
            int[] arr    = new int[0];
            int   result = new Q26().RemoveDuplicates(arr);

            Assert.AreEqual(0, result);
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Q26 q26 = db.Q26s.Find(id);

            db.Q26s.Remove(q26);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "ID,Name")] Q26 q26)
 {
     if (ModelState.IsValid)
     {
         db.Entry(q26).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(q26));
 }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "ID,Name")] Q26 q26)
        {
            if (ModelState.IsValid)
            {
                db.Q26s.Add(q26);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(q26));
        }
Esempio n. 5
0
        public void Test()
        {
            int[] arr    = new[] { 0, 0, 1, 1, 1, 2, 2, 3, 3, 4 };
            int   result = new Q26().RemoveDuplicates(arr);

            Assert.AreEqual(5, result);
            Assert.AreEqual(0, arr[0]);
            Assert.AreEqual(1, arr[1]);
            Assert.AreEqual(2, arr[2]);
            Assert.AreEqual(3, arr[3]);
            Assert.AreEqual(4, arr[4]);
        }
Esempio n. 6
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Q26 q26 = db.Q26s.Find(id);

            if (q26 == null)
            {
                return(HttpNotFound());
            }
            return(View(q26));
        }
        protected bool SaveData()
        {
            StringBuilder columnList = new StringBuilder();
            SQLParamList  sqlParams  = new SQLParamList();

            if (QueryPropertyShortCode == GCCPropertyShortCode.GCC || (QueryPropertyShortCode == GCCPropertyShortCode.GAG && QueryGAGLocation == GLocation.None))
            {
                //User had to select location
                string propSel = fbkProperty.SelectedValue;
                if (propSel.Length > 3)
                {
                    //GAG
                    if (propSel.Substring(0, 2).Equals("13"))
                    {
                        columnList.AppendFormat(",[{0}]", fbkProperty.DBColumn);
                        sqlParams.Add("@" + fbkProperty.DBColumn, 13);
                    }
                }
                else
                {
                    fbkProperty.PrepareQuestionForDB(columnList, sqlParams);
                }
            }

            ddlDepartment.PrepareQuestionForDB(columnList, sqlParams);
            Q1.PrepareQuestionForDB(columnList, sqlParams);
            Q2.PrepareQuestionForDB(columnList, sqlParams);
            Q3.PrepareQuestionForDB(columnList, sqlParams);
            Q4.PrepareQuestionForDB(columnList, sqlParams);
            Q5.PrepareQuestionForDB(columnList, sqlParams);
            Q6.PrepareQuestionForDB(columnList, sqlParams);
            Q7.PrepareQuestionForDB(columnList, sqlParams);
            Q8.PrepareQuestionForDB(columnList, sqlParams);
            Q9.PrepareQuestionForDB(columnList, sqlParams);
            Q10.PrepareQuestionForDB(columnList, sqlParams);
            Q11.PrepareQuestionForDB(columnList, sqlParams);
            Q12.PrepareQuestionForDB(columnList, sqlParams);
            Q13.PrepareQuestionForDB(columnList, sqlParams);
            Q14.PrepareQuestionForDB(columnList, sqlParams);
            Q15.PrepareQuestionForDB(columnList, sqlParams);
            Q16.PrepareQuestionForDB(columnList, sqlParams);
            Q17.PrepareQuestionForDB(columnList, sqlParams);
            Q18.PrepareQuestionForDB(columnList, sqlParams);
            Q19.PrepareQuestionForDB(columnList, sqlParams);
            Q20.PrepareQuestionForDB(columnList, sqlParams);
            Q21.PrepareQuestionForDB(columnList, sqlParams);
            Q22.PrepareQuestionForDB(columnList, sqlParams);
            Q23.PrepareQuestionForDB(columnList, sqlParams);
            Q24.PrepareQuestionForDB(columnList, sqlParams);
            Q25.PrepareQuestionForDB(columnList, sqlParams);
            Q26.PrepareQuestionForDB(columnList, sqlParams);
            Q27.PrepareQuestionForDB(columnList, sqlParams);
            Q28.PrepareQuestionForDB(columnList, sqlParams);
            Q29A.PrepareQuestionForDB(columnList, sqlParams);
            Q29B.PrepareQuestionForDB(columnList, sqlParams);
            Q29C.PrepareQuestionForDB(columnList, sqlParams);
            Q30.PrepareQuestionForDB(columnList, sqlParams);
            radQ31_Hourly.PrepareQuestionForDB(columnList, sqlParams);
            radQ31_Salary.PrepareQuestionForDB(columnList, sqlParams);
            radQ32_1.PrepareQuestionForDB(columnList, sqlParams);
            radQ32_2.PrepareQuestionForDB(columnList, sqlParams);
            radQ32_3.PrepareQuestionForDB(columnList, sqlParams);
            radQ32_4.PrepareQuestionForDB(columnList, sqlParams);
            radQ32_5.PrepareQuestionForDB(columnList, sqlParams);
            Q33.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_1.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_2.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_3.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_4.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_5.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_6.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_7.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_8.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_9.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_10.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_11.PrepareQuestionForDB(columnList, sqlParams);
            chkQ34_12.PrepareQuestionForDB(columnList, sqlParams);

            if (radFFContinue.Checked)
            {
                CSR_Q1.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q2.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q3.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q4.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q5_1.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q5_2.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q5_3.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q5_4.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q6.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q7.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_1.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_2.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_3.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_4.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_5.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_6.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_7.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_8.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_9.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q8_OtherExplanation.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9A.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9B.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9C.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9D.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9E.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9F.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9G.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q9H.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q10A.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q10B.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q10C.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q10D.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q10E.PrepareQuestionForDB(columnList, sqlParams);
                radCSR_Q11_1.PrepareQuestionForDB(columnList, sqlParams);
                radCSR_Q11_2.PrepareQuestionForDB(columnList, sqlParams);
                radCSR_Q11_3.PrepareQuestionForDB(columnList, sqlParams);
                radCSR_Q11_4.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q12.PrepareQuestionForDB(columnList, sqlParams);
                CSR_Q13.PrepareQuestionForDB(columnList, sqlParams);
            }

            columnList.Append(",[PropertyID],[DateEntered],[SurveyType]");
            sqlParams.Add("@PropertyID", Master.PropertyID)
            .Add("@DateEntered", DateTime.Now)
            .Add("@SurveyType", IsKioskSurvey ? "K" : "D");
            if (GAGLocation != GLocation.None)
            {
                columnList.Append(",[GAGLocation]");
                sqlParams.Add("@GAGLocation", GAGLocation.ToString());
            }

            columnList.Remove(0, 1);
            SQLDatabase sql   = new SQLDatabase();    sql.CommandTimeout = 120;
            int         rowID = sql.QueryAndReturnIdentity(String.Format("INSERT INTO [tblSurveySnapshot2017] ({0}) VALUES ({1});", columnList, columnList.ToString().Replace("[", "@").Replace("]", String.Empty)), sqlParams);

            if (!sql.HasError && rowID != -1)
            {
                Dictionary <string, int> wordCounts = SurveyTools.GetWordCount(Q33.Text, CSR_Q8_OtherExplanation.Text, CSR_Q13.Text);
                SurveyTools.SaveWordCounts(SharedClasses.SurveyType.Employee, rowID, wordCounts);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            string input; int no, choice;

            do
            {
                Console.WriteLine("_06_11_2019_Assignment2 part-II");
                Console.WriteLine("Enter the Question no you want to run or for all at once enter 0");
                input = Console.ReadLine();
                if (Int32.TryParse(input, out no))
                {
                    switch (no)
                    {
                    case 0:
                        Console.WriteLine("Question-19");
                        Q19.Run();
                        Console.WriteLine("Question-20");
                        Q20.Run();
                        Console.WriteLine("Question-21");
                        Q21.Run();
                        Console.WriteLine("Question-22");
                        Q22.Run();
                        Console.WriteLine("Question-23");
                        Q23.Run();
                        Console.WriteLine("Question-24");
                        Q24.Run();
                        Console.WriteLine("Question-25");
                        Q25.Run();
                        Console.WriteLine("Question-26");
                        Q26.Run();
                        Console.WriteLine("Question-27");
                        Q27.Run();
                        Console.WriteLine("Question-28");
                        Q28.Run();
                        Console.WriteLine("Question-29");
                        Q29.Run();
                        Console.WriteLine("Question-30");
                        Q30.Run();
                        Console.WriteLine("Question-31");
                        Q31.Run();
                        break;

                    case 19:
                        Q19.Run();
                        break;

                    case 20:
                        Q20.Run();
                        break;

                    case 21:
                        Q21.Run();
                        break;

                    case 22:
                        Q22.Run();
                        break;

                    case 23:
                        Q23.Run();
                        break;

                    case 24:
                        Q24.Run();
                        break;

                    case 25:
                        Q25.Run();
                        break;

                    case 26:
                        Q26.Run();
                        break;

                    case 27:
                        Q27.Run();
                        break;

                    case 28:
                        Q28.Run();
                        break;

                    case 29:
                        Q29.Run();
                        break;

                    case 30:
                        Q30.Run();
                        break;

                    case 31:
                        Q31.Run();
                        break;

                    default:
                        Console.WriteLine("Question no {0} does not exist", no);
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("Not an Integer Value");
                }
                Console.WriteLine("Do you want to run another program 1.yes 2.no");
                string input2 = Console.ReadLine();
                while (!(Int32.TryParse(input2, out choice)))
                {
                    Console.WriteLine("Renter the choice");
                    input2 = Console.ReadLine();
                }
            }while(choice == 1);
        }