예제 #1
0
    protected void Btnok_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["Vid"] != null && Request.QueryString["Cid"] != null)
        {
            string fnum      = cook.Snum;
            int    vid       = Int32.Parse(Request.QueryString["Vid"].ToString());
            int    limitTime = Int32.Parse(LbLimitTime.Text);
            if (GetMyScore(vid, fnum) == -1024)
            {
                int qcount = DataListonly.Items.Count;//考题数
                if (qcount > 0)
                {
                    //如果有题目则分析
                    int    scount    = 0;//做题数
                    string midselect = "";
                    foreach (DataListItem item in this.DataListonly.Items)
                    {
                        RadioButtonList rblm = (RadioButtonList)item.FindControl("RBLselect");
                        if (rblm.SelectedIndex > -1)
                        {
                            scount++;
                            midselect = midselect + rblm.SelectedValue + ",";
                        }
                    }

                    if (qcount == scount)
                    {
                        if (midselect.EndsWith(","))
                        {
                            midselect = midselect.Substring(0, midselect.Length - 1);
                        }
                        int syear  = cook.Syear;
                        int sgrade = cook.Sgrade;
                        int sclass = cook.Sclass;
                        int cid    = Int32.Parse(Request.QueryString["Cid"].ToString());
                        int sid    = cook.Sid;

                        LearnSite.Model.SurveyFeedback fmodel = new LearnSite.Model.SurveyFeedback();
                        fmodel.Fnum    = fnum;
                        fmodel.Fyear   = syear;
                        fmodel.Fgrade  = sgrade;
                        fmodel.Fclass  = sclass;
                        fmodel.Fterm   = cook.ThisTerm;
                        fmodel.Fcid    = cid;
                        fmodel.Fvid    = vid;
                        fmodel.Fvtype  = Int32.Parse(Lbtype.Text);
                        fmodel.Fselect = midselect;
                        LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem();

                        int tt      = Int32.Parse(Lbtime.Text) / 60;
                        int myscore = mbll.GetItemScore(midselect);
                        if (tt > limitTime)
                        {
                            if (tt - limitTime > scount)
                            {
                                fmodel.Fscore = 0;//限制一下扣分,最低分为0
                            }
                            else
                            {
                                fmodel.Fscore = myscore + limitTime - tt;
                            }
                        }
                        else
                        {
                            fmodel.Fscore = myscore;
                        }
                        fmodel.Fdate = DateTime.Now;
                        fmodel.Fsid  = sid;
                        LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback();
                        if (fbll.Add(fmodel) > 0)
                        {
                            showSurvey();
                        }
                    }
                    else
                    {
                        string msg = "您还有题目未做好,请仔细查看!";
                        LearnSite.Common.WordProcess.Alert(msg, this.Page);
                    }
                }
            }
            else
            {
                Btnok.Enabled = false;
            }
        }
    }
예제 #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LearnSite.Model.SurveyFeedback model)
 {
     return(dal.Add(model));
 }
예제 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LearnSite.Model.SurveyFeedback model)
 {
     return(dal.Update(model));
 }
예제 #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LearnSite.Model.SurveyFeedback> DataTableToList(DataTable dt)
        {
            List <LearnSite.Model.SurveyFeedback> modelList = new List <LearnSite.Model.SurveyFeedback>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LearnSite.Model.SurveyFeedback model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LearnSite.Model.SurveyFeedback();
                    if (dt.Rows[n]["Fid"] != null && dt.Rows[n]["Fid"].ToString() != "")
                    {
                        model.Fid = int.Parse(dt.Rows[n]["Fid"].ToString());
                    }
                    if (dt.Rows[n]["Fnum"] != null && dt.Rows[n]["Fnum"].ToString() != "")
                    {
                        model.Fnum = dt.Rows[n]["Fnum"].ToString();
                    }
                    if (dt.Rows[n]["Fyear"] != null && dt.Rows[n]["Fyear"].ToString() != "")
                    {
                        model.Fyear = int.Parse(dt.Rows[n]["Fyear"].ToString());
                    }
                    if (dt.Rows[n]["Fgrade"] != null && dt.Rows[n]["Fgrade"].ToString() != "")
                    {
                        model.Fgrade = int.Parse(dt.Rows[n]["Fgrade"].ToString());
                    }
                    if (dt.Rows[n]["Fclass"] != null && dt.Rows[n]["Fclass"].ToString() != "")
                    {
                        model.Fclass = int.Parse(dt.Rows[n]["Fclass"].ToString());
                    }
                    if (dt.Rows[n]["Fterm"] != null && dt.Rows[n]["Fterm"].ToString() != "")
                    {
                        model.Fterm = int.Parse(dt.Rows[n]["Fterm"].ToString());
                    }
                    if (dt.Rows[n]["Fcid"] != null && dt.Rows[n]["Fcid"].ToString() != "")
                    {
                        model.Fcid = int.Parse(dt.Rows[n]["Fcid"].ToString());
                    }
                    if (dt.Rows[n]["Fvid"] != null && dt.Rows[n]["Fvid"].ToString() != "")
                    {
                        model.Fvid = int.Parse(dt.Rows[n]["Fvid"].ToString());
                    }
                    if (dt.Rows[n]["Fvtype"] != null && dt.Rows[n]["Fvtype"].ToString() != "")
                    {
                        model.Fvtype = int.Parse(dt.Rows[n]["Fvtype"].ToString());
                    }
                    if (dt.Rows[n]["Fselect"] != null && dt.Rows[n]["Fselect"].ToString() != "")
                    {
                        model.Fselect = dt.Rows[n]["Fselect"].ToString();
                    }
                    if (dt.Rows[n]["Fscore"] != null && dt.Rows[n]["Fscore"].ToString() != "")
                    {
                        model.Fscore = int.Parse(dt.Rows[n]["Fscore"].ToString());
                    }
                    if (dt.Rows[n]["Fdate"] != null && dt.Rows[n]["Fdate"].ToString() != "")
                    {
                        model.Fdate = DateTime.Parse(dt.Rows[n]["Fdate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }