Esempio n. 1
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            if (dgv_warehouseInfo.SelectedRows.Count > 0)
            {
                projectNameObj                   = new projectName();
                projectNameObj.id                = long.Parse(dgv_warehouseInfo.SelectedRows[0].Cells["id"].Value.ToString());
                projectNameObj.name              = dgv_warehouseInfo.SelectedRows[0].Cells["name"].Value.ToString();
                projectNameObj.no                = dgv_warehouseInfo.SelectedRows[0].Cells["no"].Value.ToString();
                projectNameObj.unitProject       = dgv_warehouseInfo.SelectedRows[0].Cells["unitProject"].Value.ToString();
                projectNameObj.subsectionProject = dgv_warehouseInfo.SelectedRows[0].Cells["subsectionProject"].Value.ToString();
                projectNameObj.itemProject       = dgv_warehouseInfo.SelectedRows[0].Cells["itemProject"].Value.ToString();
                projectNameObj.position          = dgv_warehouseInfo.SelectedRows[0].Cells["position"].Value.ToString();

                FrmProjectNameUpdate frmProjectNameUpdate = new FrmProjectNameUpdate();

                frmProjectNameUpdate.Model = projectNameObj;

                if (frmProjectNameUpdate.ShowDialog() == DialogResult.OK)
                {
                    projectNameObj.inputMan = this.UserName;
                    doProjectName.Update(projectNameObj);
                }

                query();
            }
        }
Esempio n. 2
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            if (formHelper.inputCheck(this.groupBox1))
            {
                projectNameObj = new projectName();

                projectNameObj.itemProject = this.txt_itemProject.Text.Trim();

                projectNameObj.name = this.txt_name.Text.Trim();

                projectNameObj.no = this.txt_no.Text.Trim();

                projectNameObj.position = this.txt_position.Text.Trim();

                projectNameObj.subsectionProject = this.txt_subsectionProject.Text.Trim();

                projectNameObj.unitProject = this.txt_unitProject.Text.Trim();

                projectNameObj.inputMan = this.UserName;

                bool isExist = doProjectName.selectItems(projectNameObj);
                if (isExist)
                {
                    MessageBox.Show("此记录已经存在无法添加!");
                    ClearAllTextBox();
                    return;
                }
                else
                {
                    doProjectName.Add(projectNameObj);
                }

                query();
            }
            ClearAllTextBox();
        }