예제 #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);
        }
        public void DeleteSelectedCommand()
        {
            List <int> selectedRows = DataViewBase.RangesToRows(Connections.GetSelectedRows());

            if (selectedRows.Count == 0)
            {
                return;
            }

            Utility.ConfirmDialog(
                String.Format(ResourceStrings.ConfirmDeleteSelectedConnection, selectedRows.Count),
                delegate()
            {
                List <Entity> itemsToRemove = new List <Entity>();
                foreach (int row in selectedRows)
                {
                    itemsToRemove.Add((Entity)Connections.GetItem(row));
                }
                try
                {
                    foreach (Entity item in itemsToRemove)
                    {
                        OrganizationServiceProxy.Delete_(item.LogicalName, new Guid(item.Id));
                    }
                }
                catch (Exception ex)
                {
                    ErrorMessage.SetValue(ex.ToString());
                }
                Connections.RaiseOnSelectedRowsChanged(null);
                Connections.Reset();
                Connections.Refresh();
            }, null);
        }
예제 #3
0
        private void Delete_(List <int> selectedRows)
        {
            List <Entity> itemsToRemove = new List <Entity>();

            foreach (int row in selectedRows)
            {
                itemsToRemove.Add((Entity)Contacts.GetItem(row));
            }
            try
            {
                foreach (Entity item in itemsToRemove)
                {
                    OrganizationServiceProxy.Delete_(item.LogicalName, new Guid(item.Id));
                }
            }
            catch (Exception ex)
            {
                ErrorMessage.SetValue(ex.ToString());
            }
            Contacts.RaiseOnSelectedRowsChanged(null);
            Contacts.Reset();
            Contacts.Refresh();
        }