Пример #1
0
        private void AddItem_Click(object sender, EventArgs e)
        {
            if (this.SelectedProject.SelectedValue == null)
            {
                MessageBox.Show("请将信息填写完整!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string itemname  = this.ItemName.Text;
            int    projectid = Convert.ToInt32(this.SelectedProject.SelectedValue);

            if (this.ItemName.Text == "")
            {
                MessageBox.Show("请填写工作量名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ContractItem item = new ContractItem
            {
                ProjectId = projectid,
                Item      = itemname
            };

            string result = _sc.InsertItem(item);

            if (result == Response.INSERT_ITEM_SUCCESS.ToString())
            {
                MessageBox.Show("添加工作量" + itemname + "成功!");

                ///////
                BindItem(true);
                ///////
            }
            else
            {
                MessageBox.Show("添加工作量" + itemname + "失败!");
            }
        }