Example #1
0
        public Curricula ReadCurriculum()
        {
            Curricula curricula = ReadCurriculaID();

            if (connect.State == ConnectionState.Open)
            {
                int k = 0;
                foreach (var item in curricula.curriculum)
                {
                    command = new SqlCommand("Select * from Curriculum where curriculum_id='" + item.id + "'", connect);
                    reader  = command.ExecuteReader();
                    while (reader.Read())
                    {
                        Course1 course1 = new Course1();
                        course1.@ref = reader[1].ToString();
                        //ose
                        //item.course.Add(course1);
                        curricula.curriculum[k].course.Add(course1); //ose item.course.Add(course1);
                    }
                    reader.Close();
                    k++;
                }
            }
            return(curricula);
        }
        // string conString = ConfigurationManager.ConnectionStrings["career_portalConnectionString"].ConnectionString;



        public List <CareerSearch.Course1> GetAllCourseddl()
        {
            try
            {
                using (SqlConnection con = new SqlConnection(connectionString))
                {
                    string     strQry = "select distinct co_id,course_name from tbl_newcourse_master order by course_name ASC";
                    SqlCommand cmd    = new SqlCommand(strQry, con);
                    con.Open();
                    SqlDataReader  sdr = cmd.ExecuteReader();
                    List <Course1> li  = new List <Course1>();
                    if (sdr.HasRows)
                    {
                        while (sdr.Read())
                        {
                            Course1 CR = new Course1();
                            CR.CourseID   = Convert.ToInt32(sdr["co_id"]);
                            CR.CourseName = sdr["course_name"].ToString();
                            li.Add(CR);
                        }
                        return(li);
                    }
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Log.Error("" + ex);
                return(null);
            }
        }
Example #3
0
        private void AddComponentToCourse()
        {
            Console.WriteLine("What's the name of this component?");
            String componentName = Console.ReadLine();

            Console.WriteLine("What's the weight of this component? (In percentage)");
            Double weight = Convert.ToDouble(Console.ReadLine());

            Component tempComponent = new Component(weight, componentName);

            try
            {
                Course1.AddComponent(tempComponent);
            }
            catch (PreExistingCompException)
            {
                Console.WriteLine("This component already exists in this course! Please try again...");
            }
            Console.WriteLine("Component has been added!");
            DisplayAssignmentOptions();
            String key = Console.ReadLine().ToUpper();

            Component1 = tempComponent;

            if (key.Equals("K"))
            {
                Process(key);
            }
        }
Example #4
0
        public void TestCourse1()
        {
            Course1 cr1 = new Course1(1, "Java", "CoreJava", "120 hours", "6000");

            Assert.AreEqual(cr1.CourseId, 1);
            Assert.AreEqual(cr1.CourseName, "Java");
            Assert.AreEqual(cr1.CourseDetail, "CoreJava");
            Assert.AreEqual(cr1.Duration, "120 hours");
            Assert.AreEqual(cr1.Fees, "6000");
        }
    /*如果用户登录,那么就展示院系*/
    private void InitData()
    {
        string         strCon = "Integrated Security=SSPI;Initial Catalog='NetDesign';Data Source='DESKTOP-HJQH3C9';User ID='sa'; Password = '******'; Connect Timeout = 30";
        SqlConnection  conn   = new SqlConnection(strCon);
        DataSet        ds     = new DataSet();
        string         str    = "SELECT c_id AS 院编号, c_name AS 院名称 FROM college";
        SqlDataAdapter da     = new SqlDataAdapter(str, conn);

        conn.Open();
        da.Fill(ds);
        conn.Close();
        Course1.DataSource = ds;
        Course1.DataBind();
    }
Example #6
0
    /*如果用户登录,那么就展示全部课程*/
    private void InitData()
    {
        string         strCon = "Integrated Security=SSPI;Initial Catalog='NetDesign';Data Source='DESKTOP-HJQH3C9';User ID='sa'; Password = '******'; Connect Timeout = 30";
        SqlConnection  conn   = new SqlConnection(strCon);
        DataSet        ds     = new DataSet();
        string         str    = "SELECT c.c_id AS 课程编号, t2.t_name AS 课程类别, c.c_name AS 课程名称, t.t_name AS 教师名称, c.c_score AS 课程学分, c.c_time AS 课程学时, c.c_number AS 课程总容量, c.c_balannumber AS 课程剩余容量 FROM Course c LEFT JOIN teacher t ON t.t_id = c.te_id LEFT JOIN Type t2 ON t2.t_id = c.ty_id ORDER BY c.c_id; ";
        SqlDataAdapter da     = new SqlDataAdapter(str, conn);

        conn.Open();
        da.Fill(ds);
        conn.Close();
        Course1.DataSource = ds;
        Course1.DataBind();
    }
Example #7
0
    /*如果用户登录,那么就展示院系*/
    private void InitData()
    {
        SqlDataReader dr;
        string        strCon = "Integrated Security=SSPI;Initial Catalog='NetDesign';Data Source='DESKTOP-HJQH3C9';User ID='sa'; Password = '******'; Connect Timeout = 30";

        SqlConnection conn = new SqlConnection(strCon);
        SqlCommand    cmd  = new SqlCommand();

        cmd.Connection = conn;
        string str = "SELECT sc.c_id AS 课程编号, c.c_name AS 课程名称, sc.sc_score AS 成绩 FROM SC sc  LEFT JOIN Course c ON sc.c_id = c.c_id LEFT JOIN Teacher t on sc.t_id = t.t_id WHERE sc.s_id = @StudentId ORDER BY sc.s_id , sc.t_id";

        cmd.CommandText = str;
        cmd.CommandType = System.Data.CommandType.Text;

        //添加查询对象,并且给参数赋值
        SqlParameter para = new SqlParameter("@StudentId", SqlDbType.Char, 18);

        para.Value = Session["login_id"];
        cmd.Parameters.Add(para);
        try
        {
            conn.Open();
            dr = cmd.ExecuteReader();
            Course1.DataSource = dr;
            Course1.DataBind();
        }
        catch (SqlException exception)
        {
            Response.Write(exception.Message);
        }
        finally
        {
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }
    }
Example #8
0
 static void Main(string[] args)
 {
     Course1 course1 = new Course1();
 }
Example #9
0
    private void LoadGrid()
    {
        BLItem           objBL    = new BLItem();
        DataTable        temp     = new DataTable();
        DataTable        original = objBL.Get_Marks_Of_Student(Session["New"].ToString());
        List <DataTable> tables   = new List <DataTable>();
        int       i     = 0;
        int       j     = 1;
        DataTable newDt = original.Clone();

        newDt.TableName = "Table_" + j;
        newDt.Clear();
        foreach (DataRow row in original.Rows)
        {
            DataRow newRow = newDt.NewRow();
            newRow.ItemArray = row.ItemArray;
            newDt.Rows.Add(newRow);
            i++;
            if (i == 1)
            {
                Head1.Visible      = true;
                Head1.Text         = newDt.Rows[0][2].ToString();
                Course1.DataSource = newDt;
                Course1.DataBind();
                newDt = original.Clone();
                newDt.Clear();
            }
            if (i == 2)
            {
                Head2.Visible      = true;
                Head2.Text         = newDt.Rows[0][2].ToString();
                Course2.DataSource = newDt;
                Course2.DataBind();
                newDt = original.Clone();
                newDt.Clear();
            }
            if (i == 3)
            {
                Head3.Visible      = true;
                Head3.Text         = newDt.Rows[0][2].ToString();
                Course3.DataSource = newDt;
                Course3.DataBind();
                newDt = original.Clone();
                newDt.Clear();
            }
            if (i == 4)
            {
                Head4.Visible      = true;
                Head4.Text         = newDt.Rows[0][2].ToString();
                Course4.DataSource = newDt;
                Course4.DataBind();
                newDt = original.Clone();
                newDt.Clear();
            }
            if (i == 5)
            {
                Head5.Visible      = true;
                Head5.Text         = newDt.Rows[0][2].ToString();
                Course5.DataSource = newDt;
                Course5.DataBind();
                newDt = original.Clone();
                newDt.Clear();
            }
        }
    }
Example #10
0
 public Course AddCourse(Course course)
 {
     course.Faculty = this;
     Course1.Add(course);
     return(Course1.LastOrDefault());
 }