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;
            }
        }
Пример #2
0
        protected void gvLeads_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Ed")
                {
                    LeadId = Convert.ToInt32(e.CommandArgument.ToString());
                    GetLeadById();
                    Message.Show = false;
                    LoadSocialMediaList();
                    btnSave.Text = "Update";
                    PopulateItems();
                    hdnOpenForm.Value = "true";
                }
                else if (e.CommandName == "View")
                {
                    LeadId = Convert.ToInt32(e.CommandArgument.ToString());
                    GetLeadById();
                    LoadSocialMediaList();
                    PopulateItems();
                    hdnOpenForm.Value = "true";
                }
                else if (e.CommandName == "Del")
                {
                    Business.Sales.Leads Obj = new Business.Sales.Leads();
                    int rows = Obj.DeleteLeads(Convert.ToInt32(e.CommandArgument.ToString()));
                    if (rows > 0)
                    {
                        ClearControls();
                        LoadLeadList();
                        Message.IsSuccess = true;
                        Message.Text      = "Deleted Successfully";
                    }
                    else
                    {
                        Message.IsSuccess = false;
                        Message.Text      = "Data Dependency Exists";
                    }
                    Message.Show = true;
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
Пример #3
0
 private void LoadLeadList()
 {
     Business.Sales.Leads       Obj   = new Business.Sales.Leads();
     Entity.Sales.GetLeadsParam Param = new Entity.Sales.GetLeadsParam {
         CampaignId = null, DepartmentId = null, Name = null, Email = null, SourceActivityTypeId = Convert.ToInt32(ActityType.Account), ChildActivityTypeId = Convert.ToInt32(ActityType.Lead)
     };
     if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
     {
         Param.AssignEngineer = 0;
     }
     else
     {
         Param.AssignEngineer = int.Parse(HttpContext.Current.User.Identity.Name);
     }
     gvLeads.DataSource = Obj.GetAllLeads(Param);
     gvLeads.DataBind();
 }
Пример #4
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;
     }
 }
Пример #5
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;
     }
 }
Пример #6
0
        private void LoadLeadsDropdowns()
        {
            Business.Sales.Leads          Obj         = new Business.Sales.Leads();
            Business.Sales.Campaign       CampaignObj = new Business.Sales.Campaign();
            Entity.Sales.GetCampaignParam Param       = new Entity.Sales.GetCampaignParam
            {
                EndDate   = DateTime.MinValue,
                StartDate = DateTime.MinValue,
                Name      = null
            };
            ddlCampaign.DataSource     = CampaignObj.GetAllCampaign(Param);
            ddlCampaign.DataTextField  = "Name";
            ddlCampaign.DataValueField = "Id";
            ddlCampaign.DataBind();
            ddlCampaign.InsertSelect();

            ddlDepartment.DataSource     = Obj.GetDepartment();
            ddlDepartment.DataTextField  = "Name";
            ddlDepartment.DataValueField = "Id";
            ddlDepartment.DataBind();
            ddlDepartment.InsertSelect();
        }