Beispiel #1
0
    private void BindTemplate()
    {
        String qry = "SELECT dbl_lead.*, db_company.*, db_contact.ctc_id " +
                     "FROM dbl_lead, db_contact, db_company " +
                     "WHERE dbl_lead.ContactID = db_contact.ctc_id " +
                     "AND db_contact.new_cpy_id = db_company.cpy_id " +
                     "AND dbl_lead.LeadID=@LeadID;";
        DataTable dt_lead = SQL.SelectDataTable(qry, "@LeadID", hf_lead_id.Value);

        if (dt_lead.Rows.Count > 0)
        {
            String cpy_id     = dt_lead.Rows[0]["cpy_id"].ToString();
            String ctc_id     = dt_lead.Rows[0]["ctc_id"].ToString();
            String project_id = dt_lead.Rows[0]["ProjectID"].ToString();

            hf_project_id.Value        = project_id;
            hf_parent_project_id.Value = LeadsUtil.GetProjectParentIDFromID(hf_project_id.Value);
            hf_cpy_id.Value            = cpy_id;
            hf_ctc_id.Value            = ctc_id;

            // Bind Company and Contacts
            CompanyManager.BindCompany(cpy_id);
            ContactManager.BindContact(ctc_id);

            // Bind Notes and Next Action
            ContactNotesManager.LeadID = hf_lead_id.Value;
            ContactNotesManager.Bind(ctc_id);

            // Bind Other Contacts
            BindOtherContacts(null, null);

            // Bind destination projects
            LeadsUtil.BindProjects(dd_projects, dd_buckets, hf_parent_project_id.Value, hf_project_id.Value, true);
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Util.SetRebindOnWindowClose(this, false);
            if (Request.QueryString["mode"] != null && !String.IsNullOrEmpty(Request.QueryString["mode"]))
            {
                hf_mode.Value = Request.QueryString["mode"];
                if (hf_mode.Value == "new" && Request.QueryString["proj_id"] != null && !String.IsNullOrEmpty(Request.QueryString["proj_id"]))
                {
                    hf_project_id.Value = Request.QueryString["proj_id"];
                }
                else if (hf_mode.Value == "edit" && Request.QueryString["bucket_id"] != null && !String.IsNullOrEmpty(Request.QueryString["bucket_id"]))
                {
                    hf_project_id.Value = Request.QueryString["bucket_id"];
                }

                hf_parent_project_id.Value = LeadsUtil.GetProjectParentIDFromID(hf_project_id.Value);

                SetFormMode();
            }
            else
            {
                Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error");
            }
        }
    }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         LeadsUtil.BindProjects(dd_project, dd_buckets, LeadsUtil.GetProjectParentIDFromID(LeadsUtil.GetLastViewedProjectID()), null, false);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Util.SetRebindOnWindowClose(this, false);
            if (Request.QueryString["proj_id"] != null && !String.IsNullOrEmpty(Request.QueryString["proj_id"]))
            {
                hf_project_id.Value        = Request.QueryString["proj_id"];
                hf_parent_project_id.Value = LeadsUtil.GetProjectParentIDFromID(hf_project_id.Value);
                hf_user_id.Value           = Util.GetUserId();

                // Delete any temp created companies for this user
                String temp_cpy_source = "db_templead_" + Util.GetUserId();
                String dqry            = "DELETE FROM db_contact WHERE CompanyID IN (SELECT CompanyID FROM db_company WHERE Source=@Source); DELETE FROM db_company WHERE Source=@Source;"; // remove all temp contacts/companies for this user
                SQL.Delete(dqry, "@Source", temp_cpy_source);

                // Bind destination projects
                LeadsUtil.BindProjects(dd_projects, dd_buckets, hf_parent_project_id.Value, hf_project_id.Value, true);
            }
            else
            {
                Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error");
            }
        }
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["lead_ids"] != null && !String.IsNullOrEmpty(Request.QueryString["lead_ids"]) &&
                Request.QueryString["project_id"] != null && !String.IsNullOrEmpty(Request.QueryString["project_id"]))
            {
                hf_lead_ids.Value = Request.QueryString["lead_ids"];

                if (Request.QueryString["project_id"].ToString() == "search") // when moving from search, rather than from another project
                {
                    hf_from_search.Value = "1";
                    lbl_title.Text       = "Add your selected contacts to a <b>Project</b> as <b>Leads</b>..";
                    btn_move_leads.Text  = "Add Selected Contacts to Project";
                }
                else
                {
                    hf_bucket_id.Value  = Request.QueryString["project_id"];
                    hf_project_id.Value = LeadsUtil.GetProjectParentIDFromID(hf_bucket_id.Value);
                }

                LeadsUtil.BindProjects(dd_projects, dd_buckets, hf_project_id.Value, hf_bucket_id.Value, true);
            }
            else
            {
                Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error");
            }
        }
    }
Beispiel #6
0
    private void BindCompanyInfo()
    {
        String    qry    = "SELECT cpy_id, ProjectID FROM dbl_lead, db_contact, db_company WHERE dbl_lead.ContactID=db_contact.ctc_id AND db_contact.new_cpy_id=db_company.cpy_id AND LeadID=@lead_id";
        DataTable dt_cpy = SQL.SelectDataTable(qry, "@lead_id", hf_lead_id.Value);

        if (dt_cpy.Rows.Count > 0)
        {
            hf_company_id.Value = dt_cpy.Rows[0]["cpy_id"].ToString();
            hf_project_id.Value = LeadsUtil.GetProjectParentIDFromID(dt_cpy.Rows[0]["ProjectID"].ToString());
            CompanyManager.BindCompany(hf_company_id.Value);
        }
    }
Beispiel #7
0
    protected void DeactivateProject(object sender, EventArgs e)
    {
        if ((dd_del_move_bucket.Items.Count > 0 && dd_del_move_bucket.SelectedItem != null && dd_del_move_bucket.SelectedItem.Value != String.Empty) || dd_del_move_project.SelectedItem.Value == "-1")
        {
            if (User.Identity.IsAuthenticated)
            {
                // If we're chosing to move any existing leads to another project..
                String ParentProjectID = LeadsUtil.GetProjectParentIDFromID(hf_project_id.Value);
                if (dd_del_move_project.SelectedItem.Value != "-1") // move leads
                {
                    String new_project_id = dd_del_move_bucket.SelectedItem.Value;

                    String[] pn = new String[] { "@NewProjectID", "@OldProjectID", "@OldParentProjectID" };
                    Object[] pv = new Object[] { new_project_id, hf_project_id.Value, ParentProjectID };

                    String uqry = "UPDATE dbl_lead SET ProjectID=@NewProjectID WHERE (ProjectID=@OldProjectID OR ProjectID=@OldParentProjectID) OR ProjectID IN (SELECT ProjectID FROM dbl_project WHERE ParentProjectID=@OldParentProjectID)";
                    SQL.Update(uqry, pn, pv);
                }
                else // else de-activate old leads
                {
                    String uqry = "UPDATE dbl_lead SET Active=0, DateUpdated=CURRENT_TIMESTAMP WHERE Active=1 AND ProjectID=@ProjectID OR ProjectID IN (SELECT ProjectID FROM dbl_project WHERE ParentProjectID=@ProjectID)";
                    SQL.Update(uqry, "@ProjectID", ParentProjectID);
                }

                String action = "Project deactivated";
                if (dd_del_move_project.Items.Count > 0)
                {
                    if (dd_del_move_project.SelectedIndex == 0)
                    {
                        action += ", all remaining active Leads were marked inactive (removed).";
                    }
                    else
                    {
                        action += ", all remaining active Leads were moved to the " + dd_del_move_project.SelectedItem.Text + " Project.";
                    }
                }

                // Deactivate and log
                LeadsUtil.ReactivateOrDeactivateProject(hf_project_id.Value, hf_user_id.Value, false, action);
            }

            Util.SetRebindOnWindowClose(this, true);
            Util.CloseRadWindowFromUpdatePanel(this, String.Empty, false);
        }
        else
        {
            Util.PageMessageAlertify(this, "No Client List selected!", "Oops");
        }
    }
Beispiel #8
0
    protected void MakeSuspect(object sender, EventArgs e)
    {
        CompanyManager.UpdateCompany();

        if (CompanyManager.Turnover == null || CompanyManager.Industry == null || (CompanyManager.CompanySize == null && CompanyManager.CompanySizeBracket == null) || CompanyManager.Country == null || CompanyManager.Website == null)
        {
            Util.PageMessageAlertify(this, "You must have Country, Industry, Turnover, Company Size and Website specified " +
                                     "to push this Lead to Prospect.<br/><br/>Click the company edit pencil and specify the required data.", "Data Required");
        }
        else
        {
            String user_id = Util.GetUserId();

            // Find any Leads in this user's Projects which share this company so that they can be pushed to Suspect too
            String qry = "SELECT LeadID, dbl_project.ProjectID FROM dbl_lead, dbl_project, db_contact, db_company " +
                         "WHERE dbl_lead.ContactID=db_contact.ctc_id AND db_contact.new_cpy_id=db_company.cpy_id AND dbl_lead.ProjectID = dbl_project.ProjectID " +
                         "AND dbl_project.UserID=@user_id AND dbl_lead.Active=1 AND dbl_project.Active=1 AND db_company.cpy_id=@cpy_id";
            DataTable dt_leads = SQL.SelectDataTable(qry,
                                                     new String[] { "@user_id", "@cpy_id" },
                                                     new Object[] { user_id, hf_company_id.Value });

            for (int i = 0; i < dt_leads.Rows.Count; i++)
            {
                String this_lead_id    = dt_leads.Rows[i]["LeadID"].ToString();
                String this_project_id = LeadsUtil.GetProjectParentIDFromID(dt_leads.Rows[i]["ProjectID"].ToString());

                String uqry = "UPDATE dbl_lead SET Suspect=1, DateMadeSuspect=CURRENT_TIMESTAMP, " +
                              "ProjectID=(SELECT ProjectID FROM dbl_project WHERE name='Suspects' AND UserID=@user_id AND ParentProjectID=@project_id) WHERE LeadID=@lead_id";
                SQL.Update(uqry,
                           new String[] { "@lead_id", "@user_id", "@project_id" },
                           new Object[] { this_lead_id, user_id, this_project_id });

                // Leads Log
                LeadsUtil.AddLeadHistoryEntry(this_lead_id, "Pushed to Suspect.");
            }

            LeadsUtil.SetNoRebindOnWindowClose(udp_pts, false);
            Util.CloseRadWindowFromUpdatePanel(this, String.Empty, false);
        }
    }
    protected void rb_save_dest_proj_Click(object sender, EventArgs e)
    {
        RadButton       rb               = (RadButton)sender;
        String          TempLeadID       = rb.CommandArgument;
        String          SelectedBucketID = rb.CommandName;
        RadDropDownList dd_project       = (RadDropDownList)rb.Parent.FindControl("dd_project_" + TempLeadID);
        RadDropDownList dd_bucket        = (RadDropDownList)rb.Parent.FindControl("dd_bucket_" + TempLeadID);

        if (dd_project.Items.Count > 0 && dd_project.SelectedItem != null && dd_bucket.Items.Count > 0 && dd_bucket.SelectedItem != null)
        {
            String DestinationProjectID = SelectedBucketID;
            if (DestinationProjectID == String.Empty)
            {
                DestinationProjectID = null;
            }
            String uqry = "UPDATE dbl_temp_leads SET DestinationProjectID=@DestProjectID WHERE TempLeadID=@TempLeadID";
            SQL.Update(uqry,
                       new String[] { "@DestProjectID", "@TempLeadID" },
                       new Object[] { DestinationProjectID, TempLeadID });

            // Rebind, as dropdowns will have been bound by BuildNotesTooltip being called by AjaxUpdate automatically prior to saving of the DestinationID
            String SelectedProjectID = String.Empty;
            if (SelectedBucketID != null)
            {
                SelectedProjectID = LeadsUtil.GetProjectParentIDFromID(SelectedBucketID);

                // 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));
            }
            else
            {
                dd_project.SelectedIndex = 0;
                dd_bucket.SelectedIndex  = 0;
            }
        }

        Util.PageMessageSuccess(this, "Destination Project Saved!");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Util.SetRebindOnWindowClose(this, false);

            bool error = false;
            if (Request.QueryString["cpy_id"] != null && !String.IsNullOrEmpty(Request.QueryString["cpy_id"]))
            {
                hf_cpy_id.Value = Request.QueryString["cpy_id"];
            }
            else if (Request.QueryString["ctc_id"] != null && !String.IsNullOrEmpty(Request.QueryString["ctc_id"]))
            {
                hf_ctc_id.Value = Request.QueryString["ctc_id"];
                String qry = "SELECT CompanyID FROM db_contact WHERE ContactID=@ContactID";
                hf_cpy_id.Value = SQL.SelectString(qry, "CompanyID", "@ContactID", hf_ctc_id.Value);
            }
            else
            {
                Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error");
                error = true;
            }

            // Disable adding to Leads system/selecting contacts when add_leads=false
            bool InLeadsMode = true;
            if (Request.QueryString["add_leads"] != null && Request.QueryString["add_leads"].ToString() == "false")
            {
                div_add_leads.Visible             = lbl_pad.Visible = false;
                InLeadsMode                       = false;
                ContactManager.SelectableContacts = false;
            }

            if (!error)
            {
                if (hf_ctc_id.Value != String.Empty)
                {
                    ContactManager.FocusContactID = hf_ctc_id.Value;
                }

                String[] ForcedSelectedContactIDs = null;
                if (hf_ctc_id.Value != String.Empty)
                {
                    ForcedSelectedContactIDs = new String[] { hf_ctc_id.Value }
                }
                ;

                CompanyManager.BindCompany(hf_cpy_id.Value);
                ContactManager.BindContacts(hf_cpy_id.Value, ForcedSelectedContactIDs);

                if (InLeadsMode)
                {
                    // Allow adding Leads to projects if this user has projects (or has used Leads system)
                    hf_project_id.Value = LeadsUtil.GetLastViewedProjectID();
                    if (hf_project_id.Value != String.Empty)
                    {
                        div_add_leads.Visible      = true;
                        hf_parent_project_id.Value = LeadsUtil.GetProjectParentIDFromID(hf_project_id.Value);

                        // Bind destination projects
                        LeadsUtil.BindProjects(dd_projects, dd_buckets, hf_parent_project_id.Value, hf_project_id.Value, true);
                    }
                    // Otherwise disable adding Leads and allow updates to CTC/CPY only
                    else
                    {
                        ContactManager.SelectableContacts = false;
                    }
                }
            }
        }

        Util.ResizeRadWindow(this);
    }
    // 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;
    }
Beispiel #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Util.SetRebindOnWindowClose(this, false);
            if (Request.QueryString["mode"] != null && !String.IsNullOrEmpty(Request.QueryString["mode"]))
            {
                hf_mode.Value = Request.QueryString["mode"];
                if (hf_mode.Value == "new" && Request.QueryString["user_id"] != null && !String.IsNullOrEmpty(Request.QueryString["user_id"]))
                {
                    hf_user_id.Value = Request.QueryString["user_id"];
                }
                else if (hf_mode.Value == "edit" && Request.QueryString["proj_id"] != null && !String.IsNullOrEmpty(Request.QueryString["proj_id"]))
                {
                    hf_project_id.Value        = Request.QueryString["proj_id"];
                    hf_parent_project_id.Value = LeadsUtil.GetProjectParentIDFromID(hf_project_id.Value);

                    // Shared project stuff
                    if (Request.QueryString["shared"] != null && Request.QueryString["shared"] == "False")
                    {
                        btn_move_or_share.OnClientClicking = "function(button, args){ var rw = GetRadWindow(); var rwm = rw.get_windowManager(); " +
                                                             "rwm.open('assignproject.aspx?project_id=" + Server.UrlEncode(hf_parent_project_id.Value) + "&cca_action=1','rw_modify_project').set_title('Move or Share Project'); return false; }";

                        String    qry = "SELECT dbl_project_share.UserID, fullname FROM dbl_project_share, db_userpreferences WHERE dbl_project_share.UserId=db_userpreferences.userid AND ProjectID=@ParentProjID";
                        DataTable dt_shared_recipients = SQL.SelectDataTable(qry, "@ParentProjID", hf_parent_project_id.Value);
                        bool      IsShared             = dt_shared_recipients.Rows.Count > 0;
                        if (IsShared)
                        {
                            tr_sharing_management.Visible = true;

                            for (int i = 0; i < dt_shared_recipients.Rows.Count; i++)
                            {
                                RadTreeNode n = new RadTreeNode(Server.HtmlEncode(dt_shared_recipients.Rows[i]["fullname"].ToString()), dt_shared_recipients.Rows[i]["UserID"].ToString());
                                n.Checkable = true;
                                n.Checked   = true;
                                n.CssClass  = "RadTreeNode";
                                rtv_share_recipients.Nodes[0].Nodes.Add(n);
                            }

                            Util.PageMessageSuccess(this, "Note, this Project is shared with other staff members. Manage sharing at the top.");
                        }
                    }
                    else
                    {
                        // ensure shared recipient can't delete the project (but can remove it from their list)
                        lbl_header_delete.Text              = "Remove this shared <b>Project</b> from your list..";
                        lbl_title_delete.Text               = "If you click Remove Project you will no longer see this shared Project in your Project list, however no Leads will be affected and there will be no effect to the owner of the Project.";
                        tr_delete_select.Visible            = tr_delete_select_2.Visible = false;
                        btn_delete_project.Text             = "Remove Project";
                        btn_delete_project.OnClientClicking = "function(button, args){ AlertifyConfirm('Are you sure?', 'Sure?', 'Body_btn_remove_project_serv', false);}";
                        btn_move_or_share.OnClientClicking  = "function(button, args){ Alertify('You cannot move or share a Project that has been shared with you','Nope'); return false; }";
                    }
                }

                BindDropDowns();
                SetFormMode();
            }
            else
            {
                Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error");
            }
        }
    }