/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.SurveyClass> DataTableToList(DataTable dt) { List <LearnSite.Model.SurveyClass> modelList = new List <LearnSite.Model.SurveyClass>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.SurveyClass model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.SurveyClass(); if (dt.Rows[n]["Yid"] != null && dt.Rows[n]["Yid"].ToString() != "") { model.Yid = int.Parse(dt.Rows[n]["Yid"].ToString()); } if (dt.Rows[n]["Yyear"] != null && dt.Rows[n]["Yyear"].ToString() != "") { model.Yyear = int.Parse(dt.Rows[n]["Yyear"].ToString()); } if (dt.Rows[n]["Ygrade"] != null && dt.Rows[n]["Ygrade"].ToString() != "") { model.Ygrade = int.Parse(dt.Rows[n]["Ygrade"].ToString()); } if (dt.Rows[n]["Yclass"] != null && dt.Rows[n]["Yclass"].ToString() != "") { model.Yclass = int.Parse(dt.Rows[n]["Yclass"].ToString()); } if (dt.Rows[n]["Yterm"] != null && dt.Rows[n]["Yterm"].ToString() != "") { model.Yterm = int.Parse(dt.Rows[n]["Yterm"].ToString()); } if (dt.Rows[n]["Ycid"] != null && dt.Rows[n]["Ycid"].ToString() != "") { model.Ycid = int.Parse(dt.Rows[n]["Ycid"].ToString()); } if (dt.Rows[n]["Yvid"] != null && dt.Rows[n]["Yvid"].ToString() != "") { model.Yvid = int.Parse(dt.Rows[n]["Yvid"].ToString()); } if (dt.Rows[n]["Yselect"] != null && dt.Rows[n]["Yselect"].ToString() != "") { model.Yselect = dt.Rows[n]["Yselect"].ToString(); } if (dt.Rows[n]["Ycount"] != null && dt.Rows[n]["Ycount"].ToString() != "") { model.Ycount = dt.Rows[n]["Ycount"].ToString(); } if (dt.Rows[n]["Yscore"] != null && dt.Rows[n]["Yscore"].ToString() != "") { model.Yscore = int.Parse(dt.Rows[n]["Yscore"].ToString()); } if (dt.Rows[n]["Ydate"] != null && dt.Rows[n]["Ydate"].ToString() != "") { model.Ydate = DateTime.Parse(dt.Rows[n]["Ydate"].ToString()); } modelList.Add(model); } } return(modelList); }
private string surveyClassView(int Yyear, int Ygrade, int Yclass, int Yterm, int Ycid, int Yvid) { string str = ""; LearnSite.BLL.SurveyClass Ycbll = new LearnSite.BLL.SurveyClass(); LearnSite.Model.SurveyClass ycmodel = new LearnSite.Model.SurveyClass(); ycmodel = Ycbll.GetModelByClass(Yyear, Ygrade, Yclass, Yterm, Ycid, Yvid); if (ycmodel != null) { str = ycmodel.Yselect.ToString() + "|" + ycmodel.Ycount.ToString(); Lbscore.Text = ycmodel.Yscore.ToString(); } return(str); }
private void surveyClass() { if (Request.QueryString["Vid"] != null && Request.QueryString["Cid"] != null) { int syear = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString()); int sgrade = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString()); int sclass = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString()); int sterm = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["ThisTerm"].ToString()); int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int cid = Int32.Parse(Request.QueryString["Cid"].ToString()); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); string allselect = fbll.GetClassFselect(sgrade, sclass, vid); if (!string.IsNullOrEmpty(allselect)) { LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); itemandcount = mbll.GetListItemAndCount(vid, allselect); // LearnSite.Common.WordProcess.Alert(itemandcount, this.Page);//调试信息 string[] itemcountStr = itemandcount.Split('|'); LearnSite.Model.SurveyClass ymodel = new LearnSite.Model.SurveyClass(); ymodel.Ycid = cid; ymodel.Yclass = sclass; ymodel.Ycount = itemcountStr[1].ToString(); ymodel.Ydate = DateTime.Now; ymodel.Ygrade = sgrade; int yscore = fbll.GetClassYscore(syear, sgrade, sclass, sterm, vid); ymodel.Yscore = yscore; Lbscore.Text = yscore.ToString(); ymodel.Yselect = itemcountStr[0].ToString(); ymodel.Yterm = sterm; ymodel.Yvid = vid; ymodel.Yyear = syear; LearnSite.BLL.SurveyClass ybll = new LearnSite.BLL.SurveyClass(); int yid = ybll.ExistsClass(syear, sgrade, sclass, sterm, vid); if (yid > 0) { //更新 ymodel.Yid = yid; ybll.UpdateClass(ymodel); } else { ybll.Add(ymodel); } } } }
/// <summary> /// 更新一条数据,部分字段更新 /// </summary> public bool UpdateClass(LearnSite.Model.SurveyClass model) { return(dal.UpdateClass(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.SurveyClass model) { return(dal.Add(model)); }