protected void ddlLinkName_SelectedIndexChange(object sender, EventArgs e)
        {
            try
            {
                hdnOpenForm.Value = "true";
                if (ddlLinkName.SelectedIndex != 0)
                {
                    Business.Sales.Leads Obj   = new Business.Sales.Leads();
                    Entity.Sales.Leads   Leads = Obj.GetLeadById(Convert.ToInt32(ddlLinkName.SelectedValue), Convert.ToInt32(ActityType.Account), Convert.ToInt32(ActityType.Lead));
                    if (Leads.Id != 0)
                    {
                        ddlCampaign.SelectedValue = Leads.CampaignId == null ? "0" : Leads.CampaignId.ToString();
                        txtDescription.Text       = Leads.Description;
                        txtName.Text = Leads.Name;
                    }
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
Ejemplo n.º 2
0
        public int SaveLeads(Entity.Sales.Leads Model)
        {
            LeadsDbModel DbModel = new LeadsDbModel();

            Model.CopyPropertiesTo(DbModel);
            return(LeadsDataAccess.SaveLeads(DbModel));
        }
Ejemplo n.º 3
0
 private void Save()
 {
     if (LeadControlValidation())
     {
         Business.Sales.Leads Obj   = new Business.Sales.Leads();
         Entity.Sales.Leads   Model = new Entity.Sales.Leads
         {
             Id                   = LeadId,
             DepartmentId         = ddlDepartment.SelectedValue == "0" ? (int?)null : Convert.ToInt32(ddlDepartment.SelectedValue),
             CampaignId           = ddlCampaign.SelectedValue == "0" ? (int?)null : Convert.ToInt32(ddlCampaign.SelectedValue),
             CreatedBy            = Convert.ToInt32(HttpContext.Current.User.Identity.Name),
             Description          = txtDescription.Text,
             Name                 = txtName.Text,
             AlternateAddress     = txtAlternateAddress.Text,
             Email                = txtEmailId.Text,
             Fax                  = txtFax.Text,
             LeadScore            = txtLeadScore.Text == "" ? (decimal?)null : Convert.ToDecimal(txtLeadScore.Text),
             OfficePhone          = txtOfficePhone.Text,
             PrimaryAddress       = txtPrimaryAddress.Text,
             Website              = txtWebsite.Text,
             IsActive             = true,
             ActivityLinkId       = ActivityLinkId,
             ChildActivityTypeId  = Convert.ToInt32(ActityType.Lead),
             SourceActivityTypeId = Convert.ToInt32(ActityType.Account),
             SourceActivityId     = ddlLinkName.SelectedValue == "0" ? (int?)null : Convert.ToInt32(ddlLinkName.SelectedValue)
         };
         int rows = Obj.SaveLeads(Model);
         if (rows > 0)
         {
             ClearControls();
             LoadLeadList();
             LeadId            = 0;
             Message.IsSuccess = true;
             Message.Text      = "Saved Successfully";
         }
         else
         {
             Message.IsSuccess = false;
             Message.Text      = "Unable to save data.";
         }
         Message.Show = true;
     }
 }
Ejemplo n.º 4
0
 private void GetLeadById()
 {
     Business.Sales.Leads Obj   = new Business.Sales.Leads();
     Entity.Sales.Leads   Leads = Obj.GetLeadById(LeadId, Convert.ToInt32(ActityType.Account), Convert.ToInt32(ActityType.Lead));
     if (Leads.Id != 0)
     {
         ddlCampaign.SelectedValue   = Leads.CampaignId == null ? "0" : Leads.CampaignId.ToString();
         ddlDepartment.SelectedValue = Leads.DepartmentId == null ? "0" : Leads.DepartmentId.ToString();
         txtDescription.Text         = Leads.Description;
         txtAlternateAddress.Text    = Leads.AlternateAddress;
         txtEmailId.Text             = Leads.Email;
         txtFax.Text               = Leads.Fax;
         txtLeadScore.Text         = Leads.LeadScore.ToString();
         txtName.Text              = Leads.Name;
         txtOfficePhone.Text       = Leads.OfficePhone;
         txtPrimaryAddress.Text    = Leads.PrimaryAddress;
         txtWebsite.Text           = Leads.Website;
         ddlLinkName.SelectedValue = Leads.SourceActivityId == null ? "0" : Leads.SourceActivityId.ToString();
         ActivityLinkId            = Leads.ActivityLinkId;
     }
 }
Ejemplo n.º 5
0
 public Entity.Sales.Leads GetLeadById(int Id, int SourceTypeId, int ChildTypeId)
 {
     Entity.Sales.Leads Lead = new Entity.Sales.Leads();
     LeadsDataAccess.GetLeadById(Id, SourceTypeId, ChildTypeId).CopyPropertiesTo(Lead);
     return(Lead);
 }