Exemplo n.º 1
0
        ///////////////////endstuinfo



        //////////////begin add student-class

        public int Addstudenttoclass(class_student c_stud)
        {
            try
            {
                Exercise_ERContainer cn = new Exercise_ERContainer();

                cn.class_student.Add(c_stud);
                cn.SaveChanges();
                return(1);
            }
            //catch (DbEntityValidationException ex)
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(0);
            }
        }
Exemplo n.º 2
0
        ////endfromexcel//////////////////

        /////save student to db

        /////save student to db

        public static void savestudents(int classid)
        {
            Service_stuClient serviceDB = new Service_stuClient();
            List <Exercise_DAL.class_student> c_studl  = new List <Exercise_DAL.class_student>();
            List <Exercise_DAL.StudInfo1>     studentl = new List <Exercise_DAL.StudInfo1>();

            foreach (Student st in studentList)
            {
                Exercise_DAL.StudInfo1 sttemp = new Exercise_DAL.StudInfo1();
                sttemp.studentid = st.studentid;
                sttemp.name      = st.name;
                sttemp.pd        = "11111111";
                Exercise_DAL.class_student c_st = new Exercise_DAL.class_student();
                c_st.classid   = classid;
                c_st.studentid = st.studentid;
                c_st.classno   = st.no;
                c_studl.Add(c_st);
                studentl.Add(sttemp);
            }
            serviceDB.Addstu(c_studl, studentl);
            ///////////////////////////////////////////////
        }