private Feed ToFeed(Contact contact)
        {
            var item = string.Empty;

            if (contact is Person)
            {
                item = "person";
            }
            else if (contact is Company)
            {
                item = "company";
            }

            var itemUrl = "/products/crm/?id=" + contact.ID + "#profile";

            return(new Feed(contact.CreateBy, contact.CreateOn)
            {
                Item = item,
                ItemId = contact.ID.ToString(CultureInfo.InvariantCulture),
                ItemUrl = CommonLinkUtility.ToAbsolute(itemUrl),
                Product = Product,
                Module = Name,
                Title = contact.GetTitle(),
                Description = Helper.GetHtmlDescription(HttpUtility.HtmlEncode(contact.About)),
                Keywords = string.Format("{0}", contact.GetTitle()),
                HasPreview = false,
                CanComment = false,
                GroupId = GetGroupId(item, contact.CreateBy)
            });
        }
Exemplo n.º 2
0
        public static ContactBaseWrapper ToContactBaseWrapperQuick(Contact contact)
        {
            var result = new ContactBaseWrapper(contact.ID);

            result.DisplayName = contact.GetTitle();
            result.IsPrivate   = CRMSecurity.IsPrivate(contact);
            result.IsShared    = contact.ShareType == ShareType.ReadWrite || contact.ShareType == ShareType.Read;
            result.ShareType   = contact.ShareType;

            if (result.IsPrivate)
            {
                result.AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                                    .Select(item => EmployeeWraper.Get(item.Key));
            }
            result.Currency = !String.IsNullOrEmpty(contact.Currency) ?
                              new CurrencyInfoWrapper(CurrencyProvider.Get(contact.Currency)) :
                              null;

            result.SmallFotoUrl  = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=1", PathProvider.BaseAbsolutePath, contact.ID, contact is Company);
            result.MediumFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=2", PathProvider.BaseAbsolutePath, contact.ID, contact is Company);
            result.IsCompany     = contact is Company;
            result.CanEdit       = CRMSecurity.CanEdit(contact);
            //result.CanDelete = CRMSecurity.CanDelete(contact);

            return(result);
        }
Exemplo n.º 3
0
 public static void Contact(Contact contact, String actionText, int actionType, int businessValue)
 {
     var type = (int)EntityType.Contact;
     if(contact is Company)
         type = (int)EntityType.Company;
     
     UserActivityPublisher.Publish<TimeLinePublisher>(new TimeLineUserActivity(actionText, actionType, businessValue)
     {
         ContentID = contact.ID.ToString(),
         Title = contact.GetTitle(),
         SecurityId = String.Format(SecurityDataPattern, type, contact.SecurityId),
         URL = String.Concat(VirtualPathUtility.ToAbsolute(PathProvider.BaseVirtualPath + "default.aspx"), String.Format("?id={0}", contact.ID))
     });
 }
Exemplo n.º 4
0
        public ContactBaseWrapper(Contact contact)
            : base(contact.ID)
        {
            DisplayName = contact.GetTitle();
            IsPrivate   = CRMSecurity.IsPrivate(contact);

            if (IsPrivate)
            {
                AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                             .Select(item => EmployeeWraper.Get(item.Key));
            }

            SmallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(contact.ID, contact is Company);
            IsCompany    = contact is Company;
            CanEdit      = CRMSecurity.CanEdit(contact);
        }
Exemplo n.º 5
0
        public ContactBaseWrapper(Contact contact)
            : base(contact.ID)
        {
            DisplayName = contact.GetTitle();
            IsPrivate   = CRMSecurity.IsPrivate(contact);
            IsShared    = contact.IsShared;

            if (IsPrivate)
            {
                AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                             .Select(item => EmployeeWraper.Get(item.Key));
            }


            SmallFotoUrl  = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=1", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            MediumFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=2", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            IsCompany     = contact is Company;
            CanEdit       = CRMSecurity.CanEdit(contact);
        }
        public ContactBaseWrapper(Contact contact)
            : base(contact.ID)
        {
            DisplayName = contact.GetTitle();
            IsPrivate   = CRMSecurity.IsPrivate(contact);
            IsShared    = contact.ShareType == ShareType.ReadWrite || contact.ShareType == ShareType.Read;
            ShareType   = contact.ShareType;

            if (IsPrivate)
            {
                AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                             .Select(item => EmployeeWraper.Get(item.Key));
            }
            Currency = !String.IsNullOrEmpty(contact.Currency) ?
                       new CurrencyInfoWrapper(CurrencyProvider.Get(contact.Currency)) :
                       null;

            SmallFotoUrl  = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=1", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            MediumFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=2", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            IsCompany     = contact is Company;
            CanEdit       = CRMSecurity.CanEdit(contact);
            CanDelete     = CRMSecurity.CanDelete(contact);
        }
Exemplo n.º 7
0
        public ContactBaseWrapper(Contact contact)
            : base(contact.ID)
        {
            DisplayName = contact.GetTitle();
            IsPrivate = CRMSecurity.IsPrivate(contact);
            IsShared = contact.ShareType == ShareType.ReadWrite || contact.ShareType == ShareType.Read;
            ShareType = contact.ShareType;

            if (IsPrivate)
            {
                AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                                        .Select(item => EmployeeWraper.Get(item.Key));
            }
            Currency = !String.IsNullOrEmpty(contact.Currency) ?
                new CurrencyInfoWrapper(CurrencyProvider.Get(contact.Currency)) :
                null;

            SmallFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=1", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            MediumFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=2", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            IsCompany = contact is Company;
            CanEdit = CRMSecurity.CanEdit(contact);
            CanDelete = CRMSecurity.CanDelete(contact);
        }
Exemplo n.º 8
0
        private Feed ToFeed(Contact contact)
        {
            var item = string.Empty;
            if (contact is Person)
            {
                item = "person";
            }
            else if (contact is Company)
            {
                item = "company";
            }

            var itemUrl = "/products/crm/?id=" + contact.ID + "#profile";
            return new Feed(contact.CreateBy, contact.CreateOn)
                {
                    Item = item,
                    ItemId = contact.ID.ToString(CultureInfo.InvariantCulture),
                    ItemUrl = CommonLinkUtility.ToAbsolute(itemUrl),
                    Product = Product,
                    Module = Name,
                    Title = contact.GetTitle(),
                    Description = Helper.GetHtmlDescription(HttpUtility.HtmlEncode(contact.About)),
                    Keywords = string.Format("{0}", contact.GetTitle()),
                    HasPreview = false,
                    CanComment = false,
                    GroupId = string.Format("{0}_{1}", item, contact.ID)
                };
        }
Exemplo n.º 9
0
        public ContactBaseWrapper(Contact contact)
            : base(contact.ID)
        {
            DisplayName = contact.GetTitle();
            IsPrivate = CRMSecurity.IsPrivate(contact);
            IsShared = contact.IsShared;

            if (IsPrivate)
                AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                             .Select(item => EmployeeWraper.Get(item.Key));


            SmallFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=1", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            MediumFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=2", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            IsCompany = contact is Company;
            CanEdit = CRMSecurity.CanEdit(contact);
        }
Exemplo n.º 10
0
        protected void ExecContactActionView(Contact targetContact)
        {
            var contactActionViewControl = (ContactActionView)LoadControl(ContactActionView.Location);
            contactActionViewControl.TargetContact = targetContact;

            if (targetContact == null)
            {

                if (String.Compare(UrlParameters.Type, "people", true) != 0)
                {
                    contactActionViewControl.TypeAddedContact = "company";
                    contactActionViewControl.SaveContactButtonText = CRMContactResource.AddThisCompanyButton;
                    contactActionViewControl.SaveAndCreateContactButtonText = CRMContactResource.AddThisAndCreateCompanyButton;

                    contactActionViewControl.AjaxProgressText = CRMContactResource.AddingCompany;
                    Master.CurrentPageCaption = CRMContactResource.BreadCrumbsAddCompany;
                    Title = HeaderStringHelper.GetPageTitle(CRMContactResource.BreadCrumbsAddCompany);
                }
                else
                {
                    contactActionViewControl.TypeAddedContact = "people";
                    contactActionViewControl.SaveContactButtonText = CRMContactResource.AddThisPersonButton;
                    contactActionViewControl.SaveAndCreateContactButtonText = CRMContactResource.AddThisAndCreatePeopleButton;

                    contactActionViewControl.AjaxProgressText = CRMContactResource.AddingPersonProgress;
                    Master.CurrentPageCaption = CRMContactResource.BreadCrumbsAddPerson;
                    Title = HeaderStringHelper.GetPageTitle(CRMContactResource.BreadCrumbsAddPerson);
                }
            }
            else
            {
                var contactTitle = targetContact.GetTitle();

                contactActionViewControl.SaveAndCreateContactButtonText = String.Compare(UrlParameters.Type, "people", true) != 0 ? CRMContactResource.SaveThisAndCreateCompanyButton : CRMContactResource.SaveThisAndCreatePeopleButton;

                contactActionViewControl.SaveContactButtonText = CRMContactResource.SaveChanges;
                contactActionViewControl.AjaxProgressText = CRMContactResource.SavingChangesProgress;

                if (targetContact is Company)
                {
                    contactActionViewControl.TypeAddedContact = "company";
                    var headerTitle = String.Format(CRMContactResource.EditCompany, contactTitle);
                    Master.CurrentPageCaption = headerTitle;
                    Title = HeaderStringHelper.GetPageTitle(headerTitle);
                }
                else
                {
                    contactActionViewControl.TypeAddedContact = "people";
                    var headerTitle = String.Format(CRMContactResource.EditPerson, contactTitle);
                    Master.CurrentPageCaption = headerTitle;
                    Title = HeaderStringHelper.GetPageTitle(headerTitle);
                }
            }

            CommonContainerHolder.Controls.Add(contactActionViewControl);
        }
Exemplo n.º 11
0
        protected void ExecContactDetailsView(Contact targetContact)
        {
            var contactDetailsViewControl = (ContactDetailsView)LoadControl(ContactDetailsView.Location);
            contactDetailsViewControl.TargetContact = targetContact;

            CommonContainerHolder.Controls.Add(contactDetailsViewControl);

            var title = targetContact.GetTitle().HtmlEncode();

            Master.CurrentPageCaption = title;

            Master.CommonContainerHeader = Global.RenderItemHeaderWithMenu(title, targetContact is Company ? EntityType.Company : EntityType.Person, false);

            ((BasicTemplate)Master).ShowChangeButton = false;
            Title = HeaderStringHelper.GetPageTitle(title);
        }
Exemplo n.º 12
0
        protected void ExecContactActionView(Contact targetContact)
        {
            Master.DisabledSidePanel = true;

            var contactActionViewControl = (ContactActionView) LoadControl(ContactActionView.Location);

            contactActionViewControl.TargetContact = targetContact;

            if (targetContact == null)
            {

                if (String.Compare(UrlParameters.Type, "people", true) != 0)
                {
                    contactActionViewControl.TypeAddedContact = "company";
                    contactActionViewControl.SaveContactButtonText = CRMContactResource.AddThisCompanyButton;
                    contactActionViewControl.SaveAndCreateContactButtonText = CRMContactResource.AddThisAndCreateCompanyButton;

                    contactActionViewControl.AjaxProgressText = CRMContactResource.AddingCompany;
                    Master.BreadCrumbs.Add(new BreadCrumb
                                               {
                                                   Caption = CRMContactResource.BreadCrumbsAddCompany
                                               });

                    Title = HeaderStringHelper.GetPageTitle(CRMContactResource.BreadCrumbsAddCompany, Master.BreadCrumbs);
                }
                else
                {
                    contactActionViewControl.TypeAddedContact = "people";
                    contactActionViewControl.SaveContactButtonText = CRMContactResource.AddThisPersonButton;
                    contactActionViewControl.SaveAndCreateContactButtonText = CRMContactResource.AddThisAndCreatePeopleButton;

                    contactActionViewControl.AjaxProgressText = CRMContactResource.AddingPersonProgress;
                    Master.BreadCrumbs.Add(new BreadCrumb
                                               {
                                                   Caption = CRMContactResource.BreadCrumbsAddPerson
                                               });
                    Title = HeaderStringHelper.GetPageTitle(CRMContactResource.BreadCrumbsAddPerson, Master.BreadCrumbs);
                }
            }
            else
            {
                var contactTitle = targetContact.GetTitle();

                contactActionViewControl.SaveAndCreateContactButtonText = String.Compare(UrlParameters.Type, "people", true) != 0 ? CRMContactResource.SaveThisAndCreateCompanyButton : CRMContactResource.SaveThisAndCreatePeopleButton;

                contactActionViewControl.SaveContactButtonText = CRMContactResource.SaveChanges;
                contactActionViewControl.AjaxProgressText = CRMContactResource.SavingChangesProgress;

                if (targetContact is Company)
                {
                    contactActionViewControl.TypeAddedContact = "company";
                    Title = HeaderStringHelper.GetPageTitle(String.Format(CRMContactResource.EditCompany, contactTitle.HtmlEncode()), Master.BreadCrumbs);
                    Master.BreadCrumbs.Add(new BreadCrumb
                    {
                        Caption = String.Format(CRMContactResource.EditCompany, contactTitle)
                    });
                }
                else
                {
                    contactActionViewControl.TypeAddedContact = "people";
                    Title = HeaderStringHelper.GetPageTitle(String.Format(CRMContactResource.EditPerson, contactTitle.HtmlEncode()), Master.BreadCrumbs);
                    Master.BreadCrumbs.Add(new BreadCrumb
                    {
                        Caption = String.Format(CRMContactResource.EditPerson, contactTitle)
                    });
                }
            }

            CommonContainerHolder.Controls.Add(contactActionViewControl);
            SideNavigatorPanel.Visible = false;

            /*if (targetContact != null)
                SideActionsPanel.Controls.Add(new NavigationItem
                {
                    Name = DealResource.DeleteDeal,
                    URL = "settings.aspx?type=custom_field"
                });
            */
        }
Exemplo n.º 13
0
        protected void ExecContactDetailsView(Contact targetContact)
        {

            Master.DisabledSidePanel = true;

            var contactDetailsViewControl = (ContactDetailsView) LoadControl(ContactDetailsView.Location);

            contactDetailsViewControl.TargetContact = targetContact;

            var contactTitle = targetContact.GetTitle();

            Master.BreadCrumbs.Add(new BreadCrumb
                                       {
                                           Caption = CRMContactResource.AllContacts,
                                           NavigationUrl = "default.aspx"
                                       });

            Master.BreadCrumbs.Add(new BreadCrumb
                                       {
                                           Caption = contactTitle
                                       });

            var title = contactTitle.HtmlEncode();

            if (CRMSecurity.IsPrivate(targetContact))
            {
                if (targetContact is Company)
                    Master.CommonContainerHeader = Global.RenderPrivateItemHeader(title, EntityType.Company, targetContact.ID);
                else
                    Master.CommonContainerHeader = Global.RenderPrivateItemHeader(title, EntityType.Contact, targetContact.ID);
            }

            CommonContainerHolder.Controls.Add(contactDetailsViewControl);

            Title = HeaderStringHelper.GetPageTitle(contactTitle.HtmlEncode(), Master.BreadCrumbs);
        }
Exemplo n.º 14
0
        public ContactBaseWrapper(Contact contact)
            : base(contact.ID)
        {
            DisplayName = contact.GetTitle();
            IsPrivate = CRMSecurity.IsPrivate(contact);

            if (IsPrivate)
                AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                             .Select(item => EmployeeWraper.Get(item.Key));

            SmallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(contact.ID, contact is Company);
            IsCompany = contact is Company;
            CanEdit = CRMSecurity.CanEdit(contact);
        }
        public static void DataContactDetailsViewForTaskAction(BasePage page, Contact TargetContact)
        {
            var isPrivate = !CRMSecurity.CanAccessTo(TargetContact);
            var contactAccessList = new List<Guid>();
            if (isPrivate)
            {
                contactAccessList = CRMSecurity.GetAccessSubjectTo(TargetContact).Keys.ToList<Guid>();
            }

            page.RegisterInlineScript(String.Format(" var contactForInitTaskActionPanel = {0}; ",
                                                    JsonConvert.SerializeObject(new
                                                    {
                                                        id = TargetContact.ID,
                                                        displayName = TargetContact.GetTitle().HtmlEncode().ReplaceSingleQuote(),
                                                        smallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(TargetContact.ID, TargetContact is Company),
                                                        isPrivate = isPrivate,
                                                        accessList = contactAccessList.ConvertAll(n => new { id = n })
                                                    })), onReady: false);
        }