Exemplo n.º 1
0
        /// <summary>
        /// Handles the OnItemDataBound event of the gridRequirementHistory control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gridShipmentHistory_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                var lrlUserFullName   = (Literal)item.FindControl("lrlUserFullName");
                var lrlShipmentStatus = (Literal)item.FindControl("lrlShipmentStatus");

                if (!string.IsNullOrEmpty(data["tbl_ShipmentHistory_ShipmentStatusID"].ToString()))
                {
                    lrlShipmentStatus.Text =
                        EnumHelper.GetEnumDescription(
                            (ShipmentStatus)int.Parse(data["tbl_ShipmentHistory_ShipmentStatusID"].ToString()));
                }

                if (!string.IsNullOrEmpty(data["tbl_Contact_UserFullName"].ToString()))
                {
                    lrlUserFullName.Text = string.Format("<a href=\"{0}\">{1}</a>",
                                                         UrlsData.AP_Contact(
                                                             Guid.Parse(data["tbl_Contact_ID"].ToString())),
                                                         data["tbl_Contact_UserFullName"]);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the OnItemDataBound event of the gridContacts control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gridContacts_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                ((HyperLink)item.FindControl("hlEdit")).NavigateUrl = UrlsData.AP_Contact(Guid.Parse(data["ID"].ToString()));

                ((Literal)item.FindControl("litPriority")).Text = data["tbl_Priorities_Title"].ToString();
                if (!string.IsNullOrEmpty(data["tbl_Priorities_Image"].ToString()))
                {
                    ((Image)item.FindControl("imgPriority")).ImageUrl      = BusinessLogicLayer.Configuration.Settings.DictionaryLogoPath(SiteId, "tbl_Priorities") + data["tbl_Priorities_Image"];
                    ((Image)item.FindControl("imgPriority")).AlternateText = ((Image)item.FindControl("imgPriority")).ToolTip = data["tbl_Priorities_Title"].ToString();
                    ((Image)item.FindControl("imgPriority")).Visible       = true;
                }

                ((Literal)item.FindControl("litReadyToSell")).Text = data["tbl_ReadyToSell_Title"].ToString();
                if (!string.IsNullOrEmpty(data["tbl_ReadyToSell_Image"].ToString()))
                {
                    ((Image)item.FindControl("imgReadyToSell")).ImageUrl      = BusinessLogicLayer.Configuration.Settings.DictionaryLogoPath(SiteId, "tbl_ReadyToSell") + data["tbl_ReadyToSell_Image"];
                    ((Image)item.FindControl("imgReadyToSell")).AlternateText = ((Image)item.FindControl("imgReadyToSell")).ToolTip = data["tbl_ReadyToSell_Title"].ToString();
                    ((Image)item.FindControl("imgReadyToSell")).Visible       = true;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the OnItemDataBound event of the gridContacts control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gridContacts_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                ((HyperLink)item.FindControl("hlEdit")).NavigateUrl = UrlsData.AP_Contact(Guid.Parse(data["ID"].ToString()));
                ((HyperLink)item.FindControl("hlEdit")).Target      = "_blank";
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handles the OnItemDataBound event of the gridContacts control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gridContacts_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                if (access == null)
                {
                    access = Access.Check();
                }

                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                var category = Request.QueryString["c"];
                if (!string.IsNullOrEmpty(category))
                {
                    ((HyperLink)item.FindControl("hlEdit")).NavigateUrl = UrlsData.AP_Contact(Guid.Parse(data["ID"].ToString())) + "?c=" + category;
                }
                else
                {
                    ((HyperLink)item.FindControl("hlEdit")).NavigateUrl = UrlsData.AP_Contact(Guid.Parse(data["ID"].ToString()));
                }

                ((LinkButton)item.FindControl("lbDelete")).CommandArgument  = data["ID"].ToString();
                ((LinkButton)item.FindControl("lbRestore")).CommandArgument = data["ID"].ToString();
                item.FindControl("lbDelete").Visible  = !IsDeletedCategory && access.Delete;
                item.FindControl("lbRestore").Visible = IsDeletedCategory;

                ((Literal)item.FindControl("litPriority")).Text = data["tbl_Priorities_Title"].ToString();
                if (!string.IsNullOrEmpty(data["tbl_Priorities_Image"].ToString()))
                {
                    ((Image)item.FindControl("imgPriority")).ImageUrl      = BusinessLogicLayer.Configuration.Settings.DictionaryLogoPath(SiteId, "tbl_Priorities") + data["tbl_Priorities_Image"];
                    ((Image)item.FindControl("imgPriority")).AlternateText = ((Image)item.FindControl("imgPriority")).ToolTip = data["tbl_Priorities_Title"].ToString();
                    ((Image)item.FindControl("imgPriority")).Visible       = true;
                }

                ((Literal)item.FindControl("litReadyToSell")).Text = data["tbl_ReadyToSell_Title"].ToString();
                if (!string.IsNullOrEmpty(data["tbl_ReadyToSell_Image"].ToString()))
                {
                    ((Image)item.FindControl("imgReadyToSell")).ImageUrl      = BusinessLogicLayer.Configuration.Settings.DictionaryLogoPath(SiteId, "tbl_ReadyToSell") + data["tbl_ReadyToSell_Image"];
                    ((Image)item.FindControl("imgReadyToSell")).AlternateText = ((Image)item.FindControl("imgReadyToSell")).ToolTip = data["tbl_ReadyToSell_Title"].ToString();
                    ((Image)item.FindControl("imgReadyToSell")).Visible       = true;
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handles the OnItemDataBound event of the gridRequirements control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gridRequirements_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                var lrlCompanyName  = (Literal)item.FindControl("lrlCompanyName");
                var lrlUserFullName = (Literal)item.FindControl("lrlUserFullName");

                if (!string.IsNullOrEmpty(data["tbl_Company_Name"].ToString()))
                {
                    lrlCompanyName.Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Company(Guid.Parse(data["tbl_Company_ID"].ToString())), data["tbl_Company_Name"]);
                }

                if (!string.IsNullOrEmpty(data["tbl_Contact_UserFullName"].ToString()))
                {
                    lrlUserFullName.Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact(Guid.Parse(data["tbl_Contact_ID"].ToString())), data["tbl_Contact_UserFullName"]);
                }
            }
        }
        protected void gridContactActivity_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                var target = ((LinkButton)item.FindControl("lbtnShowSessionInfo"));
                if (data["tbl_ContactActivity_ContactSessionID"] != null)
                {
                    rttmSessionInfo.TargetControls.Add(target.ClientID, data["tbl_ContactActivity_ContactSessionID"].ToString(), true);
                }

                target.Text = data["tbl_ContactSessions_UserSessionNumber"] != null && !string.IsNullOrEmpty(data["tbl_ContactSessions_UserSessionNumber"].ToString()) ? "Посещение " + data["tbl_ContactSessions_UserSessionNumber"] : "---";

                if (item.FindControl("lContact") != null)
                {
                    if (!string.IsNullOrEmpty(data["tbl_Contact_UserFullName"].ToString()))
                    {
                        ((Literal)item.FindControl("lContact")).Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact(Guid.Parse(data["tbl_Contact_ID"].ToString())), data["tbl_Contact_UserFullName"]);
                    }
                    else
                    {
                        ((Literal)item.FindControl("lContact")).Text = string.Format("&lt;<a href=\"{0}\">Незнакомец</a> от {1}&gt;", UrlsData.AP_Contact(Guid.Parse(data["tbl_Contact_ID"].ToString())), DateTime.Parse(data["tbl_Contact_CreatedAt"].ToString()).ToString("dd.MM.yyyy HH:mm"));
                    }
                }

                if (!string.IsNullOrEmpty(data["tbl_ContactActivity_ActivityCode"].ToString()))
                {
                    switch ((ActivityType)int.Parse(data["tbl_ContactActivity_ActivityTypeID"].ToString()))
                    {
                    case ActivityType.InboxMessage:
                        ((Literal)item.FindControl("lActivityCode")).Text = data["tbl_ContactActivity_ActivityCode"].ToString();
                        break;

                    case ActivityType.ViewPage:
                        ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{0}</a>", Server.UrlDecode(data["tbl_ContactActivity_ActivityCode"].ToString()));
                        break;

                    case ActivityType.Link:
                        ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", Server.UrlDecode(data["tbl_ContactActivity_ActivityCode"].ToString()), Server.UrlDecode(data["tbl_ContactActivity_ActivityCode"].ToString()));
                        break;

                    case ActivityType.OpenForm:
                    case ActivityType.FillForm:
                    case ActivityType.CancelForm:
                        var codeForm = data["tbl_ContactActivity_ActivityCode"].ToString();
                        codeForm = Regex.Replace(codeForm, @"^(.*)(#(.*))$", "$1");

                        var siteActivityRuleForm = dataManager.SiteActivityRules.Select(siteID, codeForm);
                        if (siteActivityRuleForm != null)
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_SiteActivityRule(siteActivityRuleForm.ID, siteActivityRuleForm.RuleTypeID), data["tbl_ContactActivity_ActivityCode"].ToString());
                        }
                        break;

                    case ActivityType.DownloadFile:
                        var siteActivityRule = dataManager.Links.Select(siteID, data["tbl_ContactActivity_ActivityCode"].ToString());
                        if (siteActivityRule != null)
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_SiteActivityRule(siteActivityRule.ID, siteActivityRule.RuleTypeID), siteActivityRule.Code);
                        }
                        break;

                    /*case ActivityType.Event:
                     *  var siteEventTemplate = dataManager.SiteEventTemplates.SelectById(Guid.Parse(data["tbl_ContactActivity_ActivityCode"].ToString()));
                     *  if (siteEventTemplate != null)
                     *      ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_SiteEventTemplate(siteEventTemplate.ID), siteEventTemplate.Title);
                     *  ((Literal)item.FindControl("lActivityCode")).Text = siteEventTemplate.Title;
                     *  break;*/
                    case ActivityType.UserEvent:
                        var workflow = dataManager.WorkflowElement.SelectByValue(data["tbl_ContactActivity_ID"].ToString());
                        if (workflow != null)
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_WorkflowEdit(workflow.WorkflowID), data["tbl_ContactActivity_ActivityCode"]);
                        }
                        else
                        {
                            ((Literal)item.FindControl("lActivityCode")).Text = data["tbl_ContactActivity_ActivityCode"].ToString();
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Handles the OnItemDataBound event of the rgStats control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
 protected void rgStats_OnItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridDataItem)
     {
         if (e.Item.OwnerTableView.Name == "Detail")
         {
             var item           = (tbl_SiteActionLink)e.Item.DataItem;
             var hlUserFullName = ((HyperLink)e.Item.FindControl("hlUserFullName"));
             if (!string.IsNullOrEmpty(item.tbl_Contact.UserFullName))
             {
                 ((Literal)e.Item.FindControl("litContact")).Text = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", UrlsData.AP_Contact(item.tbl_Contact.ID), item.tbl_Contact.UserFullName);
             }
             else
             {
                 ((Literal)e.Item.FindControl("litContact")).Text = string.Format("&lt;<a href=\"{0}\" target=\"_blank\">Незнакомец</a> от {1}&gt;", UrlsData.AP_Contact(item.tbl_Contact.ID), item.tbl_Contact.CreatedAt.ToString("dd.MM.yyyy HH:mm"));
             }
         }
         else
         {
             dynamic siteActionLink = e.Item.DataItem;
             if (siteActionLink.SiteActivityRuleID != null)
             {
                 var siteActivityRule = _dataManager.Links.SelectById((Guid)siteActionLink.SiteActivityRuleID);
                 if (siteActivityRule != null)
                 {
                     ((HyperLink)e.Item.FindControl("hlLink")).Text        = siteActivityRule.Code;
                     ((HyperLink)e.Item.FindControl("hlLink")).NavigateUrl = UrlsData.AP_SiteActivityRule(siteActivityRule.ID, siteActivityRule.RuleTypeID);
                 }
             }
             else if (!string.IsNullOrEmpty(siteActionLink.LinkURL))
             {
                 ((HyperLink)e.Item.FindControl("hlLink")).Text        = siteActionLink.LinkURL;
                 ((HyperLink)e.Item.FindControl("hlLink")).NavigateUrl = siteActionLink.LinkURL;
             }
         }
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Handles the OnItemDataBound event of the rgTaskMembers control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void rgTaskMembers_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
            {
                var gridEditFormItem = (GridEditFormItem)e.Item;

                gridEditFormItem.FindControl("plContactPay").Visible = TypePaymentScheme == TaskTypePaymentScheme.ContactPayment;

                var dcbContractor = (DictionaryComboBox)gridEditFormItem.FindControl("dcbContractor");
                dcbContractor.SiteID = SiteId;
                dcbContractor.BindData();

                var ucContact = (ContactComboBox)gridEditFormItem.FindControl("ucContact");

                //Если задача добавляется с карточки компании
                if (CompanyId.HasValue)
                {
                    dcbContractor.SelectedId = (Guid)CompanyId;
                }

                //Если задача добавляется с карточки контакта
                if (ContactId.HasValue)
                {
                    ucContact.SelectedValue = ContactId;
                }

                var dcbOrder = (DictionaryComboBox)gridEditFormItem.FindControl("dcbOrder");
                dcbOrder.SiteID = SiteId;
                dcbOrder.BindData();

                var ddlTaskMemberRole = (DropDownList)gridEditFormItem.FindControl("ddlTaskMemberRole");
                BindTaskMemberRoles(ddlTaskMemberRole);
                ddlTaskMemberRole.SelectedIndex = ddlTaskMemberRole.Items.IndexOf(ddlTaskMemberRole.Items.FindByValue(((int)TaskMemberRole.Responsible).ToString()));
                ((RequiredFieldValidator)gridEditFormItem.FindControl("rfvTaskMemberRole")).InitialValue = "-1";

                var item = e.Item as GridEditableItem;

                var ucOrderProduct = (OrderProductsComboBox)gridEditFormItem.FindControl("ucOrderProduct");
                ucOrderProduct.ProductId = ProductId;

                if (!e.Item.OwnerTableView.IsItemInserted)
                {
                    var taskMember = (TaskMemberMap)item.DataItem;
                    if (taskMember.ContractorID.HasValue)
                    {
                        dcbContractor.SelectedId = (Guid)taskMember.ContractorID;
                    }
                    if (taskMember.OrderID.HasValue)
                    {
                        dcbOrder.SelectedId = (Guid)taskMember.OrderID;

                        ucOrderProduct.OrderId       = dcbOrder.SelectedId;
                        ucOrderProduct.SelectedValue = taskMember.OrderProductsID;
                    }
                    ucContact.SelectedValue         = taskMember.ContactID;
                    ddlTaskMemberRole.SelectedIndex = ddlTaskMemberRole.Items.IndexOf(ddlTaskMemberRole.Items.FindByValue(taskMember.TaskMemberRoleID.ToString()));
                    ((Literal)item.FindControl("lrlTaskMemberStatus")).Text = EnumHelper.GetEnumDescription((TaskMemberStatus)taskMember.TaskMemberStatusID);
                    ((CheckBox)item.FindControl("chxIsInformed")).Checked   = taskMember.IsInformed;
                    ((TextBox)item.FindControl("txtComment")).Text          = taskMember.Comment;
                    ((TextBox)item.FindControl("txtUserComment")).Text      = taskMember.UserComment;

                    RefreshOrders(dcbOrder);
                }
            }
            else if (e.Item is GridDataItem)
            {
                var taskMember = e.Item.DataItem as TaskMemberMap;
                if (taskMember != null)
                {
                    if (taskMember.ContractorID.HasValue)
                    {
                        ((Literal)e.Item.FindControl("lrlContractor")).Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Company((Guid)taskMember.ContractorID), _dataManager.Company.SelectById(SiteId, (Guid)taskMember.ContractorID).Name);
                    }

                    ((Literal)e.Item.FindControl("lrlContact")).Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact((Guid)taskMember.ContactID), _dataManager.Contact.SelectById(SiteId, (Guid)taskMember.ContactID).UserFullName);

                    if (taskMember.OrderID.HasValue)
                    {
                        ((Literal)e.Item.FindControl("lrlOrder")).Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_OrderEdit((Guid)taskMember.OrderID), _dataManager.Order.SelectById(SiteId, (Guid)taskMember.OrderID).Number);
                    }

                    if (taskMember.OrderProductsID.HasValue)
                    {
                        var orderProduct = _dataManager.OrderProducts.SelectById((Guid)taskMember.OrderProductsID);
                        ((Literal)e.Item.FindControl("lrlOrderProduct")).Text = string.Format(
                            "<a href=\"{0}\">{1}</a>", UrlsData.AP_ProductEdit(orderProduct.ProductID), orderProduct.tbl_Product.Title);
                    }

                    ((Literal)e.Item.FindControl("lrlRole")).Text           = EnumHelper.GetEnumDescription((TaskMemberRole)taskMember.TaskMemberRoleID);
                    ((Literal)e.Item.FindControl("lrlStatus")).Text         = EnumHelper.GetEnumDescription((TaskMemberStatus)taskMember.TaskMemberStatusID);
                    ((CheckBox)e.Item.FindControl("chxIsInformed")).Checked = taskMember.IsInformed;
                }
            }
        }
        /// <summary>
        /// Handles the ItemDataBound event of the rgSiteActionLinkUsers control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void rgSiteActionLinkUsers_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                var item = (tbl_SiteActionLink)e.Item.DataItem;

                if (item != null)
                {
                    if (!string.IsNullOrEmpty(item.tbl_Contact.UserFullName))
                    {
                        ((Literal)e.Item.FindControl("litContact")).Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact(item.tbl_Contact.ID), item.tbl_Contact.UserFullName);
                    }
                    else
                    {
                        ((Literal)e.Item.FindControl("litContact")).Text = string.Format("&lt;<a href=\"{0}\">Незнакомец</a> от {1}&gt;", UrlsData.AP_Contact(item.tbl_Contact.ID), item.tbl_Contact.CreatedAt.ToString("dd.MM.yyyy HH:mm"));
                    }
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Handles the OnItemDataBound event of the gridSiteAction control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gridSiteAction_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var data = (DataRowView)e.Item.DataItem;

                var imgDirection        = (Image)item.FindControl("imgDirection");
                var lUserFullName       = (Literal)item.FindControl("lUserFullName");
                var lSenderUserFullName = (Literal)item.FindControl("lSenderUserFullName");

                if (!string.IsNullOrEmpty(data["tbl_Contact_UserFullName"].ToString()))
                {
                    lUserFullName.Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact(Guid.Parse(data["tbl_Contact_ID"].ToString())), data["tbl_Contact_UserFullName"]);
                }
                else if (!string.IsNullOrEmpty(data["tbl_Contact_ID"].ToString()))
                {
                    lUserFullName.Text = string.Format("&lt;<a href=\"{0}\">Незнакомец</a> от {1}&gt;", UrlsData.AP_Contact(Guid.Parse(data["tbl_Contact_ID"].ToString())), DateTime.Parse(data["tbl_Contact_CreatedAt"].ToString()).ToString("dd.MM.yyyy HH:mm"));
                }

                if (!string.IsNullOrEmpty(data["c1_UserFullName"].ToString()))
                {
                    lSenderUserFullName.Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact(Guid.Parse(data["c1_ID"].ToString())), data["c1_UserFullName"]);
                }
                else if (!string.IsNullOrEmpty(data["c1_ID"].ToString()))
                {
                    lSenderUserFullName.Text = string.Format("&lt;<a href=\"{0}\">Незнакомец</a> от {1}&gt;", UrlsData.AP_Contact(Guid.Parse(data["c1_ID"].ToString())), DateTime.Parse(data["c1_CreatedAt"].ToString()).ToString("dd.MM.yyyy HH:mm"));
                }

                switch ((Direction)int.Parse(data["tbl_SiteAction_DirectionID"].ToString()))
                {
                case Direction.In:
                    imgDirection.ImageUrl      = "~/App_Themes/Default/images/icoInbox.png";
                    imgDirection.AlternateText = imgDirection.ToolTip = "Входящее";
                    break;

                case Direction.Out:
                    imgDirection.ImageUrl      = "~/App_Themes/Default/images/icoOutbox.png";
                    imgDirection.AlternateText = imgDirection.ToolTip = "Исходящее";
                    break;
                }

                var hlActionTemplateTitle = (HyperLink)item.FindControl("hlActionTemplateTitle");
                if (!string.IsNullOrEmpty(data["tbl_SiteActionTemplate_ID"].ToString()))
                {
                    hlActionTemplateTitle.Text        = data["tbl_SiteActionTemplate_Title"].ToString();
                    hlActionTemplateTitle.NavigateUrl =
                        UrlsData.AP_SiteActionTemplate(Guid.Parse(data["tbl_SiteActionTemplate_ID"].ToString()));
                }
                else if (!string.IsNullOrEmpty(data["tbl_SourceMonitoring_ID"].ToString()))
                {
                    if (!string.IsNullOrEmpty(data["c2_UserFullName"].ToString()))
                    {
                        lUserFullName.Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact(Guid.Parse(data["c2_ID"].ToString())), data["c2_UserFullName"]);
                    }

                    hlActionTemplateTitle.Text        = data["tbl_SourceMonitoring_Name"].ToString();
                    hlActionTemplateTitle.NavigateUrl =
                        UrlsData.AP_SourceMonitoringEdit(Guid.Parse(data["tbl_SourceMonitoring_ID"].ToString()));
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        protected void BindData()
        {
            var session = DataManager.ContactSessions.SelectById(SiteId, SessionId);

            if (session == null)
            {
                return;
            }

            var contact = session.tbl_Contact;

            hlContact.NavigateUrl = UrlsData.AP_Contact(contact.ID);
            hlContact.Text        = contact.UserFullName;

            lrlSessionNumber.Text = session.UserSessionNumber.ToString();
            lrlSessionDate.Text   = session.SessionDate.ToString("dd.MM.yyyy HH:mm");
            lrlRefferURL.Text     = session.RefferURL;
            lrlCameFromURL.Text   = session.CameFromURL;
            lrlEnterPointUrl.Text = session.EnterPointUrl;

            lrlKeywords.Text = session.Keywords;

            lrlContent.Text = session.Content;
            lrlUserIP.Text  = session.UserIP;

            if (session.RefferID.HasValue)
            {
                var contactReffer = DataManager.Contact.SelectById(SiteId, (Guid)session.RefferID);
                if (contactReffer != null)
                {
                    hlReffer.Text        = contactReffer.UserFullName;
                    hlReffer.NavigateUrl = UrlsData.AP_Contact((Guid)session.RefferID);
                }
            }

            lrlUserAgent.Text = session.UserAgent;

            if (session.BrowserID.HasValue)
            {
                var browser = session.tbl_Browsers;
                lrlBrowser.Text = string.Format("{0} {1}", browser.Name, browser.Version);
            }

            if (session.OperatingSystemID.HasValue)
            {
                var os = session.tbl_OperatingSystems;
                lrlOperationSystem.Text = string.Format("{0} {1}", os.Name, os.Version);
            }

            if (session.ResolutionID.HasValue)
            {
                lrlResolution.Text = session.tbl_Resolutions.Value;
            }

            if (session.MobileDeviceID.HasValue)
            {
                lrlMobileDevice.Text = session.tbl_MobileDevices.Name;
            }

            if (session.CountryID.HasValue)
            {
                lrlCountry.Text = session.tbl_Country.Name;
            }

            if (session.CityID.HasValue)
            {
                var city = session.tbl_City;
                lrlCity.Text     = city.Name;
                lrlDistrict.Text = city.tbl_District.Name;
                lrlRegion.Text   = city.tbl_Region.Name;
            }

            if (session.AdvertisingCampaignID.HasValue)
            {
                lrlAdvertisingCampaign.Text = session.tbl_AdvertisingCampaign.Title;
            }

            if (session.AdvertisingPlatformID.HasValue)
            {
                lrlAdvertisingPlatform.Text = session.tbl_AdvertisingPlatform.Title;
            }

            if (session.AdvertisingTypeID.HasValue)
            {
                lrlAdvertisingType.Text = session.tbl_AdvertisingType.Title;
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Handles the OnItemDataBound event of the rgTaskDurations control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void rgTaskDurations_OnItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
            {
                var userControl = (SaveTaskDuration)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
                userControl.SiteId = SiteId;
                if (Task != null)
                {
                    userControl.Task = Task;
                }
                userControl.TaskDurations = TaskDurationsList;
                userControl.BindData();

                var item = e.Item as GridEditableItem;

                if (!e.Item.OwnerTableView.IsItemInserted)
                {
                    var taskDuration = (TaskDurationMap)item.DataItem;
                    ((ContactComboBox)userControl.FindControl("ucResponsible")).SelectedValue        = taskDuration.ResponsibleID;
                    ((RadDateTimePicker)userControl.FindControl("rdpStartDate")).SelectedDate        = taskDuration.SectionDateStart;
                    ((RadDateTimePicker)userControl.FindControl("rdpEndDate")).SelectedDate          = taskDuration.SectionDateEnd;
                    ((RadNumericTextBox)userControl.FindControl("rntxtActualDurationHours")).Value   = taskDuration.ActualDurationHours;
                    ((RadNumericTextBox)userControl.FindControl("rntxtActualDurationMinutes")).Value = taskDuration.ActualDurationMinutes;
                    ((TextBox)userControl.FindControl("txtComment")).Text = taskDuration.Comment;
                }
            }
            else if (e.Item is GridDataItem)
            {
                var taskDuration = e.Item.DataItem as TaskDurationMap;
                if (taskDuration != null && taskDuration.ResponsibleID.HasValue)
                {
                    ((Literal)e.Item.FindControl("lrlResponsible")).Text = string.Format("<a href=\"{0}\">{1}</a>", UrlsData.AP_Contact((Guid)taskDuration.ResponsibleID), _dataManager.Contact.SelectById(SiteId, (Guid)taskDuration.ResponsibleID).UserFullName);
                }
            }
        }