Esempio n. 1
0
        internal void InsertNewAccount(DataGrid grdIAccount, dhJournalDetail newItem)
        {
            JournalDetailList updatedList = new JournalDetailList();

            var itemsSource   = grdIAccount.ItemsSource as IEnumerable;
            int SerialCounter = 1;

            //    double total = 0;
            // add the total ammount
            //   total = total + Convert.ToDouble(newItem.FGrossAmount);
            if (null != itemsSource)
            {
                IEnumerable <DataGridRow> row = blUtil.GetDataGridRows(grdIAccount);
                //updatedList.Remove(
                /// go through each row in the datagrid
                foreach (DataGridRow r in row)
                {
                    if (r != null)
                    {
                        dhJournalDetail gridRowObject = (dhJournalDetail)r.Item;
                        //   gridRowObject.ISerialNumber = SerialCounter;
                        SerialCounter = SerialCounter + 1;
                        //    total = total + Convert.ToDouble(gridRowObject.FGrossAmount);
                        updatedList.Add(gridRowObject);
                    }
                }
            }
            //     newItem.ISerialNumber = SerialCounter;
            updatedList.Add(newItem);
            grdIAccount.ItemsSource = updatedList;
        }
Esempio n. 2
0
        internal void RemoveAccountFromGrid(DataGrid objDataGrid, dhJournalDetail objectToRemove, dhDBnames ObjDbName, bool?iSDraft)
        {
            JournalDetailList updatedList = new JournalDetailList();
            var row = blUtil.GetDataGridRows(objDataGrid);

            foreach (DataGridRow r in row)
            {
                dhJournalDetail gridRowObject = (dhJournalDetail)r.Item;
                updatedList.Add(gridRowObject);
            }
            //ftotalamountTextBox.Text = total.ToString();
            //if (isDraft == true)
            //{
            //    blInvoice objblInovice = new blInvoice();
            //    objectToRemove.BIsDraft = isDraft;
            //    DataSet ds = objblInovice.RemoveSaleInoviceItem(ObjDbName, objectToRemove);
            //    updatedList.Remove(objectToRemove);
            //    //bl objblItems = null;
            //}
            //else
            //{
            updatedList.Remove(objectToRemove);
            //}
            objDataGrid.ItemsSource = updatedList;
        }