protected void Btnadd_Click(object sender, EventArgs e) { string Gtitle = TextBoxGtitle.Text.Trim(); if (!string.IsNullOrEmpty(Gtitle)) { string hid = tcook.Hid.ToString(); string Gtype = DDLtype.SelectedValue; LearnSite.Model.Gauge gmodel = new LearnSite.Model.Gauge(); gmodel.Gcount = 0; gmodel.Gdate = DateTime.Now; gmodel.Ghid = Int32.Parse(hid); gmodel.Gtitle = Gtitle; gmodel.Gtype = Gtype; LearnSite.BLL.Gauge gbll = new LearnSite.BLL.Gauge(); gbll.Add(gmodel); System.Threading.Thread.Sleep(200); TextBoxGtitle.Text = ""; ShowGauge(); } else { LearnSite.Common.WordProcess.Alert("请输入自定义评价标准的标题!", this.Page); } }
/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.Gauge> DataTableToList(DataTable dt) { List <LearnSite.Model.Gauge> modelList = new List <LearnSite.Model.Gauge>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Gauge model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Gauge(); if (dt.Rows[n]["Gid"] != null && dt.Rows[n]["Gid"].ToString() != "") { model.Gid = int.Parse(dt.Rows[n]["Gid"].ToString()); } if (dt.Rows[n]["Ghid"] != null && dt.Rows[n]["Ghid"].ToString() != "") { model.Ghid = int.Parse(dt.Rows[n]["Ghid"].ToString()); } if (dt.Rows[n]["Gtype"] != null && dt.Rows[n]["Gtype"].ToString() != "") { model.Gtype = dt.Rows[n]["Gtype"].ToString(); } if (dt.Rows[n]["Gtitle"] != null && dt.Rows[n]["Gtitle"].ToString() != "") { model.Gtitle = dt.Rows[n]["Gtitle"].ToString(); } if (dt.Rows[n]["Gcount"] != null && dt.Rows[n]["Gcount"].ToString() != "") { model.Gcount = int.Parse(dt.Rows[n]["Gcount"].ToString()); } if (dt.Rows[n]["Gdate"] != null && dt.Rows[n]["Gdate"].ToString() != "") { model.Gdate = DateTime.Parse(dt.Rows[n]["Gdate"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LearnSite.Model.Gauge model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.Gauge model) { return(dal.Add(model)); }