public Commodity searchComdByComdID(string strComdID) { Commodity comd = new Commodity(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_SearchByComdID"); SqlParameter[] sqlParms = { new SqlParameter("@ComdID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strComdID; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(searchResult)) { comd.ComdID = searchResult.Tables[0].Rows[0]["ComdID"].ToString(); comd.ComdName = searchResult.Tables[0].Rows[0]["ComdName"].ToString(); comd.ComdStandard = searchResult.Tables[0].Rows[0]["ComdStandard"].ToString(); comd.Unit = searchResult.Tables[0].Rows[0]["Unit"].ToString(); comd.Description = searchResult.Tables[0].Rows[0]["Description"].ToString(); comd.Manufacturer = searchResult.Tables[0].Rows[0]["Manufacturer"].ToString(); comd.DeleteFLG = (bool)searchResult.Tables[0].Rows[0]["DeleteFLG"]; } } catch (Exception ex) { throw new DAOException("E0001"); } return comd; }
public void getComdByComdIDTest1() { CommodityImpl target = new CommodityImpl(); // TODO: Initialize to an appropriate value string strComdID = string.Empty; // TODO: Initialize to an appropriate value Commodity expected = new Commodity(); // TODO: Initialize to an appropriate value Commodity actual; actual = target.getComdByComdID(strComdID); Assert.AreEqual(false, actual.Valid); }
public Commodity getComdByComdID(string strComdID) { Commodity commodity; try { commodity = comdDAO.searchComdByComdID(strComdID); } catch (Exception ex) { commodity = new Commodity(); } return commodity; }