示例#1
0
        public int ManageDuplicateUnpaidPurchaseInvoice()
        {
            int rowFocusindex = -1;

            //ShowAllCount = PSDetailsEntity.Where(e => e.SelectedPSID != 0).Count();
            TempList = new ObservableCollection <UnpaidPurchaseInvoiceGridViewModel>();
            TempList = UnpaidPurchaseInvoicedetailsEntity;

            var query = TempList.GroupBy(x => x.ID)
                        .Where(g => g.Count() > 1)
                        .ToList();

            if (query.Count > 0 && UnpaidPurchaseInvoicedetailsEntity.Count > 1)
            {
                var obj1 = query[0].ElementAt(0);
                var obj2 = query[0].ElementAt(1);
                int?qty  = 1;

                qty = query[0].ElementAt(0).CountQty + query[0].ElementAt(1).CountQty;

                var index1 = TempList.IndexOf(query[0].ElementAt(0));
                var index2 = TempList.IndexOf(query[0].ElementAt(1));
                OnPropertyChanged("UnpaidPurchaseInvoicedetailsEntity");
                TempList = UnpaidPurchaseInvoicedetailsEntity;
            }
            else
            {
                int count = UnpaidPurchaseInvoicedetailsEntity.Count(x => x.ID == 0);
                if (count == 0)
                {
                    var row = new UnpaidPurchaseInvoiceGridViewModel(UnpaidInvoiceList);
                    // row.CountQty = 0;
                    //   row.GSTRate = TaxRate;

                    UnpaidPurchaseInvoicedetailsEntity.Add(row);
                    OnPropertyChanged("UnpaidPurchaseInvoicedetailsEntity");
                    TempList      = UnpaidPurchaseInvoicedetailsEntity;
                    rowFocusindex = -1;
                }
                else
                {
                    var emptyRow = TempList.Where(y => y.ID == 0).FirstOrDefault();
                    rowFocusindex = UnpaidPurchaseInvoicedetailsEntity.IndexOf(emptyRow);
                }
            }
            return(rowFocusindex);
        }
示例#2
0
        public void createNewUnpaidPurchaseInvoice()
        {
            var row = new UnpaidPurchaseInvoiceGridViewModel(UnpaidInvoiceList);

            //row.SelectedPSID = 0;
            if (UnpaidPurchaseInvoicedetailsEntity != null)
            {
                if (UnpaidPurchaseInvoicedetailsEntity.Count > 0)
                {
                    UnpaidPurchaseInvoicedetailsEntity.Clear();
                    // var row = new CollectAmountDataGridViewModel();
                    //  PQDetailsEntity.Add(row);
                    OnPropertyChanged("UnpaidPurchaseInvoicedetailsEntity");
                }
            }
            UnpaidPurchaseInvoicedetailsEntity.Add(row);
            OnPropertyChanged("UnpaidPurchaseInvoicedetailsEntity");
        }