private List<PrintJobCategory> getQueryResult(SqlCommand cmd) { DbDataReader reader = cmd.ExecuteReader(); DataTable dt = new DataTable(); List<PrintJobCategory> categorys = new List<PrintJobCategory>(); PrintJobCategory category = null; dt.Load(reader); reader.Close(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { category = new PrintJobCategory(); category.objectId = getInt(dt.Rows[i]["ObjectId"]); category.createDate = getDateTime(dt.Rows[i]["CreateDate"]); category.updateDate = getDateTime(dt.Rows[i]["UpdateDate"]); category.updateBy = getString(dt.Rows[i]["UpdateBy"]); category.isDeleted = (getInt(dt.Rows[i]["IsDeleted"]) == 1); category.category_code = getString(dt.Rows[i]["category_code"]); category.category_name = getString(dt.Rows[i]["category_name"]); category.id = getString(dt.Rows[i]["id"]); categorys.Add(category); } } return categorys; }
public List<String> getCategoryItemCodesByCategory(PrintJobCategory category, UserAC user) { IDatabase db = DAOFactory.getInstance().getDatabase(); DbConnection conn = db.getConnection(); DbTransaction transaction = db.beginTransaction(conn); try { IPrintItemDetailDAO lookupDAO = DAOFactory.getInstance().createPrintJobLookupDAO(); List<String> items = lookupDAO.getItemNamesByCategoryId(category.id, transaction); transaction.Commit(); return items; } catch (Exception e) { transaction.Rollback(); throw e; } finally { conn.Close(); } }
public static String getJobTypeJson(PrintJobCategory category) { StringBuilder jobTypeJson = new StringBuilder(); jobTypeJson.Append("{id:'").Append(category.id).Append("',name:'").Append(category.category_name).Append("'}"); return jobTypeJson.ToString(); }