I have a LINQ query which I’m using in my process. In this I’m passing some values as input for filter. Now i want to store them.in Config file and get them from there. How can i store them in config.
{“Hr”, “Payroll”, “IT”, “HomeService”}
Above are the values in future they might add few more also , if it’s in config means it will pick automatically.
Can anyone suggest me how can i achieve this.
If (ReadDT.AsEnumerable. Skip(1). Any (Function(k) Date.Parse(k(4).ToString). ToShortDateString. Contains (Now.AddDays (-2). ToShortDateString) AndAlso {“Hr”, “Payroll”, “IT”, “HomeService”}.Contains(k(8).ToString)), (From d In ReadDT.AsEnumerable. Skip (1) where DateTime.Parse(d(4).ToString)=Now. AddDays (-2). Date AndAlso {“Hr”, “Payroll”, “IT”, “Home Service”}.Contains(d(8).ToString) Select d).CopyToDataTable, Nothing)
How about the following?
if there is no special character in keyword, create comma separated string.
config("keyword") = "Hr,Payroll,IT,HomeService"
Then
If (ReadDT.AsEnumerable. Skip(1). Any (Function(k) Date.Parse(k(4).ToString). ToShortDateString. Contains (Now.AddDays (-2). ToShortDateString) AndAlso config(“keyword”).ToString.Split({",“c}).Contains(k(8).ToString)), (From d In ReadDT.AsEnumerable. Skip (1) where DateTime.Parse(d(4).ToString)=Now. AddDays (-2). Date AndAlso config(“keyword”).ToString.Split({”,"c}).Contains(d(8).ToString) Select d).CopyToDataTable, Nothing)
If (ReadDT.AsEnumerable.Skip(1). Any (Function(k) Date.Parse(k(4).ToString). ToShortDateString().Contains (Now.AddDays (-2). ToShortDateString()) AndAlso Config(“ColValues”).ToString.Contains(k(8).ToString())), (From d In ReadDT.AsEnumerable. Skip (1) where DateTime.Parse(d(4).ToString()).Date=Now.AddDays (-2). Date AndAlso Config(“ColValues”).ToString.Contains(d(8).ToString) Select d).CopyToDataTable(), Nothing)