Beispiel #1
0
    /// <summary>
    /// Handles the TextChanged event of the txtQualificationDescription* controls, used to update the corresponding LeadQualification entity.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void txtQualificationDescription_TextChanged(object sender, EventArgs e)
    {
        TextBox tb = sender as TextBox;

        if (tb != null)
        {
            string Id = tb.Attributes[cQualificationId];
            if (!string.IsNullOrEmpty(Id))
            {
                IQualification qualification = EntityFactory.GetById <IQualification>(Id);
                if (qualification != null)
                {
                    ILead lead = GetCurrentLead();
                    if (lead != null)
                    {
                        ILeadQualification lead_qual = GetLeadQualification(lead, qualification);
                        if (lead_qual != null)
                        {
                            lead_qual.Notes = tb.Text;
                            lead_qual.Save();
                        }
                        else
                        {
                            ILeadQualification new_qual = EntityFactory.Create <ILeadQualification>();
                            new_qual.Lead          = lead;
                            new_qual.Qualification = qualification;
                            new_qual.Notes         = tb.Text;
                            new_qual.Save();
                        }
                    }
                }
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// Handles the CheckedChanged event of the chkQualificationSelected* controls, used to update the corresponding LeadQualification entity.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void ChkQualificationSelectedCheckedChanged(object sender, EventArgs e)
    {
        CheckBox cb = sender as CheckBox;

        if (cb != null)
        {
            string Id = cb.Attributes[cQualificationId];
            if (!string.IsNullOrEmpty(Id))
            {
                IQualification qualification = EntityFactory.GetById <IQualification>(Id);
                if (qualification != null)
                {
                    ILead lead = GetCurrentLead();
                    if (lead != null)
                    {
                        ILeadQualification lead_qual = GetLeadQualification(lead, qualification);
                        if (lead_qual != null)
                        {
                            lead_qual.Checked = cb.Checked;
                            lead_qual.Save();
                        }
                        else
                        {
                            ILeadQualification new_qual = EntityFactory.Create <ILeadQualification>();
                            new_qual.Lead          = lead;
                            new_qual.Qualification = qualification;
                            new_qual.Checked       = cb.Checked;
                            new_qual.Save();
                        }
                    }
                }
            }
        }
    }