/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.SysFormula> DataTableToList(DataTable dt) { List <Hownet.Model.SysFormula> modelList = new List <Hownet.Model.SysFormula>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.SysFormula model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.SysFormula(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } else { model.ID = 0; } model.Operator1 = dt.Rows[n]["Operator1"].ToString(); model.Value1 = dt.Rows[n]["Value1"].ToString(); model.Operator2 = dt.Rows[n]["Operator2"].ToString(); model.Value2 = dt.Rows[n]["Value2"].ToString(); model.Operator3 = dt.Rows[n]["Operator3"].ToString(); model.Value3 = dt.Rows[n]["Value3"].ToString(); model.Operator4 = dt.Rows[n]["Operator4"].ToString(); model.Value4 = dt.Rows[n]["Value4"].ToString(); model.Operator5 = dt.Rows[n]["Operator5"].ToString(); model.Value5 = dt.Rows[n]["Value5"].ToString(); model.Operator6 = dt.Rows[n]["Operator6"].ToString(); model.Value6 = dt.Rows[n]["Value6"].ToString(); model.Operator7 = dt.Rows[n]["Operator7"].ToString(); model.Value7 = dt.Rows[n]["Value7"].ToString(); model.Operator8 = dt.Rows[n]["Operator8"].ToString(); model.Value8 = dt.Rows[n]["Value8"].ToString(); if (dt.Rows[n]["TypeID"].ToString() != "") { model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString()); } else { model.TypeID = 0; } model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.SysFormula model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.SysFormula model) { return(dal.Add(model)); }