Exemplo n.º 1
0
        /// <summary>
        /// 検索処理実行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Search_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // DB接続
                SqlServer clsSqlServer = new SqlServer(Com01.clsSystemInfo.SystemDatabase);
                clsSqlServer.Connect();

                // マテリアルマスタ検索(共通)
                Com02.struct_m_kaisya m_kaisya = new Com02.struct_m_kaisya();
                m_kaisya.kigyo_code        = Com01.clsSystemInfo.ComLineArgs.kigyo_code;
                m_kaisya.kaisya_code       = clsBindData.SearchKaisyaCode;
                m_kaisya.kaisya_name_ryaku = "%" + clsBindData.SearchKaisyaName_Ryaku + "%";
                if (clsBindData.SearchInvalidFlg == true)
                {
                    m_kaisya.invalid_flg = 1;
                }
                clsBindData.KaisyaInfo = Com02.Get_m_kaisya(clsSqlServer, m_kaisya, 100);

                // 画面更新
                this.DataContext = clsBindData;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <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);
        }