コード例 #1
0
        public Action MoveUpCommand()
        {
            if (_moveUpCommand == null)
            {
                _moveUpCommand = delegate()
                {
                    // reindex all the items by moving the selected index up
                    SelectedRange[] range   = Lines.GetSelectedRows();
                    int             fromRow = (int)range[0].FromRow;

                    if (fromRow == 0)
                    {
                        return;
                    }

                    QuoteDetail line       = (QuoteDetail)Lines.GetItem(fromRow);
                    QuoteDetail lineBefore = (QuoteDetail)Lines.GetItem(fromRow - 1);
                    // swap the indexes from the item before
                    int?lineItemNumber = line.LineItemNumber;

                    line.LineItemNumber       = lineBefore.LineItemNumber;
                    lineBefore.LineItemNumber = lineItemNumber;
                    line.RaisePropertyChanged("LineItemNumber");
                    lineBefore.RaisePropertyChanged("LineItemNumber");
                    range[0].FromRow--;
                    Lines.RaiseOnSelectedRowsChanged(range);
                    Lines.SortBy(new SortCol("lineitemnumber", true));
                    Lines.Refresh();
                };
            }
            return(_moveUpCommand);
        }
コード例 #2
0
        public void Search()
        {
            string parentRecordId = ParentRecordId.GetValue().Id.ToString().Replace("{", "").Replace("}", "");

            if (_viewFetchXml == null)
            {
                Connections.FetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' returntotalrecordcount='true' no-lock='true' distinct='false' count='{0}' paging-cookie='{1}' page='{2}'>
                                  <entity name='connection'>
                                    <attribute name='record2id' />
                                    <attribute name='record2roleid' />
                                    <attribute name='record1id' />
                                    <attribute name='record1roleid' />
                                    <attribute name='connectionid' />
                                    <filter type='and'>
                                      
                                      <condition attribute='record2id' operator='eq' value='" + parentRecordId + @"' />
                                    </filter>
                                  {3}
                                  </entity>
                                </fetch>";
                Connections.Refresh();
            }
            else
            {
                Connections.FetchXml = _viewFetchXml.Replace(QueryParser.ParentRecordPlaceholder, parentRecordId);
                Connections.SortBy(_defaultSortCol);
            }
        }
コード例 #3
0
        public QuoteLineItemEditorViewModel()
        {
            Lines = new EntityDataViewModel(10, typeof(QuoteDetail), false);

            Lines.OnSelectedRowsChanged += OnSelectedRowsChanged;
            Lines.FetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' returntotalrecordcount='true' no-lock='true' distinct='false' count='{0}' paging-cookie='{1}' page='{2}'>
                              <entity name='quotedetail'>
                                <attribute name='productid' />
                                <attribute name='productdescription' />
                                <attribute name='priceperunit' />
                                <attribute name='quantity' />
                                <attribute name='extendedamount' />
                                <attribute name='quotedetailid' />
                                <attribute name='isproductoverridden' />
                                <attribute name='ispriceoverridden' />
                                <attribute name='manualdiscountamount' />
                                <attribute name='lineitemnumber' />
                                <attribute name='description' />
                                <attribute name='transactioncurrencyid' />
                                <attribute name='baseamount' />
                                <attribute name='requestdeliveryby' />
                                <attribute name='salesrepid' />
                                <attribute name='uomid' />
                                {3}
                                <link-entity name='quote' from='quoteid' to='quoteid' alias='ac'>
                                  <filter type='and'>
                                    <condition attribute='quoteid' operator='eq' uiname='tes' uitype='quote' value='" + GetQuoteId() + @"' />
                                  </filter>
                                </link-entity>
                              </entity>
                            </fetch>";

            Lines.SortBy(new SortCol("lineitemnumber", true));
            Lines.NewItemFactory = NewLineFactory;
            QuoteDetailValidation.Register(Lines.ValidationBinder);
            SelectedQuoteDetail.SetValue(new ObservableQuoteDetail());
        }
コード例 #4
0
 public void Init()
 {
     Contacts.SortBy(new SortCol("lastname", true));
     Contacts.Refresh();
 }