コード例 #1
0
    protected void gridData_OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLowerInvariant())
        {
        case "delete":
            CheckPermissions("DeleteData");

            // Get record ID
            int formRecordID = ValidationHelper.GetInteger(actionArgument, 0);

            // Get BizFormInfo object
            if (bfi != null)
            {
                // Get class object
                if (dci != null)
                {
                    // Get record object
                    var item = BizFormItemProvider.GetItem(formRecordID, dci.ClassName);

                    // Delete all files of the record
                    BizFormInfoProvider.DeleteBizFormRecordFiles(dci.ClassFormDefinition, item, SiteContext.CurrentSiteName);

                    // Delete the form record
                    item.Delete();
                }
            }

            break;
        }
    }
コード例 #2
0
        public void UpdateFormEntry(string formName, int itemID, string fieldToUpdate, object newValue)
        {
            BizFormInfo formObject = BizFormInfoProvider.GetBizFormInfo(formName, SiteContext.CurrentSiteID);

            if (formObject == null)
            {
                throw new InvalidOperationException("The requested checkin form does not exist.");
            }
            // Gets the class name of the form
            DataClassInfo formClass = DataClassInfoProvider.GetDataClassInfo(formObject.FormClassID);
            string        className = formClass.ClassName;

            BizFormItem item = BizFormItemProvider.GetItem(itemID, className);

            item.SetValue(item.ColumnNames.Find(t => t.ToLower() == fieldToUpdate), newValue);
            item.SubmitChanges(false);
        }