Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        string  ST_cmd_sql  = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_date desc";
        string  ST_top_sql  = "select top 10 * from ST_news order by ST_n_hit desc";
        string  personindex = "select top 10* from ST_news order by ST_n_id desc";
        string  TitleClass  = "select ST_c_id, ST_c_name from ST_class order by ST_date desc";
        DataSet ST_classds  = myobj.GetDataSet(TitleClass, "ST_class");
        DataSet ST_cmdds    = myobj.GetDataSet(ST_cmd_sql, "ST_news");
        DataSet ST_topds    = myobj.GetDataSet(ST_top_sql, "ST_news");
        DataSet mypersonds  = myobj.GetDataSet(personindex, "ST_class");

        //绑定博客文章类型列表
        ClassList.DataSource = new DataView(ST_classds.Tables[0]);
        ClassList.DataBind();

        //绑定推荐文章列表
        CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
        CmdList.DataBind();

        //绑定热点文章列表
        TopList.DataSource = new DataView(ST_topds.Tables[0]);
        TopList.DataBind();


        //绑定最新个人最新发表的博客文章
        ClassList0.DataSource = new DataView(mypersonds.Tables[0]);
        ClassList0.DataBind();
        if (Request.QueryString["c_id"] == null)
        {
            person_BindData();
        }
        else
        {
            NewsBlogList_Bind();
        }


        if (Request.Cookies["colors"] != null)
        {
            string   ST_test      = Request.Cookies["colors"].Value;
            String[] ST_colorList = ST_test.Split(new[] { ',' });
            ST_bgcolor = ST_colorList[0];
            ST_tcolor  = ST_colorList[1];
        }
        else
        {
            ST_bgcolor = "#FFFFFF";
            ST_tcolor  = "#cccccc";
        }
        Page.DataBind();
        string rd = DateTime.Now.Ticks.ToString();

        str = "imgFile/1.jpg?rd=" + rd + "|imgFile/2.jpg?rd=" + rd + "|imgFile/3.jpg?rd=" + rd + "|imgFile/4.jpg?rd=" +
              rd + "";
        string path = Server.MapPath("./") + "imgFile/LoopId.txt";

        loopId = File.ReadAllText(path);
        loopId = loopId.Replace(',', '|');
    }
Пример #2
0
        protected void GetShift(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string shift = ShiftList.SelectedItem.ToString();
                Session["Shift"] = shift;
                string currentyear = DateTime.Now.Year.ToString();
                ClassErr.Visible   = false;
                CourseErr.Visible  = false;
                TeacherErr.Visible = false;
                using (SqlConnection con = new SqlConnection(conString))
                {
                    con.Open();
                    string         query = "Select * from ClassTable where DId='" + Session["AccountId"].ToString() + "'  and Year='" + currentyear + "' and Shift='" + Session["Shift"] + "'";
                    SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                    DataTable      dt    = new DataTable();
                    sda.Fill(dt);
                    ClassList.DataSource = dt;
                    ClassList.DataBind();
                    ClassList.DataTextField  = "ClassName";
                    ClassList.DataValueField = "ClassId";
                    ClassList.DataBind();

                    ClassList.Items.Insert(0, new ListItem("Select", "NA"));
                    Section.Text = dt.Rows[0][2].ToString();

                    con.Close();
                }
            }
        }
Пример #3
0
        private void LoadData()
        {
            if (ClassList.Items.Count > 0)
            {
                ClassList.Items.Clear();
            }

            SortedList list = new SortedList();

            foreach (MetaClass mc in DataContext.Current.MetaModel.MetaClasses)
            {
                if (!mc.IsBridge && !mc.IsCard && !String.IsNullOrEmpty(mc.TitleFieldName))
                {
                    string name         = mc.Name;
                    string friendlyName = CHelper.GetResFileString(mc.FriendlyName);
                    string text         = name;

                    if (name != friendlyName)
                    {
                        text = String.Format(CultureInfo.InvariantCulture, "{0} ({1})", friendlyName, name);
                    }

                    list.Add(text, name);
                }
            }

            ClassList.DataSource     = list;
            ClassList.DataTextField  = "key";
            ClassList.DataValueField = "value";
            ClassList.DataBind();
        }
Пример #4
0
 public void TitleClass(string sqlstr)
 {
     SqlConnection myconn = new SqlConnection(ConfigurationSettings.AppSettings["ConStr"].ToString());
     myconn.Open();
     SqlDataAdapter myda = new SqlDataAdapter(sqlstr, myconn);
     DataSet myds = new DataSet();
     myda.Fill(myds);
     ClassList.DataSource = new DataView(myds.Tables[0]);
     ClassList.DataBind();
 }
Пример #5
0
    //加载文章类型的信息
    public void ST_Type_List_Bind()
    {
        string sqlstr = "select * from ST_class order by ST_date desc ";

        //调用公共类中的ExceDS()方法,用来返回一个DataSet类型
        My_sqldata.ExceDS(sqlstr);
        //获取数据表中的主键字段
        ClassList.DataKeyNames = new string[] { "ST_c_id" };
        ClassList.DataSource   = My_sqldata.ExceDS(sqlstr);
        ClassList.DataBind();
    }
Пример #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (IsSafe(Request.QueryString["id"], 2) == false)
            {
                Response.Write("非法参数,<a href=BlogIndex.aspx>点此返回</a>");
                Response.End();
            }
            string ST_dns = ConfigurationSettings.AppSettings["conStr"];
            string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + "";
            //最新推荐文章
            string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_id desc";

            ST_myConn = new SqlConnection(ST_dns);
            SqlDataAdapter ST_myCmd    = new SqlDataAdapter(ST_sql, ST_myConn);
            SqlDataAdapter ST_classCmd = new SqlDataAdapter("select ST_c_id,ST_c_name from ST_class", ST_myConn);
            SqlDataAdapter ST_cmdCmd   = new SqlDataAdapter(ST_cmd_sql, ST_myConn);

            DataSet ST_ds = new DataSet();

            ST_myCmd.Fill(ST_ds, "新闻查看");

            DataSet ST_classds = new DataSet();

            ST_classCmd.Fill(ST_classds, "类别列表");

            DataSet ST_cmdds = new DataSet();

            ST_cmdCmd.Fill(ST_cmdds, "推荐文章");

            NewsShow.DataSource = ST_ds.Tables[0];
            NewsShow.DataBind();

            ClassList.DataSource = new DataView(ST_classds.Tables[0]);
            ClassList.DataBind();

            CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
            CmdList.DataBind();
            //调用ST_UpdateHit()方法
            ST_UpdateHit();
            if (Request.Cookies["colors"] != null)
            {
                string   ST_test      = Request.Cookies["colors"].Value;
                String[] ST_colorList = ST_test.Split(new char[] { ',' });
                ST_bgcolor = ST_colorList[0];
                ST_tcolor  = ST_colorList[1];
            }
            else
            {
                ST_bgcolor = "#FFDE94";
                ST_tcolor  = "#efe3ce";
            }
            Page.DataBind();
        }
Пример #7
0
        public void BindClassDropdown()
        {
            string    command    = "Select ClassId, ClassName from class order by ClassName";
            DataTable ClassTable = new DataTable();


            ClassTable = DataService.GetDataWithoutParameter(command);
            ClassList.DataValueField = "ClassId";
            ClassList.DataTextField  = "ClassName";
            ClassList.DataSource     = ClassTable;

            ClassList.DataBind();
            ClassList.Items.Insert(0, new ListItem("--- Select Class ---", "0"));
        }
Пример #8
0
        public void CategoriesDatabind()
        {
            DataSet CategoriesList = AccountsTool.GetAllCategories();

            ClassList.DataSource     = CategoriesList;
            ClassList.DataTextField  = "Description";
            ClassList.DataValueField = "CategoryID";
            ClassList.DataBind();

            droplistCategories.DataSource     = CategoriesList;
            droplistCategories.DataTextField  = "Description";
            droplistCategories.DataValueField = "CategoryID";
            droplistCategories.DataBind();
            droplistCategories.Items.Insert(0, new ListItem("移动到...", ""));
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string login = Session["Log"].ToString();

            if (!Page.IsPostBack)
            {
                using (var db = new hackerEntities())
                {
                    //分类
                    ClassList.DataSource     = db.VideoClass.ToList();
                    ClassList.DataValueField = "id";
                    ClassList.DataTextField  = "name";
                    ClassList.DataBind();
                    //ClassList.Items.Insert(0, new ListItem("请选择一个分类", "0"));
                }
            }
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (IsSafe(Request.QueryString["id"], 2) == false)
            {
                Response.Write("错误页面,<a href=BlogIndex.aspx>点此返回</a>");
                Response.End();
            }
            string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + "";
            //最新推荐文章
            string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_id desc";

            string  sqlstr = "select ST_c_id,ST_c_name from ST_class";
            DataSet ST_ds  = myobj.GetDataSet(ST_sql, "ST_news");

            DataSet ST_classds = myobj.GetDataSet(sqlstr, "ST_class");

            DataSet ST_cmdds = myobj.GetDataSet(ST_cmd_sql, "ST_news");

            NewsShow.DataSource = ST_ds.Tables[0];
            NewsShow.DataBind();

            ClassList.DataSource = new DataView(ST_classds.Tables[0]);
            ClassList.DataBind();

            CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
            CmdList.DataBind();
            //调用ST_UpdateHit()方法
            ST_UpdateHit();
            if (Request.Cookies["colors"] != null)
            {
                string   ST_test      = Request.Cookies["colors"].Value;
                String[] ST_colorList = ST_test.Split(new[] { ',' });
                ST_bgcolor = ST_colorList[0];
                ST_tcolor  = ST_colorList[1];
            }
            else
            {
                ST_bgcolor = "#FFFFFF";
                ST_tcolor  = "#cccccc";
            }
            Page.DataBind();
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //初始化页面
            string ST_dns = ConfigurationSettings.AppSettings["conStr"];
            //最新推荐文章
            string        ST_cmd_sql = "select top 10 * from news where ST_n_iscmd=1 order by n_date desc";
            SqlConnection ST_myConn  = new SqlConnection(ST_dns);

            //定义并初始化命令对象
            SqlDataAdapter ST_classCmd = new SqlDataAdapter("select n_classid, classname from class", ST_myConn);
            SqlDataAdapter ST_cmd_Cmd  = new SqlDataAdapter(ST_cmd_sql, ST_myConn);

            //创建一个dataset数据集
            DataSet ST_classds = new DataSet();

            ST_classCmd.Fill(ST_classds, "类别列表");
            DataSet ST_cmdds = new DataSet();

            ST_cmd_Cmd.Fill(ST_cmdds, "推荐文章");
            ClassList.DataSource = new DataView(ST_classds.Tables[0]);

            //绑定文章类型列表
            ClassList.DataBind();
            cmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
            cmdList.DataBind();

            //绑定最新博客列表
            NewsList_Bind();
            if (Request.Cookies["colors"] != null)
            {
                string   ST_test      = Request.Cookies["colors"].Value;
                string[] ST_colorList = ST_test.Split(new char[] { ',' });
                ST_bgcolor = ST_colorList[0];
                ST_tcolor  = ST_colorList[1];
            }
            else
            {
                ST_bgcolor = "#FFDE94";
                ST_tcolor  = "#EFE3CE";
            }
            Page.DataBind();
        }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        string ST_dns = ConfigurationSettings.AppSettings["conStr"];
        //最新推荐文章
        string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_date desc";

        ST_myConn = new SqlConnection(ST_dns);
        SqlDataAdapter ST_classCmd = new SqlDataAdapter("select ST_c_id, ST_c_name from ST_class ", ST_myConn);
        SqlDataAdapter ST_cmdCmd   = new SqlDataAdapter(ST_cmd_sql, ST_myConn);
        DataSet        ST_classds  = new DataSet();

        ST_classCmd.Fill(ST_classds, "类别列表");
        DataSet ST_cmdds = new DataSet();

        ST_cmdCmd.Fill(ST_cmdds, "推荐文章");

        ClassList.DataSource = new DataView(ST_classds.Tables[0]);
        ClassList.DataBind();

        CmdList.DataSource = new DataView(ST_cmdds.Tables[0]);
        CmdList.DataBind();
        //调用自定义NewsBlogList_Bind方法
        NewsBlogList_Bind();
        if (Request.Cookies["colors"] != null)
        {
            string   ST_test      = Request.Cookies["colors"].Value;
            String[] ST_colorList = ST_test.Split(new char[] { ',' });
            ST_bgcolor = ST_colorList[0];
            ST_tcolor  = ST_colorList[1];
        }
        else
        {
            ST_bgcolor = "#FFDE94";
            ST_tcolor  = "#efe3ce";
        }
        Page.DataBind();
    }
Пример #13
0
        private void EditClick(object sender, EventArgs e)
        {
            PnlMain.Visible = true;
            // ShowTTForm.Visible = false;
            string temp = ((LinkButton)sender).ID.ToString();

            Session["TTId"] = temp;
            if (Page.IsPostBack)
            {
                string[] classInfo  = new string[2];
                string[] courseInfo = new string[2];
                string   q          = "Select * from TimeTable where Id='" + temp + "'";
                con.Open();
                SqlCommand    com = new SqlCommand(q, con);
                SqlDataReader dr  = com.ExecuteReader();
                dr.Read();

                if (dr.HasRows)
                {
                    classInfo = GetClassInfo(dr["ClassId"].ToString());
                    //ShiftList.SelectedValue = classInfo[1];
                    ShiftList.SelectedIndex = ShiftList.Items.IndexOf(ShiftList.Items.FindByText(classInfo[1]));

                    Section.Text             = classInfo[2];
                    courseInfo               = GetCourseInfo(dr["CourseId"].ToString());
                    CourseList.SelectedIndex = CourseList.Items.IndexOf(CourseList.Items.FindByText(courseInfo[1]));
                    Session["courseId"]      = CourseList.SelectedValue;

                    //CourseList.SelectedItem.Text = courseInfo[1];
                    //TeacherList.SelectedItem.Text = GetTeacherInfo(dr["TId"].ToString());
                    string Tname = GetTeacherInfo(dr["TId"].ToString());
                    TeacherList.SelectedIndex = TeacherList.Items.IndexOf(TeacherList.Items.FindByText(Tname));
                    Session["TeacId"]         = TeacherList.SelectedValue;

                    STime.Text  = dr["STime"].ToString();
                    ETime.Text  = dr["ETime"].ToString();
                    RoomNo.Text = dr["ClassRoomNo"].ToString();
                    SemesterList.SelectedValue = dr["SemesterNo"].ToString();
                    DaysList.SelectedValue     = dr["Day"].ToString();
                    Tname = GetTeacherInfo(dr["AId"].ToString());

                    if (!dr["AId"].Equals("0"))
                    {
                        AssDiv.Visible = true;
                        AssErr.Visible = false;
                        string query2 = "Select * from Teacher where Department='" + Session["AccountId"].ToString() + "'";
                        con.Close();
                        con.Open();
                        SqlDataAdapter sda2 = new SqlDataAdapter(query2, con);
                        DataTable      dt2  = new DataTable();
                        sda2.Fill(dt2);

                        AssisTeacherList.DataSource = dt2;
                        AssisTeacherList.DataBind();
                        AssisTeacherList.DataTextField  = "TName";
                        AssisTeacherList.DataValueField = "TId";
                        AssisTeacherList.DataBind();

                        AssisTeacherList.Items.Insert(0, new ListItem("Select", "NA"));
                        AssisTeacherList.SelectedIndex = AssisTeacherList.Items.IndexOf(AssisTeacherList.Items.FindByText(Tname));
                        Session["AssisId"]             = AssisTeacherList.SelectedValue;
                        con.Close();
                    }
                    else
                    {
                        AssDiv.Visible = false;
                        AssErr.Visible = false;
                    }
                    using (SqlConnection con = new SqlConnection(conString))
                    {
                        con.Close();
                        string currentyear = DateTime.Now.Year.ToString();
                        con.Open();
                        string         query = "Select * from ClassTable where DId='" + Session["AccountId"].ToString() + "'  and Year='" + currentyear + "' and Shift='" + classInfo[1] + "'";
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        DataTable      dt    = new DataTable();
                        sda.Fill(dt);
                        ClassList.DataSource = dt;
                        ClassList.DataBind();
                        ClassList.DataTextField  = "ClassName";
                        ClassList.DataValueField = "ClassId";
                        ClassList.DataBind();

                        ClassList.Items.Insert(0, new ListItem("Select", "NA"));
                        Section.Text            = dt.Rows[0][2].ToString();
                        ClassList.SelectedIndex = ClassList.Items.IndexOf(ClassList.Items.FindByText(classInfo[0]));
                        Session["classId"]      = ClassList.SelectedValue;
                        con.Close();
                    }
                }
                con.Close();
                AddTT.Visible    = false;
                UpdateTT.Visible = true;
            }
            //Response.Redirect("proforma.aspx");
        }
Пример #14
0
        protected void GetDeparmentID()
        {
            if (!IsPostBack)
            {
                string currentyear = DateTime.Now.Year.ToString();
                ClassErr.Visible   = false;
                CourseErr.Visible  = false;
                TeacherErr.Visible = false;
                using (SqlConnection con = new SqlConnection(conString))
                {
                    con.Open();
                    string         query = "Select * from ClassTable where DId='" + Session["AccountId"].ToString() + "'  and Year='" + currentyear + "' and Shift='" + ShiftList.SelectedItem + "'";
                    SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                    DataTable      dt    = new DataTable();
                    sda.Fill(dt);
                    ClassList.DataSource = dt;
                    ClassList.DataBind();
                    ClassList.DataTextField  = "ClassName";
                    ClassList.DataValueField = "ClassId";
                    ClassList.DataBind();

                    ClassList.Items.Insert(0, new ListItem("Select", "NA"));
                    Section.Text = dt.Rows[0][2].ToString();

                    con.Close();


                    con.Open();
                    string         query1 = "Select * from Course";
                    SqlDataAdapter sda1   = new SqlDataAdapter(query1, con);
                    DataTable      dt1    = new DataTable();
                    sda1.Fill(dt1);
                    if (!dt1.HasErrors)
                    {
                    }

                    CourseList.DataSource = dt1;
                    CourseList.DataBind();
                    CourseList.DataTextField  = "CourseName";
                    CourseList.DataValueField = "CourseId";
                    CourseList.DataBind();

                    CourseList.Items.Insert(0, new ListItem("Select", "NA"));
                    con.Close();

                    con.Open();
                    string         query2 = "Select * from Teacher where Department='" + Session["AccountId"].ToString() + "'";
                    SqlDataAdapter sda2   = new SqlDataAdapter(query2, con);
                    DataTable      dt2    = new DataTable();
                    sda2.Fill(dt2);
                    TeacherList.DataSource = dt2;
                    TeacherList.DataBind();
                    TeacherList.DataTextField  = "TName";
                    TeacherList.DataValueField = "TId";
                    TeacherList.DataBind();

                    TeacherList.Items.Insert(0, new ListItem("Select", "NA"));

                    //AssisTeacherList.DataSource = dt2;
                    //AssisTeacherList.DataBind();
                    //AssisTeacherList.DataTextField = "TName";
                    //AssisTeacherList.DataValueField = "TId";
                    //AssisTeacherList.DataBind();

                    //AssisTeacherList.Items.Insert(0, new ListItem("Select", "NA"));

                    con.Close();
                }


                //    }
            }
        }