コード例 #1
0
ファイル: RowService.cs プロジェクト: robin88/wojilu
        //---------------------------------------------------------------------------------------------
        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;
        }
コード例 #2
0
        //---------------------------------------------------------------------------------------------

        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: RowService.cs プロジェクト: robin88/wojilu
        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 );
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: RowService.cs プロジェクト: robin88/wojilu
        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;
        }