Ejemplo n.º 1
0
        private void buttonAddProject_Click(object sender, EventArgs e)
        {
            if (this.SelectedCategory.SelectedItem == null)
            {
                MessageBox.Show("请填写完整的工作量名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return;
            }
            string projectname = this.pName.Text;
            //int categoryId = Convert.ToInt32(this.SelectedCategory.SelectedValue);
            int categoryId = int.Parse(((ComboboxItem)this.SelectedCategory.SelectedItem).Value);


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

            ContractProject project = new ContractProject
            {
                CategoryId = categoryId,
                Project    = projectname,
            };

            string result = _sc.InsertProject(project);

            if (result == Response.INSERT_PROJECT_SUCCESS.ToString())
            {
                MessageBox.Show("添加项目" + project.Project + "成功!");

                /////////////////////////////////////////
                BindProject(true);
                ///////////////////////////////////////
            }
            else
            {
                MessageBox.Show("添加项目" + project.Project + "失败!");
            }
        }