public void Save(PageView currentPage, string controlPlaceId, ControlData[] data) { if (_connectionString != string.Empty) { SqlContext context = new SqlContext(); context.ConnectionString = _connectionString; try { context.BeginTransaction(); //delete all controls in control place SqlHelper.ExecuteNonQuery(context, CommandType.StoredProcedure, "page_ControlPropertiesDeleteAllInControlPlace", new SqlParameter("@PageUID", currentPage.Id), new SqlParameter("@ControlPlaceID", controlPlaceId)); //add new controls from array "data" for (int i = 0; i < data.Length; i++) { SqlHelper.ExecuteNonQuery(context, CommandType.StoredProcedure, "page_ControlPropertiesInsertInControlPlace", new SqlParameter("@PageUID", currentPage.Id), new SqlParameter("@ControlPlaceID", controlPlaceId), new SqlParameter("@ControlIndex", i), new SqlParameter("@ControlUID", data[i].ControlUID), new SqlParameter("@ControlProperties", data[i].Settings)); } context.Commit(); } catch { context.Rollback(); throw; } } //if(_connectionString!=string.Empty) }
public void Save(PageView currentPage, string controlPlaceId, ControlData[] data) { if(_connectionString!=string.Empty) { SqlContext context = new SqlContext(); context.ConnectionString=_connectionString; try { context.BeginTransaction(); //delete all controls in control place SqlHelper.ExecuteNonQuery(context,CommandType.StoredProcedure,"page_ControlPropertiesDeleteAllInControlPlace", new SqlParameter("@PageUID",currentPage.Id),new SqlParameter("@ControlPlaceID",controlPlaceId)); //add new controls from array "data" for(int i=0;i<data.Length;i++) { SqlHelper.ExecuteNonQuery(context,CommandType.StoredProcedure,"page_ControlPropertiesInsertInControlPlace", new SqlParameter("@PageUID",currentPage.Id), new SqlParameter("@ControlPlaceID",controlPlaceId), new SqlParameter("@ControlIndex",i), new SqlParameter("@ControlUID",data[i].ControlUID), new SqlParameter("@ControlProperties",data[i].Settings)); } context.Commit(); } catch { context.Rollback(); throw; } }//if(_connectionString!=string.Empty) }