示例#1
0
        private void popupMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Text)
            {
            case "不保存退出":
                Controls.Clear();
                break;

            case "保存并退出":
                _items.Clear();
                if (_grid != null)
                {
                    for (int i = 0; i < _grid.Rows.Count; i++)
                    {
                        if (CheckRow(i))
                        {
                            DrugItem item = GetRowItem(i);
                            _items.Add(item);
                        }
                    }
                }
                Controls.Clear();
                break;
            }
        }
示例#2
0
        private DrugItem GetRowItem(int rowIndex)
        {
            DrugItem item = new DrugItem();

            item.ItemCode = _grid.Rows[rowIndex].Cells[0].Value.ToString();
            item.ItemName = _grid.Rows[rowIndex].Cells[1].Value.ToString();
            item.Dosage   = double.Parse(_grid.Rows[rowIndex].Cells[2].Value.ToString());
            item.ItemUnit = _grid.Rows[rowIndex].Cells[3].Value.ToString();
            return(item);
        }
示例#3
0
        private void AddRow(DrugItem item)
        {
            List <object> rowValues = new List <object>();

            rowValues.Add(item.ItemCode);
            rowValues.Add(item.ItemName);
            rowValues.Add(item.Dosage);
            rowValues.Add(item.ItemUnit);
            _grid.Rows.Add(rowValues.ToArray());
        }