예제 #1
0
    protected void txtTransporter_TextChanged(object sender, EventArgs e)
    {
        OnSelectingTransporter(this, new SelectingTransporterEventArgs()
        {
            TransporterName = txtTransporter.Text
        });
        ProfileManager profileManager;

        if (txtTransporter.Text.Contains('|'))
        {
            profileManager     = new ProfileManager(this);
            transporterManager = new TransporterManager(this);

            string[] identifications = txtTransporter.Text.Split('|');
            string   identification  = identifications[0].ToString().Trim();

            LegalEntityProfile legalEntityProfile = profileManager.GetLegalEntityProfile(identification);
            if (legalEntityProfile != null)
            {
                transporter = transporterManager.GetTransporterByLegalEntityProfile(Page.Company.CompanyId, legalEntityProfile.LegalEntityProfileId);
            }

            ShowTransporter(transporter);
        }
    }
    protected void txtTransporter_TextChanged(object sender, EventArgs e)
    {
        OnSelectingTransporter(this, new SelectingTransporterEventArgs() { TransporterName = txtTransporter.Text });
        ProfileManager profileManager;
        if (txtTransporter.Text.Contains('|'))
        {
            profileManager = new ProfileManager(this);
            transporterManager = new TransporterManager(this);

            string[] identifications = txtTransporter.Text.Split('|');
            string identification = identifications[0].ToString().Trim();

            LegalEntityProfile legalEntityProfile = profileManager.GetLegalEntityProfile(identification);
            if (legalEntityProfile != null)
                transporter = transporterManager.GetTransporterByLegalEntityProfile(Page.Company.CompanyId, legalEntityProfile.LegalEntityProfileId);

            ShowTransporter(transporter);
        }
    }
예제 #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Transporter transporter = new Transporter();

        if (Profile_LegalEntity1.CompanyProfileEntity != null)
        {
            originalTransporter = manager.GetTransporterByLegalEntityProfile(Company.CompanyId, Profile_LegalEntity1.CompanyProfileEntity.LegalEntityProfileId);
        }
        else if (Page.ViewState["TransporterId"] != null)
        {
            originalTransporter = manager.GetTransporter(Convert.ToInt32(Page.ViewState["TransporterId"]));
        }

        if (originalTransporter != null)
        {
            transporter.CopyPropertiesFrom(originalTransporter);
        }

        transporter.CompanyId            = Company.MatrixId.Value;
        transporter.ModifiedDate         = DateTime.Now;
        transporter.LegalEntityProfileId = Profile_LegalEntity1.CompanyProfileEntity.LegalEntityProfileId;

        //
        // Add entity for insert
        //
        if (transporter.LegalEntityProfileId == 0)
        {
            transporter.LegalEntityProfile = Profile_LegalEntity1.CompanyProfileEntity;
        }

        if (Page.ViewState["TransporterId"] == null && Page.ViewState["ProfileExists"] != "0")
        {
            manager.Insert(transporter);
        }
        else
        {
            manager.Update(originalTransporter, transporter);
        }
        Response.Redirect("Transporters.aspx");
    }