コード例 #1
0
        protected void BuildEmailHistoryTooltip(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs args)
        {
            String EmailHistoryID = args.Value;

            String qry = "SELECT ContactID, ee.Email as 'E-mail', up.Fullname as 'Estimated By', EmailEstimationPatternID as 'Pattern', EmailEstimateByPatternFailed as 'Failed', Validated, DateAdded " +
                         "FROM db_contact_email_history ee LEFT JOIN db_userpreferences up ON ee.EstimatedByUserID=up.UserID WHERE EmailEstimateID=@EmailEstimateID ORDER BY DateAdded";
            DataTable dt_estimate = SQL.SelectDataTable(qry, "@EmailHistoryID", EmailHistoryID);

            if (dt_estimate.Rows.Count > 0)
            {
                String ContactID           = dt_estimate.Rows[0]["ContactID"].ToString();
                String PatternDetails      = EmailBuilder.GetPatternDetailsByPatternID(dt_estimate.Rows[0]["Pattern"].ToString());
                String EstimatedByFullName = dt_estimate.Rows[0]["Estimated By"].ToString();
                String DateAdded           = dt_estimate.Rows[0]["DateAdded"].ToString();

                qry = "SELECT TRIM(CONCAT(CASE WHEN FirstName IS NULL THEN '' ELSE CONCAT(TRIM(FirstName), ' ') END, " +
                      "CASE WHEN NickName IS NULL THEN '' ELSE '' END, CASE WHEN LastName IS NULL THEN '' ELSE TRIM(LastName) END)) as 'name' " +
                      "FROM db_contact WHERE ContactID=@ContactID";
                String ContactName = SQL.SelectString(qry, "name", "@ContactID", ContactID);

                Label lbl_title = new Label();
                lbl_title.CssClass = "MediumTitle";
                lbl_title.Text     = "E-mail estimation history for contact '<b>" + Server.HtmlEncode(ContactName) + "</b>'";
                lbl_title.Attributes.Add("style", "font-weight:500; margin-top:0px; margin-bottom:6px; position:relative; top:-3px;");

                Label  lbl_cur_email = new Label();
                String BuiltInfo     = "Currently estimated e-mail was built by " + Server.HtmlEncode(EstimatedByFullName) + " based on matched e-mail patterns of other contacts at this company."
                                       + "<br/>E-mail built using " + Server.HtmlEncode(PatternDetails)
                                       + "<br/>Built: " + Server.HtmlEncode(DateAdded);
                lbl_cur_email.Text      = BuiltInfo;
                lbl_cur_email.Font.Size = 8;

                Panel p = new Panel();
                p.Width = 679;

                qry = "SELECT Email as 'E-mail', Fullname as 'Estimated By', EmailEstimationPatternID as 'Pattern', EmailEstimateByPatternFailed as 'Failed', Validated, DateAdded " +
                      "FROM db_contact_email_history ee LEFT JOIN db_userpreferences up ON ee.EstimatedByUserID=up.UserID WHERE ContactID=@ContactID ORDER BY EmailEstimateByPatternFailed, DateAdded DESC";
                DataTable dt_email_history = SQL.SelectDataTable(qry.Replace("EmailHistoryID=@EmailHistoryID", "ContactID=@ContactID"), "@ContactID", ContactID);

                RadGrid rg_email_history = new RadGrid();
                rg_email_history.Skin                = "Silk";
                rg_email_history.Font.Size           = 7;
                rg_email_history.AutoGenerateColumns = true;
                rg_email_history.AllowSorting        = false;
                rg_email_history.DataSource          = dt_email_history;
                rg_email_history.DataBind();
                rg_email_history.Width          = 675;
                rg_email_history.ItemDataBound += rg_email_history_ItemDataBound;

                p.Controls.Add(lbl_title);
                p.Controls.Add(lbl_cur_email);
                p.Controls.Add(rg_email_history);

                args.UpdatePanel.ContentTemplateContainer.Controls.Add(p);
                args.UpdatePanel.ChildrenAsTriggers = true;
            }
        } // delete soon
コード例 #2
0
 protected void OnAjaxUpdate(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs e)
 {
     string[] tooltipId = e.TargetControlID.Split(new char[] { '_' });
     if (tooltipId.Length == 4)
     {
         Literal literal = new Literal();
         literal.Text = _4screen.CSB.DataAccess.Business.AdWordHelper.GetCampaignContent(new Guid(tooltipId[0]), new Guid(tooltipId[1]), UserDataContext.GetUserDataContext(), tooltipId[2], "Popup");
         literal.Text = System.Text.RegularExpressions.Regex.Replace(literal.Text, @"(/Pages/Other/AdCampaignRedirecter.aspx\?CID=\w{8}-\w{4}-\w{4}-\w{4}-\w{12})", "$1&OID=" + tooltipId[1] + "&Word=" + tooltipId[2] + "&Type=PopupLink");
         e.UpdatePanel.ContentTemplateContainer.Controls.Add(literal);
     }
 }
コード例 #3
0
    // Notes & Destination Project Picker
    protected void BuildNotesTooltip(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs args)
    {
        String TempLeadID = args.Value;

        // Find destination note box
        RadTextBox rtb_dest_note = new RadTextBox();

        foreach (GridDataItem item in rg_leads.Items)
        {
            String ThisRowTempLeadID = item["TempLeadID"].Text;
            if (TempLeadID == ThisRowTempLeadID)
            {
                rtb_dest_note = (RadTextBox)item["Notes"].FindControl("tb_notes");
                break;
            }
        }

        Panel p = new Panel();

        Label lbl_notes_title = new Label();

        lbl_notes_title.CssClass = "MediumTitle";
        lbl_notes_title.Text     = "Lead Notes and Actions";
        lbl_notes_title.Attributes.Add("style", "font-weight:500; margin-top:0px; margin-bottom:6px; position:relative; top:-3px;");

        RadTextBox rtb_note = new RadTextBox();

        rtb_note.ID       = "rtb_note_" + TempLeadID;
        rtb_note.Height   = 140;
        rtb_note.Width    = 590;
        rtb_note.TextMode = InputMode.MultiLine;
        rtb_note.Text     = rtb_dest_note.Text;

        RadButton rb_clear_note = new RadButton();

        rb_clear_note.ID = "rb_clear_note_" + TempLeadID;
        rb_clear_note.Attributes.Add("style", "float:left; margin:4px 4px 4px 1px;");
        rb_clear_note.Skin            = "Bootstrap";
        rb_clear_note.Text            = "Clear Notes";
        rb_clear_note.Click          += rb_clear_note_Click;
        rb_clear_note.CommandArgument = TempLeadID;

        RadButton rb_clear_all_notes = new RadButton();

        rb_clear_all_notes.ID = "rb_clear_all_notes_" + TempLeadID;
        rb_clear_all_notes.Attributes.Add("style", "float:left; margin:4px 0px 4px 1px;");
        rb_clear_all_notes.Skin            = "Bootstrap";
        rb_clear_all_notes.Text            = "Clear All Notes";
        rb_clear_all_notes.Click          += rb_clear_note_Click;
        rb_clear_all_notes.CommandArgument = TempLeadID;

        RadButton rb_add_note = new RadButton();

        rb_add_note.ID = "rb_add_note_" + TempLeadID;
        rb_add_note.Attributes.Add("style", "float:right; margin:4px 1px 4px 4px;");
        rb_add_note.Skin            = "Bootstrap";
        rb_add_note.Text            = "Save Note/Next Action";
        rb_add_note.Click          += rb_add_note_Click;
        rb_add_note.CommandArgument = TempLeadID;

        RadButton rb_add_note_to_all = new RadButton();

        rb_add_note_to_all.ID = "rb_add_note_to_all_" + TempLeadID;
        rb_add_note_to_all.Attributes.Add("style", "float:right; margin:4px 1px 4px 4px;");
        rb_add_note_to_all.Skin            = "Bootstrap";
        rb_add_note_to_all.Text            = "Save Note/Next Action to All";
        rb_add_note_to_all.Click          += rb_add_note_Click;
        rb_add_note_to_all.CommandArgument = TempLeadID;

        // Next Action stuff
        Panel p_next_action = new Panel();

        p_next_action.CssClass = "NextActionContainer";
        p_next_action.Attributes.Add("style", "margin-top:50px; padding-top:10px;");

        Label lbl_next_action = new Label();

        lbl_next_action.Text     = "Next Action:";
        lbl_next_action.CssClass = "SmallTitle";
        lbl_next_action.Attributes.Add("style", "float:left; padding:5px 5px 0px 5px;");

        RadDropDownList dd_next_action_type = new RadDropDownList(); // needs binding

        dd_next_action_type.ID     = "dd_next_action_type_" + TempLeadID;
        dd_next_action_type.Width  = 100;
        dd_next_action_type.Height = 30;
        dd_next_action_type.Attributes.Add("style", "margin-right:5px; position:relative; top:-2px;");
        dd_next_action_type.ZIndex          = 99999999;
        dd_next_action_type.ExpandDirection = DropDownListExpandDirection.Up;
        dd_next_action_type.Skin            = "Bootstrap";

        String qry = "SELECT * FROM dbl_action_type ORDER BY ActionType";

        dd_next_action_type.DataSource     = SQL.SelectDataTable(qry, null, null);
        dd_next_action_type.DataTextField  = "ActionType";
        dd_next_action_type.DataValueField = "ActionTypeID";
        dd_next_action_type.DataBind();

        RadDateTimePicker rdp_next_action = new RadDateTimePicker();

        rdp_next_action.ID             = "rd_next_action_" + TempLeadID;
        rdp_next_action.Skin           = "Bootstrap";
        rdp_next_action.ZIndex         = 99999999;
        rdp_next_action.Width          = 200;
        rdp_next_action.PopupDirection = DatePickerPopupDirection.TopLeft;

        RadButton rb_remove_all_next_action = new RadButton();

        rb_remove_all_next_action.ID = "rb_remove_all_next_action_" + TempLeadID;
        rb_remove_all_next_action.Attributes.Add("style", "float:right;");
        rb_remove_all_next_action.Skin            = "Bootstrap";
        rb_remove_all_next_action.Text            = "Remove All Next Actions";
        rb_remove_all_next_action.Click          += rb_clear_note_Click;
        rb_remove_all_next_action.CommandArgument = TempLeadID;

        // Attempt to set a previously set next action/destination project
        HiddenField hf_nat = new HiddenField()
        {
            ID = "hf_nat_" + TempLeadID
        };
        HiddenField hf_nad = new HiddenField()
        {
            ID = "hf_nad_" + TempLeadID
        };
        String DestinationProjectID = String.Empty;

        qry = "SELECT DestinationProjectID, NextActionTypeID, NextActionDate FROM dbl_temp_leads WHERE TempLeadID=@TempLeadID";
        DataTable dt_next_action = SQL.SelectDataTable(qry, "@TempLeadID", TempLeadID);

        if (dt_next_action.Rows.Count > 0)
        {
            DestinationProjectID = dt_next_action.Rows[0]["DestinationProjectID"].ToString();

            DateTime d = new DateTime();
            if (DateTime.TryParse(dt_next_action.Rows[0]["NextActionDate"].ToString(), out d))
            {
                rdp_next_action.SelectedDate = d;
                hf_nad.Value = d.ToString();
            }

            String app_type = dt_next_action.Rows[0]["NextActionTypeID"].ToString();
            if (dd_next_action_type.FindItemByValue(app_type) != null)
            {
                dd_next_action_type.SelectedIndex = dd_next_action_type.FindItemByValue(app_type).Index;
                hf_nat.Value = dd_next_action_type.SelectedItem.Value;
            }
        }

        p_next_action.Controls.Add(lbl_next_action);
        p_next_action.Controls.Add(dd_next_action_type);
        p_next_action.Controls.Add(rdp_next_action);
        p_next_action.Controls.Add(rb_remove_all_next_action);
        p_next_action.Controls.Add(hf_nat);
        p_next_action.Controls.Add(hf_nad);

        // Destination Project stuff
        Panel p_dest_project = new Panel();

        p_dest_project.Attributes.Add("style", "margin-top:24px;");

        Label lbl_dest_title = new Label();

        lbl_dest_title.CssClass = "MediumTitle";
        lbl_dest_title.Text     = "Pick a Project/Bucket for this Lead (optional, overrides target on import)...";
        lbl_dest_title.Attributes.Add("style", "font-weight:500; margin-top:0px; margin-bottom:6px; position:relative; top:-3px;");

        RadDropDownList dd_project = new RadDropDownList();

        dd_project.ID     = "dd_project_" + TempLeadID;
        dd_project.Width  = 200;
        dd_project.Height = 30;
        dd_project.Attributes.Add("style", "margin-right:5px;");
        dd_project.ZIndex                = 99999999;
        dd_project.ExpandDirection       = DropDownListExpandDirection.Up;
        dd_project.Skin                  = "Bootstrap";
        dd_project.AutoPostBack          = true;
        dd_project.SelectedIndexChanged += dd_project_SelectedIndexChanged;

        RadDropDownList dd_bucket = new RadDropDownList();

        dd_bucket.ID     = "dd_bucket_" + TempLeadID;
        dd_bucket.Width  = 200;
        dd_bucket.Height = 30;
        dd_bucket.Attributes.Add("style", "margin-right:5px;");
        dd_bucket.ZIndex          = 99999999;
        dd_bucket.ExpandDirection = DropDownListExpandDirection.Up;
        dd_bucket.Skin            = "Bootstrap";

        RadButton rb_save_dest_proj = new RadButton();

        rb_save_dest_proj.ID = "btn_save_proj_" + TempLeadID;
        rb_save_dest_proj.Attributes.Add("style", "float:right; position:relative; top:-1px;");
        rb_save_dest_proj.Skin             = "Bootstrap";
        rb_save_dest_proj.Text             = "Save Destination Project";
        rb_save_dest_proj.Click           += rb_save_dest_proj_Click;
        rb_save_dest_proj.CommandArgument  = TempLeadID;
        rb_save_dest_proj.CausesValidation = false;
        // Set CommandName to the currently selected bucketID on save
        rb_save_dest_proj.OnClientClicking = "function(button, args){ var dd = $find('ctl00_Body_" + dd_bucket.ClientID + "'); $find('ctl00_Body_" + rb_save_dest_proj.ClientID + "').set_commandName(dd.get_selectedItem().get_value()); }";

        String SelectedProjectID = String.Empty;
        String SelectedBucketID  = String.Empty;

        if (DestinationProjectID != String.Empty)
        {
            SelectedProjectID = LeadsUtil.GetProjectParentIDFromID(DestinationProjectID);
            SelectedBucketID  = DestinationProjectID;
        }

        // Bind projects & select if possible
        LeadsUtil.BindProjects(dd_project, dd_bucket, SelectedProjectID, SelectedBucketID, true, true);
        dd_project.Items.Insert(0, new DropDownListItem(String.Empty, String.Empty));
        dd_bucket.Items.Insert(0, new DropDownListItem(String.Empty, String.Empty));

        if (DestinationProjectID == String.Empty)
        {
            dd_project.SelectedIndex = 0;
            dd_bucket.SelectedIndex  = 0;
        }

        p_dest_project.Controls.Add(lbl_dest_title);
        p_dest_project.Controls.Add(dd_project);
        p_dest_project.Controls.Add(dd_bucket);
        p_dest_project.Controls.Add(rb_save_dest_proj);

        p.Controls.Add(lbl_notes_title);
        p.Controls.Add(rtb_note);
        p.Controls.Add(new Label()
        {
            Text = "<br/>"
        });
        p.Controls.Add(rb_clear_note);
        p.Controls.Add(rb_clear_all_notes);
        p.Controls.Add(rb_add_note);
        p.Controls.Add(rb_add_note_to_all);
        p.Controls.Add(p_next_action);
        p.Controls.Add(p_dest_project);

        args.UpdatePanel.ContentTemplateContainer.Controls.Add(p);
        args.UpdatePanel.ChildrenAsTriggers = true;
    }