Esempio n. 1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            var menu = DataManager.Menu.SelectByAccessProfileID(AccessProfile.ID).FirstOrDefault(o => o.ModuleID.HasValue && o.tbl_Module.Name == "Contacts");

            if (menu != null)
            {
                var tab = string.IsNullOrEmpty(menu.TabName) && menu.ParentID.HasValue ? DataManager.Menu.SelectByID(menu.ParentID.Value).TabName : menu.TabName;
                ContactsUrl = ResolveUrl(string.Format("~/{0}/{1}/List", tab, menu.tbl_Module.Name));
            }
            else
            {
                ContactsUrl = UrlsData.AP_Contacts("Monitoring");
            }

            var advertisingPlatforms = DataManager.StatisticData.VisitorSourceNewAnonymousAdvertisingPlatform.OrderByDescending(o => o.Value.DbValue).Take(3);
            var sb = new StringBuilder();

            foreach (var advertisingPlatform in advertisingPlatforms)
            {
                if (advertisingPlatform.Value.Value == 0)
                {
                    continue;
                }

                var advPlatform = DataManager.AdvertisingPlatform.SelectById(Guid.Parse(advertisingPlatform.Key.Split('_')[1]));
                sb.Append(string.Format("<li><a href=\"{0}?f={1}\">{2} {3}</a></li>", ContactsUrl, advPlatform.ID, advPlatform.Title, advertisingPlatform.Value.HtmlValue));
            }

            lrlVisitorSourceNewAnonymousAdvertisingPlatform.Text = sb.ToString();
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the AjaxRequest event of the radAjaxManager control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.AjaxRequestEventArgs"/> instance containing the event data.</param>
        protected void radAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "AddCompany")
            {
                if (Session["UpdatedContactId"] != null && Session["CompanyTitle"] != null)
                {
                    var company = new tbl_Company
                    {
                        ID        = Guid.NewGuid(),
                        CreatedAt = DateTime.Now,
                        SiteID    = CurrentUser.Instance.SiteID,
                        Name      = Session["CompanyTitle"].ToString(),
                        StatusID  = _dataManager.Status.SelectDefault(CurrentUser.Instance.SiteID).ID
                    };
                    _dataManager.Company.Add(company);

                    var contact = _dataManager.Contact.SelectById(CurrentUser.Instance.SiteID, Guid.Parse(Session["UpdatedContactId"].ToString()));
                    contact.CompanyID = company.ID;
                    _dataManager.Contact.Update(contact);

                    Session["CompanyTitle"]     = null;
                    Session["UpdatedContactId"] = null;

                    Response.Redirect(UrlsData.AP_Company(company.ID));
                }
            }

            if (e.Argument == "CancelAddCompany")
            {
                Session["CompanyTitle"]     = null;
                Session["UpdatedContactId"] = null;
                Response.Redirect(UrlsData.AP_Contacts());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the Click event of the btnUpdate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            var saveResult = ucContactEdit.Save();

            tagsContact.SaveTags(ucContactEdit.ContactId);

            if (saveResult)
            {
                Response.Redirect(UrlsData.AP_Contacts());
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteId = ((LeadForceBasePage)Page).SiteId;

            hlCancel.NavigateUrl = UrlsData.AP_Contacts();

            tagsContact.ObjectID = ucContactEdit.ContactId;

            if (!Page.IsPostBack)
            {
                ucContactEdit.SiteId = SiteId;
                ucContactEdit.BindData();
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var menu = DataManager.Menu.SelectByAccessProfileID(AccessProfile.ID).FirstOrDefault(o => o.ModuleID.HasValue && o.tbl_Module.Name == "Contacts");

            if (menu != null)
            {
                var tab = string.IsNullOrEmpty(menu.TabName) && menu.ParentID.HasValue ? DataManager.Menu.SelectByID(menu.ParentID.Value).TabName : menu.TabName;
                Url = ResolveUrl(string.Format("~/{0}/{1}/List", tab, menu.tbl_Module.Name));
            }
            else
            {
                Url = UrlsData.AP_Contacts("Monitoring");
            }

            if (Request.QueryString["c"] != null)
            {
                Category = Request.QueryString["c"].ToLower();
            }
            else if (IsLeftColumn && Request.QueryString["f"] == null)
            {
                Category = "known";
            }

            int?profileActiveContactCount = null;

            if (CurrentUser.Instance.SiteAccessProfileID.HasValue)
            {
                profileActiveContactCount = DataManager.AccessProfile.SelectById((Guid)CurrentUser.Instance.SiteAccessProfileID).ActiveContactsCount;
            }

            if (profileActiveContactCount.HasValue && profileActiveContactCount > 0)
            {
                if (DataManager.StatisticData.ContactCategoryActiveCount.DbValue > profileActiveContactCount)
                {
                    lrlActiveCount.Text = string.Format("<b><span style=\"color:red\">{0}</span> из {1}</b>", DataManager.StatisticData.ContactCategoryActiveCount.DbValue.ToString("F0"), profileActiveContactCount);
                }
                else
                {
                    lrlActiveCount.Text = string.Format("<b>{0} из {1}</b>", DataManager.StatisticData.ContactCategoryActiveCount.DbValue.ToString("F0"), profileActiveContactCount);
                }
            }
            else
            {
                lrlActiveCount.Text = string.Format("<b>{0}</b>", DataManager.StatisticData.ContactCategoryActiveCount.DbValue.ToString("F0"));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteId = ((LeadForceBasePage)Page).SiteId;

            ((Site)Page.Master).HideInaccessibleTabs(ref RadTabStrip1, ref RadMultiPage1);

            string contactId = Page.RouteData.Values["id"] as string;

            var category = Request.QueryString["c"];

            if (!string.IsNullOrEmpty(category))
            {
                hlCancel.NavigateUrl = UrlsData.AP_Contacts() + "?c=" + category;
            }
            else
            {
                hlCancel.NavigateUrl = UrlsData.AP_Contacts();
            }

            if (!Guid.TryParse(contactId, out _contactID))
            {
                Response.Redirect(UrlsData.AP_Contacts());
            }


            if (!Page.IsPostBack)
            {
                ucContactEdit.ContactId = _contactID;
                ucContactEdit.SiteId    = SiteId;
                ucContactEdit.Section   = Section;
                ucContactEdit.BindData();

                tagsContact.ObjectID = ucContactEdit.ContactId;
            }

            access = Access.Check(ucContactEdit.OwnerId, ucContactEdit.CompanyId);
            if (!access.Write)
            {
                lbtnSave.Visible = false;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            siteID = ((LeadForceBasePage)Page).SiteId;

            var contactId = Page.RouteData.Values["id"] as string;

            if (contactId != "null" && !Guid.TryParse(contactId, out _contactID))
            {
                Response.Redirect(UrlsData.AP_Contacts());
            }

            gridSiteAction.SiteID = siteID;
            gridSiteAction.Where  = new List <GridWhere>();

            var dataManager = new DataManager();
            var site        = dataManager.Sites.SelectById(siteID);

            if (site != null)
            {
                if (!site.ShowHiddenMessages)
                {
                    gridSiteAction.Where.Add(new GridWhere {
                        Column = "IsHidden", Value = site.ShowHiddenMessages.ToString()
                    });
                }
            }

            if (_contactID != Guid.Empty)
            {
                //gridSiteAction.Where.Add(new GridWhere { Column = "ContactID", Value = _contactID.ToString() });
                gridSiteAction.Where.Add(new GridWhere {
                    CustomQuery = string.Format("(tbl_SiteAction.ContactID = '{0}' OR tbl_SiteAction.SenderID = '{0}')", _contactID)
                });
                gridSiteAction.Columns[2].Visible = false;
            }

            gridSiteAction.Actions.Add(new GridAction {
                Text = "Карточка сообщения", NavigateUrl = string.Format("~/{0}/SiteAction/Message/{{0}}", ((LeadForceBasePage)Page).CurrentTab), ImageUrl = "~/App_Themes/Default/images/icoView.png"
            });
        }
Esempio n. 8
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = "Сообщения - LeadForce";

            string contactId = Page.RouteData.Values["id"] as string;

            if (contactId != "null" && !Guid.TryParse(contactId, out _contactID))
            {
                Response.Redirect(UrlsData.AP_Contacts());
            }

            if (!Page.IsPostBack)
            {
                if (_contactID != Guid.Empty)
                {
                    var contact = DataManager.Contact.SelectById(SiteId, _contactID);
                    lUserFullName.Text         = contact.UserFullName;
                    lScore.Text                = contact.Score.ToString();
                    lBehaviorScore.Text        = contact.BehaviorScore.ToString();
                    lCharacteristicsScore.Text = contact.CharacteristicsScore.ToString();
                    pUserInfo.Visible          = true;
                }
            }
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            rttmSessionInfo.TargetControls.Clear();
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(gridContactActivity, rttmSessionInfo);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(ucPeriodFilter, gridContactActivity);

            siteID = ((LeadForceBasePage)Page).SiteId;

            var contactId = Page.RouteData.Values["id"] as string;

            if (contactId != "null" && !Guid.TryParse(contactId, out _contactID))
            {
                Response.Redirect(UrlsData.AP_Contacts());
            }

            gridContactActivity.SiteID = siteID;

            ucPeriodFilter.FilterChanged += ucPeriodFilter_FilterChanged;

            /*if (_contactID != Guid.Empty)
             *  ucPeriodFilter.AllPeriod = true;*/

            BindData(ucPeriodFilter.StartDate, ucPeriodFilter.EndDate);
        }
Esempio n. 10
0
        /// <summary>
        /// Handles the OnClick event of the lbtnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void lbtnSave_OnClick(object sender, EventArgs e)
        {
            if (!access.Write)
            {
                return;
            }

            var saveResult = ucContactEdit.Save();

            tagsContact.SaveTags(ucContactEdit.ContactId);

            if (saveResult)
            {
                var category = Request.QueryString["c"];
                if (!string.IsNullOrEmpty(category))
                {
                    Response.Redirect(UrlsData.AP_Contacts() + "?c=" + category);
                }
                else
                {
                    Response.Redirect(UrlsData.AP_Contacts());
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteId = ((LeadForceBasePage)Page).SiteId;

            ((Site)Page.Master).HideInaccessibleTabs(ref RadTabStrip1, ref RadMultiPage1);

            string contactId = Page.RouteData.Values["id"] as string;

            var category = Request.QueryString["c"];

            if (!string.IsNullOrEmpty(category))
            {
                hlCancel.NavigateUrl = UrlsData.AP_Contacts() + "?c=" + category;
            }
            else
            {
                hlCancel.NavigateUrl = UrlsData.AP_Contacts();
            }


            if (!Guid.TryParse(contactId, out _contactID))
            {
                Response.Redirect(UrlsData.AP_Contacts());
            }
            //@@@
            ucTaskList.ContactId = _contactID;
            ucTaskList.SiteId    = SiteId;

            if (!Page.IsPostBack)
            {
                ucContactEdit.ContactId = _contactID;
                ucContactEdit.SiteId    = SiteId;
                ucContactEdit.Section   = Section;
                ucContactEdit.BindData();

                BindSiteActivityRules();

                tagsContact.ObjectID = ucContactEdit.ContactId;

                dcbWorkflowTemplate.SiteID = SiteId;
                dcbWorkflowTemplate.Filters.Add(new DictionaryOnDemandComboBox.DictionaryFilterColumn
                {
                    Name   = "ManualStart",
                    DbType = DbType.Boolean,
                    Value  = "TRUE"
                });
                dcbWorkflowTemplate.Filters.Add(new DictionaryOnDemandComboBox.DictionaryFilterColumn
                {
                    Name   = "Status",
                    DbType = DbType.Int32,
                    Value  = "1"
                });
                dcbWorkflowTemplate.BindData();
            }

            aWorkflow.Attributes.Add("onclick", this.ClientID + "_ShowWorkflowTemplateRadWindow();");
            aWorkflow.Visible = ((LeadForceBasePage)Page).IsDefaultEdition;

            access = Access.Check(ucContactEdit.OwnerId, ucContactEdit.CompanyId);
            if (!access.Write)
            {
                BtnFillForm.Visible = false;
                //hlSendMessage.Visible = false;
                lbtnSave.Visible = false;
            }

            gridContactColumnValues.Where = new List <GridWhere>();
            gridContactColumnValues.Where.Add(new GridWhere {
                Column = "ContactID", Value = _contactID.ToString()
            });

            //@@@
            gridContactSessions.Actions.Add(new GridAction {
                Text = "Карточка сессии", NavigateUrl = string.Format("~/{0}/Contacts/Session/View/{{0}}", Page.RouteData.Values["tab"] as string), ImageUrl = "~/App_Themes/Default/images/icoView.png"
            });
            gridContactSessions.SiteID = SiteId;
            gridContactSessions.Where  = new List <GridWhere>();
            gridContactSessions.Where.Add(new GridWhere {
                Column = "ContactID", Value = _contactID.ToString()
            });
        }