/// <summary> /// 增加一条数据 /// </summary> public bool Add(Maticsoft.Model.BaseDepartment model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.BaseDepartment model) { return(dal.Update(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <Maticsoft.Model.BaseDepartment> DataTableToList(DataTable dt) { List <Maticsoft.Model.BaseDepartment> modelList = new List <Maticsoft.Model.BaseDepartment>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Maticsoft.Model.BaseDepartment model; for (int n = 0; n < rowsCount; n++) { model = new Maticsoft.Model.BaseDepartment(); if (dt.Rows[n]["DeptID"] != null && dt.Rows[n]["DeptID"].ToString() != "") { model.DeptID = int.Parse(dt.Rows[n]["DeptID"].ToString()); } if (dt.Rows[n]["ParentDeptID"] != null && dt.Rows[n]["ParentDeptID"].ToString() != "") { model.ParentDeptID = int.Parse(dt.Rows[n]["ParentDeptID"].ToString()); } if (dt.Rows[n]["DeptName"] != null && dt.Rows[n]["DeptName"].ToString() != "") { model.DeptName = dt.Rows[n]["DeptName"].ToString(); } if (dt.Rows[n]["CreatedDate"] != null && dt.Rows[n]["CreatedDate"].ToString() != "") { model.CreatedDate = DateTime.Parse(dt.Rows[n]["CreatedDate"].ToString()); } if (dt.Rows[n]["CreatedGuy"] != null && dt.Rows[n]["CreatedGuy"].ToString() != "") { model.CreatedGuy = int.Parse(dt.Rows[n]["CreatedGuy"].ToString()); } if (dt.Rows[n]["UpdatedDate"] != null && dt.Rows[n]["UpdatedDate"].ToString() != "") { model.UpdatedDate = DateTime.Parse(dt.Rows[n]["UpdatedDate"].ToString()); } if (dt.Rows[n]["UpdatedGuy"] != null && dt.Rows[n]["UpdatedGuy"].ToString() != "") { model.UpdatedGuy = int.Parse(dt.Rows[n]["UpdatedGuy"].ToString()); } if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "") { model.Remark = dt.Rows[n]["Remark"].ToString(); } if (dt.Rows[n]["DeptIDs"] != null && dt.Rows[n]["DeptIDs"].ToString() != "") { model.DeptIDs = dt.Rows[n]["DeptIDs"].ToString(); } if (dt.Rows[n]["Value1"] != null && dt.Rows[n]["Value1"].ToString() != "") { model.Value1 = dt.Rows[n]["Value1"].ToString(); } if (dt.Rows[n]["Value2"] != null && dt.Rows[n]["Value2"].ToString() != "") { model.Value2 = dt.Rows[n]["Value2"].ToString(); } if (dt.Rows[n]["Value3"] != null && dt.Rows[n]["Value3"].ToString() != "") { model.Value3 = dt.Rows[n]["Value3"].ToString(); } if (dt.Rows[n]["Value4"] != null && dt.Rows[n]["Value4"].ToString() != "") { model.Value4 = dt.Rows[n]["Value4"].ToString(); } if (dt.Rows[n]["Value5"] != null && dt.Rows[n]["Value5"].ToString() != "") { model.Value5 = dt.Rows[n]["Value5"].ToString(); } modelList.Add(model); } } return(modelList); }