public static string AddData(SAPbobsCOM.Company oCompany, EXR model) { RTNMANVAL rtn = new RTNMANVAL(); int errCode; string errMessage, strResult = ""; SAPbobsCOM.SBObob oSBob = null; SAPbobsCOM.Recordset rs = null; try { oCompany.StartTransaction(); oSBob = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge); rs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); rs = oSBob.GetLocalCurrency(); rs = oSBob.GetSystemCurrency(); oSBob.SetCurrencyRate(model.Currency, model.DateRate, model.Rate, true); oCompany.EndTransaction(BoWfTransOpt.wf_Commit); strResult = "OK"; } catch (Exception e) { if (oCompany.InTransaction) { oCompany.EndTransaction(BoWfTransOpt.wf_RollBack); } ; throw; } return(strResult); }
// PUT api/exchangerate/5 public void Put([FromBody] EXR value) { RTNMANVAL returnVal = null; SAPbobsCOM.Company oCompany = null; string newKey = ""; try { oCompany = Company.GetCompany(Properties.Settings.Default.StrDbServer, Properties.Settings.Default.StrDbUserName, Properties.Settings.Default.StrDbPassword, Properties.Settings.Default.StrDbName, Properties.Settings.Default.StrSapB1UserName, Properties.Settings.Default.StrSapB1Password, Properties.Settings.Default.StrSapB1LicenseServer); newKey = Logic.SAP.SAP_EXR.AddData(oCompany, value); returnVal = new RTNMANVAL() { errorCode = "0", message = "Data has beed updated", value = newKey }; } catch (Exception e) { returnVal = new RTNMANVAL() { errorCode = "-1", message = e.Message.ToString() }; } }