//////////////////////////////////////////////////////////////////////////// // イベント名 : koshinButton_Click /// <summary> /// /// </summary> /// <param name="e"></param> /// <param name="sender"></param> /// <history> /// 日付 担当者 内容 /// 2014/07/16 HuyTX 新規作成 /// </history> //////////////////////////////////////////////////////////////////////////// private void koshinButton_Click(object sender, EventArgs e) { TraceLog.StartWrite(MethodInfo.GetCurrentMethod()); Cursor preCursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; if (!IsEditedControl()) return; if (MessageForm.Show2(MessageForm.DispModeType.Question, "在庫一覧の編集内容を確定します。よろしいですか?") == DialogResult.Yes) { if (!IsRegisConfirm()) return; if (!IsValidDataUpdate()) return; IKoshinBtnClickALInput alInput = new KoshinBtnClickALInput(); alInput.ZaikoListDataGridView = zaikoListDataGridView; new KoshinBtnClickApplicationLogic().Execute(alInput); _isLoad = false; outputButton.Enabled = true; DoFormLoad(); } } catch (Exception ex) { TraceLog.ErrorWrite(MethodInfo.GetCurrentMethod(), ex.ToString()); MessageForm.Show(MessageForm.DispModeType.Error, MessageResouce.MSGID_E00001, ex.Message); } finally { Cursor.Current = preCursor; TraceLog.EndWrite(MethodInfo.GetCurrentMethod()); } }
//////////////////////////////////////////////////////////////////////////// // メソッド名 : DoUpdate /// <summary> /// /// </summary> /// <history> /// 日付 担当者 内容 /// 2014/06/30 DatNT 新規作成 /// </history> //////////////////////////////////////////////////////////////////////////// private void DoUpdate() { this.nameMstNameKbn000TableAdapter.Fill(this.nameMstDataSet.NameMstNameKbn000); // table update NameMstUpdateDataSet.NameMstUpdateDataTable dataTable = new NameMstUpdateDataSet.NameMstUpdateDataTable(); // table insert NameMstDataSet.NameMstDataTable insertTable = new NameMstDataSet.NameMstDataTable(); DateTime now = Common.Common.GetCurrentTimestamp(); for (int i = 0; i < nameListDataGridView.RowCount - 1; i++) { // update if (nameListDataGridView.Rows[i].Cells["IsUpdateCol"].Value.ToString() == "1") { DataGridViewComboBoxCell cb = (DataGridViewComboBoxCell)nameListDataGridView.Rows[i].Cells["NameKbnCol"]; string valueKbnNew = cb.Value.ToString(); if (valueKbnNew != nameListDataGridView.Rows[i].Cells["NameKbnOldCol"].Value.ToString() || nameListDataGridView.Rows[i].Cells["NameCdCol"].Value.ToString() != nameListDataGridView.Rows[i].Cells["NameCdOldCol"].Value.ToString() || nameListDataGridView.Rows[i].Cells["NameCol"].Value.ToString() != nameListDataGridView.Rows[i].Cells["NameOldCol"].Value.ToString() || nameListDataGridView.Rows[i].Cells["DeleteFlgCol"].Value.ToString() != nameListDataGridView.Rows[i].Cells["DeleteFlgOldCol"].Value.ToString() ) { NameMstUpdateDataSet.NameMstUpdateRow updateRow = dataTable.NewNameMstUpdateRow(); updateRow.NameKbnNew = valueKbnNew; updateRow.NameCdNew = nameListDataGridView.Rows[i].Cells["NameCdCol"].Value.ToString(); updateRow.Name = nameListDataGridView.Rows[i].Cells["NameCol"].Value.ToString(); updateRow.NameCdOld = nameListDataGridView.Rows[i].Cells["NameCdOldCol"].Value.ToString(); updateRow.NameKbnOld = nameListDataGridView.Rows[i].Cells["NameKbnOldCol"].Value.ToString(); updateRow.InsertDt = (DateTime)nameListDataGridView.Rows[i].Cells["InsertDt"].Value; updateRow.InsertUser = nameListDataGridView.Rows[i].Cells["InsertUser"].Value.ToString(); updateRow.InsertTarm = nameListDataGridView.Rows[i].Cells["InsertTarm"].Value.ToString(); updateRow.UpdateDt = (DateTime)nameListDataGridView.Rows[i].Cells["UpdateDt"].Value; updateRow.UpdateUser = nameListDataGridView.Rows[i].Cells["UpdateUser"].Value.ToString(); updateRow.UpdateTarm = nameListDataGridView.Rows[i].Cells["UpdateTarm"].Value.ToString(); updateRow.DeleteFlg = nameListDataGridView.Rows[i].Cells["DeleteFlgCol"].Value.ToString(); dataTable.AddNameMstUpdateRow(updateRow); updateRow.AcceptChanges(); updateRow.SetAdded(); } } else // insert { if ((nameListDataGridView.Rows[i].Cells["NameKbnCol"].Value == null || string.IsNullOrEmpty(nameListDataGridView.Rows[i].Cells["NameKbnCol"].Value.ToString())) && (nameListDataGridView.Rows[i].Cells["NameCdCol"].Value == null || string.IsNullOrEmpty(nameListDataGridView.Rows[i].Cells["NameCdCol"].Value.ToString())) && (nameListDataGridView.Rows[i].Cells["NameCol"].Value == null || string.IsNullOrEmpty(nameListDataGridView.Rows[i].Cells["NameCol"].Value.ToString())) && (nameListDataGridView.Rows[i].Cells["DeleteFlgCol"].Value == null || (string.IsNullOrEmpty(nameListDataGridView.Rows[i].Cells["DeleteFlgOldCol"].Value.ToString())) ) ) { // don't insert } else { NameMstDataSet.NameMstRow insertRow = insertTable.NewNameMstRow(); insertRow.NameKbn = nameListDataGridView.Rows[i].Cells["NameKbnCol"].Value.ToString(); // UPD 20140724 START ZynasSou //insertRow.NameCd = nameListDataGridView.Rows[i].Cells["NameCdCol"].Value.ToString(); insertRow.NameCd = Common.Common.GetKeyRenban("NameMst", nameListDataGridView.Rows[i].Cells["NameKbnCol"].Value.ToString(), "", "").PadLeft(3,'0'); // UPD 20140724 END ZynasSou insertRow.Name = nameListDataGridView.Rows[i].Cells["NameCol"].Value.ToString(); if (string.IsNullOrEmpty(nameListDataGridView.Rows[i].Cells["DeleteFlgCol"].Value.ToString()) || nameListDataGridView.Rows[i].Cells["DeleteFlgCol"].Value.ToString() == "0") { insertRow.DeleteFlg = "0"; } else { insertRow.DeleteFlg = "1"; } insertRow.InsertDt = now; insertRow.InsertUser = loginUser; insertRow.InsertTarm = terminalName; insertRow.UpdateDt = now; insertRow.UpdateUser = loginUser; insertRow.UpdateTarm = terminalName; insertTable.AddNameMstRow(insertRow); insertRow.AcceptChanges(); insertRow.SetAdded(); } } } IKoshinBtnClickALInput alInput = new KoshinBtnClickALInput(); alInput.NameMstUpdateDT = dataTable; alInput.NameMstDT = insertTable; IKoshinBtnClickALOutput alOutput = new KoshinBtnClickApplicationLogic().Execute(alInput); if (alOutput.ListKey.Count == 0) { MessageForm.Show2(MessageForm.DispModeType.Infomation, "登録しました。"); DoSearch(); } else { ChangeBackgroundUpdate(alOutput.ListKey); } }