Esempio n. 1
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
            case 0:                     //添加数据
                frmEditVendor frmev = new frmEditVendor();
                frmev.frmMode = 1;      //add
                frmev.Text    = "添加供应商";
                frmev.ShowDialog();
                if (frmev.DialogResult == DialogResult.OK)
                {
                    LoadVendor();
                }
                break;

            case 1:                     //修改数据
                EditData();
                break;

            case 2:                     //删除当前数据
                if (MessageBox.Show("确定要删除当前选中的编号为 " + dgVendor[dgVendor.CurrentRowIndex, 0].ToString().Trim() + " 的供应商吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    if (DelVendor(dgVendor[dgVendor.CurrentRowIndex, 0].ToString()))
                    {
                        LoadVendor();
                    }
                }
                break;

            case 4:
                this.Close();
                break;
            }
        }
Esempio n. 2
0
        //编辑物品类别
        private void EditData()
        {
            frmEditVendor frmev = new frmEditVendor();

            frmev.frmMode       = 2;
            frmev.OldVendorCode = dgVendor[dgVendor.CurrentRowIndex, 0].ToString();
            frmev.TextBox1.Text = dgVendor[dgVendor.CurrentRowIndex, 0].ToString();
            frmev.TextBox2.Text = dgVendor[dgVendor.CurrentRowIndex, 1].ToString();
            frmev.TextBox3.Text = dgVendor[dgVendor.CurrentRowIndex, 2].ToString();
            frmev.TextBox4.Text = dgVendor[dgVendor.CurrentRowIndex, 3].ToString();
            if (dgVendor[dgVendor.CurrentRowIndex, 4].ToString() == "1")
            {
                frmev.CheckBox1.Checked = true;
            }
            else
            {
                frmev.CheckBox1.Checked = false;
            }
            frmev.Text = "编辑供应商";
            frmev.ShowDialog();
            if (frmev.DialogResult == DialogResult.OK)
            {
                LoadVendor();
            }
        }
Esempio n. 3
0
        private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            switch (ToolBar1.Buttons.IndexOf(e.Button))
            {
                case 0: //添加数据
                    frmEditVendor frmev = new frmEditVendor();
                    frmev.frmMode = 1; //add
                    frmev.Text = "添加供应商";
                    frmev.ShowDialog();
                    if (frmev.DialogResult == DialogResult.OK)
                    {
                        LoadVendor();
                    }
                    break;
                case 1: //修改数据
                    EditData();
                    break;
                case 2: //删除当前数据
                    if (MessageBox.Show("确定要删除当前选中的编号为 " + dgVendor[dgVendor.CurrentRowIndex, 0].ToString().Trim() + " 的供应商吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        if (DelVendor(dgVendor[dgVendor.CurrentRowIndex, 0].ToString()))
                        {
                            LoadVendor();
                        }
                    }
                    break;

                case 4:
                    this.Close();
                    break;
            }
        }
Esempio n. 4
0
 //编辑物品类别
 private void EditData()
 {
     frmEditVendor frmev = new frmEditVendor();
     frmev.frmMode = 2;
     frmev.OldVendorCode = dgVendor[dgVendor.CurrentRowIndex, 0].ToString();
     frmev.TextBox1.Text = dgVendor[dgVendor.CurrentRowIndex, 0].ToString();
     frmev.TextBox2.Text = dgVendor[dgVendor.CurrentRowIndex, 1].ToString();
     frmev.TextBox3.Text = dgVendor[dgVendor.CurrentRowIndex, 2].ToString();
     frmev.TextBox4.Text = dgVendor[dgVendor.CurrentRowIndex, 3].ToString();
     if (dgVendor[dgVendor.CurrentRowIndex, 4].ToString() == "1")
     {
         frmev.CheckBox1.Checked = true;
     }
     else
     {
         frmev.CheckBox1.Checked = false;
     }
     frmev.Text = "编辑供应商";
     frmev.ShowDialog();
     if (frmev.DialogResult == DialogResult.OK)
     {
         LoadVendor();
     }
 }