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); } }
private void BindContact() { String qry = "SELECT * FROM db_contact LEFT JOIN db_company ON db_contact.new_cpy_id = db_company.cpy_id " + "LEFT JOIN db_userpreferences ON db_contact.email_verification_user_id = db_userpreferences.userid WHERE ctc_id=@ctc_id"; DataTable dt_contact = SQL.SelectDataTable(qry, "@ctc_id", hf_ctc_id.Value); if (dt_contact.Rows.Count > 0) { String ctc_id = dt_contact.Rows[0]["ctc_id"].ToString(); String cpy_id = dt_contact.Rows[0]["new_cpy_id"].ToString(); // Bind contacts ContactManager.BindContact(ctc_id); hf_cpy_id.Value = cpy_id; String name = (dt_contact.Rows[0]["title"] + " " + dt_contact.Rows[0]["first_name"] + " " + dt_contact.Rows[0]["last_name"]).Trim(); lbl_title.Text = "Editing <b>" + Server.HtmlEncode(name) + "</b>.."; } else { Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error"); } }