/// <summary> /// 获得数据列表 /// </summary> public List <Tunnel.Model.Tunnel_formtype> DataTableToList(DataTable dt) { List <Tunnel.Model.Tunnel_formtype> modelList = new List <Tunnel.Model.Tunnel_formtype>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Tunnel.Model.Tunnel_formtype model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_formtype(); if (dt.Rows[n]["Form_id"].ToString() != "") { model.Form_id = int.Parse(dt.Rows[n]["Form_id"].ToString()); } model.Form_name = dt.Rows[n]["Form_name"].ToString(); if (dt.Rows[n]["Item_max"].ToString() != "") { model.Item_max = int.Parse(dt.Rows[n]["Item_max"].ToString()); } modelList.Add(model); } } return(modelList); }
protected void Button1_Click(object sender, EventArgs e) { Tunnel.BLL.Tunnel_bum bt = new Tunnel.BLL.Tunnel_bum(); Tunnel.BLL.Tunnel_form tf = new Tunnel.BLL.Tunnel_form(); Tunnel.Model.Tunnel_form mf = new Tunnel.Model.Tunnel_form(); Tunnel.BLL.Tunnel_formtype btf = new Tunnel.BLL.Tunnel_formtype(); Tunnel.Model.Tunnel_formtype bmf = new Tunnel.Model.Tunnel_formtype(); mf.f_name = TextBox1.Text.Trim(); mf.f_lcid = int.Parse(DropDownList2.SelectedValue); mf.f_bum = 0; mf.f_user = 1; mf.f_date = DateTime.Now; int i = tf.Name_Add(mf); if (i > 0) { bmf.Form_id = i; bmf.Form_name = TextBox1.Text.Trim(); bmf.Item_max = 0; btf.Add(bmf); Tunnel.Common.Message.Show("保存成功!"); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Tunnel_formtype model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Tunnel.Model.Tunnel_formtype model) { dal.Add(model); }