private string SelectFieldNamesForEntity(int entityId) { string sqlText = @"SELECT name FROM dbo.AdvancedFields WHERE entity_id = @entity_id "; CommaDelimitedStringCollection commaStr = new CommaDelimitedStringCollection(); using (SqlConnection conn = GetConnection()) using (OpenCbsCommand cmd = new OpenCbsCommand(sqlText, conn)) { cmd.AddParam("@entity_id", entityId); using (OpenCbsReader reader = cmd.ExecuteReader()) { if (reader.Empty) { return(string.Empty); } while (reader.Read()) { commaStr.Add(reader.GetString("name")); } } } return(commaStr.ToString()); }
static void Main(string[] args) { CommaDelimitedStringCollection commaStr = new CommaDelimitedStringCollection(); string[] itemList = { "Test1", "Test2", "Test3" }; commaStr.AddRange(itemList); Console.WriteLine(commaStr.ToString()); //Outputs Test1,Test2,Test3 Console.ReadLine(); }
public static string ConvertStringListToCommaSeparatedString(this List <string> list) { var coll = new CommaDelimitedStringCollection(); foreach (var s in list) { coll.Add(s); } return(coll.ToString()); }
private string GetRolesDelimitedByComma(List <RolDto> roles) { CommaDelimitedStringCollection list = new CommaDelimitedStringCollection(); foreach (RolDto rol in roles) { list.Add(rol.Codigo); } return(list.ToString()); }
public void Manipulations() { CommaDelimitedStringCollection c = new CommaDelimitedStringCollection(); c.Add("1"); Assert.Equal("1", c.ToString()); c.Add("2"); c.Add("3"); Assert.Equal("1,2,3", c.ToString()); c.Remove("2"); Assert.Equal("1,3", c.ToString()); c.Insert(1, "2"); Assert.Equal("1,2,3", c.ToString()); c.Clear(); Assert.Null(c.ToString()); string[] foo = new string[3]; foo[0] = "1"; foo[1] = "2"; foo[2] = "3"; c.AddRange(foo); Assert.Equal("1,2,3", c.ToString()); }
private OracleCommand GetInsertCommand(object entity) { if (ConnectionMode == Enums.Mode.UnitOfWork && !insertCommands.Where(a => a.Equals(entity)).Any()) { insertCommands.Add(entity); return(null); } OracleCommand cmd = new OracleCommand(); string commandText = string.Empty; CommaDelimitedStringCollection columns = new CommaDelimitedStringCollection(); CommaDelimitedStringCollection parameters = new CommaDelimitedStringCollection(); foreach (var prop in entity.GetType().GetProperties()) { var value = prop.GetValue(entity, null); var seq = prop.GetCustomAttributes(false).Where(a => a is SequenceAttribute).FirstOrDefault(); var defaultValue = prop.GetCustomAttributes(false).Where(a => a is DefaultValueAttribute).FirstOrDefault(); columns.Add(String.Format("{0}", prop.Name)); if (seq != null) { parameters.Add(String.Format("{0}.{1}.NextVal", _schemmaName, (seq as SequenceAttribute).SequenceName)); } else { if (defaultValue == null) { parameters.Add(String.Format(":{0}", prop.Name)); if (prop.PropertyType.Name.StartsWith("Nullable") && value == null) { cmd.Parameters.Add(new OracleParameter(prop.Name, DBNull.Value)); } else { cmd.Parameters.Add(new OracleParameter(prop.Name, value)); } } else { parameters.Add(String.Format("{0}", (defaultValue as DefaultValueAttribute).Value.ToString())); } } } commandText = String.Format("INSERT INTO {0}.{1} ({2}) VALUES ({3})", _schemmaName, entity.GetType().Name, columns.ToString(), parameters.ToString()); cmd.CommandText = commandText.ToString(); return(cmd); }
//Expression<Func<T, object>> property public IEnumerable <T> Query <T>(Expression <Func <T, object> > columns = null, Expression <Func <T, object> > order = null, long take = 0, long skip = 0, Expression <Func <T, object> > where = null, object[] args = null) { List <object> parameters = new List <object>(); List <T> lista = new List <T>(); CommaDelimitedStringCollection cols = new CommaDelimitedStringCollection(); CommaDelimitedStringCollection ord = new CommaDelimitedStringCollection(); StringBuilder whereBuilder = new StringBuilder(); GetColumns <T>(columns, cols); GetColumns <T>(order, ord); GetWhere <T>(where, whereBuilder, parameters); return(Query <T>(cols.ToString(), take, skip, ord.ToString(), whereBuilder.ToString(), parameters.ToArray())); }
private OracleCommand GetMappedInsertCommand(object entity, KeyValuePair <Mapper, Type> map) { if (ConnectionMode == Enums.Mode.UnitOfWork && !insertCommands.Where(a => a.Equals(entity)).Any()) { insertCommands.Add(entity); return(null); } OracleCommand cmd = new OracleCommand(); string commandText = string.Empty; CommaDelimitedStringCollection col = new CommaDelimitedStringCollection(); CommaDelimitedStringCollection param = new CommaDelimitedStringCollection(); col.AddRange(map.Key.Columns.Select(a => a.ColumnName).ToArray()); foreach (var column in map.Key.Columns) { var prop = entity.GetType().GetProperty(column.ColumnName); var value = prop.GetValue(entity, null); if (String.IsNullOrWhiteSpace(column.DefaultValue)) { if (string.IsNullOrWhiteSpace(column.SequenceName)) { param.Add(String.Format(":{0}", column.ColumnName)); if (column.Nullable && value == null) { cmd.Parameters.Add(new OracleParameter(column.ColumnName, DBNull.Value)); } else { cmd.Parameters.Add(new OracleParameter(column.ColumnName, value)); } } else { param.Add(String.Format("{0}.{1}.NextVal", _schemmaName, column.SequenceName)); } } else { param.Add(column.DefaultValue); } } commandText = String.Format("INSERT INTO {0}.{1} ({2}) VALUES ({3})", _schemmaName, entity.GetType().Name, col.ToString(), param.ToString()); cmd.CommandText = commandText.ToString(); return(cmd); }
public override string GetInQueryValues(string values, bool encode) { CommaDelimitedStringCollection strings = new CommaDelimitedStringCollection(); string[] textArray = values.Split(new char[] { ',' }); foreach (string text2 in textArray) { string text = text2.Trim(); if (!string.IsNullOrEmpty(text)) { strings.Add(this.Parameters.GetParameter(text)); } } return(strings.ToString()); }
public static string Encode(string[] values, bool surround) { if ((values == null) || (values.Length < 1)) { return(NULL); } CommaDelimitedStringCollection strings = new CommaDelimitedStringCollection(); foreach (string text in values) { if (!string.IsNullOrEmpty(text)) { strings.Add(Encode(text.Trim(), surround)); } } return(strings.ToString()); }
public override String GetInQueryValues(string values, bool encode) { CommaDelimitedStringCollection csv = new CommaDelimitedStringCollection(); String[] split = values.Split(','); String temp; foreach (string value in split) { temp = value.Trim(); if (!string.IsNullOrEmpty(temp)) { csv.Add(Parameters.GetParameter(temp)); } } return(csv.ToString()); }
public static string ConvertBookmakListToCommaSeparatedString(this ReadOnlyCollection <BookmarkInfo> bookmarks) { var coll = new CommaDelimitedStringCollection(); //var actioncoll = new CommaDelimitedStringCollection(); foreach (var b in bookmarks) { //actioncoll.Clear(); //foreach (string s in b.BookMarkActions) //{ // actioncoll.Add(s); //} //var output = b.Name + (actioncoll.Count > 0 ? "-" + actioncoll.ToString() : ""); coll.Add(b.BookmarkName); } return(coll.ToString()); }
private OracleCommand GetMappedUpdateCommand(object entity, KeyValuePair <Mapper, Type> map) { if (ConnectionMode == Enums.Mode.UnitOfWork && !insertCommands.Where(a => a.Equals(entity)).Any()) { updateCommands.Add(entity); return(null); } OracleCommand cmd = new OracleCommand(); string commandText = string.Empty; CommaDelimitedStringCollection columns = new CommaDelimitedStringCollection(); StringBuilder where = new StringBuilder(); foreach (var column in map.Key.Columns) { var prop = entity.GetType().GetProperty(column.ColumnName); var value = prop.GetValue(entity, null); if (column.IsPk) { where.Append(String.Format("{0} = :{0} AND", column.ColumnName)); cmd.Parameters.Add(new OracleParameter(column.ColumnName, value)); } else { columns.Add(String.Format("{0} = :{0},", column.ColumnName)); if (column.Nullable && value == null) { cmd.Parameters.Add(new OracleParameter(column.ColumnName, DBNull.Value)); } else { cmd.Parameters.Add(new OracleParameter(column.ColumnName, value)); } } } where.Remove(where.Length - 3, 3); commandText = String.Format("UPDATE {0}.{1} SET {2} WHERE {3}", _schemmaName, entity.GetType().Name, columns.ToString(), where.ToString()); cmd.CommandText = commandText; return(cmd); }
/// <summary> /// Encodes the specified values for use in SQL expressions and /// optionally surrounds the value with single-quotes. /// </summary> /// <param name="values"></param> /// <param name="surround"></param> /// <returns></returns> public static String Encode(String[] values, bool surround) { if (values == null || values.Length < 1) { return(SqlUtil.NULL); } CommaDelimitedStringCollection csv = new CommaDelimitedStringCollection(); foreach (String value in values) { if (!String.IsNullOrEmpty(value)) { csv.Add(SqlUtil.Encode(value.Trim(), surround)); } } return(csv.ToString()); }
/// <summary> /// Updates and returns the value of the DataParameter object. /// </summary> /// <param name="context">The current System.Web.HttpContext of the request.</param> /// <param name="control">The System.Web.UI.Control that the parameter is bound to.</param> /// <returns>A System.Object that represents the updated and current value of the parameter.</returns> protected override Object Evaluate(HttpContext context, Control control) { String value = String.Empty; if (_dataSource == null && control != null) { _dataSource = control.FindControl(DataSourceID) as IListDataSource; } if (_dataSource != null) { IEnumerable entityList = _dataSource.GetEntityList(); if (entityList != null) { CommaDelimitedStringCollection values = new CommaDelimitedStringCollection(); String propertyName = PropertyName ?? EntityKeyName; IList list = EntityUtil.GetEntityList(entityList); Object temp; foreach (Object item in list) { temp = EntityUtil.GetPropertyValue(item, EntityKeyName); if (temp != null) { values.Add(String.Format("'{0}'", temp)); } } if (values.Count > 0) { value = String.Format("{0} IN ({1})", propertyName, values.ToString()); } } } return(value); }
protected void StartWorkflowButtonClick(object sender, EventArgs e) { var ids = Request["ids"].Split(',').ToList().ConvertAll(Convert.ToInt32); var workflowConfigId = Convert.ToInt32(AvailableCriteriaDropDownList.SelectedValue); var comment = string.IsNullOrEmpty(InstantiationCommentTextBox.Text) ? TheGlobalisationService.GetString("no_comment_supplied") : InstantiationCommentTextBox.Text; // TODO: custom workflow variables? Log.Info(string.Format("Instantiating workflow {0}: {1}", workflowConfigId, comment)); var inst = TheWorkflowInstanceService.Instantiate(workflowConfigId, comment); var flags = new CommaDelimitedStringCollection(); foreach (ListItem item in FlagsCheckBoxList.Items) { if (item.Selected) { flags.Add(TheGlobalisationService.GetString(item.Text)); } } inst.Flags = flags.ToString(); foreach (var id in ids) { ((UmbracoWorkflowInstance)inst).CmsNodes.Add(id); } TheWorkflowInstanceService.Update(inst); TheWorkflowInstanceService.Start(inst.Id); TheWorkflowRuntime.RunWorkflows(); SavedLiteral.Visible = true; }
static void Main(string[] args) { // Display title and info. Console.WriteLine("ASP.NET Configuration Info"); Console.WriteLine("Type: CommaDelimitedStringCollection"); Console.WriteLine(); // Set the path of the config file. string configPath = "/aspnet"; // Get the Web application configuration object. Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath); // Get the section related object. AuthorizationSection configSection = (AuthorizationSection)config.GetSection("system.web/authorization"); // Get the authorization rule collection. AuthorizationRuleCollection authorizationRuleCollection = configSection.Rules; // <Snippet2> // Create a CommaDelimitedStringCollection object. CommaDelimitedStringCollection myStrCollection = new CommaDelimitedStringCollection(); // </Snippet2> for (int i = 0; i < authorizationRuleCollection.Count; i++) { if (authorizationRuleCollection.Get(i).Action.ToString().ToLower() == "allow") { // <Snippet3> // Add values to the CommaDelimitedStringCollection object. myStrCollection.AddRange( authorizationRuleCollection.Get(i).Users.ToString().Split( ",".ToCharArray())); // </Snippet3> } } Console.WriteLine("Allowed Users: {0}", myStrCollection.ToString()); // <Snippet4> // Count the elements in the collection. Console.WriteLine("Allowed User Count: {0}", myStrCollection.Count); // </Snippet4> // <Snippet5> // Call the Contains method. Console.WriteLine("Contains 'userName1': {0}", myStrCollection.Contains("userName1")); // </Snippet5> // <Snippet6> // Determine the index of an element // in the collection. Console.WriteLine("IndexOf 'userName0': {0}", myStrCollection.IndexOf("userName0")); // </Snippet6> // <Snippet7> // Call IsModified. Console.WriteLine("IsModified: {0}", myStrCollection.IsModified); // </Snippet7> // <Snippet8> // Call IsReadyOnly. Console.WriteLine("IsReadOnly: {0}", myStrCollection.IsReadOnly); // </Snippet8> Console.WriteLine(); Console.WriteLine("Add a user name to the collection."); // <Snippet9> // Insert a new element in the collection. myStrCollection.Insert(myStrCollection.Count, "userNameX"); // </Snippet9> Console.WriteLine("Collection Value: {0}", myStrCollection.ToString()); Console.WriteLine(); Console.WriteLine("Remove a user name from the collection."); // <Snippet10> // Remove an element of the collection. myStrCollection.Remove("userNameX"); // </Snippet10> Console.WriteLine("Collection Value: {0}", myStrCollection.ToString()); // Display and wait Console.ReadLine(); }
private async void ReadFromBilagscan(UnicontaBaseEntity selectedItem) { #if !SILVERLIGHT if (!readingFromBilagscan) { readingFromBilagscan = true; bool processLines = false; var accessToken = await Bilagscan.Account.GetBilagscanAccessToken(api); var noOfVouchers = 0; var companySettings = await api.Query <CompanySettingsClient>(); var orgNo = companySettings.FirstOrDefault()._OrgNumber; var journal = dgGldailyJournal.SelectedItem as GLDailyJournalClient; // UnicontaBaseEntity[] baseEntityArray = new UnicontaBaseEntity[1] { selectedItem }; using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); var response = await client.GetAsync($"https://api.bilagscan.dk/v1/organizations/" + orgNo.ToString() + "/vouchers?seen=false&count=100&offset=0&sorts=-upload_date&status=successful"); var content = await response.Content.ReadAsStringAsync(); var vouchers = Bilagscan.Voucher.GetVouchers(content); var credCache = api.CompanyEntity.GetCache(typeof(Uniconta.DataModel.Creditor)) ?? await api.CompanyEntity.LoadCache(typeof(Uniconta.DataModel.Creditor), api); var offsetCache = api.CompanyEntity.GetCache(typeof(Uniconta.DataModel.GLAccount)) ?? await api.CompanyEntity.LoadCache(typeof(Uniconta.DataModel.GLAccount), api); var vouchersSeen = new CommaDelimitedStringCollection(); var master = new List <UnicontaBaseEntity> { journal }; var newLines = new List <UnicontaBaseEntity>(); var updateCreditor = new List <UnicontaBaseEntity>(); if (vouchers?.data != null) { var creditors = credCache.GetKeyStrRecords as Uniconta.DataModel.Creditor[]; foreach (var voucher in vouchers.data) { vouchersSeen.Add(NumberConvert.ToString(voucher.id)); var journalLine = new GLDailyJournalLineClient() { Approved = false, ForceSettlement = false }; var postingType = BilagscanVoucherType.Invoice; var hint = Bilagscan.Voucher.GetHint(voucher.note); var bilagscanRefID = voucher.id; journalLine.ReferenceNumber = bilagscanRefID != 0 ? NumberConvert.ToString(bilagscanRefID) : null; var bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "voucher_number", true) == 0).FirstOrDefault(); if (bsItem != null) { journalLine.Invoice = bsItem.value; } bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "voucher_type", true) == 0).FirstOrDefault(); if (bsItem != null) { switch (bsItem.value) { case "invoice": postingType = BilagscanVoucherType.Invoice; break; case "creditnote": postingType = BilagscanVoucherType.Creditnote; break; case "receipt": postingType = BilagscanVoucherType.Receipt; break; } } var creditorCVR = string.Empty; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "company_vat_reg_no", true) == 0).FirstOrDefault(); if (bsItem != null) { creditorCVR = bsItem.value; } bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "total_amount_incl_vat", true) == 0).FirstOrDefault(); if (bsItem != null) { journalLine.Amount = Math.Abs(NumberConvert.ToDoubleNoThousandSeperator(bsItem.value)); if (postingType != BilagscanVoucherType.Creditnote) { journalLine.Amount = -journalLine.Amount; } } CountryCode countryCode = CountryCode.Denmark; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "country", true) == 0).FirstOrDefault(); if (bsItem != null) { CountryISOCode countryISO; countryCode = CountryCode.Denmark; //default if (Enum.TryParse(bsItem.value, true, out countryISO)) { countryCode = (CountryCode)countryISO; } } bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "invoice_date", true) == 0).FirstOrDefault(); if (bsItem != null) { var invoiceDate = bsItem.value == string.Empty ? GetSystemDefaultDate() : StringSplit.DateParse(bsItem.value, DateFormat.ymd); journalLine.Date = invoiceDate; if (journalLine.Date == DateTime.MinValue) { journalLine.Date = GetSystemDefaultDate(); } } bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "payment_date", true) == 0).FirstOrDefault(); if (bsItem != null) { var paymentDate = bsItem.value == string.Empty ? DateTime.MinValue : StringSplit.DateParse(bsItem.value, DateFormat.ymd); journalLine._DueDate = paymentDate; } bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "currency", true) == 0).FirstOrDefault(); if (bsItem != null) { Currencies currencyISO; if (!Enum.TryParse(bsItem.value, true, out currencyISO)) { currencyISO = Currencies.DKK; //default } journalLine._Currency = (byte)currencyISO; } string bbanAcc = null; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "payment_account_number", true) == 0).FirstOrDefault(); if (bsItem != null) { bbanAcc = bsItem.value; } string bbanRegNum = null; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "payment_reg_number", true) == 0).FirstOrDefault(); if (bsItem != null) { bbanRegNum = bsItem.value; } string ibanNo = null; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "payment_iban", true) == 0).FirstOrDefault(); if (bsItem != null) { ibanNo = bsItem.value; } string swiftNo = null; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "payment_swift_bic", true) == 0).FirstOrDefault(); if (bsItem != null) { swiftNo = bsItem.value; } string paymentCodeId = null; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "payment_code_id", true) == 0).FirstOrDefault(); if (bsItem != null) { paymentCodeId = bsItem.value; } string paymentId = null; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "payment_id", true) == 0).FirstOrDefault(); if (bsItem != null) { paymentId = bsItem.value; } string jointPaymentId = null; bsItem = voucher.header_fields.Where(hf => string.Compare(hf.code, "joint_payment_id", true) == 0).FirstOrDefault(); if (bsItem != null) { jointPaymentId = bsItem.value; } var paymentMethod = PaymentTypes.VendorBankAccount; switch (paymentCodeId) { case "71": paymentMethod = PaymentTypes.PaymentMethod3; break; case "73": paymentMethod = PaymentTypes.PaymentMethod4; break; case "75": paymentMethod = PaymentTypes.PaymentMethod5; break; case "04": case "4": paymentMethod = PaymentTypes.PaymentMethod6; break; } if (paymentMethod != PaymentTypes.VendorBankAccount && (paymentId != null || jointPaymentId != null)) { journalLine._PaymentMethod = paymentMethod; journalLine._PaymentId = string.Format("{0} +{1}", paymentId, jointPaymentId); } else if (bbanRegNum != null && bbanAcc != null) { journalLine._PaymentMethod = PaymentTypes.VendorBankAccount; journalLine._PaymentId = string.Format("{0}-{1}", bbanRegNum, bbanAcc); } else if (swiftNo != null && ibanNo != null) { journalLine._PaymentMethod = PaymentTypes.IBAN; journalLine._PaymentId = ibanNo; } journalLine.SettleValue = "Voucher"; Uniconta.DataModel.Creditor creditor = null; if (hint != null) { journalLine._DocumentRef = hint.RowId; //if (hint.CreditorAccount != null) // creditor = (Uniconta.DataModel.Creditor)credCache.Get(hint.CreditorAccount); //if (hint.Amount != 0) // journalLine.Amount = hint.Amount; //if (hint.Currency != null && hint.Currency != "-") // journalLine.Currency = hint.Currency; //if (hint.PaymentId != null) //{ // journalLine._PaymentId = hint.PaymentId; // journalLine.PaymentMethod = hint.PaymentMethod; //} } journalLine._AccountType = 2; var creditorCVRNum = Regex.Replace(creditorCVR, "[^0-9]", string.Empty); if (creditorCVRNum != string.Empty) { creditor = creditors.Where(s => (Regex.Replace(s._LegalIdent ?? string.Empty, "[^0-9.]", "") == creditorCVRNum)).FirstOrDefault(); } if (creditorCVRNum == string.Empty) { journalLine.Text = Uniconta.ClientTools.Localization.lookup("NotValidVatNo"); } else if (creditor == null) { var newCreditor = new CreditorClient() { _Account = creditorCVR, _LegalIdent = creditorCVR, _PaymentMethod = journalLine._PaymentMethod, _PaymentId = journalLine._PaymentId, _SWIFT = swiftNo }; CompanyInfo companyInformation = null; try { companyInformation = await CVR.CheckCountry(creditorCVR, countryCode); } catch (Exception ex) { UnicontaMessageBox.Show(ex); return; } if (companyInformation != null) { if (companyInformation.life != null) { newCreditor._Name = companyInformation.life.name; } if (companyInformation.address != null) { newCreditor._Address1 = companyInformation.address.CompleteStreet; newCreditor._ZipCode = companyInformation.address.zipcode; newCreditor._City = companyInformation.address.cityname; newCreditor._Country = companyInformation.address.Country; } if (companyInformation.contact != null) { newCreditor._Phone = companyInformation.contact.phone; newCreditor._ContactEmail = companyInformation.contact.email; } journalLine.Text = newCreditor.Name; } else { newCreditor.Name = Uniconta.ClientTools.Localization.lookup("NotValidVatNo"); } await api.Insert(newCreditor); journalLine.Account = creditorCVR; } else { if (!string.IsNullOrEmpty(creditor._PostingAccount)) { var account = (GLAccountClient)offsetCache.Get(creditor._PostingAccount); if (!string.IsNullOrEmpty(account.Vat)) { var dailyJournal = (GLDailyJournalClient)master[0]; if (dailyJournal.TwoVatCodes) { journalLine._OffsetVat = account.Vat; } else { journalLine._Vat = account.Vat; } } journalLine._OffsetAccount = creditor._PostingAccount; } else { journalLine.Vat = creditor._Vat; } if (journalLine._DueDate == DateTime.MinValue && creditor._Payment != string.Empty) { var paymentTermsCache = api.GetCache(typeof(PaymentTerm)) ?? await api.LoadCache(typeof(PaymentTerm)); var paymentTerm = (PaymentTerm)paymentTermsCache.Get(creditor._Payment); if (paymentTerm != null) { journalLine._DueDate = paymentTerm.GetDueDate(journalLine.DueDate); } } journalLine.Account = creditor._Account; journalLine.Text = creditor._Name; if (creditor._SWIFT == null && swiftNo != null) { creditor._SWIFT = swiftNo; updateCreditor.Add(creditor); } } journalLine.SetMaster(master[0]); newLines.Add(journalLine); noOfVouchers += 1; } } var errorCode = await api.Insert(newLines); api.UpdateNoResponse(updateCreditor); if (vouchersSeen.Count != 0) { // Mark voucher as seen string serializedRequest = "{ \"vouchers\": [ " + vouchersSeen.ToString() + " ] }"; var vContent = new StringContent(serializedRequest, Encoding.UTF8, "application/json"); response = await client.PostAsync($"https://api.bilagscan.dk/v1/organizations/" + NumberConvert.ToString(orgNo) + "/vouchers/seen", vContent); var res = await response.Content.ReadAsStringAsync(); } } if (noOfVouchers == 0) { UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("StillProcessingTryAgain"), Uniconta.ClientTools.Localization.lookup("Bilagscan")), Uniconta.ClientTools.Localization.lookup("Bilagscan"), MessageBoxButton.OK, MessageBoxImage.Information); } else { var messageText = string.Concat(string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup("NumberOfImportedVouchers"), noOfVouchers), Environment.NewLine, Environment.NewLine, string.Format(Uniconta.ClientTools.Localization.lookup("GoTo"), Uniconta.ClientTools.Localization.lookup("Journallines")), "?"); if (UnicontaMessageBox.Show(messageText, Uniconta.ClientTools.Localization.lookup("BilagscanRead"), MessageBoxButton.OKCancel, MessageBoxImage.Information) == MessageBoxResult.OK) { AddDockItem(TabControls.GL_DailyJournalLine, journal, null, null, true); } } readingFromBilagscan = false; } #endif }