mrogers-brainloaf
-
12/2/2009 4:58:20 PM
BizForm Records disappearing
we have a system we have developed for a client that uses BizForms heavily for data capture from service agents around the US. The come to the site, open up a page that displays the correct bizForm based on some logic, then they save the bizform. This is all working properly and the records appear properly. They also export into excel properly. But in the past few weeks, the client has discovered that a couple of the records have gone missing from the bizForm Tables. This has happened on multiple biz forms. The forms have not been edited or manually deleted as far as we can tell. They have not be saved again either.
here is the way I display the bizForm:
bizForm.FormName = form.FormName;
// could this be it? for new forms with recordid zero would this blow something up? bizForm.ItemID = activity.RecordId;
//bizForm.BasicForm.SubmitButton.Text = "Save"; bizForm.OnAfterSave += new CMS.FormControls.BizForm.OnAfterSaveEventHandler(bizForm_OnAfterSave); bizForm.BasicForm.SubmitButton.Text = "Save and Submit Final";
And then here is my OnAfterSave:
string bizFormName = form.FormName; string siteName = "BlankSiteASPX";
// Read BizForm definition BizFormInfo bfi = BizFormInfoProvider.GetBizFormInfo(bizFormName, siteName);
if (bfi != null) { // Read data type definition DataClassInfo dci = DataClassInfoProvider.GetDataClass(bfi.FormClassID);
if (dci != null) { // Get all bizform data GeneralConnection genConn = ConnectionHelper.GetConnection(); //DataSet ds = genConn.ExecuteQuery(dci.ClassName + ".selectall", null, null, null);
// Get ID of the first record int formRecordID = bizForm.ItemID; // Get the record with ID of the first row record DataClass formRecord = new DataClass(dci.ClassName, formRecordID, genConn);
if (!formRecord.IsEmpty()) { // Set new field values formRecord.SetValue("RepId", activity.User.UserId); formRecord.SetValue("RepName", activity.User.Fullname); formRecord.SetValue("StoreName", activity.LocationName); formRecord.SetValue("StoreNum", activity.Location.StoreNumber); formRecord.SetValue("City", activity.Location.StoreCity); formRecord.SetValue("State", activity.Location.StoreState); formRecord.SetValue("mplid", activity.Id); formRecord.SetValue("ScheduleDate", activity.ScheduleDate); formRecord.SetValue("ServiceByDate", activity.ServiceByDate); formRecord.SetValue("ScheduleDate", activity.ServicedDate);
// Save updates in the database formRecord.Update();
//lblInfo.Text = "The first record was updated successfully."; } //else //{ // lblInfo.Text = "No data found."; //} } }
All of this seems to record properly, but the records seem to disappear at somepoint. Can you see anything I am doing wrong?
|