Пример #1
0
        private void ShowData(string strSql)
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter(strSql, SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "PaperInfo");
            RowNum = DataGridPaper.CurrentPageIndex * DataGridPaper.PageSize + 1;

            string SortExpression = DataGridPaper.Attributes["SortExpression"];
            string SortDirection  = DataGridPaper.Attributes["SortDirection"];

            SqlDS.Tables["PaperInfo"].DefaultView.Sort = SortExpression + " " + SortDirection;

            DataGridPaper.DataSource = SqlDS.Tables["PaperInfo"].DefaultView;
            DataGridPaper.DataBind();
            for (int i = 0; i < DataGridPaper.Items.Count; i++)
            {
                Label labAvaiTime = (Label)DataGridPaper.Items[i].FindControl("labAvaiTime");
                labAvaiTime.Text = DataGridPaper.Items[i].Cells[8].Text.Trim() + "/<br>" + DataGridPaper.Items[i].Cells[9].Text.Trim();

                LinkButton LBAnswerRecord = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButAnswerRecord");
                LBAnswerRecord.Attributes.Add("onclick", "javascript:NewWin=window.open('AnswerRecord.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&PaperName=" + DataGridPaper.Items[i].Cells[2].Text.Trim() + "&PaperMark=" + DataGridPaper.Items[i].Cells[10].Text.Trim() + "&PassMark=" + DataGridPaper.Items[i].Cells[11].Text.Trim() + "&PaperType=" + intPaperType + "','AnswerRecord','titlebar=yes,menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=yes,top=0,left=0,width=screen.availWidth,height=screen.availHeight');NewWin.moveTo(0,0);NewWin.resizeTo(screen.availWidth,screen.availHeight);return false;");

                LinkButton LBDel = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButDel");
                LBDel.Attributes.Add("onclick", "javascript:{if(confirm('确定要删除选择答卷吗?')==false) return false;}");
            }
            LabelRecord.Text      = Convert.ToString(SqlDS.Tables["PaperInfo"].Rows.Count);
            LabelCountPage.Text   = Convert.ToString(DataGridPaper.PageCount);
            LabelCurrentPage.Text = Convert.ToString(DataGridPaper.CurrentPageIndex + 1);
            SqlConn.Dispose();
        }
Пример #2
0
        private void ShowData(string strSql)
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter(strSql, SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "PaperInfo");
            RowNum = DataGridPaper.CurrentPageIndex * DataGridPaper.PageSize + 1;
            LinNum = 0;

            string SortExpression = DataGridPaper.Attributes["SortExpression"];
            string SortDirection  = DataGridPaper.Attributes["SortDirection"];

            SqlDS.Tables["PaperInfo"].DefaultView.Sort = SortExpression + " " + SortDirection;

            DataGridPaper.DataSource = SqlDS.Tables["PaperInfo"].DefaultView;
            DataGridPaper.DataBind();
            for (int i = 0; i < DataGridPaper.Items.Count; i++)
            {
                Label labAvaiTime = (Label)DataGridPaper.Items[i].FindControl("labAvaiTime");
                labAvaiTime.Text = DataGridPaper.Items[i].Cells[12].Text.Trim() + "/<br>" + DataGridPaper.Items[i].Cells[13].Text.Trim();

                LinkButton LBEditPaper    = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButEditPaper");
                LinkButton LBDel          = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButDel");
                LinkButton LBPreviewPaper = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButPreviewPaper");

                if ((myLoginID.Trim().ToUpper() == "ADMIN") || (myLoginID.Trim().ToUpper() == DataGridPaper.Items[i].Cells[8].Text.Trim().ToUpper()))
                {
                    if (DataGridPaper.Items[i].Cells[14].Text.Trim() == "1")
                    {
                        LBEditPaper.Attributes.Add("onclick", "jscomNewOpenBySize('EditRandPaper.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&PaperType=" + DataGridPaper.Items[i].Cells[11].Text.Trim() + "','EditRandPaper',700,600);return false;");
                    }
                    else
                    {
                        LBEditPaper.Attributes.Add("onclick", "jscomNewOpenBySize('EditCustomPaper.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&PaperType=" + DataGridPaper.Items[i].Cells[11].Text.Trim() + "','EditCustomPaper',700,600);return false;");
                    }
                    LBDel.Attributes.Add("onclick", "javascript:{if(confirm('确定要删除选择试卷吗?')==false) return false;}");
                    LBPreviewPaper.Attributes.Add("onclick", "javascript:NewWin=window.open('PreviewPaper.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "','PreviewPaper','titlebar=yes,menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=yes,top=0,left=0,width=screen.availWidth,height=screen.availHeight');NewWin.moveTo(0,0);NewWin.resizeTo(screen.availWidth,screen.availHeight);return false;");
                }
                else
                {
                    LBEditPaper.Attributes.Add("onclick", "javascript:alert('对不起,您没有此操作权限!');return false;");
                    LBDel.Attributes.Add("onclick", "javascript:alert('对不起,您没有此操作权限!');return false;");
                    LBPreviewPaper.Attributes.Add("onclick", "javascript:alert('对不起,您没有此操作权限!');return false;");
                }
            }
            LabelRecord.Text      = Convert.ToString(SqlDS.Tables["PaperInfo"].Rows.Count);
            LabelCountPage.Text   = Convert.ToString(DataGridPaper.PageCount);
            LabelCurrentPage.Text = Convert.ToString(DataGridPaper.CurrentPageIndex + 1);
            SqlConn.Dispose();
        }
Пример #3
0
        private void ShowData(string strSql)
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter(strSql, SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "PaperInfo");
            RowNum = DataGridPaper.CurrentPageIndex * DataGridPaper.PageSize + 1;

            string SortExpression = DataGridPaper.Attributes["SortExpression"];
            string SortDirection  = DataGridPaper.Attributes["SortDirection"];

            SqlDS.Tables["PaperInfo"].DefaultView.Sort = SortExpression + " " + SortDirection;

            DataGridPaper.DataSource = SqlDS.Tables["PaperInfo"].DefaultView;
            DataGridPaper.DataBind();
            for (int i = 0; i < DataGridPaper.Items.Count; i++)
            {
                Label labAvaiTime = (Label)DataGridPaper.Items[i].FindControl("labAvaiTime");
                labAvaiTime.Text = DataGridPaper.Items[i].Cells[11].Text.Trim() + "/<br>" + DataGridPaper.Items[i].Cells[12].Text.Trim();

                LinkButton LBStartExam = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButStartExam");
                if (DataGridPaper.Items[i].Cells[14].Text.Trim() == "整卷模式")
                {
                    LBStartExam.Attributes.Add("onclick", "javascript:{if (confirm('您确定要开始作业吗?')==true) {NewExam=window.open('StartJobAll.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&UserID=" + intUserID + "&Start=yes','StartJobAll','titlebar=yes,menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=yes,top=0,left=0,width=screen.availWidth,height=screen.availHeight');NewExam.moveTo(0,0);NewExam.resizeTo(screen.availWidth,screen.availHeight);}else{return false;}}");
                }
                if (DataGridPaper.Items[i].Cells[14].Text.Trim() == "逐题模式")
                {
                    LBStartExam.Attributes.Add("onclick", "javascript:{if (confirm('您确定要开始作业吗?')==true) {NewExam=window.open('StartJobOne.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&UserID=" + intUserID + "&Start=yes','StartJobOne','titlebar=yes,menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=yes,top=0,left=0,width=screen.availWidth,height=screen.availHeight');NewExam.moveTo(0,0);NewExam.resizeTo(screen.availWidth,screen.availHeight);}else{return false;}}");
                }
            }
            LabelRecord.Text      = Convert.ToString(SqlDS.Tables["PaperInfo"].Rows.Count);
            LabelCountPage.Text   = Convert.ToString(DataGridPaper.PageCount);
            LabelCurrentPage.Text = Convert.ToString(DataGridPaper.CurrentPageIndex + 1);
            SqlConn.Dispose();
        }
Пример #4
0
        private void ShowData(string strSql)
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter(strSql, SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "PaperInfo");
            RowNum = DataGridPaper.CurrentPageIndex * DataGridPaper.PageSize + 1;

            string SortExpression = DataGridPaper.Attributes["SortExpression"];
            string SortDirection  = DataGridPaper.Attributes["SortDirection"];

            SqlDS.Tables["PaperInfo"].DefaultView.Sort = SortExpression + " " + SortDirection;

            DataGridPaper.DataSource = SqlDS.Tables["PaperInfo"].DefaultView;
            DataGridPaper.DataBind();
            for (int i = 0; i < DataGridPaper.Items.Count; i++)
            {
                Label labAvaiTime = (Label)DataGridPaper.Items[i].FindControl("labAvaiTime");
                labAvaiTime.Text = DataGridPaper.Items[i].Cells[8].Text.Trim() + "/<br>" + DataGridPaper.Items[i].Cells[9].Text.Trim();

                LinkButton LBAverage  = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButAverage");
                LinkButton LBGrade    = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButGrade");
                LinkButton LBLore     = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButLore");
                LinkButton LBTestType = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButTestType");
                LinkButton LBTest     = (LinkButton)DataGridPaper.Items[i].FindControl("LinkButTest");

                //				LBAverage.Attributes.Add("onclick","javascript:alert('对不起,未注册用户不能进行试卷统计!');return false;");
                //				LBGrade.Attributes.Add("onclick","javascript:alert('对不起,未注册用户不能进行试卷统计!');return false;");
                //				LBLore.Attributes.Add("onclick","javascript:alert('对不起,未注册用户不能进行试卷统计!');return false;");
                //				LBTestType.Attributes.Add("onclick","javascript:alert('对不起,未注册用户不能进行试卷统计!');return false;");
                //				LBTest.Attributes.Add("onclick","javascript:alert('对不起,未注册用户不能进行试卷统计!');return false;");

                string sqlID    = "select avg(TotalMark) as avg from UserScore where PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + " and ExamState=1";
                string ziduan   = "avg";
                string avgPrice = ObjFun.GetValues(sqlID, ziduan);
                if (avgPrice == "")
                {
                    LBAverage.Attributes.Add("onclick", "javascript:alert('还没有人参与过这个试卷的考试!');return false;");
                }
                else
                {
                    if (avgPrice.Length > 5)
                    {
                        intOrder = Convert.ToDouble(avgPrice.Substring(0, 5));
                    }
                    else
                    {
                        intOrder = Convert.ToDouble(avgPrice);
                    }
                    LBAverage.Attributes.Add("onclick", "javascript:alert('这个试卷的考试平均分为:" + intOrder.ToString() + "');return false;");
                }

//				LBGrade.Attributes.Add("onclick","javascript:NewWin=window.open('StatisGrade.aspx?UserScoreID="+DataGridPaper.Items[i].Cells[0].Text.Trim()+"','StatisGrade','titlebar=yes,menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=yes,top=0,left=0,width=screen.availWidth,height=screen.availHeight');NewWin.moveTo(0,0);NewWin.resizeTo(screen.availWidth,screen.availHeight);return false;");
                LBGrade.Attributes.Add("onclick", "jscomNewOpenBySize('StatisGrade.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&PaperName=" + DataGridPaper.Items[i].Cells[2].Text.Trim() + "','StatisGrade',700,600);return false;");

                LBLore.Attributes.Add("onclick", "jscomNewOpenBySize('StatisLore.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&PaperName=" + DataGridPaper.Items[i].Cells[2].Text.Trim() + "','StatisLore',700,600);return false;");

                LBTestType.Attributes.Add("onclick", "jscomNewOpenBySize('StatisTestType.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&PaperName=" + DataGridPaper.Items[i].Cells[2].Text.Trim() + "','StatisTestType',700,600);return false;");

                LBTest.Attributes.Add("onclick", "jscomNewOpenBySize('StatisTest.aspx?PaperID=" + DataGridPaper.Items[i].Cells[0].Text.Trim() + "&PaperName=" + DataGridPaper.Items[i].Cells[2].Text.Trim() + "','StatisTest',700,600);return false;");
            }
            LabelRecord.Text      = Convert.ToString(SqlDS.Tables["PaperInfo"].Rows.Count);
            LabelCountPage.Text   = Convert.ToString(DataGridPaper.PageCount);
            LabelCurrentPage.Text = Convert.ToString(DataGridPaper.CurrentPageIndex + 1);
            SqlConn.Dispose();
        }