/// <summary> /// 追加ボタンクリックイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void add_Click(object sender, EventArgs e) { if (!this.addPreCheck(this)) { return; } UserKanriAddServiceInBo userAddServiceInBo = new UserKanriAddServiceInBo(); userAddServiceInBo.empId = this.empId.Text.ToString(); userAddServiceInBo.userName = this.userName.Text.ToString(); userAddServiceInBo.kengenSelectedIndex = this.kengen.SelectedIndex; userAddServiceInBo.userKanriDataGridView1 = this.userKanriDataGridView1; UserKanriAddService userAddService = new UserKanriAddService(); userAddService.setInBo(userAddServiceInBo); UserKanriAddServiceOutBo shinseiServiseOutBo = userAddService.execute(); if (!String.IsNullOrEmpty(shinseiServiseOutBo.errorMessage)) { MessageBox.Show( shinseiServiseOutBo.errorMessage, "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.userKanriDataGridView1.DataSource = shinseiServiseOutBo.userList; this.userKanriViewSetthing(ref this.userKanriDataGridView1); this.setCheckValList(ref this.userKanriDataGridView1); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void add_Click(object sender, EventArgs e) { bool isNgRequired = false; if (String.IsNullOrEmpty(this.empId.Text)) { errorProvider1.SetError(this.empId, MessageConst.ERR_001); isNgRequired = true; } if (String.IsNullOrEmpty(this.userName.Text)) { errorProvider1.SetError(this.userName, MessageConst.ERR_001); isNgRequired = true; } if (String.IsNullOrEmpty(this.kengen.Text) || this.kengen.Text.ToIntType() == 2) { errorProvider1.SetError(this.kengen, MessageConst.ERR_001); isNgRequired = true; } if (isNgRequired) { return; } checkValList = new List<bool>(); for (int i = 0; i < this.userKanriDataGridView1.Rows.Count; i++) { if (this.userKanriDataGridView1.Rows[i].Cells[0].Value != null && (bool)this.userKanriDataGridView1.Rows[i].Cells[0].Value != false) { checkValList.Add((bool)this.userKanriDataGridView1.Rows[i].Cells[0].Value); continue; } checkValList.Add(false); } UserKanriAddServiceInBo userAddServiceInBo = new UserKanriAddServiceInBo(); userAddServiceInBo.empId = this.empId.Text.ToString(); userAddServiceInBo.userName = this.userName.Text.ToString(); userAddServiceInBo.kengenSelectedIndex = this.kengen.SelectedIndex; userAddServiceInBo.userKanriDataGridView1 = this.userKanriDataGridView1; UserKanriAddService userAddService = new UserKanriAddService(); userAddService.setInBo(userAddServiceInBo); UserKanriAddServiceOutBo shinseiServiseOutBo = userAddService.execute(); if (!String.IsNullOrEmpty(shinseiServiseOutBo.errorMessage)) { MessageBox.Show( shinseiServiseOutBo.errorMessage, "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.userKanriDataGridView1.DataSource = shinseiServiseOutBo.userList; this.userKanriViewSetthing(ref this.userKanriDataGridView1); this.setCheckValList(ref this.userKanriDataGridView1); }