public bool CreateArticle(string articleNo, string name, int priceCalcMethodsNo, int postingTemplate, int stockProfileNo) { _articleComponent.bcInitData(); _articleComponent.bcSetInitialValues(); _articleComponent.bcSetValueFromStr((int)Article_Properties.ART_ArticleNo, articleNo); _articleComponent.bcUpdateStr((int)Article_Properties.ART_Name, name); // Konteringsmall _articleComponent.bcUpdateInt((int)Article_Properties.ART_PostingTemplateNo, postingTemplate); // Prisprofil _articleComponent.bcUpdateInt((int)Article_Properties.ART_PriceCalcMethodsNo, priceCalcMethodsNo); // Lagerprofil _articleComponent.bcUpdateInt((int)Article_Properties.ART_StockProfileNo, stockProfileNo); var errCode = _articleComponent.bcAddNew(); if (errCode != 0) { _articleComponent.bcCancelRecord(); LogFileWriter.WriteLine(string.Format("Attempt to create article '{0} - {1}' failed. Code {2} - {3}", articleNo, name, errCode, _articleComponent.bcGetMessageText(errCode))); return(false); } return(true); }
private void LogErrorMessage(int errCode) { if (errCode == 4) { LogFileWriter.WriteLine("Did not find any invoices to transfer."); } else if (errCode > 99) { LogFileWriter.WriteLine(string.Format("Failed to get invoices. Code {0} - {1}", errCode, _invoiceComp.bcGetMessageText(errCode))); } }