Beispiel #1
0
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            // int nID = int.Parse(Request.QueryString["id"]);


            string strKnowledgeID = Request.QueryString.Get("id");

            string[] str1 = strKnowledgeID.Split(new char[] { '/' });

            int nID = int.Parse(str1[str1.LongLength - 1].ToString());

            OrganizationBLL orgBll = new OrganizationBLL();
            int             orgID  = orgBll.GetStationOrgID(PrjPub.CurrentLoginUser.OrgID);

            CoursewareBLL coursewareBLL = new CoursewareBLL();
            IList <RailExam.Model.Courseware> coursewares = new List <RailExam.Model.Courseware>();

            if (Request.QueryString.Get("type") == "Courseware")
            {
                coursewares = coursewareBLL.GetCoursewares(nID, -1, txtCoursewareName.Text, txtKeyWords.Text, txtAuthors.Text, orgID);
            }
            else if (Request.QueryString.Get("type") == "TrainType")
            {
                coursewares = coursewareBLL.GetCoursewares(-1, nID, txtCoursewareName.Text, txtKeyWords.Text, txtAuthors.Text, orgID);
            }
            else
            {
                coursewares = coursewareBLL.GetCoursewaresByPostID(nID, txtCoursewareName.Text, txtKeyWords.Text, txtAuthors.Text, orgID);
            }

            if (coursewares != null)
            {
                foreach (RailExam.Model.Courseware obj in coursewares)
                {
                    if (obj.CoursewareName.Length <= 20)
                    {
                        obj.CoursewareName = "<a onclick=OpenIndex('" + obj.CoursewareID + "') href=# title=" + obj.CoursewareName + " > " + obj.CoursewareName + " </a>";
                    }
                    else
                    {
                        obj.CoursewareName = "<a onclick=OpenIndex('" + obj.CoursewareID + "') href=# title=" + obj.CoursewareName + " > " + obj.CoursewareName.Substring(0, 20) + "...</a>";
                    }
                }

                Grid1.DataSource = coursewares;
                Grid1.DataBind();
            }
        }
Beispiel #2
0
        private void BindGrid()
        {
            string strIDPath = Request.QueryString["id"];

            CoursewareBLL coursewareBLL = new CoursewareBLL();
            IList <RailExam.Model.Courseware> coursewares = new List <RailExam.Model.Courseware>();

            OrganizationBLL orgBll = new OrganizationBLL();
            int             orgID  = orgBll.GetStationOrgID(PrjPub.CurrentLoginUser.OrgID);

            if (Request.QueryString.Get("type") == "Courseware")
            {
                coursewares = coursewareBLL.GetCoursewaresByCoursewareTypeID(Convert.ToInt32(strIDPath), orgID);
            }
            else if (Request.QueryString.Get("type") == "TrainType")
            {
                coursewares = coursewareBLL.GetCoursewaresByTrainTypeID(Convert.ToInt32(strIDPath), orgID);
            }
            else
            {
                coursewares = coursewareBLL.GetCoursewaresByPostID(Convert.ToInt32(strIDPath), orgID);
            }

            if (coursewares != null)
            {
                foreach (RailExam.Model.Courseware obj in coursewares)
                {
                    if (obj.CoursewareName.Length <= 20)
                    {
                        obj.CoursewareName = "<a onclick=OpenIndex('" + obj.CoursewareID + "') href=# title=" + obj.CoursewareName + " > " + obj.CoursewareName + " </a>";
                    }
                    else
                    {
                        obj.CoursewareName = "<a onclick=OpenIndex('" + obj.CoursewareID + "') href=# title=" + obj.CoursewareName + " > " + obj.CoursewareName.Substring(0, 20) + "...</a>";
                    }
                }

                Grid1.DataSource = coursewares;
                Grid1.DataBind();
            }
        }