/// <summary>
 /// Handles the SelectedIndexChanged event of the ddlTargetStatus control.
 /// </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 cmdStatusChange_OnClick(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtSelectedTargetId.Value))
     {
         ICampaignTarget target = EntityFactory.GetRepository <ICampaignTarget>().Get(txtSelectedTargetId.Value);
         if (target != null)
         {
             target.Status = txtNewStatusValue.Value;
             target.Save();
             if (target.Status.Equals(GetLocalResourceObject("Status_Response").ToString()))
             {
                 bool            isLead         = target.TargetType.Equals("Lead");
                 ITargetResponse targetResponse = EntityFactory.Create <ITargetResponse>();
                 targetResponse.CampaignTarget = target;
                 targetResponse.Campaign       = target.Campaign;
                 if (isLead)
                 {
                     targetResponse.Lead = EntityFactory.GetById <ILead>(target.EntityId);
                 }
                 else
                 {
                     targetResponse.Contact = EntityFactory.GetById <IContact>(target.EntityId);
                 }
                 ShowResponseView(targetResponse, isLead);
             }
         }
         txtSelectedTargetId.Value = String.Empty;
         txtNewStatusValue.Value   = String.Empty;
     }
 }
 /// <summary>
 /// Removes the target association from the campaign by updating its status.
 /// </summary>
 /// <param name="targetId">The target id.</param>
 private void RemoveTargetAssociation(string targetId)
 {
     if (!String.IsNullOrEmpty(targetId))
     {
         ICampaignTarget campaignTarget = EntityFactory.GetRepository <ICampaignTarget>().Get(targetId);
         if (campaignTarget != null)
         {
             campaignTarget.Status = GetLocalResourceObject("TargetStatus_Removed").ToString();
             campaignTarget.Save();
             LoadMarketing();
         }
     }
 }
 /// <summary>
 /// Handles the OnClick event of the cmdInitialTarget control.
 /// </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 cmdInitialTarget_OnClick(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtSelectedTargetId.Value))
     {
         ICampaignTarget target = EntityFactory.GetRepository <ICampaignTarget>().Get(txtSelectedTargetId.Value);
         if (target != null)
         {
             target.InitialTarget = Convert.ToBoolean(txtNewInitialTargetValue.Value);
             target.Save();
         }
         txtSelectedTargetId.Value      = String.Empty;
         txtNewInitialTargetValue.Value = String.Empty;
     }
 }