Nirmal KumarC

Nirmal KumarC

  • 1.3k
  • 327
  • 75.8k

How to Array using table column value passing array

Sep 10 2014 10:23 AM
 Table Design:
 
Template table:
Tempid             TemplteName                 TempMessage                                      TempActive
   1                       Fees                              Dear * your * amount * is pending            A
categories Table:
 
id  ValueId     Categories                 
 
1      1             $Studentid$                   
2      2            $StudentName$
3      3            $CrsDate$ 
4     4             $PendingAmount$ 
5     5             $Text$ 
 
 
category Get table
id Template_ID SNo ValueId
1     1                   1        2
2     1                   2        3
3     1                   3        4
 
This three table joinig   i will get  temp id wise result this:
 
Categories:
 $StudentName$
$CrsDate$
$PendingAmount$
 
 
how to assign  this data passed: 
 
string message = TxtMsg.Text;
string[] replacements = { $StudentName$, $CrsDate$,$PendingAmount$ };
MatchCollection mc = Regex.Matches(message, @"\*");
int limit = Math.Min(mc.Count, replacements.Length) - 1;
for (int i = limit; i >= 0; i--)
{
message = message.Remove(mc[i].Index, 1).Insert(mc[i].Index, replacements[i]);
}
TxtMsg.Text = message.ToString();
 
 
I want This result :
Dear John your 25000 is started pending amount
 
 
Thank You