Exemplo n.º 1
0
    private void BindSalesRepresentativeDropDown()
    {
        ISalesRepresentativeRepository salesRepresentativeRepository = new SalesRepresentativeRepository();

        SalesRepDropDown.DataSource     = CurrentRole == Roles.FranchisorAdmin ? salesRepresentativeRepository.GetAllSalesRepresentatives() : GetSalesRepresentativesForFranchisee(Convert.ToInt64(FranchiseeId));
        SalesRepDropDown.DataTextField  = "Name";
        SalesRepDropDown.DataValueField = "SalesRepresentativeId";
        SalesRepDropDown.DataBind();
        SalesRepDropDown.Items.Insert(0, new ListItem("--All--", "0"));
    }
Exemplo n.º 2
0
    /// <summary>
    /// Binds all Sales Rep Drop Down
    /// </summary>
    private void BindSalesRepDropDown()
    {
        //Fill salesrep dropdown

        var currentOrgRole = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole;

        if (currentOrgRole.CheckRole((long)Roles.FranchisorAdmin) || currentOrgRole.CheckRole((long)Roles.FranchiseeAdmin))
        {
            spanSalesPerson.Style.Add(HtmlTextWriterStyle.Display, "block");
        }
        else
        {
            spanSalesPerson.Style.Add(HtmlTextWriterStyle.Display, "none");
        }

        ISalesRepresentativeRepository salesRepRepo = new SalesRepresentativeRepository();
        List <SalesRepresentative>     salesReps    = null;

        if (currentOrgRole.CheckRole((long)Roles.FranchiseeAdmin))
        {
            salesReps = salesRepRepo.GetSalesRepresentativesForFranchisee(IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.OrganizationId);
        }
        else if (currentOrgRole.CheckRole((long)Roles.FranchisorAdmin))
        {
            salesReps = salesRepRepo.GetAllSalesRepresentatives();
        }

        if (salesReps != null)
        {
            ddlSalesPerson.DataSource     = salesReps;
            ddlSalesPerson.DataTextField  = "NameAsString";
            ddlSalesPerson.DataValueField = "Id";
            ddlSalesPerson.DataBind();
            ddlSalesPerson.Items.Insert(0, new ListItem("All", "0"));
        }

        hidUserId.Value = IoC.Resolve <ISessionContext>().UserSession.UserId.ToString();
        if (FranchiseeView == false)
        {
            if (ddlSalesPerson.Items.FindByValue(hidUserId.Value) != null)
            {
                ddlSalesPerson.Items.FindByValue(hidUserId.Value).Selected = true;
                ddlSalesPerson.Enabled           = false;
                _spnDistance.Attributes["class"] = "titletext_default";
            }
        }
        hidRole.Value = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.RoleAlias;
    }
Exemplo n.º 3
0
    private List <SalesRepresentative> GetSalesRepresentativesForFranchisee(long franchiseeId)
    {
        ISalesRepresentativeRepository salesRepresentativeRepository = new SalesRepresentativeRepository();

        return(franchiseeId == 0 ? salesRepresentativeRepository.GetAllSalesRepresentatives() : salesRepresentativeRepository.GetSalesRepresentativesForFranchisee(franchiseeId));
    }