Exemple #1
0
    /// <summary>
    /// this method return true if the representant exist
    /// </summary>
    /// <returns></returns>
    private bool ExistRepresentant()
    {
        Boolean existRepresentant = false;

        manager = new RepresentantManager(this);

        if (manager.GetRepresentantByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["ProfileId"])) != null)
        {
            existRepresentant = true;
        }

        if (manager.GetRepresentantByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["LegalEntityProfileId"])) != null)
        {
            existRepresentant = true;
        }

        return(existRepresentant);
    }
    /// <summary>
    /// this method return true if the representant exist
    /// </summary>
    /// <returns></returns>
    private bool ExistRepresentant()
    {
        Boolean existRepresentant = false;
        manager = new RepresentantManager(this);

        if (manager.GetRepresentantByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["ProfileId"])) != null)
            existRepresentant = true;

        if (manager.GetRepresentantByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["LegalEntityProfileId"])) != null)
            existRepresentant = true;

        return existRepresentant;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        manager = new RepresentantManager(this);

        //retrieve the RepresentantId from Modal Popup
        if (!String.IsNullOrEmpty(Request["RepresentantId"]))
        {
            Page.ViewState["RepresentantId"] = Request["RepresentantId"];
            lblRepresentantCode.Visible = true;
            lblRepresentantCode.Text = "Código do Representante: " + Request["RepresentantId"];
        }

        if (Context.Items["RepresentantId"] != null)
            Page.ViewState["RepresentantId"] = Context.Items["RepresentantId"];

        if (Page.ViewState["RepresentantId"] != null)
        {
            original_representant = manager.GetRepresentant(Convert.ToInt32(Page.ViewState["RepresentantId"]));

            if (!IsPostBack && original_representant != null)
            {
                /*
                 * The code below checks the type of profile(LegalEntityProfile/Profile)
                */
                if (original_representant.LegalEntityProfile != null)
                    Profile1.CompanyProfileEntity = original_representant.LegalEntityProfile;
                else
                    Profile1.ProfileEntity = original_representant.Profile;

                //
                //load bank informations
                //

                if (original_representant.BankId.HasValue)
                    cboBank.SelectedValue = Convert.ToString(original_representant.BankId);

                txtAccountNumber.Text = original_representant.AccountNumber;
                txtAgency.Text = original_representant.Agency;

                //
                //load ranking value
                //
                if (original_representant.Rating != null)
                    rtnRating.CurrentRating = Convert.ToInt32(original_representant.Rating);
            }
        }
        else
        {
            //
            //  Legal Entity
            //
            if (Page.ViewState["LegalEntityProfileId"] != null)
            {
                original_representant = manager.GetRepresentantByLegalEntityProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["LegalEntityProfileId"]));
                if (original_representant != null)
                {
                    Page.ViewState["ProfileExists"] = "0";

                    /*
                     * if isn't a postback set the values of company in profile_LegalEntity1
                     * else the values are reload in all postback
                     * 
                     */
                    if (!IsPostBack)
                        Profile1.CompanyProfileEntity = original_representant.LegalEntityProfile;

                }
            }

            //
            // Natural Person
            //
            if (Page.ViewState["ProfileId"] != null)
            {
                original_representant = manager.GetRepresentantByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["ProfileId"]));
                if (original_representant != null)
                {
                    Page.ViewState["ProfileExists"] = "0";
                    /*if isn't a postback set the values of company in profile
                     * else the values are reload in all postback
                     */
                    if (!IsPostBack)
                        Profile1.ProfileEntity = original_representant.Profile;
                }
            }
            if (original_representant != null)
                Page.ViewState["RepresentantId"] = original_representant.RepresentantId;
        }
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        manager = new RepresentantManager(this);

        //retrieve the RepresentantId from Modal Popup
        if (!String.IsNullOrEmpty(Request["RepresentantId"]))
        {
            Page.ViewState["RepresentantId"] = Request["RepresentantId"];
            lblRepresentantCode.Visible      = true;
            lblRepresentantCode.Text         = "Código do Representante: " + Request["RepresentantId"];
        }

        if (Context.Items["RepresentantId"] != null)
        {
            Page.ViewState["RepresentantId"] = Context.Items["RepresentantId"];
        }

        if (Page.ViewState["RepresentantId"] != null)
        {
            original_representant = manager.GetRepresentant(Convert.ToInt32(Page.ViewState["RepresentantId"]));

            if (!IsPostBack && original_representant != null)
            {
                /*
                 * The code below checks the type of profile(LegalEntityProfile/Profile)
                 */
                if (original_representant.LegalEntityProfile != null)
                {
                    Profile1.CompanyProfileEntity = original_representant.LegalEntityProfile;
                }
                else
                {
                    Profile1.ProfileEntity = original_representant.Profile;
                }

                //
                //load bank informations
                //

                if (original_representant.BankId.HasValue)
                {
                    cboBank.SelectedValue = Convert.ToString(original_representant.BankId);
                }

                txtAccountNumber.Text = original_representant.AccountNumber;
                txtAgency.Text        = original_representant.Agency;

                //
                //load ranking value
                //
                if (original_representant.Rating != null)
                {
                    rtnRating.CurrentRating = Convert.ToInt32(original_representant.Rating);
                }
            }
        }
        else
        {
            //
            //  Legal Entity
            //
            if (Page.ViewState["LegalEntityProfileId"] != null)
            {
                original_representant = manager.GetRepresentantByLegalEntityProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["LegalEntityProfileId"]));
                if (original_representant != null)
                {
                    Page.ViewState["ProfileExists"] = "0";

                    /*
                     * if isn't a postback set the values of company in profile_LegalEntity1
                     * else the values are reload in all postback
                     *
                     */
                    if (!IsPostBack)
                    {
                        Profile1.CompanyProfileEntity = original_representant.LegalEntityProfile;
                    }
                }
            }

            //
            // Natural Person
            //
            if (Page.ViewState["ProfileId"] != null)
            {
                original_representant = manager.GetRepresentantByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["ProfileId"]));
                if (original_representant != null)
                {
                    Page.ViewState["ProfileExists"] = "0";

                    /*if isn't a postback set the values of company in profile
                     * else the values are reload in all postback
                     */
                    if (!IsPostBack)
                    {
                        Profile1.ProfileEntity = original_representant.Profile;
                    }
                }
            }
            if (original_representant != null)
            {
                Page.ViewState["RepresentantId"] = original_representant.RepresentantId;
            }
        }
    }