//--------------------------------------------------------------------------------------------- public MoveRowInfo MoveRow( string strRow, string action, int rowId ) { string[] arrRow = strRow.Split( '/' ); int rowId1 = 0; int rowId2 = 0; if (action == "up") { rowId1 = rowId - 1; rowId2 = rowId; } else if (action == "down") { rowId1 = rowId; rowId2 = rowId + 1; } if (rowActionError( arrRow.Length, action, rowId, rowId1, rowId2 )) return new MoveRowInfo(); MoveRowInfo mr = new MoveRowInfo(); mr.Row1 = rowId1; mr.Row2 = rowId2; mr.RowString = getNewRowString( arrRow, action, rowId ); mr.RowStringOld = strRow; return mr; }
//--------------------------------------------------------------------------------------------- public MoveRowInfo MoveRow(string strRow, string action, int rowId) { string[] arrRow = strRow.Split('/'); int rowId1 = 0; int rowId2 = 0; if (action == "up") { rowId1 = rowId - 1; rowId2 = rowId; } else if (action == "down") { rowId1 = rowId; rowId2 = rowId + 1; } if (rowActionError(arrRow.Length, action, rowId, rowId1, rowId2)) { return(new MoveRowInfo()); } MoveRowInfo mr = new MoveRowInfo(); mr.Row1 = rowId1; mr.Row2 = rowId2; mr.RowString = getNewRowString(arrRow, action, rowId); mr.RowStringOld = strRow; return(mr); }
private static String updateStyle(String style, MoveRowInfo mr) { // 3/1/2 row1_column1=>row2_column1 // 1/3/2 row2_column1=>row1_column1 String[] arrRowStr = mr.RowStringOld.Split('/'); int raw1 = mr.Row1 > mr.Row2 ? mr.Row2 : mr.Row1; int raw2 = mr.Row1 > mr.Row2 ? mr.Row1 : mr.Row2; int tempColumns = 0; for (int i = 0; i < arrRowStr.Length; i++) { int rowId = i + 1; int columns = cvt.ToInt(arrRowStr[i]); if (rowId == raw1) { style = replaceColumnId(style, columns, rowId, raw2, true); tempColumns = columns; } else if (rowId == raw2) { style = replaceColumnId(style, columns, rowId, raw1, false); } } style = restoreTemp(style, tempColumns, raw2); return(style); }
public void UpdateRow( ContentApp app, MoveRowInfo mr ) { app.Layout = mr.RowString; app.Style = updateStyle( app.Style, mr ); app.SkinStyle = updateStyle( app.SkinStyle, mr ); app.update(); int tempId = 9999; ContentSection.updateBatch( "RowId=" + tempId, "AppId=" + app.Id + " and RowId=" + mr.Row1 ); ContentSection.updateBatch( "RowId=" + mr.Row1, "AppId=" + app.Id + " and RowId=" + mr.Row2 ); ContentSection.updateBatch( "RowId=" + mr.Row2, "AppId=" + app.Id + " and RowId=" + tempId ); List<ContentSection> list = new ContentSectionService().GetByApp( app.Id ); }
public void UpdateRow(ContentApp app, MoveRowInfo mr) { app.Layout = mr.RowString; app.Style = updateStyle(app.Style, mr); app.SkinStyle = updateStyle(app.SkinStyle, mr); app.update(); int tempId = 9999; ContentSection.updateBatch("RowId=" + tempId, "AppId=" + app.Id + " and RowId=" + mr.Row1); ContentSection.updateBatch("RowId=" + mr.Row1, "AppId=" + app.Id + " and RowId=" + mr.Row2); ContentSection.updateBatch("RowId=" + mr.Row2, "AppId=" + app.Id + " and RowId=" + tempId); List <ContentSection> list = new ContentSectionService().GetByApp(app.Id); }
private int moveRowToEnd(ContentApp app, int rowId) { /* * next row int[]=4*,5,6,7 * moveRow( 'up', 5 )=>4,5*,6,7 * moveRow( 'up', 6 )=>4,5,6*,7 * moveRow( 'up', 7 )=>4,5,6,7* */ string[] rowList = app.RowList; if (rowId <= 0 || rowId > rowList.Length) { return(0); } for (int i = rowId + 1; i < rowList.Length + 1; i++) { MoveRowInfo mr = this.MoveRow(app.Layout, "up", i); this.UpdateRow(app, mr); } return(rowList.Length); }
private static String updateStyle( String style, MoveRowInfo mr ) { // 3/1/2 row1_column1=>row2_column1 // 1/3/2 row2_column1=>row1_column1 String[] arrRowStr = mr.RowStringOld.Split( '/' ); int raw1 = mr.Row1 > mr.Row2 ? mr.Row2 : mr.Row1; int raw2 = mr.Row1 > mr.Row2 ? mr.Row1 : mr.Row2; int tempColumns = 0; for (int i = 0; i < arrRowStr.Length; i++) { int rowId = i + 1; int columns = cvt.ToInt( arrRowStr[i] ); if (rowId == raw1) { style = replaceColumnId( style, columns, rowId, raw2, true ); tempColumns = columns; } else if (rowId == raw2) { style = replaceColumnId( style, columns, rowId, raw1, false ); } } style = restoreTemp( style, tempColumns, raw2 ); return style; }