Try our conversational search powered by Generative AI!

Problems with Editing Club

Vote:
 

Hello,

We are using Netstar StarCommunity for our community website. I am working on the Club module of the StarCommunity.

In Club module I am having problem while updating the club. It thows me error while updating the tags. Update code is working fine for the first time but throwing error after updating the Club for more than once.

Below is the code...for Updating Club....

public void UpdateUserGroup(Group group, ICategory groupType) {


   bool alreadyInTransaction = DatabaseHandler.InTransaction;
   if (!alreadyInTransaction)
    DatabaseHandler.BeginTransaction();

   Club clubToUpdate = (Club)GetGroup(group.Name).Clone();
   clubToUpdate.Description = group.Description;
   clubToUpdate.SecurityStatus = group.SecurityStatus;

   // store group type as category
   clubToUpdate.Categories.Clear();
   clubToUpdate.Categories.Add(groupType);

   clubToUpdate.EntityTags.Clear();
   AddEntityTags(clubToUpdate, group.CSVTags);
   SetAttributeValues(clubToUpdate, group);

   ClubHandler.UpdateClub(clubToUpdate);

   if (!alreadyInTransaction)
    DatabaseHandler.Commit();
  }

==============

Aslo pls Note that group in the above code is actually the club of StarCommunity.

Regards,

bhavin.chheda@vizualize.com

 

 

#20351
May 27, 2008 16:50
Vote:
 

Hi Bhavin,

Can you include the exception and the stack trace and I'll see what might be the issue.

Best regards,

Mattias 

#20374
May 27, 2008 21:25
Vote:
 
 

Server Error in '/BoostR' Application.

Violation of PRIMARY KEY constraint 'PK_tblStarCommunityTagItemCountArchive'. Cannot insert duplicate key in object 'dbo.tblStarCommunityTagItemCountArchive'.
The statement has been terminated.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_tblStarCommunityTagItemCountArchive'. Cannot insert duplicate key in object 'dbo.tblStarCommunityTagItemCountArchive'.
The statement has been terminated.

Source Error:

Line 227:			SetAttributeValues(clubToUpdate, group); Line 228: Line 229:			ClubHandler.UpdateClub(clubToUpdate); Line 230: Line 231:			if (!alreadyInTransaction)

Source File: C:\Documents and Settings\sadhana.gangan\My Documents\Visual Studio 2008\Projects\USG\Source\BoostR.NL\Source\USG.BoostR.Service\UserGroupService.cs    Line: 229

Stack Trace:

[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_tblStarCommunityTagItemCountArchive'. Cannot insert duplicate key in object 'dbo.tblStarCommunityTagItemCountArchive'. The statement has been terminated.]    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932    System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31    System.Data.SqlClient.SqlDataReader.get_MetaData() +62    System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122    System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12    System.Data.Common.DbCommand.ExecuteReader() +9    StarSuite.Core.Data.DatabaseHandler.GetScalar(Boolean inTransaction, String sp, CommandType commandType, Object[] args) +61    StarSuite.Core.Data.DatabaseHandler.GetScalar(String sp, Object[] args) +29    StarCommunity.Core.Modules.Data.TagFactory.AddEntityTags(ITaggableEntity entity, Int32 id, ISite site, Int32 archiveIntervalHours) +542  [StarCommunityException: Unable to add entity tag.]    StarCommunity.Core.Modules.Data.TagFactory.AddEntityTags(ITaggableEntity entity, Int32 id, ISite site, Int32 archiveIntervalHours) +1120    StarCommunity.Core.Modules.Tags.TagHandler.UpdateEntityTags(ITaggableEntity entity, Int32 id) +465    StarCommunity.Core.Modules.Data.StarCommunityFactoryBase.UpdateEntity(ITaggableEntity entity, Int32 id) +86  [StarCommunityException: Could not save tags for entity of type StarCommunity.Modules.Club.Club, StarCommunity.Modules.Club with id 1.]    StarCommunity.Core.Modules.Data.StarCommunityFactoryBase.UpdateEntity(ITaggableEntity entity, Int32 id) +222    StarCommunity.Core.Modules.Data.StarCommunityFactoryBase.UpdateEntity(IStarCommunityEntity entity, Int32 id, Boolean add) +159  [StarCommunityException: Could not update entity of type StarCommunity.Modules.Club.Club, StarCommunity.Modules.Club with id 1.]    StarCommunity.Core.Modules.Data.StarCommunityFactoryBase.UpdateEntity(IStarCommunityEntity entity, Int32 id, Boolean add) +383    StarCommunity.Core.Modules.Data.StarCommunityFactoryBase.UpdateEntity(IStarCommunityEntity entity) +35    StarCommunity.Modules.Club.Data.ClubFactory.UpdateClub(Club club) +1052  [StarCommunityException: Could not update club with id 1.]    StarCommunity.Modules.Club.Data.ClubFactory.UpdateClub(Club club) +1516    StarCommunity.Modules.Club.ClubHandler.UpdateClub(Club club) +123    USG.BoostR.Service.UserGroupService.UpdateUserGroup(Group group, ICategory groupType) in C:\Documents and Settings\sadhana.gangan\My Documents\Visual Studio 2008\Projects\USG\Source\BoostR.NL\Source\USG.BoostR.Service\UserGroupService.cs:229    USG.BoostR.UI.Web.Groups.GroupForm.EditUserGroup(Object sender, EventArgs e) in C:\Documents and Settings\sadhana.gangan\My Documents\Visual Studio 2008\Projects\USG\Source\BoostR.NL\Source\USG.BoostR.UI\Web\Groups\GroupForm.aspx.cs:346    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746 
#20389
May 28, 2008 8:46
Vote:
 

Hi Bhavin,

I would suggest you report this as an incident at http://world.episerver.com/Support/Register-Support-Incident/. When describing the problem include the code with all subsequently called methods (AddEntityTags and SetAttributeValues) and exception + stacktrace, and we'll take it from there.

#20418
May 28, 2008 13:41
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.