Ejemplo n.º 1
0
    protected void gridData_OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLowerCSafe())
        {
        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();

                    // Update number of entries in BizFormInfo
                    BizFormInfoProvider.RefreshDataCount(bfi.FormName, bfi.FormSiteID);
                }
            }

            break;
        }
    }
        public void Submit(IForm form)
        {
            try
            {
                var formInfo = BizFormInfoProvider.GetBizFormInfo(form.Name, SiteContext.CurrentSiteID);
                if (formInfo == null)
                {
                    throw new InvalidOperationException("The requested checkin form does not exist.");
                }
                var dataClassInfo = DataClassInfoProvider.GetDataClassInfo(formInfo.FormClassID);
                var item          = new BizFormItem(dataClassInfo.ClassName);

                SetFormValues(form, item);

                item.SetValue("FormInserted", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                item.SetValue("FormUpdated", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                BizFormItemProvider.SetItem(item);
                BizFormInfoProvider.RefreshDataCount(formInfo.FormName, formInfo.FormSiteID);

                if (form.Notification != null)
                {
                    SendNotificationEmail(formInfo, form, item);
                }

                if (!String.IsNullOrEmpty(form.Autoresponder?.Sender))
                {
                    SendAcknowledgementEmail(formInfo, item, form.Controls);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("There was a problem saving the form. Please contact our support team.", ex);
            }
        }
Ejemplo n.º 3
0
    protected void gridData_OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLower())
        {
        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
                    IDataClass formRecord = DataClassFactory.NewDataClass(dci.ClassName, formRecordID);
                    if (!formRecord.IsEmpty())
                    {
                        // Delete all files of the record
                        BizFormInfoProvider.DeleteBizFormRecordFiles(dci.ClassFormDefinition, formRecord, CMSContext.CurrentSiteName);

                        // Delete the form record
                        formRecord.Delete();

                        // Update number of entries in BizFormInfo
                        if (bfi != null)
                        {
                            BizFormInfoProvider.RefreshDataCount(bfi.FormName, bfi.FormSiteID);
                        }
                    }
                }
            }

            break;
        }
    }