Ejemplo n.º 1
0
        private void 修ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.lvMInfo.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem lvi = this.lvMInfo.SelectedItems[0];

            try
            {
                frmInput            fi  = new frmInput("请输入库存数量!", lvi.SubItems[1].Text);
                string              str = fi.ShowInput();
                int                 i   = Convert.ToInt32(str);
                MerchandiseInfoData mid = (MerchandiseInfoData)lvi.Tag;
                mid.Storage = i;
                MInfoCortrol.updMInfo(mid);
                lvi.SubItems[1].Text = i.ToString();
            }
            catch (MessageException ex)
            {
                if (ex.Message != "")
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
        private void btnAmend_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.lvMType.SelectedItems.Count == 0)
                {
                    throw new MessageException("请选择要修改的项目!");
                }

                checkText();

                MerchandiseInfoData mid = getMInfo();
                mid.ID = ((MerchandiseInfoData)this.lvMType.SelectedItems[0].Tag).ID;

                MInfoCortrol.updMInfo(mid);

                ListViewItem lvi = new ListViewItem(mid.Name);
                lvi.Tag = mid;
                ListViewItem.ListViewSubItem lvs = new ListViewItem.ListViewSubItem();

                MerchandiseTypeData ptd = MTypeCortrol.getMTypeOfID(mid.TypeID);
                lvs.Text = ptd.Name;
                lvs.Tag  = ptd;

                lvi.SubItems.Add(lvs);
                lvi.SubItems.Add(mid.Quantity.ToString());

                this.lvMType.Items[this.lvMType.SelectedIndices[0]] = lvi;
                clear();
            }
            catch (MessageException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }