protected void Buttonadd_Click(object sender, EventArgs e) { string hname = TextBoxHname.Text.Trim(); int hln = hname.Length; if (hln > 0 && hln < 50) { LearnSite.Model.House model = new LearnSite.Model.House(); model.Hname = hname; model.Hseat = ""; LearnSite.BLL.House bll = new LearnSite.BLL.House(); bll.Add(model);//增加一个机房 System.Threading.Thread.Sleep(200); showhouse(); TextBoxHname.Text = ""; } }
/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.House> DataTableToList(DataTable dt) { List <LearnSite.Model.House> modelList = new List <LearnSite.Model.House>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.House model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.House(); if (dt.Rows[n]["Hid"].ToString() != "") { model.Hid = int.Parse(dt.Rows[n]["Hid"].ToString()); } model.Hname = dt.Rows[n]["Hname"].ToString(); model.Hseat = dt.Rows[n]["Hseat"].ToString(); modelList.Add(model); } } return(modelList); }
private void showOld() { if (Request.QueryString["Hid"] != null && Request.QueryString["Sgrade"] != null && Request.QueryString["Sclass"] != null) { string hid = Request.QueryString["Hid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(hid)) { string sgrade = Request.QueryString["Sgrade"].ToString(); string sclass = Request.QueryString["Sclass"].ToString(); LearnSite.BLL.House bll = new LearnSite.BLL.House(); LearnSite.Model.House model = new LearnSite.Model.House(); model = bll.GetModel(Int32.Parse(hid)); bool hostnameshow = false; if (model != null) { LabelTitle.Text = model.Hname; firstshows = model.Hseat; LearnSite.BLL.Ip pbll = new LearnSite.BLL.Ip(); StoreMsg.InnerText = pbll.GetSiginStudentStr(Int32.Parse(sgrade), Int32.Parse(sclass), Int32.Parse(hid), hostnameshow); if (firstshows.IndexOf('-') > -1) { string[] old_collects = firstshows.Split('-'); if (old_collects.Length > 3) { string slnum = old_collects[0]; string sallnum = old_collects[1]; string ssortway = old_collects[2]; myhouse.Text = viewseats(Int32.Parse(slnum), Int32.Parse(sallnum), ssortway); } } } } else { LearnSite.Common.WordProcess.Alert("参数格式错误", this.Page); } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LearnSite.Model.House model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.House model) { return(dal.Add(model)); }