the following code worked for Kentico 5, but no longer for 6
BizFormInfo bfi = BizFormInfoProvider.GetBizFormInfo("BIZFORMNAME", "SITENAME");
if (bfi != null)
{
DataClassInfo dci = DataClassInfoProvider.GetDataClass(bfi.FormClassID);
if (dci != null)
{
GeneralConnection genConn = ConnectionHelper.GetConnection();
// create a new record in memory (new DataClass object)
DataClass formRecord = new DataClass(dci.ClassName, genConn);
// Insert some data
formRecord.SetValue("Email", Request.Form["txtEmail"]);
formRecord.SetValue("FormInserted", DateTime.Now);
formRecord.SetValue("FormUpdated", DateTime.Now);
// Insert the new record in the database
formRecord.Insert();
// Update number of entries in BizFormInfo
bfi.FormItems++;
BizFormInfoProvider.SetBizFormInfo(bfi);
// Dataclass object
IDataClass content = DataClassFactory.NewDataClass(dci.ClassName, formRecord.ID, genConn);
DataRow row = content.DataRow;
CMS.FormControls.BizForm form = new CMS.FormControls.BizForm();
form.SendNotificationEmail(bfi.FormSendFromEmail, bfi.FormSendToEmail, row, bfi, content);
}
}
}
the old code will no longer compile so i have modifed bits and pieces. it inserts data ok (from devnet doco), but I couldn't find how to send a notification email? help?
BizFormInfo bfi = BizFormInfoProvider.GetBizFormInfo("BIZFORMNAME", "SITENAME");
if (bfi != null)
{
DataClassInfo dci = DataClassInfoProvider.GetDataClass(bfi.FormClassID);
if (dci != null)
{
BizFormItemProvider bProvider = new BizFormItemProvider();
BizFormItem formRecord = new BizFormItem(dci.ClassName, bProvider);
formRecord.SetValue("Email", Request.Form["Email"]);
formRecord.SetValue("FormInserted", DateTime.Now);
formRecord.SetValue("FormUpdated", DateTime.Now);
formRecord.Insert();
BizFormInfoProvider.RefreshDataCount(bfi.FormName, bfi.FormSiteID);
// Dataclass object
IDataClass content = DataClassFactory.NewDataClass(dci.ClassName, formRecord.ItemID);
CMS.FormControls.BizForm form = new CMS.FormControls.BizForm();
//compiles and doesn't throw exception, but does not email?
form.SendNotificationEmail(bfi.FormSendFromEmail, bfi.FormSendToEmail, , bfi);
}
}
}