Example #1
0
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        ImageButton linkButton = new ImageButton();

        linkButton = (ImageButton)sender;
        bool result = RelationshipManager.DeleteRelationship(Convert.ToInt32(linkButton.CommandArgument));

        RelationshipManager.LoadRelationshipPage(gvRelationship, rptPager, 1, ddlPageSize);
    }
        /// <summary>
        /// Löscht die Freundschaftsbeziehung zwischen 2 Benutzern
        /// </summary>
        /// <param name="relationship">
        /// Freunschaftsbeziehungsobjekt zwischen den 2 Benutzern
        /// </param>
        public void DeleteRelationship(String relationship)
        {
            DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(Relationship));
            ASCIIEncoding ascciEndcoding    = new ASCIIEncoding();
            MemoryStream  ms = new MemoryStream(ascciEndcoding.GetBytes(relationship));
            Relationship  relationshipToDelete = (Relationship)json.ReadObject(ms);

            ms.Close();
            RelationshipManager.DeleteRelationship(relationshipToDelete);
        }