i think i write this code is correct but i don't know why k2 can't sent e-mail to destiontion users
private void AddUsers(int setIdx)
{
Array destinations = null;
DataSet DSReviewer = new DataSet(); //-------------------- by my self
// Get the property that returns the result
string propName = string.Format("DestinationSetDestinations{0}", setIdx);
System.Reflection.PropertyInfo pi =
K2.Configuration.GetType().GetProperty(propName);
if (pi == null)
return;
// Invoke the get
System.Reflection.MethodInfo mi = pi.GetGetMethod();
if (mi == null)
return;
object retval = mi.Invoke(K2.Configuration, null);
destinations = retval as Array;
if (destinations == null)
return;
foreach (string destination in destinations)
{
K2.Destinations.Add(SourceCode.KO.DestinationType.User, destination);
}
// ------------------- by my self
using (SqlConnection conn = new SqlConnection("Data Source=DCVPC;Initial Catalog=SmartBox;Integrated Security=SSPI;Persist Security Info=False;"))
{
conn.Open();
string strSql;
strSql = "SELECT EmployeeDetail.Email ";
strSql += "FROM EmployeeDetail ";
strSql += "WHERE EmployeeDetail.EmpNo in ( ";
strSql += "SELECT Reviewer.EmployeeNo ";
strSql += "FROM EmployeeDetail INNER JOIN ";
strSql += "Reviewer ON EmployeeDetail.Department = Reviewer.Department INNER JOIN ";
strSql += "LeaveForm ON EmployeeDetail.EmpNo = LeaveForm.EmpNo ";
strSql += "WHERE LeaveForm.LeaveNo = " + K2.ProcessInstance.DataFields["LeaveNo"].Value;
SqlDataAdapter SQLDAReviewer = new SqlDataAdapter(strSql,conn);
if (DSReviewer.Tables.Contains("Reviewer"))
{
DSReviewer.Tables.Remove("ProgramData");
}
SQLDAReviewer.Fill(DSReviewer, "Reviewer");
if (DSReviewer.Tables["Reviewer"].Rows.Count > 0)
{
for (int i = 0; i < DSReviewer.Tables["Reviewer"].Rows.Count; i++)
{
K2.Destinations.Add(SourceCode.KO.DestinationType.User, "K2:ISONETVPC"" + Convert.ToString(DSReviewer.Tables["Reviewer"].Rows[0]));
}
}
}
}
some one who can help me about my problem i think if i change syntax fill dataset to xml before and to destionation user
may it can send this e-mail ?????