private void tb_seihin_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_seihin_cd.Text) == false) { e.Cancel = true; return; } //製品コード //未入力は許容する if (tb_seihin_cd.Text.ToString() != null && tb_seihin_cd.Text.ToString() != "") { if (chk_seihin_cd() == false) { MessageBox.Show("入力された製品コードは存在しません。"); e.Cancel = true; } else { if (chk_seihin_kousei() == false) { MessageBox.Show("入力された製品コードは製品構成が登録されていません。"); e.Cancel = true; } } } }
private void tb_urikake_no_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_urikake_no.Text) == false) { e.Cancel = true; return; } if (tb_urikake_no.Text != null && tb_urikake_no.Text != "") { //入力された売上番号を"0000000000"形式の文字列に変換 decimal w_decimal; if (decimal.TryParse(tb_urikake_no.Text.ToString(), out w_decimal)) { tb_urikake_no.Text = w_decimal.ToString("0000000000"); } else { MessageBox.Show("請求番号に異常があります。"); e.Cancel = true; return; } DataTable w_dt = new DataTable(); w_dt = tss.OracleSelect("select * from tss_urikake_m where urikake_no = '" + tb_urikake_no.Text.ToString() + "'"); if (w_dt.Rows.Count == 0) { MessageBox.Show("入力した請求番号は存在しません。"); e.Cancel = true; } } }
private void tb_koutei_cd_Validating(object sender, CancelEventArgs e) { //禁止文字チェック if (tss.Check_String_Escape(tb_koutei_cd.Text) == false) { e.Cancel = true; return; } //工程コード //未入力は許容する if (tb_koutei_cd.Text.ToString() != null && tb_koutei_cd.Text.ToString() != "") { if (chk_koutei_cd() == false) { MessageBox.Show("工程コードに異常があります"); e.Cancel = true; } else { //w_dt_koutei = tss.OracleSelect("select * from tss_koutei_m where koutei_cd = '" + tb_koutei_cd.Text.ToString() + "'"); //tb_koutei_name.Text = w_dt_koutei.Rows[0][1].ToString(); } } }
private void tb_torihikisaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd.Text) == false) { e.Cancel = true; return; } if (tb_torihikisaki_cd.Text == "999999") { MessageBox.Show("取引先コードのオール9は、システム予約コードの為、使用できません。"); tb_torihikisaki_cd.Focus(); e.Cancel = true; return; } //終了ボタンを考慮して、空白は許容する if (tb_torihikisaki_cd.Text != "") { if (chk_torihikisaki_cd() != true) { MessageBox.Show("取引先コードに異常があります。"); e.Cancel = true; } else { //取引先名を取得・表示 tb_torihikisaki_name.Text = get_torihikisaki_name(tb_torihikisaki_cd.Text); } } }
private void tb_torihikisaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd.Text) == false) { e.Cancel = true; return; } //終了ボタンを考慮して、空白は許容する if (tb_torihikisaki_cd.Text != "") { //既存データの場合は、取引先コードの変更、再読み込みは不可 if (tb_nyukin_no.Text.ToString() == w_nyukin_no.ToString("0000000000")) { if (chk_torihikisaki_cd() != true) { MessageBox.Show("取引先コードに異常があります。"); e.Cancel = true; } else { //取引先名を取得・表示 tb_torihikisaki_name.Text = get_torihikisaki_name(tb_torihikisaki_cd.Text); //chk_torihikisaki_simebi(); } } } }
private void tb_torihikisaki_cd1_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd1.Text) == false) { e.Cancel = true; return; } }
private void tb_user_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_user_cd.Text) == false) { e.Cancel = true; return; } }
private void tb_kadou_su_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_kadou_su.Text) == false) { e.Cancel = true; return; } if (chk_kadou_su(tb_kadou_su.Text.ToString()) == false) { MessageBox.Show("稼働日は0~31の間で設定してください。"); return; } }
private bool chk_torihikisaki_cd(string in_cd) { bool out_bl = true; if (tss.Check_String_Escape(in_cd) == false) { out_bl = false; return(out_bl); } if (in_cd != null && in_cd != "") { } return(out_bl); }
private void tb_torihikisaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd.Text) == false) { e.Cancel = true; return; } if (tb_torihikisaki_cd.Text == "") { tb_torihikisaki_name.Text = ""; return; } DataTable dt_work = new DataTable(); dt_work = tss.OracleSelect("select * from tss_torihikisaki_m where torihikisaki_cd = '" + tb_torihikisaki_cd.Text + "'"); if (dt_work.Rows.Count <= 0) { //無し MessageBox.Show("入力された取引先コードが存在しません。取引先マスタに登録してください。"); tb_torihikisaki_cd.Focus(); } else { //既存データ有 tb_torihikisaki_name.Text = get_torihikisaki_name(tb_torihikisaki_cd.Text); } }
private void tb_uriage_no_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_uriage_no.Text) == false) { e.Cancel = true; return; } if (tb_uriage_no.Text == null || tb_uriage_no.Text == "") { //MessageBox.Show("売上番号を入力してください。"); //e.Cancel = true; } else { //入力された売上番号を"0000000000"形式の文字列に変換 decimal w_decimal; if (decimal.TryParse(tb_uriage_no.Text.ToString(), out w_decimal)) { tb_uriage_no.Text = w_decimal.ToString("0000000000"); } else { MessageBox.Show("売上番号に異常があります。"); tb_uriage_no.Focus(); } w_dt_m = tss.OracleSelect("select * from tss_uriage_m where uriage_no = '" + tb_uriage_no.Text + "' order by seq asc"); if (w_dt_m.Rows.Count == 0) { MessageBox.Show("入力した売上番号は存在しません"); } } }
private void dgv_kubun_m_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (tss.Check_String_Escape(e.FormattedValue.ToString()) == false) { e.Cancel = true; return; } }
//区分コードの検証イベント private void tb_kubun_meisyou_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_kubun_meisyou_cd.Text) == false) { e.Cancel = true; return; } //区分名称区分が空白の場合はOKとする if (tb_kubun_meisyou_cd.Text != "") { if (kubun_meisyou_cd_check() != true) { MessageBox.Show("区分コードに異常があります。"); e.Cancel = true; } } }
private void tb_line_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_line_cd.Text) == false) { e.Cancel = true; return; } //空白の場合はOKとする if (tb_line_cd.Text != "") { if (chk_line_cd() != true) { MessageBox.Show("ラインコードに異常があります。"); e.Cancel = true; } } }
private void tb_seikyu_simebi_Validating(object sender, CancelEventArgs e) { //禁止文字のチェック if (tss.Check_String_Escape(tb_seikyu_simebi.Text) == false) { e.Cancel = true; return; } //空白は許容する if (tb_seikyu_simebi.Text != null && tb_seikyu_simebi.Text != "") { if (chk_seikyu_simebi() == false) { MessageBox.Show("請求締日に異常があります。"); e.Cancel = true; } } }
/// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> ///製品コード入力(変更)時のイベント//////////////////////////////////////////////////////////////////////////////// private void tb_seihin_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_seihin_cd.Text) == false) { e.Cancel = true; return; } //空白の場合はOKとする if (tb_seihin_cd.Text != "") { if (chk_seihin_cd() != true) { MessageBox.Show("入力されている製品コードは存在しません。"); e.Cancel = true; return; } seihin_kousei_name_disp(tb_seihin_cd.Text); } }
private void tb_torihikisaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd.Text) == false) { e.Cancel = true; return; } if (tb_torihikisaki_cd.Text == "") { tb_torihikisaki_name.Text = ""; return; } //bool bl = true; //戻り値 DataTable dt_work1 = new DataTable(); dt_work1 = tss.OracleSelect("select * from tss_torihikisaki_m where torihikisaki_cd = '" + tb_torihikisaki_cd.Text + "'"); if (dt_work1.Rows.Count <= 0) { //無し MessageBox.Show("入力された取引先コードが存在しません。取引先マスタに登録してください。"); tb_torihikisaki_cd.Focus(); } else { //既存データ有 tb_torihikisaki_name.Text = get_torihikisaki_name(tb_torihikisaki_cd.Text); if (dgv_siire.DataSource == null) { DataTable dt_work = new DataTable(); dt_work = tss.OracleSelect("select buhin_cd,buhin_name,siire_su,siire_tanka,siire_kingaku,siire_simebi,siharai_date,bikou from tss_siire_m where torihikisaki_cd = '" + 0 + "'"); dgv_siire.DataSource = dt_work; dgv_siire_disp(); } else { } } }
private void btn_send_Click(object sender, EventArgs e) { if (w_to_max < 0) { MessageBox.Show("送信先を指定してください。"); return; } if (tb_title.Text.Length <= 0) { MessageBox.Show("タイトルを入力してください。"); return; } if (tb_naiyou.Text.Length <= 0) { MessageBox.Show("メッセージを入力してください。"); return; } if (tss.Check_String_Escape(tb_title.Text) == false) { return; } if (tss.Check_String_Escape(tb_naiyou.Text) == false) { return; } //送信確認 DialogResult result = MessageBox.Show("メッセージを送信します。\nよろしいですか?", "確認", MessageBoxButtons.YesNo); if (result == DialogResult.No) { //「キャンセル」が選択された時 return; } else { //処理する send_message(); MessageBox.Show("送信が完了しました。"); } }
private void tb_seihin_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_seihin_cd.Text) == false) { e.Cancel = true; return; } //製品コード //未入力は許容する if (tb_seihin_cd.Text.ToString() != null && tb_seihin_cd.Text.ToString() != "") { if (chk_seihin_cd() == false) { MessageBox.Show("入力された製品コードは存在しません。"); e.Cancel = true; } else { if (chk_seihin_tanka() == false) { if (tb_seihin_cd.Text == e.ToString()) //このへん怪しい { } else { tb_seihin_name.Text = get_seihin_name(tb_seihin_cd.Text); gamen_sinki(tb_seihin_cd.Text); } } if (chk_seihin_tanka() == true) { dgv_disp2(); dgv_disp(); } } } }
private void tb_torihikisaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd.Text) == false) { e.Cancel = true; return; } if (tb_torihikisaki_cd.Text != null && tb_torihikisaki_cd.Text != "") { if (chk_torihikisaki_cd(tb_torihikisaki_cd.Text)) { tb_torihikisaki_name.Text = (get_torihikisaki_name(tb_torihikisaki_cd.Text)); } else { MessageBox.Show("取引先コードに異常があります。"); tb_torihikisaki_name.Text = ""; e.Cancel = true; } } }
private void tb_seihin_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_seihin_cd.Text) == false) { e.Cancel = true; return; } if (tb_seihin_cd.Text != "") { tb_seihin_name.Text = get_seihin_name(tb_seihin_cd.Text); } }
private void tb_busyo_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_busyo_cd.Text) == false) { e.Cancel = true; return; } //オール0は他の画面で使用するため使用不可とする if (tb_busyo_cd.Text == "000000") { MessageBox.Show("部署コードに「000000」は使用できません。"); e.Cancel = true; return; } //空白の場合はOKとする if (tb_busyo_cd.Text != "") { if (chk_busyo_cd() != true) { MessageBox.Show("部署コードに異常があります。"); e.Cancel = true; } } }
private void dgv_m_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (tss.Check_String_Escape(e.FormattedValue.ToString()) == false) { e.Cancel = true; return; } for (int i = 0; i < dgv_m.Rows.Count - 1; i++) { if (chk_zaiko_su(dgv_m.Rows[i].Cells[3].Value.ToString()) == false) { MessageBox.Show("入力した数に異常があります。"); dgv_m.CurrentCell = dgv_m[3, i]; return; } } }
private void tb_seihin_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_seihin_cd.Text) == false) { e.Cancel = true; return; } tb_seihin_name.Text = get_seihin_name(tb_seihin_cd.Text); DataTable dt_work = new DataTable(); dt_work = tss.OracleSelect("select seihin_kousei_no,seihin_kousei_name from tss_seihin_kousei_name_m where seihin_cd = '" + tb_seihin_cd.Text.ToString() + "' ORDER BY seihin_kousei_no"); dgv_kubun_m.DataSource = dt_work; dgv_kubun_m.Columns[0].HeaderText = "製品構成番号"; dgv_kubun_m.Columns[1].HeaderText = "製品構成名称"; }
private void tb_torihikisaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd.Text) == false) { e.Cancel = true; return; } DataTable dt_work2 = new DataTable(); dt_work2 = tss.OracleSelect("select torihikisaki_name from TSS_TORIHIKISAKI_M where torihikisaki_cd = '" + tb_torihikisaki_cd.Text + "'"); if (dt_work2.Rows.Count != 0) { tb_torihikisaki_name.Text = dt_work2.Rows[0][0].ToString(); } else { //MessageBox.Show("取引先マスタに登録がありません。取引先マスタの登録をしてください。"); return; } }
private void tb_siiresaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_siiresaki_cd.Text) == false) { e.Cancel = true; return; } //空白の場合はOKとする if (tb_siiresaki_cd.Text != "") { if (chk_siiresaki_cd() != true) { MessageBox.Show("仕入先コードに異常があります。"); e.Cancel = true; } else { tb_siiresaki_name.Text = get_siiresaki_name(tb_siiresaki_cd.Text); } } }
private void tb_buhin_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_buhin_cd.Text) == false) { e.Cancel = true; return; } if (tb_buhin_cd.Text.ToString() != null && tb_buhin_cd.Text.ToString() != "") { w_dt_m = tss.OracleSelect("select * from tss_buhin_m where buhin_cd = '" + tb_buhin_cd.Text.ToString() + "'"); if (w_dt_m.Rows.Count != 0) { tb_buhin_name.Text = w_dt_m.Rows[0]["buhin_name"].ToString(); } else { MessageBox.Show("入力した部品コードは存在しません。"); e.Cancel = true; } } }
private void dgv_m_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (tss.Check_String_Escape(e.FormattedValue.ToString()) == false) { e.Cancel = true; return; } //新しい行のセルでなく、セルの内容が変更されている時だけ検証する DataGridView dgv = (DataGridView)sender; if (e.RowIndex == dgv.NewRowIndex || !dgv.IsCurrentCellDirty) { return; } //指示日(入庫日) if (e.ColumnIndex == 10) { if (chk_sijibi(e.FormattedValue.ToString()) == false) { MessageBox.Show("指示日は YYYYMMDD 形式で入力してください。"); e.Cancel = true; return; } } //指示数(入庫数) if (e.ColumnIndex == 11) { if (chk_suryou(e.FormattedValue.ToString()) == false) { MessageBox.Show("数量は-999999999.99~9999999999.99の範囲で入力してください。"); e.Cancel = true; return; } } }
private void dgv_idou_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { int i = e.ColumnIndex; int j = e.RowIndex; if (dgv_idou.CurrentCell.Value == null) { } else { if (e.FormattedValue.ToString() == dgv_idou.CurrentCell.Value.ToString()) { return; } } if (tss.Check_String_Escape(e.FormattedValue.ToString()) == false) { e.Cancel = true; return; } if (i == 0) { string w_buhin_cd = e.FormattedValue.ToString(); if (w_buhin_cd != "") { DataTable dt_w = new DataTable(); dt_w = tss.OracleSelect("select torihikisaki_cd from TSS_BUHIN_M WHERE buhin_cd = '" + w_buhin_cd.ToString() + "'"); if (dt_w.Rows.Count == 0) { MessageBox.Show("この部品コードは登録されていません。部品登録してください。"); e.Cancel = true; dgv_idou.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = ""; return; } //移動元取引先コードと移動先取引先コードがnullでない場合 if (dgv_idou.Rows[j].Cells[3].Value != null) { string str = dt_w.Rows[0][0].ToString(); string str2 = dgv_idou.Rows[j].Cells[3].Value.ToString(); //string str3 = dgv_idou.Rows[j].Cells[7].Value.ToString(); if (str == str2) { } //if (str == str3) //{ //} else { DialogResult result = MessageBox.Show("移動する部品コードの取引先コードと部品マスタの取引先コードが異なりますがよろしいですか?", "部品入移動登録", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) { dgv_idou.EndEdit(); //dgv_seihin_kousei.EndEdit(); dgv_idou.Focus(); } if (result == DialogResult.Cancel) { e.Cancel = true; dgv_idou.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = ""; return; } } } if (dgv_idou.Rows[j].Cells[7].Value != null) { string str = dt_w.Rows[0][0].ToString(); //string str2 = dgv_idou.Rows[j].Cells[3].Value.ToString(); string str3 = dgv_idou.Rows[j].Cells[7].Value.ToString(); if (str == str3) { } else { DialogResult result = MessageBox.Show("移動する部品コードの取引先コードと部品マスタの取引先コードが異なりますがよろしいですか?", "部品入移動登録", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) { dgv_idou.EndEdit(); //dgv_seihin_kousei.EndEdit(); dgv_idou.Focus(); } if (result == DialogResult.Cancel) { e.Cancel = true; dgv_idou.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = ""; return; } } } dgv_idou.Rows[e.RowIndex].Cells[i + 1].Value = tss.get_buhin_name(w_buhin_cd); dgv_idou.EndEdit(); } } if (i == 2) { string zaiko_kbn = e.FormattedValue.ToString(); //在庫区分が01(フリー)なら、取引先コードと受注コード1、2はリードオンリーで色をグレーにする。 if (zaiko_kbn != "02") { dgv_idou[3, j].Value = null; dgv_idou[4, j].Value = null; dgv_idou[5, j].Value = null; dgv_idou[3, j].Style.BackColor = Color.LightGray; dgv_idou[4, j].Style.BackColor = Color.LightGray; dgv_idou[5, j].Style.BackColor = Color.LightGray; dgv_idou[3, j].ReadOnly = true; dgv_idou[4, j].ReadOnly = true; dgv_idou[5, j].ReadOnly = true; dgv_idou.EndEdit(); } else { dgv_idou[3, j].Style.BackColor = Color.PowderBlue; dgv_idou[4, j].Style.BackColor = Color.PowderBlue; dgv_idou[5, j].Style.BackColor = Color.White; dgv_idou[3, j].ReadOnly = false; dgv_idou[4, j].ReadOnly = false; dgv_idou[5, j].ReadOnly = false; dgv_idou.EndEdit(); } } if (i == 6) { string zaiko_kbn = e.FormattedValue.ToString(); //在庫区分が01(フリー)なら、受注コード1、2はリードオンリーで色をグレーにする。 if (zaiko_kbn != "02") { dgv_idou[7, j].Value = null; dgv_idou[8, j].Value = null; dgv_idou[9, j].Value = null; dgv_idou[7, j].Style.BackColor = Color.LightGray; dgv_idou[8, j].Style.BackColor = Color.LightGray; dgv_idou[9, j].Style.BackColor = Color.LightGray; dgv_idou[7, j].ReadOnly = true; dgv_idou[8, j].ReadOnly = true; dgv_idou[9, j].ReadOnly = true; dgv_idou.EndEdit(); } else { dgv_idou[7, j].Style.BackColor = Color.PowderBlue; dgv_idou[8, j].Style.BackColor = Color.PowderBlue; dgv_idou[9, j].Style.BackColor = Color.White; dgv_idou[7, j].ReadOnly = false; dgv_idou[8, j].ReadOnly = false; dgv_idou[9, j].ReadOnly = false; dgv_idou.EndEdit(); } } if (i == 3 || i == 7) { if (e.FormattedValue == null || e.FormattedValue.ToString() == "") { return; } if (e.FormattedValue == dgv_idou.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) { return; } else { DataTable dt_w = new DataTable(); dt_w = tss.OracleSelect("select torihikisaki_name from tss_torihikisaki_m where torihikisaki_cd = '" + e.FormattedValue.ToString() + "'"); if (dt_w.Rows.Count == 0) { MessageBox.Show("入力された取引先コードが存在しません"); e.Cancel = true; return; } else { if (dgv_idou.Rows[e.RowIndex].Cells[0].Value != null) { //torihikisaki_ck(); string str = dgv_idou.Rows[e.RowIndex].Cells[0].Value.ToString(); string str2 = e.FormattedValue.ToString(); DataTable dt_w2 = new DataTable(); dt_w2 = tss.OracleSelect("select torihikisaki_cd from tss_buhin_m where buhin_cd = '" + str + "'"); if (dt_w2.Rows.Count == 0) { MessageBox.Show("入力された移動先取引先コードが存在しません"); return; } else { string str3 = dt_w2.Rows[0][0].ToString(); if (str2 == str3) { } else { DialogResult result = MessageBox.Show("移動する部品コードの取引先コードと部品マスタの取引先コードが異なりますがよろしいですか?", "部品入移動登録", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) { dgv_idou.EndEdit(); //dgv_seihin_kousei.EndEdit(); dgv_idou.Focus(); } if (result == DialogResult.Cancel) { e.Cancel = true; return; } } } } } } } }
private void tb_torihikisaki_cd_Validating(object sender, CancelEventArgs e) { if (tss.Check_String_Escape(tb_torihikisaki_cd.Text) == false) { e.Cancel = true; return; } if (tb_torihikisaki_cd.Text == "000000" || tb_torihikisaki_cd.Text == "999999") { MessageBox.Show("取引先コードのオール0とオール9は、システム予約コードの為、使用できません。"); e.Cancel = true; return; } }