/// <summary> /// 获得数据列表 /// </summary> public List<ScriptExecuteDetailResult> DataTableToList(DataTable dt) { List<ScriptExecuteDetailResult> modelList = new List<ScriptExecuteDetailResult>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ScriptExecuteDetailResult model; for (int n = 0; n < rowsCount; n++) { model = new ScriptExecuteDetailResult(); if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } if (dt.Rows[n]["ScriptName"] != null && dt.Rows[n]["ScriptName"].ToString() != "") { model.ScriptName = dt.Rows[n]["ScriptName"].ToString(); } if (dt.Rows[n]["ser_id"] != null && dt.Rows[n]["ser_id"].ToString() != "") { model.ser_id = int.Parse(dt.Rows[n]["ser_id"].ToString()); } if (dt.Rows[n]["IsSucceed"] != null && dt.Rows[n]["IsSucceed"].ToString() != "") { model.IsSucceed = dt.Rows[n]["IsSucceed"].ToString(); } if (dt.Rows[n]["StartDate"] != null && dt.Rows[n]["StartDate"].ToString() != "") { model.StartDate = dt.Rows[n]["StartDate"].ToString(); } if (dt.Rows[n]["EndDate"] != null && dt.Rows[n]["EndDate"].ToString() != "") { model.EndDate = dt.Rows[n]["EndDate"].ToString(); } if (dt.Rows[n]["LogFilePath"] != null && dt.Rows[n]["LogFilePath"].ToString() != "") { model.LogFilePath = dt.Rows[n]["LogFilePath"].ToString(); } if (dt.Rows[n]["terminal"] != null && dt.Rows[n]["terminal"].ToString() != "") { model.Terminal = dt.Rows[n]["terminal"].ToString(); } if (dt.Rows[n]["remark"] != null && dt.Rows[n]["remark"].ToString() != "") { model.Remark = dt.Rows[n]["remark"].ToString(); } modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ScriptExecuteDetailResult model) { return dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ScriptExecuteDetailResult model) { return dal.Add(model); }