コード例 #1
0
        public void ToggleEmailVerified(object sender, EventArgs e)
        {
            ContactTemplate ctc_template = (ContactTemplate)((RadButton)sender).Parent.Parent.FindControl("ctc_template");

            ctc_template.ToggleEmailVerified();
            Util.SetRebindOnWindowClose(this, true, RadAjaxManager.GetCurrent(this.Page));

            BindContactProxy();
        }
コード例 #2
0
        public void AddContext(object sender, EventArgs e)
        {
            ContactTemplate ctc_template = (ContactTemplate)((RadButton)sender).Parent.Parent.FindControl("ctc_template");

            ctc_template.UpdateContact(TargetSystemID, TargetSystem); // pass targets so we can add context.. assume that if Updating a contact in a given context, that it should become contextual
            ctc_template.AddContext(TargetSystem, TargetSystemID);
            Util.SetRebindOnWindowClose(this, true, RadAjaxManager.GetCurrent(this.Page));

            Util.PageMessageAlertify(this, "Contact added to this entry!", "Added");

            BindContactProxy();
        }
コード例 #3
0
        private void ShowPreview()
        {
            documentViewer.Visibility = Visibility.Collapsed;

            FlowDocument doc = null;

            switch (_args.DocumentType)
            {
            case EditType.Appointment:
                doc = new AppointmentTemplate((Appointment)_args.DatabaseObject).GetFlowDocument();
                break;

            case EditType.Contact:
                doc = new ContactTemplate((Contact)_args.DatabaseObject).GetFlowDocument();
                break;

            case EditType.Note:
                doc = new NoteTemplate((NotebookPage)_args.DatabaseObject).GetFlowDocument();
                break;

            case EditType.Task:
                doc = new TaskTemplate((UserTask)_args.DatabaseObject).GetFlowDocument();
                break;

            default:
                break;
            }

            FlowDocument copy = doc.Copy();

            Size size = ((PaperSize)((FrameworkElement)paperSizeCombo.SelectedItem).Tag).Size;

            if ((size.Width < size.Height && orientationCombo.SelectedIndex == 1) ||
                (size.Width > size.Height && orientationCombo.SelectedIndex == 0))
            {
                size = new Size(size.Height, size.Width);
            }

            documentViewer.Document = FlowPaginator.ConvertFrom(
                copy, size,
                ((PageMargin)((FrameworkElement)marginCombo.SelectedItem).Tag).Margin
                );

            documentViewer.Visibility = Visibility.Visible;
            documentViewer.FadeIn(AnimationHelpers.AnimationDuration);

            documentViewer.FitToWidth();
        }
コード例 #4
0
        protected void UpdateContact(object sender, EventArgs e)
        {
            ContactTemplate ctc_template = (ContactTemplate)((RadButton)sender).Parent.Parent.FindControl("ctc_template");

            ctc_template.UpdateContact();
            // NOPE -- pass targets so we can add context.. assume that if Updating a contact in a given context, that it should become contextual //TargetSystemID, TargetSystem
            Util.SetRebindOnWindowClose(this, true, RadAjaxManager.GetCurrent(this.Page));

            // Perform contact merge incase necessary
            if (AutoContactMergingEnabled)
            {
                CompanyManager.MergeContacts(CompanyID, false);
            }

            BindContactProxy();
        }
コード例 #5
0
        public void UpdateContacts(String CompanyID, String TargetSystemID = "", String TargetSystem = "")
        {
            foreach (GridNestedViewItem nested_item in rg_contacts.MasterTableView.GetItems(GridItemType.NestedView))
            {
                ContactTemplate ctc_template = (ContactTemplate)nested_item.FindControl("ctc_template");
                ctc_template.UpdateContact(TargetSystemID, TargetSystem);
            }
            Util.SetRebindOnWindowClose(this, true, RadAjaxManager.GetCurrent(this.Page));

            // Perform contact merge incase necessary
            if (AutoContactMergingEnabled)
            {
                CompanyManager.MergeContacts(CompanyID, false);
            }

            BindContactProxy();
        }
コード例 #6
0
        private static void SaveContact(Window owner, StatusStrip statusStrip, Contact contact, string filename)
        {
            try
            {
                switch (Path.GetExtension(filename).ToLower())
                {
                case ".rtf":
                    FlowDocument doc     = new ContactTemplate(contact).GetFlowDocument();
                    TextRange    range   = new TextRange(doc.ContentStart, doc.ContentEnd);
                    FileStream   fStream = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write);
                    range.Save(fStream, DataFormats.Rtf);
                    fStream.Close();

                    statusStrip.UpdateMainStatus("EXPORT SUCCESSFUL");
                    break;

                case ".txt":
                    string[] filecontents = new ContactTemplate(contact).GetTextDocument();
                    File.WriteAllLines(filename, filecontents);

                    statusStrip.UpdateMainStatus("EXPORT SUCCESSFUL");
                    break;

                default:
                    statusStrip.UpdateMainStatus("ERROR: REQUESTED FILE TYPE UNAVAILABLE");

                    TaskDialog dialog = new TaskDialog(owner,
                                                       "Error Saving File", "The requested file type is not available.",
                                                       MessageType.Error);
                    dialog.ShowDialog();
                    break;
                }
            }
            catch (Exception exc)
            {
                statusStrip.UpdateMainStatus("ERROR: " + exc.Message.ToUpper());

                TaskDialog dialog = new TaskDialog(owner,
                                                   "Error Saving File", exc.Message, MessageType.Error);
                dialog.ShowDialog();

                ExportContact(owner, statusStrip, contact, Path.GetDirectoryName(saveDialog.SelectedFile));
            }
        }
コード例 #7
0
        protected void rg_contacts_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridNestedViewItem)
            {
                GridNestedViewItem nested_item  = (GridNestedViewItem)e.Item;
                HiddenField        hf_ctc_id    = (HiddenField)nested_item.FindControl("hf_ctc_id");
                ContactTemplate    ctc_template = (ContactTemplate)nested_item.FindControl("ctc_template");
                ctc_template.DuplicateLeadCheckingEnabled = this.DuplicateLeadCheckingEnabled;

                // Bind existing contacts
                String ContactID = hf_ctc_id.Value;
                ctc_template.BindContact(ContactID, IncludeContactTypes, TargetSystem, OnlyShowTargetSystemContactTypes, hf_user_id.Value);

                RadButton btn_update = (RadButton)nested_item.FindControl("btn_update");
                btn_update.ValidationGroup  = "vg_" + ContactID;
                btn_update.OnClientClicking = "function(button,args){ValidateContact('" + btn_update.ValidationGroup + "');}";

                RadButton btn_remove_dnc = (RadButton)nested_item.FindControl("btn_remove_dnc");
                btn_remove_dnc.Visible = ctc_template.HasKillWarning;
                RadButton btn_remove_estimated = (RadButton)nested_item.FindControl("btn_remove_estimated");
                btn_remove_estimated.Visible = ctc_template.IsEmailEstimated;
                RadButton btn_verifiy_email = (RadButton)nested_item.FindControl("btn_verifiy_email");
                btn_verifiy_email.Visible = false;// !ctc_template.IsEmailVerified && ctc_template.WorkEmail != String.Empty;
                RadButton btn_add_context = (RadButton)nested_item.FindControl("btn_add_context");
                btn_add_context.Visible = !OnlyShowContextualContacts;

                if (ctc_template.DontContactReason == "Already being Pursued by Someone Else")
                {
                    btn_remove_dnc.Text = "Remove Being Pursued Notice";
                }
                else if (ctc_template.HasDoNotContact)
                {
                    btn_remove_dnc.Text = "Remove Do-Not-Contact";
                }

                if (AllowKillingLeads)
                {
                    // check to see if we allow kill of lead
                    String    qry     = "SELECT GROUP_CONCAT(LeadID) as 'LeadID' FROM dbl_lead WHERE ProjectID IN (SELECT ProjectID FROM dbl_project WHERE UserID=@userid) AND Active=1 AND ContactID=@ctc_id";
                    DataTable dt_lead = SQL.SelectDataTable(qry,
                                                            new String[] { "@userid", "@ctc_id" },
                                                            new Object[] { hf_user_id.Value, ContactID });
                    if (dt_lead.Rows.Count > 0)
                    {
                        String    LeadID   = dt_lead.Rows[0]["LeadID"].ToString(); // this is a group concat of Lead entries for this user, so will kill all active in current projects
                        RadButton btn_kill = (RadButton)nested_item.FindControl("btn_kill");
                        btn_kill.Visible          = true;
                        btn_kill.OnClientClicking = "function (button,args){ var rw = GetRadWindow(); var rwm = rw.get_windowManager(); setTimeout(function ()" +
                                                    "{ rwm.open('multikill.aspx?lead_ids=" + Server.UrlEncode(LeadID) + "&kill_from_viewer=1', 'rw_kill_leads'); }, 0);}";
                    }
                }

                // Disable invalid leads' checkboxes
                if (SelectableContacts)
                {
                    ArrayList NewContactIDs            = (ArrayList)ViewState["NewContactIDs"];
                    ArrayList ForcedSelectedContactIDs = (ArrayList)ViewState["ForcedSelectedContactIDs"];
                    if (!ctc_template.IsValidContact || ForcedSelectedContactIDs.Count > 0 || NewContactIDs.Count > 0)
                    {
                        foreach (GridDataItem item in rg_contacts.Items)
                        {
                            if (ContactID == item["ContactID"].Text)
                            {
                                if (NewContactIDs.Contains(ContactID))
                                {
                                    ((CheckBox)item.FindControl("cb_select")).Checked = true;
                                    break;
                                }
                                if (!ctc_template.IsValidContact)
                                {
                                    ((CheckBox)item.FindControl("cb_select")).Enabled = false;
                                    break;
                                }
                                else if (ForcedSelectedContactIDs.Contains(ContactID))
                                {
                                    ((CheckBox)item.FindControl("cb_select")).Enabled = false;
                                    ((CheckBox)item.FindControl("cb_select")).Checked = true;
                                    ctc_template.SelectFirstContactTypeForTargetSystem(ContactID, TargetSystem);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else if (e.Item is GridDataItem)
            {
                GridDataItem item   = (GridDataItem)e.Item;
                String       ctc_id = item["ContactID"].Text;

                // Completion indicator (based on company completion)
                int completion = 0;
                Int32.TryParse(item["Completion"].Text, out completion);
                item["Completion"].Text = String.Empty;
                String CssClass = "LowRatingCell HandCursor";
                if (completion >= 66)
                {
                    CssClass = "HighRatingCell HandCursor";
                }
                else if (completion >= 33)
                {
                    CssClass = "MediumRatingCell HandCursor";
                }
                item["Completion"].CssClass = CssClass;
                item["Completion"].ToolTip  = "Contact information is " + completion + "% complete.";

                ContactEmailManager ContactEmailManager = (ContactEmailManager)item["BEmailLink"].FindControl("ContactEmailManager");
                ContactEmailManager.ConfigureControl(true, "BindContactProxy", ctc_id);

                if (SelectableContacts)
                {
                    // Don't Contact Reason
                    if ((item["DontContactReason"].Text != "&nbsp;" && !item["DontContactReason"].Text.Contains("soft")) || item["DontContactUntil"].Text != "&nbsp;")
                    {
                        item["Select"].ToolTip  = "Do-not-contact is set, expand for more details.";
                        item["Select"].CssClass = "DoNotContact HandCursor";
                    }
                    else
                    {
                        item["Select"].CssClass = "HandCursor";
                    }
                }
            }
        }
コード例 #8
0
    private void BindContactCard()
    {
        String qry = "SELECT * FROM db_contact LEFT JOIN db_company ON db_contact.CompanyID = db_company.CompanyID " +
                     "LEFT JOIN db_userpreferences ON db_contact.EmailVerifiedByUserID = db_userpreferences.userid WHERE ContactID=@ContactID";
        DataTable dt_contact = SQL.SelectDataTable(qry, "@ContactID", hf_ctc_id.Value);

        if (dt_contact.Rows.Count > 0)
        {
            String ctc_id = dt_contact.Rows[0]["ContactID"].ToString();
            String cpy_id = dt_contact.Rows[0]["CompanyID"].ToString();

            String name  = (dt_contact.Rows[0]["Title"] + " " + dt_contact.Rows[0]["FirstName"] + " " + dt_contact.Rows[0]["LastName"]).Trim();
            String title = dt_contact.Rows[0]["Title"].ToString(); if (String.IsNullOrEmpty(title))
            {
                title = "-";
            }
            String first_name = dt_contact.Rows[0]["FirstName"].ToString(); if (String.IsNullOrEmpty(first_name))
            {
                first_name = "-";
            }
            String last_name = dt_contact.Rows[0]["LastName"].ToString(); if (String.IsNullOrEmpty(last_name))
            {
                last_name = "-";
            }
            String job_title = dt_contact.Rows[0]["JobTitle"].ToString(); if (String.IsNullOrEmpty(job_title))
            {
                job_title = "-";
            }
            String phone = dt_contact.Rows[0]["Phone"].ToString(); if (String.IsNullOrEmpty(phone))
            {
                phone = "-";
            }
            String mobile = dt_contact.Rows[0]["Mobile"].ToString(); if (String.IsNullOrEmpty(mobile))
            {
                mobile = "-";
            }
            String w_email = dt_contact.Rows[0]["Email"].ToString(); if (String.IsNullOrEmpty(w_email))
            {
                w_email = "-";
            }
            String p_email = dt_contact.Rows[0]["PersonalEmail"].ToString(); if (String.IsNullOrEmpty(p_email))
            {
                p_email = "-";
            }
            String date_added = dt_contact.Rows[0]["DateAdded"].ToString(); if (String.IsNullOrEmpty(date_added))
            {
                date_added = "-";
            }
            String email_verified = dt_contact.Rows[0]["EmailVerified"].ToString(); if (String.IsNullOrEmpty(email_verified))
            {
                email_verified = "-";
            }
            String email_verification_date = dt_contact.Rows[0]["EmailVerificationDate"].ToString(); if (String.IsNullOrEmpty(email_verification_date))
            {
                email_verification_date = "-";
            }
            String email_verification_user_id = dt_contact.Rows[0]["EmailVerifiedByUserID"].ToString(); if (String.IsNullOrEmpty(email_verification_user_id))
            {
                email_verification_user_id = "-";
            }
            String email_verified_name = dt_contact.Rows[0]["fullname"].ToString(); if (String.IsNullOrEmpty(email_verified_name))
            {
                email_verified_name = "-";
            }
            String company = dt_contact.Rows[0]["CompanyName"].ToString(); if (String.IsNullOrEmpty(company))
            {
                company = "-";
            }
            String LinkedInUrl = dt_contact.Rows[0]["LinkedInUrl"].ToString(); if (String.IsNullOrEmpty(LinkedInUrl))
            {
                LinkedInUrl = "-";
            }
            bool is_email_verified = email_verified == "1";

            // Calculate completion and update company table
            int completion = ContactTemplate.BindContact(ctc_id);
            lbl_completion.Text = completion + "%";

            qry = "SELECT * FROM db_contactintype cit, db_contacttype ct WHERE cit.ContactTypeID=ct.ContactTypeID AND SystemName='Lead' AND ContactType='Suspect' AND ContactID=@ctc_id";
            DataTable dt_contact_types = SQL.SelectDataTable(qry, "@ctc_id", ctc_id);
            bool      is_suspect       = dt_contact_types.Rows.Count > 0;

            lbl_name.Text    = Server.HtmlEncode(name);
            lbl_company.Text = Server.HtmlEncode(Util.TruncateText(company, 25));
            if (company.Length > 25)
            {
                lbl_company.Attributes.Add("style", "cursor:pointer;");
                lbl_company.ToolTip = company;
            }

            lbl_phone.Text  = Server.HtmlEncode(phone);
            lbl_mobile.Text = Server.HtmlEncode(mobile);
            hl_w_email.Text = Server.HtmlEncode(w_email);
            if (w_email != "-")
            {
                hl_w_email.NavigateUrl = "mailto:" + w_email;
            }
            hl_p_email.Text = Server.HtmlEncode(p_email);
            if (p_email != "-")
            {
                hl_p_email.NavigateUrl = "mailto:" + p_email;
            }
            hl_linkedin.Text = "No LinkedIn Profile";
            if (LinkedInUrl != "-")
            {
                hl_linkedin.NavigateUrl = LinkedInUrl;
                hl_linkedin.Text        = "View LinkedIn Profile";
            }
            lbl_job_title.Text  = Server.HtmlEncode(job_title);
            lbl_date_added.Text = Server.HtmlEncode(date_added);

            // Set user pic & e-mail verified status
            if (email_verified == "1")
            {
                img_user_pic.ImageUrl = "~/images/leads/contact_card_verified.png";
                img_user_pic.CssClass = "HandCursor";
                img_user_pic.ToolTip  = Server.HtmlEncode("E-mail address verified by " + email_verified_name + " at " + email_verification_date);
            }
            else
            {
                img_user_pic.ImageUrl = "~/images/leads/contact_card.png";
                img_user_pic.ToolTip  = "E-mail not verified";
            }

            // Set view/edit contact button
            lb_edit_contact.OnClientClick =
                "var rw = GetRadWindow(); var rwm = rw.get_windowManager(); " +
                "rwm.open('viewcompanyandcontact.aspx?ctc_id=" + Server.UrlEncode(ctc_id) + "&add_leads=false', \"rw_view_cpy_ctc\"); return false;";
        }
        else
        {
            Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error");
        }
    }