/// <summary> /// 詳細情報変更チェック処理 /// </summary> /// <param name="bindingData"></param> /// <param name="strKaisyaCode_old"></param> /// <returns></returns> private bool Chk_SyosaiChange(BindingData bindingData, string strKaisyaCode_old) { if (strKaisyaCode_old == "") { // 旧情報無し return(false); } // キー項目を確認 if (!(bindingData.KaisyaCode.text.Equals(strKaisyaCode_old))) { return(true); } // キー項目以外でバインド元データと差異があるか確認 DataRow dRows = bindingData.KaisyaInfo.Select("kaisya_code = '" + bindingData.KaisyaCode.text + "'")[0]; if (!(dRows[Com02.struct_m_kaisya.idx_kaisya_name].ToString() == bindingData.KaisyaName.text)) { return(true); } // 変更なし return(false); }
private void Set_ProjectInit(BindingData clsBindData) { /* * // DB接続 * SqlServer clsSqlServer = new SqlServer(Com01.clsSystemInfo.SystemDatabase); * clsSqlServer.Connect(); */ }
/// <summary> /// 引数のデータテーブルからマテリアルコードが一致する値を詳細にセットする。 /// </summary> /// <param name="bindingData"></param> /// <param name="kaisyaCode"></param> /// <param name="kaisyaCode_old"></param> private void Set_SyosaiInfo(BindingData bindingData, string kaisyaCode, ref string materialCode_old) { // Selectメソッドを使ってデータを抽出 DataRow[] dRowsRecode = bindingData.KaisyaInfo.Select("kaisya_code = '" + kaisyaCode + "'"); if (dRowsRecode == null || dRowsRecode.Length > 1) { // なぜこうなるのか return; } // 無効フラグ if (dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_invalid_flg].ToString() == "1") { bindingData.InvalidFlg = new CheckItem(true, ""); } else { bindingData.InvalidFlg = new CheckItem(false, ""); } string[] postal = dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_postal_code].ToString().Split('-'); bindingData.PostalCode_1 = new TextItem(postal[0], ""); bindingData.PostalCode_2 = new TextItem(postal[1], ""); bindingData.KaisyaCode = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_kaisya_code].ToString(), ""); bindingData.KaisyaName = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_kaisya_name].ToString(), ""); bindingData.KaisyaName_Kana = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_kaisya_name_kana].ToString(), ""); bindingData.KaisyaName_Ryaku = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_kaisya_name_ryaku].ToString(), ""); bindingData.Address = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_address].ToString(), ""); bindingData.TelNo = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_tel_no].ToString(), ""); bindingData.FaxNo = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_fax_no].ToString(), ""); bindingData.MailAddress = new TextItem(dRowsRecode[0].ItemArray[Com02.struct_m_kaisya.idx_mail_address].ToString(), ""); // キーの旧情報として保持 KaisyaCode_old = bindingData.KaisyaCode.text; return; }
/// <summary> /// マスタ登録データ設定処理 /// </summary> /// <param name="clsSqlServer"></param> /// <param name="bindingData"></param> /// <returns></returns> private Com02.struct_m_kaisya Set_EntryData(SqlServer clsSqlServer, BindingData bindingData) { // キーを条件に最新データを取得 Com02.struct_m_kaisya m_kaisya = new Com02.struct_m_kaisya(); m_kaisya.kigyo_code = Com01.clsSystemInfo.ComLineArgs.kigyo_code; m_kaisya.kaisya_code = bindingData.KaisyaCode.text; m_kaisya.invalid_flg = 1; // 削除も含めて検索 DataTable dTable = Com02.Get_m_kaisya(clsSqlServer, m_kaisya, 1); // システム日時を取得 Com01.Set_DateTime(clsSqlServer); // 更新日時をセット m_kaisya.koshin_datetime = Com01.clsSystemInfo.dtNow.ToString(); m_kaisya.koshin_user_id = Com01.clsSystemInfo.ComLineArgs.user_id; m_kaisya.koshin_program = Com01.clsSystemInfo.strExeName; // 検索結果 if (dTable == null || dTable.Rows.Count == 0) { // 新規登録日時 m_kaisya.toroku_datetime = m_kaisya.koshin_datetime; m_kaisya.toroku_user_id = m_kaisya.koshin_user_id; m_kaisya.toroku_program = m_kaisya.koshin_program; // 空の場合は規定値を m_kaisya.invalid_flg = 0; } else { DataRow dRow = dTable.Rows[0]; // 取得内容を構造体へ m_kaisya.toroku_datetime = dRow[Com02.struct_m_kaisya.idx_toroku_datetime].ToString(); m_kaisya.toroku_user_id = dRow[Com02.struct_m_kaisya.idx_toroku_user_id].ToString(); m_kaisya.toroku_program = dRow[Com02.struct_m_kaisya.idx_toroku_program].ToString(); m_kaisya.invalid_flg = int.Parse(dRow[Com02.struct_m_kaisya.idx_invalid_flg].ToString()); m_kaisya.kaisya_code = dRow[Com02.struct_m_kaisya.idx_kaisya_code].ToString(); m_kaisya.kaisya_name = dRow[Com02.struct_m_kaisya.idx_kaisya_name].ToString(); m_kaisya.kaisya_name_kana = dRow[Com02.struct_m_kaisya.idx_kaisya_name_kana].ToString(); m_kaisya.kaisya_name_ryaku = dRow[Com02.struct_m_kaisya.idx_kaisya_name_ryaku].ToString(); m_kaisya.address = dRow[Com02.struct_m_kaisya.idx_address].ToString(); m_kaisya.postal_code = dRow[Com02.struct_m_kaisya.idx_postal_code].ToString(); m_kaisya.tel_no = dRow[Com02.struct_m_kaisya.idx_tel_no].ToString(); m_kaisya.fax_no = dRow[Com02.struct_m_kaisya.idx_fax_no].ToString(); m_kaisya.mail_address = dRow[Com02.struct_m_kaisya.idx_mail_address].ToString(); } // これに対して画面内容を上書く if (bindingData.InvalidFlg.check == true) { m_kaisya.invalid_flg = 1; } else { m_kaisya.invalid_flg = 0; } m_kaisya.kaisya_code = bindingData.KaisyaCode.text; m_kaisya.kaisya_name = bindingData.KaisyaName.text; m_kaisya.kaisya_name_kana = bindingData.KaisyaName_Kana.text; m_kaisya.kaisya_name_ryaku = bindingData.KaisyaName_Ryaku.text; m_kaisya.address = bindingData.Address.text; m_kaisya.postal_code = bindingData.PostalCode_1.text + "-" + bindingData.PostalCode_2.text; m_kaisya.tel_no = bindingData.TelNo.text; m_kaisya.fax_no = bindingData.FaxNo.text; m_kaisya.mail_address = bindingData.MailAddress.text; return(m_kaisya); }