コード例 #1
0
        private GeneralResultDTO SubmitRequestAccessFormInternal(string email)
        {
            var requestAccessForm = BizFormInfoProvider.GetBizFormInfo(_RequestAccessFormCodeName, SiteContext.CurrentSiteID);

            if (requestAccessForm != null)
            {
                var    requestAccessFormClass     = DataClassInfoProvider.GetDataClassInfo(requestAccessForm.FormClassID);
                string requestAccessFormClassName = requestAccessFormClass.ClassName;

                BizFormItem newFormItem = BizFormItem.New(requestAccessFormClassName);

                newFormItem.SetValue("Email", email);
                newFormItem.SetValue("Site", SiteContext.CurrentSite.DisplayName);
                newFormItem.SetValue("FormInserted", DateTime.Now);
                newFormItem.SetValue("FormUpdated", DateTime.Now);

                newFormItem.Insert();

                SendFormEmail(newFormItem);

                return(new GeneralResultDTO {
                    success = true
                });
            }
            else
            {
                return(new GeneralResultDTO {
                    success = false, errorMessage = ResHelper.GetString("Kadena.ForgottenPassword.ForgottenPasswordRepositoryNotFound", LocalizationContext.CurrentCulture.CultureCode)
                });
            }
        }
コード例 #2
0
        private GeneralResultDTO SubmitBidInternal(string name, string description, string requestType, string biddingWay, int numberOfBidings, List <HttpPostedFile> files, DateTime productionDate, DateTime?selectionDate)
        {
            var bidForm = BizFormInfoProvider.GetBizFormInfo(_BidFormCodeName, SiteContext.CurrentSiteID);

            if (bidForm != null)
            {
                var    bidFormClass     = DataClassInfoProvider.GetDataClassInfo(bidForm.FormClassID);
                string bidFormClassName = bidFormClass.ClassName;

                BizFormItem newFormItem = BizFormItem.New(bidFormClassName);

                newFormItem.SetValue("Name", name);
                newFormItem.SetValue("Description", description);
                newFormItem.SetValue("RequestType", requestType);
                newFormItem.SetValue("BiddingWayText", biddingWay);
                newFormItem.SetValue("BiddingWayNumber", numberOfBidings);

                newFormItem.SetValue("ProductionDate", productionDate);
                if (selectionDate.HasValue)
                {
                    newFormItem.SetValue("SelectionDate", selectionDate);
                }

                newFormItem.SetValue("FormInserted", DateTime.Now);
                newFormItem.SetValue("FormUpdated", DateTime.Now);

                newFormItem.SetValue("Site", SiteContext.CurrentSite.DisplayName);

                if (files.Count > 0)
                {
                    for (int i = 0; files.Count > i; i++)
                    {
                        string extension           = System.IO.Path.GetExtension(files[i].FileName);
                        string fileName            = new FormsHelper().GetNewGuidName(extension);
                        string formFilesFolderPath = FormHelper.GetBizFormFilesFolderPath(SiteContext.CurrentSiteName);
                        string fileNameString      = fileName + "/" + Path.GetFileName(files[i].FileName);
                        new FormsHelper().SaveFileToDisk(files[i], fileName, formFilesFolderPath);
                        newFormItem.SetValue(string.Format("File{0}", i + 1), (object)fileNameString);
                    }
                }
                newFormItem.Insert();

                new FormsHelper().SendFormEmail(newFormItem, files.Count);

                return(new GeneralResultDTO {
                    success = true
                });
            }
            else
            {
                return(new GeneralResultDTO {
                    success = false, errorMessage = ResHelper.GetString("Kadena.NewBidRequest.RepositoryNotFound", LocalizationContext.CurrentCulture.CultureCode)
                });
            }
        }
コード例 #3
0
        private void CreateFormSubmission(ITreeNode document, string formName, ContactInfo contact)
        {
            var dataClassInfo =
                DataClassInfoProviderBase <DataClassInfoProvider> .GetDataClassInfo(BizFormInfoProvider
                                                                                    .GetBizFormInfo(formName, _mSiteInfo.SiteID).FormClassID);

            var formItem = new BizFormItem(dataClassInfo.ClassName);

            _mFormActivityGenerator.GenerateFormSubmitActivity(formItem, document, contact.ContactID,
                                                               _mSiteInfo.SiteID);
            CopyDataFromContactToForm(contact, dataClassInfo, formItem);
            SetFormSpecificData(formName, contact, formItem);
            formItem.Insert();
        }
コード例 #4
0
        private GeneralResultDTO SubmitContactUsFormInternal(string fullName, string companyName, string email, string phone, string message, List <HttpPostedFile> files)
        {
            var contactUsForm = BizFormInfoProvider.GetBizFormInfo(_ContactUsFormCodeName, SiteContext.CurrentSiteID);

            if (contactUsForm != null)
            {
                var    contactUsFormClass     = DataClassInfoProvider.GetDataClassInfo(contactUsForm.FormClassID);
                string contactUsFormClassName = contactUsFormClass.ClassName;

                BizFormItem newFormItem = BizFormItem.New(contactUsFormClassName);

                newFormItem.SetValue("FullName", fullName);
                newFormItem.SetValue("CompanyName", companyName);
                newFormItem.SetValue("Email", email);
                newFormItem.SetValue("Phone", phone);
                newFormItem.SetValue("Message", message);
                newFormItem.SetValue("Site", SiteContext.CurrentSite.DisplayName);
                newFormItem.SetValue("User", MembershipContext.AuthenticatedUser.UserName);
                newFormItem.SetValue("FormInserted", DateTime.Now);
                newFormItem.SetValue("FormUpdated", DateTime.Now);

                if (files.Count > 0)
                {
                    for (int i = 0; files.Count > i; i++)
                    {
                        string extension           = System.IO.Path.GetExtension(files[i].FileName);
                        string fileName            = new FormsHelper().GetNewGuidName(extension);
                        string formFilesFolderPath = FormHelper.GetBizFormFilesFolderPath(SiteContext.CurrentSiteName);
                        string fileNameString      = fileName + "/" + Path.GetFileName(files[i].FileName);
                        new FormsHelper().SaveFileToDisk(files[i], fileName, formFilesFolderPath);
                        newFormItem.SetValue(string.Format("File{0}", i + 1), (object)fileNameString);
                    }
                }
                newFormItem.Insert();

                new FormsHelper().SendFormEmail(newFormItem, files.Count);

                return(new GeneralResultDTO {
                    success = true
                });
            }
            else
            {
                return(new GeneralResultDTO {
                    success = false, errorMessage = ResHelper.GetString("Kadena.ContactForm.ContactFormRepositoryNotFound", LocalizationContext.CurrentCulture.CultureCode)
                });
            }
        }
コード例 #5
0
        public void InsertFormEntry(string formName, FormEntry entry)
        {
            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 'ContactUs' form
            DataClassInfo formClass = DataClassInfoProvider.GetDataClassInfo(formObject.FormClassID);
            string        className = formClass.ClassName;

            BizFormItem item = BizFormItem.New(className);

            foreach (var formValue in entry.FormValues)
            {
                item.SetValue(item.ColumnNames.Find(t => t.ToLower() == formValue.Key), formValue.Value);
            }

            item.Insert();
        }
コード例 #6
0
        private GeneralResultDTO SubmitNewKitRequestInternal(string name, string description, int[] productIDs, string[] productNames)
        {
            var newKitRequestForm = BizFormInfoProvider.GetBizFormInfo(_NewKitRequestFormCodeName, SiteContext.CurrentSiteID);

            if (newKitRequestForm != null)
            {
                var    newKitRequestFormClass     = DataClassInfoProvider.GetDataClassInfo(newKitRequestForm.FormClassID);
                string newKitRequestFormClassName = newKitRequestFormClass.ClassName;

                BizFormItem newFormItem = BizFormItem.New(newKitRequestFormClassName);

                newFormItem.SetValue("Name", name);
                newFormItem.SetValue("Description", description);
                newFormItem.SetValue("ProductNames", string.Join("|", productNames));
                newFormItem.SetValue("ProductNodeIDs", string.Join("|", productIDs));

                newFormItem.SetValue("Site", SiteContext.CurrentSite.DisplayName);
                newFormItem.SetValue("User", MembershipContext.AuthenticatedUser.UserName);

                newFormItem.SetValue("FormInserted", DateTime.Now);
                newFormItem.SetValue("FormUpdated", DateTime.Now);

                newFormItem.Insert();

                SendFormEmail(newFormItem);

                return(new GeneralResultDTO {
                    success = true
                });
            }
            else
            {
                return(new GeneralResultDTO {
                    success = false, errorMessage = ResHelper.GetString("Kadena.NewKitRequest.ContactFormRepositoryNotFound", LocalizationContext.CurrentCulture.CultureCode)
                });
            }
        }
コード例 #7
0
        private void CreateFormSubmission(TreeNode document, string formName, ContactInfo contact)
        {
            var form      = BizFormInfo.Provider.Get(formName, mSite.SiteID);
            var classInfo = DataClassInfoProvider.GetDataClassInfo(form.FormClassID);
            var formItem  = new BizFormItem(classInfo.ClassName);
            var url       = DocumentURLProvider.GetAbsoluteUrl(document);

            CopyDataFromContactToForm(contact, classInfo, formItem);
            SetFormSpecificData(formName, contact, formItem);
            formItem.Insert();

            var activity = new ActivityInfo
            {
                ActivityContactID    = contact.ContactID,
                ActivityItemID       = form.FormID,
                ActivityItemDetailID = formItem.ItemID,
                ActivitySiteID       = mSite.SiteID,
                ActivityTitle        = nameBuilder.CreateTitle(PredefinedActivityType.BIZFORM_SUBMIT, form.FormDisplayName),
                ActivityType         = PredefinedActivityType.BIZFORM_SUBMIT,
                ActivityURL          = url
            };

            ActivityInfo.Provider.Set(activity);
        }