コード例 #1
0
        public void sincronizeDataWithCSV(string csv)
        {
            if (csv.Length == 0)
            {
                resetDataItems();
                updateShowedData();
                return;
            }

            string[]           pieces  = csv.Split(',');
            PieceStringHandler handler = new PieceStringHandler();
            GridDataItem       item;

            resetDataItems();

            for (int i = 0; i < pieces.Length; i++)
            {
                handler.setString(pieces[i]);
                item = findDataItem(handler.name);

                if (item != null)
                {
                    item.quantity = handler.quantity;
                }
            }

            updateShowedData();
        }
コード例 #2
0
        public string getCSVData()
        {
            StringBuilder      builder = new StringBuilder();
            PieceStringHandler handler = new PieceStringHandler();

            for (int i = 0; i < items.Count; i++)
            {
                handler.quantity = items[i].quantity;
                handler.name     = items[i].data as string;

                if (handler.quantity != 0)
                {
                    if (builder.Length != 0)
                    {
                        builder.Append(",");
                    }

                    builder.Append(handler.getString());
                }
            }

            return(builder.ToString());
        }