public static ActionEntity[] DataTableToBindEntitys(DataTable dt) { if (dt == null) return null; var results = new ActionEntity[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { results[i] = DataRowToBindEntity(dt.Rows[i]); } return results; }
public void CreateEntity(ActionEntity entity) { base.UseTran((tran) => { DbCommand cmd = base.Database.GetStoredProcCommand("P_CreateAction"); base.Database.AddInParameter(cmd, "ActionName", DbType.String, entity.ActionName); base.Database.AddInParameter(cmd, "ActionNo", DbType.String, entity.ActionNo); base.Database.AddInParameter(cmd, "ActionType", DbType.String, entity.ActionType); base.Database.AddInParameter(cmd, "ParentActionNo", DbType.String, entity.ParentActionNo); base.Database.AddInParameter(cmd, "Order", DbType.Int32, entity.Order); base.Database.AddInParameter(cmd, "Remark", DbType.String, entity.Remark); base.Database.ExecuteNonQuery(cmd, tran); }); }
public static ActionEntity DataRowToBindEntity(DataRow row) { if (row == null) return null; var result = new ActionEntity() { ActionNo = (string)(row["ActionNo"]), ActionName = (string)(row["ActionName"]), ParentActionNo = (string)(row["ParentActionNo"]), Remark = (string)(row["Remark"]), Order = (int)(row["Order"]), ActionType = (string)(row["ActionType"]), }; return result; }