/// <summary> /// 获得数据列表 /// </summary> public List <dbamet.Model.AskForLeave> DataTableToList(DataTable dt) { List <dbamet.Model.AskForLeave> modelList = new List <dbamet.Model.AskForLeave>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { dbamet.Model.AskForLeave model; for (int n = 0; n < rowsCount; n++) { model = new dbamet.Model.AskForLeave(); if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["avtiveTitle"] != null && dt.Rows[n]["avtiveTitle"].ToString() != "") { model.avtiveTitle = dt.Rows[n]["avtiveTitle"].ToString(); } if (dt.Rows[n]["customId"] != null && dt.Rows[n]["customId"].ToString() != "") { model.customId = dt.Rows[n]["customId"].ToString(); } if (dt.Rows[n]["openTime"] != null && dt.Rows[n]["openTime"].ToString() != "") { model.openTime = DateTime.Parse(dt.Rows[n]["openTime"].ToString()); } if (dt.Rows[n]["submitTIme"] != null && dt.Rows[n]["submitTIme"].ToString() != "") { model.submitTIme = DateTime.Parse(dt.Rows[n]["submitTIme"].ToString()); } if (dt.Rows[n]["reason"] != null && dt.Rows[n]["reason"].ToString() != "") { model.reason = dt.Rows[n]["reason"].ToString(); } if (dt.Rows[n]["pass"] != null && dt.Rows[n]["pass"].ToString() != "") { if ((dt.Rows[n]["pass"].ToString() == "1") || (dt.Rows[n]["pass"].ToString().ToLower() == "true")) { model.pass = true; } else { model.pass = false; } } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(dbamet.Model.AskForLeave model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(dbamet.Model.AskForLeave model) { return(dal.Add(model)); }