/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.Working model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.Working model) { dal.Update(model); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.Working> DataTableToList(DataTable dt) { List <Hownet.Model.Working> modelList = new List <Hownet.Model.Working>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.Working model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.Working(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } model.Name = dt.Rows[n]["Name"].ToString(); model.Sn = dt.Rows[n]["Sn"].ToString(); if (dt.Rows[n]["WorkTypeID"].ToString() != "") { model.WorkTypeID = int.Parse(dt.Rows[n]["WorkTypeID"].ToString()); } model.Remark = dt.Rows[n]["Remark"].ToString(); if (dt.Rows[n]["IsUse"].ToString() != "") { if ((dt.Rows[n]["IsUse"].ToString() == "1") || (dt.Rows[n]["IsUse"].ToString().ToLower() == "true")) { model.IsUse = true; } else { model.IsUse = false; } } if (dt.Rows[n]["IsEnd"].ToString() != "") { model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString()); } if (dt.Rows[n]["IsSpecial"].ToString() != "") { if ((dt.Rows[n]["IsSpecial"].ToString() == "1") || (dt.Rows[n]["IsSpecial"].ToString().ToLower() == "true")) { model.IsSpecial = true; } else { model.IsSpecial = false; } } if (dt.Rows[n]["Price"].ToString() != "") { model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString()); } else { model.Price = 0; } model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }