/// <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 Line /// </summary> /// <returns>rfq line</returns> public MRfQLine GetRfQLine() { if (_rfqLine == null) { _rfqLine = MRfQLine.Get(GetCtx(), GetC_RfQLine_ID(), Get_TrxName()); } return(_rfqLine); }
/// <summary> /// Get MRfQLine from Cache /// </summary> /// <param name="ctx">context</param> /// <param name="C_RfQLine_ID">ID</param> /// <param name="trxName">Transaction</param> /// <returns>MRFQLINE</returns> public static MRfQLine Get(Ctx ctx, int C_RfQLine_ID, Trx trxName) { int key = C_RfQLine_ID; MRfQLine retValue = (MRfQLine)s_cache[key]; if (retValue != null) { return(retValue); } retValue = new MRfQLine(ctx, C_RfQLine_ID, trxName); if (retValue.Get_ID() != 0) { s_cache.Add(key, retValue); } return(retValue); }
/// <summary> /// Is "Quote Total Amt Only" Valid /// </summary> /// <returns>null or error message</returns> public String CheckQuoteTotalAmtOnly() { if (!IsQuoteTotalAmtOnly()) { return(null); } // Need to check Line Qty MRfQLine[] lines = GetLines(); for (int i = 0; i < lines.Length; i++) { MRfQLine line = lines[i]; MRfQLineQty[] qtys = line.GetQtys(); if (qtys.Length > 1) { log.Warning("isQuoteTotalAmtOnlyValid - #" + qtys.Length + " - " + line); String msg = "@Line@ " + line.GetLine() + ": #@C_RfQLineQty@=" + qtys.Length + " - @IsQuoteTotalAmt@"; return(msg); } } return(null); }
/// <summary> /// Get active Lines /// </summary> /// <returns>array of lines</returns> public MRfQLine[] GetLines() { List <MRfQLine> list = new List <MRfQLine>(); String sql = "SELECT * FROM C_RfQLine " + "WHERE C_RfQ_ID=@param1 AND IsActive='Y' " + "ORDER BY Line"; 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 MRfQLine(GetCtx(), dr, Get_TrxName())); } } catch (Exception e) { log.Log(VAdvantage.Logging.Level.SEVERE, sql, e); } finally { dt = null; idr.Close(); } MRfQLine[] retValue = new MRfQLine[list.Count]; retValue = list.ToArray(); return(retValue); }
/// <summary> /// Parent Constructor /// </summary> /// <param name="line">RfQ line</param> public MRfQLineQty(MRfQLine line) : this(line.GetCtx(), 0, line.Get_TrxName()) { SetClientOrg(line); SetC_RfQLine_ID(line.GetC_RfQLine_ID()); }