/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.Holidays model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.Holidays model) { dal.Update(model); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.Holidays> DataTableToList(DataTable dt) { List <Hownet.Model.Holidays> modelList = new List <Hownet.Model.Holidays>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.Holidays model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.Holidays(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } else { model.ID = 0; } if (dt.Rows[n]["TypeID"].ToString() != "") { model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString()); } else { model.TypeID = 0; } if (dt.Rows[n]["TimeOne"].ToString() != "") { model.TimeOne = DateTime.Parse(dt.Rows[n]["TimeOne"].ToString()); } else { model.TimeOne = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["TimeTwo"].ToString() != "") { model.TimeTwo = DateTime.Parse(dt.Rows[n]["TimeTwo"].ToString()); } else { model.TimeTwo = DateTime.Parse("1900-1-1"); } if (dt.Rows[n]["EmployeeID"].ToString() != "") { model.EmployeeID = int.Parse(dt.Rows[n]["EmployeeID"].ToString()); } else { model.EmployeeID = 0; } model.Remark = dt.Rows[n]["Remark"].ToString(); if (dt.Rows[n]["MainID"].ToString() != "") { model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString()); } else { model.MainID = 0; } if (dt.Rows[n]["IsCaicMoney"].ToString() != "") { if ((dt.Rows[n]["IsCaicMoney"].ToString() == "1") || (dt.Rows[n]["IsCaicMoney"].ToString().ToLower() == "true")) { model.IsCaicMoney = true; } else { model.IsCaicMoney = false; } } if (dt.Rows[n]["Times"].ToString() != "") { model.Times = int.Parse(dt.Rows[n]["Times"].ToString()); } else { model.Times = 0; } model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }