Announcement

Collapse
No announcement yet.

c#-Problem zu Mobile CRM Express

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • c#-Problem zu Mobile CRM Express

    Hallo zusammen,

    ich habe ein Problem, mit dem MS CRM Mobile Express. Dort gibt es eine Kundendetailsseite. Ich möchte diese gerne optimierten. Nur weiß ich nicht wie. Die Daten stehen immer unterneinander, doch ich möchte diese der Übersicht halber nebeneinander schreiben.

    Jetzt:

    Kunde:

    KundeXX

    So soll es aussehen: Kunde: KundeXX

    Ich poste dazu den Code der Seite. Hinzu kommt, dass ich mit mit C# überhaupt nicht auskenne. Über Hilfe würde ich mich sehr freuen! Hier der Code der aspx.cs-Seite:



    public partial class EntityReadOnly : Mobile

    {

    protected EntityForm _entityForm;

    protected void Page_Load(object sender, EventArgs e)

    {

    //Create the entity form for the instance

    _entityForm = new EntityForm(this, true);

    //Add the entity form

    TheForm.Controls.Add(_entityForm);

    BreadCrumbsControl breadCrumbs = Master.FindControl("BreadCrumbs") as BreadCrumbsControl;

    breadCrumbs.HomePageName = MobileUtility.GetResource("HomePageText");

    breadCrumbs.HomePageUrl = "Home.aspx";


    string referencingEntity = HttpUtility.HtmlEncode(Request.QueryString["referencingentity"]);

    string referencingRecordName = HttpUtility.HtmlEncode(Request.QueryString["referencingrecordname"]);

    string referencingId = HttpUtility.HtmlEncode(Request.QueryString["referencingid"]);


    // Coming from the related entities home page will give us the above querystring values

    // They must all be present in order for this page to "act" as the 5th layer of the BC control

    if ((referencingEntity != null && referencingEntity.Length != 0) &&

    (referencingRecordName != null && referencingRecordName.Length != 0) &&

    (referencingId != null && referencingId.Length != 0))

    {

    Guid referencingGuid = new Guid(referencingId);


    EntityMetadata referencingMetadata = MetadataCache.GetEntityMetadata(referencingEntity) ;

    breadCrumbs.EntityHomePageName = HttpUtility.HtmlEncode(referencingMetadata.Display CollectionName);

    breadCrumbs.EntityHomePageUrl = "EntityHome.aspx?entity=" + referencingMetadata.Name;

    breadCrumbs.RecordPageName = referencingRecordName;

    breadCrumbs.RecordPageUrl = "EntityReadOnly.aspx?entity=" + referencingMetadata.Name + "&" + referencingMetadata.PrimaryKey + "=" + referencingId;


    breadCrumbs.RelatedEntitiesName = string.Format(MobileUtility.GetResource("RelatedEn titiesText"), HttpUtility.HtmlEncode(_entityForm.CurrentEntityMe tadata.DisplayCollectionName));

    breadCrumbs.RelatedEntitiesUrl = "RelatedEntities.aspx?relatedEntity="

    + _entityForm.CurrentEntityMetadata.Name

    + "&entity="

    + referencingMetadata.Name

    + "&"

    + referencingMetadata.PrimaryKey

    + "="

    + referencingGuid.ToString("b")

    + "&instancename="

    + referencingRecordName;


    // Related entities are already created and should always have names and ids

    if (_entityForm.RecordName != null && _entityForm.RecordName.Length != 0)

    {

    breadCrumbs.RelatedEntityPageName = HttpUtility.HtmlEncode(_entityForm.RecordName);

    }

    else

    {

    throw new ArgumentNullException(MobileUtility.GetResource("N ameFieldIsRequired"));

    }

    if (_entityForm.RecordId != Guid.Empty)

    {

    breadCrumbs.RelatedEntityPageUrl = "EntityReadOnly.aspx?entity="

    + _entityForm.CurrentEntityMetadata.Name

    + "&"

    + _entityForm.CurrentEntityMetadata.PrimaryKey

    + "="

    + _entityForm.RecordId.ToString("b")

    + "&referencingentity="

    + referencingMetadata.Name

    + "&referencingrecordname="

    + referencingRecordName

    + "&referencingid="

    + referencingGuid.ToString("b");

    }

    else

    {

    throw new ArgumentNullException(MobileUtility.GetResource("R ecordIdIsRequired"));

    }

    }

    else

    {

    breadCrumbs.EntityHomePageName = HttpUtility.HtmlEncode(_entityForm.CurrentEntityMe tadata.DisplayCollectionName);

    breadCrumbs.EntityHomePageUrl = "EntityHome.aspx?entity=" + _entityForm.CurrentEntityMetadata.Name;

    if (_entityForm.RecordName != null && _entityForm.RecordName.Length != 0)

    {

    breadCrumbs.RecordPageName = HttpUtility.HtmlEncode(_entityForm.RecordName);

    }

    else

    {

    throw new ArgumentNullException(MobileUtility.GetResource("N ameFieldIsRequired"));

    }

    if (_entityForm.RecordId != Guid.Empty)

    {

    breadCrumbs.RecordPageUrl = "EntityReadOnly.aspx?entity=" + _entityForm.CurrentEntityMetadata.Name + "&" + _entityForm.CurrentEntityMetadata.PrimaryKey + "=" + _entityForm.RecordId.ToString("b");

    }

    else

    {

    throw new ArgumentNullException(MobileUtility.GetResource("R ecordIdIsRequired"));

    }


    // TODO: WE ARE STOPPING RELATED ENTITIES AT THE RELATED ENTITY FOR NOW

    // The BC control does not support an infinite number of links at the moment, so we are allowing

    // 5 levels of depth.

    //The array list that will hold the related entity names

    //That way we don't have more than one entity of the same name as a link

    ArrayList relatedEntitiesList = new ArrayList();

    //Get the relationships that relate to the current entity instance

    RelationshipMetadata[] relationships = this._entityForm.CurrentEntityMetadata.ReferencesT o;

    //Add the related entity names to the list if the entity exists in the config xml

    foreach (RelationshipMetadata relationship in relationships)

    {

    XmlNode entityNode = MobileUtility.GetEntityNode(relationship.Referenci ngEntity);


    if (entityNode != null)

    {

    if (!relatedEntitiesList.Contains(relationship.Refere ncingEntity))

    {

    relatedEntitiesList.Add(relationship.ReferencingEn tity);

    }

    }

    }
Working...
X