Esempio n. 1
0
        //Function-> this function reads in the information from an input file and populates the chart with that info
        public void ReadInfoIntoChart()
        {
            //go to the file and extract the X and Y points
            string line;
            string StudentA, StudentB, StudentC, StudentD;

            using (StreamReader inFile = new StreamReader("../../GradePercentsOnAssigns.txt"))
            {
                while ((line = inFile.ReadLine()) != null)
                {
                    //each student is split by a tab, each test score per student is split by ":"
                    //split the lines by a comma (since input goes X,Y)
                    string[] Students = line.Split('\t');

                    //get each student's test scores
                    StudentA = Students[0];
                    StudentB = Students[1];
                    StudentC = Students[2];
                    StudentD = Students[3];

                    //now split each student by the colons since each test score is separated by that
                    string[] StudentAScores = StudentA.Split(':');
                    string[] StudentBScores = StudentB.Split(':');
                    string[] StudentCScores = StudentC.Split(':');
                    string[] StudentDScores = StudentD.Split(':');

                    //call function above to go through each student's test & score array
                    //and populate the correct values into the points for the chart
                    StudentAPoints = createDataPoints(StudentAScores);
                    StudentBPoints = createDataPoints(StudentBScores);
                    StudentCPoints = createDataPoints(StudentCScores);
                    StudentDPoints = createDataPoints(StudentDScores);
                }
            }
        }
        public ActionResult ManageStudentMod(StudentsData Data)
        {
            JObject joResult = new JObject();

            try
            {
                Students st = new Students();
                st.name     = Data.Name;
                st.datatype = Data.DataType;
                st.kind     = Data.Kind;
                st.no       = Convert.ToInt32(Data.no);
                dbDapper.Update(st);

                if (Data.ExperienceList != null)
                {
                    ssql = " delete from studentd where studentno = '{0}' and type = '{1}' ";
                    ssql = string.Format(ssql, Data.no.ToString(), "exp");
                    dbDapper.Execute(ssql);
                    foreach (string item in Data.ExperienceList)
                    {
                        StudentD sd = new StudentD();
                        sd.studentno = Convert.ToInt32(Data.no);
                        sd.type      = "exp";
                        sd.value     = item;
                        dbDapper.Insert(sd);
                    }
                }

                if (Data.ResearchList != null)
                {
                    ssql = " delete from studentd where studentno = '{0}' and type = '{1}' ";
                    ssql = string.Format(ssql, Data.no.ToString(), "res");
                    dbDapper.Execute(ssql);
                    foreach (string item in Data.ResearchList)
                    {
                        StudentD sd = new StudentD();
                        sd.studentno = Convert.ToInt32(Data.no);
                        sd.type      = "res";
                        sd.value     = item;
                        dbDapper.Insert(sd);
                    }
                }



                joResult.Add("msg", "ok");
            }
            catch (Exception ex)
            {
                joResult.Add("msg", ex.Message);
            }

            return(Content(JsonConvert.SerializeObject(joResult), "application/json"));
        }
Esempio n. 3
0
 public StudentB()
 {
     objStudent = new StudentD();
 }