示例#1
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         frmInput fipt = new frmInput("请输入任意关键字进行搜索");
         string   str  = fipt.ShowInput();
         foreach (ListViewItem lvi in this.lvMType.Items)
         {
             bool ok = false;
             foreach (ListViewItem.ListViewSubItem lvs in lvi.SubItems)
             {
                 if (lvs.Text.IndexOf(str) != -1)
                 {
                     ok = true;
                     break;;
                 }
             }
             if (ok == false)
             {
                 this.lvMType.Items.Remove(lvi);
             }
         }
         clear();
     }
     catch (MessageException ex)
     {
         if (ex.Message != "")
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
        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);
                }
            }
        }
示例#3
0
        private void btnAmend_Click(object sender, EventArgs e)
        {
            try
            {
                TreeNode tn = this.mTypeTreeView1.tvMType.SelectedNode;
                if (tn == null)
                {
                    throw new MessageException("请选择要修改的项目!");
                }
                else if (Convert.ToInt32(tn.Tag) == 1)
                {
                    throw new MessageException("该项目不能修改!");
                }
                frmInput            ipt = new frmInput("请输入新类型名:", tn.Text);
                string              str = ipt.ShowInput();
                MerchandiseTypeData mtd = new MerchandiseTypeData();
                mtd.ID       = Convert.ToInt32(tn.Tag);
                mtd.Name     = str;
                mtd.ParentID = Convert.ToInt32(tn.Parent.Tag);
                MTypeCortrol.updTypeName(mtd);

                tn.Text = str;
            }
            catch (MessageException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#4
0
        private void btnAccession_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.mTypeTreeView1.tvMType.SelectedNode == null)
                {
                    throw new MessageException("请选择父项目!");
                }
                frmInput            ipt = new frmInput("请输入商品类型:");
                string              str = ipt.ShowInput();
                MerchandiseTypeData mtd = new MerchandiseTypeData();
                mtd.Name     = str;
                mtd.ParentID = Convert.ToInt32(this.mTypeTreeView1.tvMType.SelectedNode.Tag);
                int      i  = MTypeCortrol.addTypeName(mtd);
                TreeNode tn = new TreeNode(str);
                tn.Tag = i;
                this.mTypeTreeView1.tvMType.SelectedNode.Nodes.Add(tn);
            }

            catch (MessageException ex)
            {
                if (ex.Message != "")
                {
                    MessageBox.Show(ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#5
0
        private void addPInfo_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.lvMInfo.SelectedItems.Count == 0)
                    return;

                frmSelectPInfo fspi = new frmSelectPInfo();
                PurveyInfoData pid = (PurveyInfoData)fspi.ShowSelect();
                foreach (ListViewItem lvi in this.lvPurvey.Items)
                {
                    if ((PurveyInfoData)lvi.Tag == pid)
                    {
                        lvi.Selected = true;
                        return;
                    }
                }
                frmInput fi = new frmInput("请输入供应价格");
                string str = fi.ShowInput();
                double price = Convert.ToDouble(str);
                PurveyData pd = new PurveyData();
                pd.PInfoID = pid.ID;
                pd.MInfoID = ((MerchandiseInfoData)this.lvMInfo.SelectedItems[0].Tag).ID;
                pd.Price = price;
                int i = PurveyCortrol.addPurevey(pd);
                pd.ID = i;
                addPurevey(pid, pd);
            }
            catch (MessageException ex)
            {
                if (ex.Message != "")
                    MessageBox.Show(ex.Message);
            }
        }
示例#6
0
        private void btnAccession_Click(object sender, EventArgs e)
        {
            frmInput ipt = new frmInput("请输入类型名!");

            try
            {
                string         str = ipt.ShowInput();
                int            i   = PTypeCortrol.addTypeName(new PurveyTypeData(0, str));
                PurveyTypeData ptd = new PurveyTypeData(i, str);
                this.pTypeListBox.lbPType.Items.Add(ptd);
            }
            catch (Exception ex)
            {
                if (ex.Message != "")
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
示例#7
0
        private void btnAmend_Click(object sender, EventArgs e)
        {
            frmInput ipt = new frmInput("请输入类型名!", this.pTypeListBox.lbPType.SelectedItem.ToString());

            try
            {
                string         str = ipt.ShowInput();
                PurveyTypeData ptd = new PurveyTypeData(((PurveyTypeData)this.pTypeListBox.lbPType.SelectedItem).ID, str);
                int            i   = PTypeCortrol.updTypeName(ptd);
                this.pTypeListBox.lbPType.Items[i] = ptd;
            }
            catch (MessageException ex) {
                if (ex.Message != "")
                {
                    MessageBox.Show(ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }