示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(WebToLeadFormView));

            _webFormKey = Global.TenantSettings.WebFormKey.ToString();

            RegisterContactFields();
            RegisterScript();


            RegisterClientScriptHelper.DataUserSelectorListView(Page, "_ContactManager", null, null, true);

            RegisterClientScriptHelper.DataUserSelectorListView(
                Page,
                "_Notify",
                new Dictionary <Guid, string>
            {
                {
                    SecurityContext.CurrentAccount.ID,
                    SecurityContext.CurrentAccount.Name.HtmlEncode()                             //CustomNamingPeople.Substitute<CRMCommonResource>("CurrentUser").HtmlEncode()
                }
            },
                null,
                true);
        }
示例#2
0
        private void RegisterScript()
        {
            Page.RegisterClientScript(new Masters.ClientScripts.ReportsViewData());

            RegisterClientScriptHelper.DataReportsView(Page);

            Page.RegisterInlineScript(string.Format("ASC.CRM.Reports.init({0}, {1});",
                                                    (int)CurrentReportType,
                                                    ViewFiles.ToString().ToLowerInvariant()));

            RegisterClientScriptHelper.DataUserSelectorListView(Page, "_Reports", null);
        }
        protected void InitForContacts()
        {
            StartImportLabel = CRMContactResource.StartImport;

            ImportFromCSVStepOneHeaderLabel = CRMContactResource.ImportFromCSVStepOneHeader;
            ImportFromCSVStepTwoHeaderLabel = CRMContactResource.ImportFromCSVStepTwoHeader;

            ImportFromCSVStepOneDescriptionLabel = CRMContactResource.ImportFromCSVStepOneDescription;
            ImportFromCSVStepTwoDescriptionLabel = CRMContactResource.ImportFromCSVStepTwoDescription;

            ImportStartingPanelHeaderLabel      = CRMContactResource.ImportStartingPanelHeader;
            ImportStartingPanelDescriptionLabel = CRMContactResource.ImportStartingPanelDescription;
            ImportStartingPanelButtonLabel      = CRMContactResource.ImportStartingPanelButton;

            ImportImgSrc = WebImageSupplier.GetAbsoluteWebPath("import_contacts.png", ProductEntryPoint.ID);

            Page.RegisterClientScript(new Masters.ClientScripts.ImportFromCSVViewDataContacts());
            RegisterClientScriptHelper.DataUserSelectorListView(Page, "_ImportContactsManager", null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _webFormKey = Global.TenantSettings.WebFormKey.ToString();

            Page.RegisterClientScript(typeof(Masters.ClientScripts.WebToLeadFormViewData));
            RegisterScript();


            RegisterClientScriptHelper.DataUserSelectorListView(Page, "_ContactManager", null);

            RegisterClientScriptHelper.DataUserSelectorListView(
                Page, "_Notify",
                new Dictionary <Guid, string>
            {
                {
                    SecurityContext.CurrentAccount.ID,
                    SecurityContext.CurrentAccount.Name.HtmlEncode()
                }
            });
        }
        protected void InitContactManagerSelector()
        {
            Dictionary <Guid, String> SelectedUsers = null;

            if (TargetContact != null)
            {
                var AccessSubjectTo = CRMSecurity.GetAccessSubjectTo(TargetContact, EmployeeStatus.Active).ToList();
                SelectedUsers = new Dictionary <Guid, String>();
                if (AccessSubjectTo.Count != 0)
                {
                    foreach (var item in AccessSubjectTo)
                    {
                        SelectedUsers.Add(item.Key, item.Value);
                    }
                }
            }
            else
            {
                SelectedUsers = new Dictionary <Guid, String>();
                SelectedUsers.Add(SecurityContext.CurrentAccount.ID, SecurityContext.CurrentAccount.Name.HtmlEncode());
            }
            RegisterClientScriptHelper.DataUserSelectorListView(Page, "_ContactManager", SelectedUsers);
        }
        protected void InitForContacts()
        {
            StartImportLabel = CRMContactResource.StartImport;

            ImportFromCSVStepOneHeaderLabel = CRMContactResource.ImportFromCSVStepOneHeader;
            ImportFromCSVStepTwoHeaderLabel = CRMContactResource.ImportFromCSVStepTwoHeader;

            ImportFromCSVStepOneDescriptionLabel = CRMContactResource.ImportFromCSVStepOneDescription;
            ImportFromCSVStepTwoDescriptionLabel = CRMContactResource.ImportFromCSVStepTwoDescription;


            ImportStartingPanelHeaderLabel      = CRMContactResource.ImportStartingPanelHeader;
            ImportStartingPanelDescriptionLabel = CRMContactResource.ImportStartingPanelDescription;
            ImportStartingPanelButtonLabel      = CRMContactResource.ImportStartingPanelButton;

            ImportImgSrc = WebImageSupplier.GetAbsoluteWebPath("import_contacts.png", ProductEntryPoint.ID);

            var columnSelectorData = new[]
            {
                new
                {
                    name     = String.Empty,
                    title    = CRMContactResource.NoMatchSelect,
                    isHeader = false
                },
                new
                {
                    name     = "-1",
                    title    = CRMContactResource.DoNotImportThisField,
                    isHeader = false
                },
                new
                {
                    name     = String.Empty,
                    title    = CRMContactResource.GeneralInformation,
                    isHeader = true
                },
                new
                {
                    name     = "firstName",
                    title    = CRMContactResource.FirstName,
                    isHeader = false
                },
                new
                {
                    name     = "lastName",
                    title    = CRMContactResource.LastName,
                    isHeader = false
                },
                new
                {
                    name     = "title",
                    title    = CRMContactResource.JobTitle,
                    isHeader = false
                },
                new
                {
                    name     = "companyName",
                    title    = CRMContactResource.CompanyName,
                    isHeader = false
                },
                new
                {
                    name     = "contactStage",
                    title    = CRMContactResource.ContactStage,
                    isHeader = false
                },
                new
                {
                    name     = "contactType",
                    title    = CRMContactResource.ContactType,
                    isHeader = false
                },
                new
                {
                    name     = "notes",
                    title    = CRMContactResource.About,
                    isHeader = false
                }
            }.ToList();

            foreach (ContactInfoType infoTypeEnum in Enum.GetValues(typeof(ContactInfoType)))
            {
                foreach (Enum categoryEnum in Enum.GetValues(ContactInfo.GetCategory(infoTypeEnum)))
                {
                    var localName  = String.Format("contactInfo_{0}_{1}", infoTypeEnum, Convert.ToInt32(categoryEnum));
                    var localTitle = String.Format("{1} ({0})", categoryEnum.ToLocalizedString().ToLower(), infoTypeEnum.ToLocalizedString());

                    if (infoTypeEnum == ContactInfoType.Address)
                    {
                        foreach (AddressPart addressPartEnum in Enum.GetValues(typeof(AddressPart)))
                        {
                            columnSelectorData.Add(new
                            {
                                name     = String.Format(localName + "_{0}", addressPartEnum),
                                title    = String.Format(localTitle + " {0}", addressPartEnum.ToLocalizedString().ToLower()),
                                isHeader = false
                            });
                        }
                    }
                    else
                    {
                        columnSelectorData.Add(new
                        {
                            name     = localName,
                            title    = localTitle,
                            isHeader = false
                        });
                    }
                }
            }

            var fieldsDescription = Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Company);

            Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Person).ForEach(item =>
            {
                var alreadyContains = fieldsDescription.Any(field => field.ID == item.ID);

                if (!alreadyContains)
                {
                    fieldsDescription.Add(item);
                }
            });

            columnSelectorData.AddRange(fieldsDescription.FindAll(customField => customField.FieldType == CustomFieldType.TextField || customField.FieldType == CustomFieldType.TextArea || customField.FieldType == CustomFieldType.Heading)
                                        .ConvertAll(customField => new
            {
                name     = "customField_" + customField.ID,
                title    = customField.Label.HtmlEncode(),
                isHeader = customField.FieldType == CustomFieldType.Heading
            }));

            columnSelectorData.AddRange(
                new[]
            {
                new
                {
                    name     = String.Empty,
                    title    = CRMContactResource.ContactTags,
                    isHeader = true
                },
                new
                {
                    name     = "tag",
                    title    = CRMContactResource.ContactTagList,
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 1),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 2),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 3),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 4),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 5),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 6),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 7),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 8),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 9),
                    isHeader = false
                },
                new
                {
                    name     = "tag",
                    title    = String.Format("{0} {1}", CRMContactResource.ContactTag, 10),
                    isHeader = false
                },
            }.ToList()
                );

            Page.RegisterInlineScript(String.Format(" var columnSelectorData = {0}; ", JavaScriptSerializer.Serialize(columnSelectorData)), onReady: false);

            RegisterClientScriptHelper.DataUserSelectorListView(Page, "_ImportContactsManager", null, null, true);
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterClientScriptHelper.DataUserSelectorListView(Page, "", SelectedUsers);

            RegisterScript();
        }