/// <summary> /// Parent Constructor. /// Also creates qtys if RfQ Qty /// Is saved if there are qtys(!) /// </summary> /// <param name="response">response</param> /// <param name="line">line</param> public MRfQResponseLine(MRfQResponse response, MRfQLine line) : base(response.GetCtx(), 0, response.Get_TrxName()) { SetClientOrg(response); SetC_RfQResponse_ID(response.GetC_RfQResponse_ID()); // SetC_RfQLine_ID(line.GetC_RfQLine_ID()); // SetIsSelectedWinner(false); SetIsSelfService(false); // MRfQLineQty[] qtys = line.GetQtys(); for (int i = 0; i < qtys.Length; i++) { if (qtys[i].IsActive() && qtys[i].IsRfQQty()) { if (Get_ID() == 0) // save this line { Save(); } MRfQResponseLineQty qty = new MRfQResponseLineQty(this, qtys[i]); qty.Save(); } } }
/// <summary> /// Get RfQ Responses /// </summary> /// <param name="activeOnly">active responses only</param> /// <param name="completedOnly">complete responses only</param> /// <returns>array of lines</returns> public MRfQResponse[] GetResponses(bool activeOnly, bool completedOnly) { List <MRfQResponse> list = new List <MRfQResponse>(); String sql = "SELECT * FROM C_RfQResponse " + "WHERE C_RfQ_ID=@param1"; if (activeOnly) { sql += " AND IsActive='Y'"; } if (completedOnly) { sql += " AND IsComplete='Y'"; } sql += " ORDER BY Price"; DataTable dt = null; IDataReader idr = null; SqlParameter[] param = null; try { param = new SqlParameter[1]; param[0] = new SqlParameter("@param1", GetC_RfQ_ID()); idr = DataBase.DB.ExecuteReader(sql, param, Get_TrxName()); dt = new DataTable(); dt.Load(idr); idr.Close(); foreach (DataRow dr in dt.Rows)// while (dr.next()) { list.Add(new MRfQResponse(GetCtx(), dr, Get_TrxName())); } } catch { //log.log(Level.SEVERE, sql, e); } finally { dt = null; idr.Close(); } MRfQResponse[] retValue = new MRfQResponse[list.Count]; retValue = list.ToArray(); return(retValue); }