Example #1
0
        internal void InsertNewItemRow(DataGrid grdItems, dhSaleItem newItem)
        {
            //ItemsList updatedList = new ItemsList();

            //var itemsSource = grdItems.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(grdItems);
            //    //updatedList.Remove(
            //    /// go through each row in the datagrid
            //    foreach (DataGridRow r in row)
            //    {
            //        if (r != null)
            //        {
            //            dhSaleItem gridRowObject = (dhSaleItem)r.Item;
            //            gridRowObject.ISerialNumber = SerialCounter;
            //            SerialCounter = SerialCounter + 1;
            //            total = total + Convert.ToDouble(gridRowObject.FGrossAmount);
            //            updatedList.Add(gridRowObject);
            //        }
            //    }
            //}
            //newItem.ISerialNumber = SerialCounter;
            //updatedList.Add(newItem);
            //grdItems.ItemsSource = updatedList;
        }
Example #2
0
        public void RemoveItem(DataGrid objDataGrid, dhSaleItem objectToRemove, dhDBnames ObjDbName, bool?isDraft)
        {
            ItemsList updatedList = new ItemsList();
            var       row         = blUtil.GetDataGridRows(objDataGrid);

            foreach (DataGridRow r in row)
            {
                dhSaleItem gridRowObject = (dhSaleItem)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;
        }
Example #3
0
        public DataSet RemoveSaleInoviceItem(dhDBnames objDBNames, dhSaleItem objInvoiceItem)
        {
            DataSet ds;

            ds = objDALGeneral.RemoveSaleInoviceItem(objDBNames, objInvoiceItem);
            return(ds);
        }
Example #4
0
        public void InsertNewItemRow(DataGrid objDataGrid, dhSaleItem newItem, TextBox ftotalamountTextBox)
        {
            ItemsList updatedList = new ItemsList();

            var    itemsSource   = objDataGrid.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(objDataGrid);
                //updatedList.Remove(
                /// go through each row in the datagrid
                foreach (DataGridRow r in row)
                {
                    if (r != null)
                    {
                        dhSaleItem gridRowObject = (dhSaleItem)r.Item;
                        gridRowObject.ISerialNumber = SerialCounter;
                        SerialCounter = SerialCounter + 1;
                        total         = total + Convert.ToDouble(gridRowObject.FGrossAmount);
                        updatedList.Add(gridRowObject);
                    }
                }
            }
            newItem.ISerialNumber = SerialCounter;
            updatedList.Add(newItem);
            ftotalamountTextBox.Text = total.ToString();
            objDataGrid.ItemsSource  = updatedList;
        }
Example #5
0
      internal DataSet InsertUpdateProductionItem(DataHolders.dhDBnames dhDBnames, dhSaleItem objProductionitem)
      {
          DataSet ds;

          ds = objDALGeneral.InsertUpdateProductionItem(dhDBnames, objProductionitem);
          return(ds);
      }
Example #6
0
        // helping function to get data table
        //private static DataTable DataViewAsDataTable(DataView dv)
        //{
        //    DataTable dt = dv.Table.Clone();
        //    foreach (DataRowView drv in dv)
        //    {
        //        dt.ImportRow(drv.Row);
        //    }
        //    return dt;
        //}

        public void InsertNewRow(DataGrid objDataGrid)
        {
            // create Empty data
            dsGeneral.dtPosSaleItemDataTable dt = new dsGeneral.dtPosSaleItemDataTable();
            blSaleItemList updatedList          = new blSaleItemList();
            // DataView view = (DataView) objDataGrid.ItemsSource;
            //  DataTable objDT = DataViewAsDataTable(view);

            //   dt = (dsGeneral.dtPosSaleItemDataTable)objDataGrid.ItemsSource;// (dsGeneral.dtPosSaleItemDataTable)objDT;
            // create a new row
            //dsGeneral.dtPosSaleItemRow dtRow = (dsGeneral.dtPosSaleItemRow)dt.NewRow();
            //dtRow[0] = Convert.ToInt64(dt.Rows[dt.Rows.Count - 1][0];
            //dt.AdddtPosSaleItemRow(dtRow);

            var row = blUtil.GetDataGridRows(objDataGrid);

            /// go through each row in the datagrid
            foreach (DataGridRow r in row)
            {
                dhSaleItem gridRowObject = (dhSaleItem)r.Item;
                updatedList.Add(gridRowObject);
                // Get the state of what's in column 1 of the current row (in my case a string)
                //  string t = rv.Row[1].ToString();
            }

            // create a new object and add to list
            dhSaleItem objNewRow = new dhSaleItem();

            updatedList.Add(objNewRow);
            objDataGrid.ItemsSource = updatedList;
        }
Example #7
0
        public void RemoveItem(DataGrid objDataGrid, dhSaleItem objectToRemove, dhDBnames ObjDbName, bool?isDraft)
        {
            ItemsList updatedList = new ItemsList();

            if ((ItemsList)objDataGrid.ItemsSource != null)
            {
                ItemsList templist = (ItemsList)objDataGrid.ItemsSource;
                foreach (dhSaleItem item in templist)
                {
                    // dhSaleItem gridRowObject = (dhSaleItem)r.Item;
                    // item.ISerialNumber = SerialCounter;
                    // SerialCounter = SerialCounter - 1;
                    // total = total + Convert.ToDouble(item.FGrossAmount);
                    updatedList.Add(item);
                }
            }

            //var row = blUtil.GetDataGridRows(objDataGrid);
            //foreach (DataGridRow r in row)
            //{
            //    dhSaleItem gridRowObject = (dhSaleItem)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);
            }

            int    SerialCounter = 1;
            double total         = 0;

            //total = total + Convert.ToDouble(newItem.FGrossAmount);
            SerialCounter = updatedList.Count > 0 ? updatedList.Count : 1;
            //newItem.ISerialNumber = SerialCounter;
            ItemsList NewList = new ItemsList();

            // obj removed now let we sort with serial
            foreach (dhSaleItem item in updatedList)
            {
                //dhSaleItem gridRowObject = (dhSaleItem)r.Item;
                item.ISerialNumber = SerialCounter;
                SerialCounter      = SerialCounter - 1;
                NewList.Add(item);
                // total = total + Convert.ToDouble(item.FGrossAmount);
            }

            objDataGrid.ItemsSource = NewList;
        }
Example #8
0
 public static void RemoveItem(DataGrid objDataGrid, dhSaleItem objectToRemove, dhDBnames ObjDbName, bool?iSDraft)
 {
     try
     {
         if (objblItems == null)
         {
             objblItems = new blItems();
         }
         {
             objblItems.RemoveItem(objDataGrid, objectToRemove, ObjDbName, iSDraft);
         }
     }
     catch (Exception ex) { throw ex; }
 }
Example #9
0
 public static void InsertNewItemRow(DataGrid objDataGrid, dhSaleItem neItem, TextBox ftotalamountTextBox)
 {
     try
     {
         if (objblItems == null)
         {
             objblItems = new blItems();
         }
         {
             objblItems.InsertNewItemRow(objDataGrid, neItem, ftotalamountTextBox);
         }
     }
     catch (Exception ex) { throw ex; }
 }
Example #10
0
 public static void InsertNewItemRow(DataGrid grdItems, dhSaleItem newItem)
 {
     try
     {
         if (objblItems == null)
         {
             objblItems = new blItems();
         }
         {
             objblItems.InsertNewItemRow(grdItems, newItem);
         }
     }
     catch (Exception ex) { throw ex; }
 }
Example #11
0
        public object Convert(object value, Type targetType, object parameter,
                              System.Globalization.CultureInfo culture)
        {
            if (targetType != typeof(bool))
            {
                throw new InvalidOperationException("The target must be a boolean");
            }
            dhSaleItem oj = (dhSaleItem)value;

            if (oj.BIsEditAbleInInvoice == "False")
            {
                return("False");
            }
            else
            {
                return("True");
            }

            //Boolean invers = ( Convert.ToBoolean( oj.BIsEditAbleInInvoice) != false ? false : true);
            //return oj.BIsEditAbleInInvoice;
        }
Example #12
0
        public void InsertNewItemRow(DataGrid objDataGrid, dhSaleItem newItem, TextBox ftotalamountTextBox)
        {
            ItemsList updatedList   = new ItemsList();
            int       SerialCounter = 1;
            double    total         = 0;

            total                 = total + Convert.ToDouble(newItem.FGrossAmount);
            SerialCounter         = objDataGrid.Items.Count > 0 ? objDataGrid.Items.Count + 1 : 1;
            newItem.ISerialNumber = SerialCounter;
            updatedList.Add(newItem);

            SerialCounter--;
            if ((ItemsList)objDataGrid.ItemsSource != null)
            {
                ItemsList templist = (ItemsList)objDataGrid.ItemsSource;
                foreach (dhSaleItem item in templist)
                {
                    // dhSaleItem gridRowObject = (dhSaleItem)r.Item;
                    item.ISerialNumber = SerialCounter;
                    SerialCounter      = SerialCounter - 1;
                    total = total + Convert.ToDouble(item.FGrossAmount);
                    updatedList.Add(item);
                }
            }
            //else
            //{

            //}

            // add the total ammount

            //if (null != updatedList)
            //{
            //    //IEnumerable<DataGridRow> row = blUtil.GetDataGridRows(objDataGrid);
            //    ////updatedList.Remove(
            //    ///// go through each row in the datagrid
            //    //        foreach (DataGridRow r in row)
            //    //        {
            //    //            if (r != null)
            //    //            {
            //    //                dhSaleItem gridRowObject = (dhSaleItem)r.Item;
            //    //                gridRowObject.ISerialNumber = SerialCounter ;
            //    //                SerialCounter = SerialCounter + 1;
            //    //                total = total + Convert.ToDouble(gridRowObject.FGrossAmount);
            //    //                updatedList.Add(gridRowObject);
            //    //            }
            //    //        }

            //}

            //  updatedList.Add(newItem);
            ftotalamountTextBox.Text = total.ToString();
            objDataGrid.ItemsSource  = updatedList;
            //ItemsList updatedList = new ItemsList();
            //var itemsSource = objDataGrid.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(objDataGrid);
            ////updatedList.Remove(
            ///// go through each row in the datagrid
            //        foreach (DataGridRow r in row)
            //        {
            //            if (r != null)
            //            {
            //                dhSaleItem gridRowObject = (dhSaleItem)r.Item;
            //                gridRowObject.ISerialNumber = SerialCounter ;
            //                SerialCounter = SerialCounter + 1;
            //                total = total + Convert.ToDouble(gridRowObject.FGrossAmount);
            //                updatedList.Add(gridRowObject);
            //            }
            //        }
            //  }
            //newItem.ISerialNumber = SerialCounter;
            //updatedList.Add(newItem);
            //ftotalamountTextBox.Text = total.ToString();
            //objDataGrid.ItemsSource = updatedList;
        }
Example #13
0
        public DataSet InsertUpdateProductionItem(dhDBnames dhDBnames, dhSaleItem item)
        {
            DataSet dsreturn = objDatabase.GetDataSet(dhDBnames, item, "xmlInsertUpdateProductionItem");

            return(dsreturn);
        }
Example #14
0
        public DataSet RemoveSaleInoviceItem(dhDBnames objDBNames, dhSaleItem objInvoiceItem)
        {
            DataSet dsreturn = objDatabase.GetDataSet(objDBNames, objInvoiceItem, "xmlRemoveSaleInoviceItem");

            return(dsreturn);
        }
Example #15
0
        public DataSet InsertUpdateSaleInoviceItem(dhDBnames objDBNames, dhSaleItem objInvoice)
        {
            DataSet dsreturn = objDatabase.GetDataSet(objDBNames, objInvoice, "xmlInsertUpdateSaleInoviceItem");

            return(dsreturn);
        }