/// <summary> /// Returns the total costs of the Message in form of a TSMTotalCost receipt /// </summary> /// <returns></returns> public TSMTotalCost GetTotalCosts() { if (string.IsNullOrEmpty(CST)) { return(null); } string[] tItems = TheCommonUtils.cdeSplit(CST, ";:;", true, true); TSMTotalCost tTotal = new TSMTotalCost() { Items = new List <TSMCosting>() }; foreach (string t in tItems) { string[] tt = TheCommonUtils.cdeDecrypt(t, TheBaseAssets.MySecrets.GetAI()).Split(';'); //3.083: Must be cdeAI if (tt.Length < 4) { continue; } TSMCosting tCost = new TSMCosting(TheCommonUtils.CInt(tt[0]), TheCommonUtils.CStr(tt[1]), TheCommonUtils.CStr(tt[2]), TheCommonUtils.CStr(tt[3])); tTotal.Items.Add(tCost); tTotal.TotalCredits += tCost.Credits; tTotal.TotalItems++; } return(tTotal); }
/// <summary> /// Adds an encrypted cost-ticket to the current message to the CST parameter /// </summary> /// <param name="pCosts"></param> public void AddCosting(TSMCosting pCosts) { if (pCosts != null) { if (string.IsNullOrEmpty(CST)) { CST = ""; } string tCosting = TheCommonUtils.cdeEncrypt(string.Format("{0};{1};{2};{3}", pCosts.Credits, pCosts.Description, pCosts.Vendor, pCosts.VendorCode), TheBaseAssets.MySecrets.GetAI()); //3.083: Must be cdeAI if (!string.IsNullOrEmpty(CST)) { CST += ";:;"; } CST += tCosting; } }