Ejemplo n.º 1
0
        private void Set_ProjectInit(BindingData clsBindData)
        {
            // DB接続
            SqlServer clsSqlServer = new SqlServer(Com01.clsSystemInfo.SystemDatabase);

            clsSqlServer.Connect();

            Com02.struct_m_kbn m_kbn_UnitKbn = new Com02.struct_m_kbn();
            m_kbn_UnitKbn.kigyo_code = Com01.clsSystemInfo.ComLineArgs.kigyo_code;
            m_kbn_UnitKbn.data_code  = SystemInfo.DataCode.unit_code;

            // 区分マスタを取得
            clsBindData.UnitKbnInfo = Com02.Get_v_kbn(clsSqlServer, m_kbn_UnitKbn);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 引数のデータテーブルからマテリアルコードが一致する値を詳細にセットする。
        /// </summary>
        /// <param name="bindingData"></param>
        /// <param name="materialCode"></param>
        private void Set_SyosaiInfo(BindingData bindingData, string materialCode, ref string materialCode_old)
        {
            // Selectメソッドを使ってデータを抽出
            DataRow[] dRowsMaterialCode = bindingData.MaterialInfo.Select("material_code = '" + materialCode + "'");
            if (dRowsMaterialCode == null || dRowsMaterialCode.Length > 1)
            {
                // なぜこうなるのか
                return;
            }

            // バインド用プロパティにセット
            bindingData.MaterialCode = dRowsMaterialCode[0].ItemArray[Com02.struct_m_material.idx_material_code].ToString();
            bindingData.MaterialName = dRowsMaterialCode[0].ItemArray[Com02.struct_m_material.idx_material_name].ToString();
            bindingData.TypeName     = dRowsMaterialCode[0].ItemArray[Com02.struct_m_material.idx_type_name].ToString();
            bindingData.KikakuShiyo  = dRowsMaterialCode[0].ItemArray[Com02.struct_m_material.idx_kikaku_shiyo].ToString();
            bindingData.Biko         = dRowsMaterialCode[0].ItemArray[Com02.struct_m_material.idx_biko].ToString();

            // 単位コードの何行目かを取得
            string strUnitKbn = dRowsMaterialCode[0].ItemArray[Com02.struct_m_material.idx_unit_kbn].ToString();

            for (int idx = 0; idx <= bindingData.UnitKbnInfo.Rows.Count - 1; idx += 1)
            {
                if (strUnitKbn == bindingData.UnitKbnInfo.Rows[idx].ItemArray[Com02.struct_m_kbn.idx_kbn].ToString())
                {
                    // 行を選択
                    bindingData.UnitKbnInfo_Selectedindex = idx;
                }
            }

            // 無効フラグ
            if (dRowsMaterialCode[0].ItemArray[Com02.struct_m_material.idx_invalid_flg].ToString() == "1")
            {
                bindingData.InvalidFlg = true;
            }
            else
            {
                bindingData.InvalidFlg = false;
            }

            // キーの旧情報として保持
            materialCode_old = bindingData.MaterialCode;
            return;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 詳細情報変更チェック処理
        /// </summary>
        /// <param name="bindingData"></param>
        /// <param name="strMaterialCode_old"></param>
        /// <returns></returns>
        private bool Chk_SyosaiChange(BindingData bindingData, string strMaterialCode_old)
        {
            if (strMaterialCode_old == "")
            {
                // 旧情報無し
                return(false);
            }

            // キー項目を確認
            if (!(bindingData.MaterialCode.Equals(strMaterialCode_old)))
            {
                return(true);
            }

            // キー項目以外でバインド元データと差異があるか確認
            DataRow dRows = bindingData.MaterialInfo.Select("material_code = '" + bindingData.MaterialCode + "'")[0];

            if (!(dRows[Com02.struct_m_material.idx_material_name].ToString() == bindingData.MaterialName))
            {
                return(true);
            }
            if (!(dRows[Com02.struct_m_material.idx_unit_kbn].ToString() == bindingData.UnitKbn))
            {
                return(true);
            }
            if (!(dRows[Com02.struct_m_material.idx_type_name].ToString() == bindingData.TypeName))
            {
                return(true);
            }
            if (!(dRows[Com02.struct_m_material.idx_kikaku_shiyo].ToString() == bindingData.KikakuShiyo))
            {
                return(true);
            }
            if (!(dRows[Com02.struct_m_material.idx_biko].ToString() == bindingData.Biko))
            {
                return(true);
            }

            // 変更なし
            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// マテリアルマスタ登録データ設定処理
        /// </summary>
        /// <param name="clsSqlServer"></param>
        /// <param name="bindingData"></param>
        /// <returns></returns>
        private Com02.struct_m_material Set_EntryData(SqlServer clsSqlServer, BindingData bindingData)
        {
            // キーを条件に最新データを取得
            Com02.struct_m_material m_material = new Com02.struct_m_material();
            m_material.kigyo_code    = Com01.clsSystemInfo.ComLineArgs.kigyo_code;
            m_material.material_code = bindingData.MaterialCode;
            m_material.invalid_flg   = 1; // 削除も含めて検索
            DataTable dTable = Com02.Get_m_material(clsSqlServer, m_material, 1);

            // システム日時を取得
            Com01.Set_DateTime(clsSqlServer);

            // 更新日時をセット
            m_material.koshin_datetime = Com01.clsSystemInfo.dtNow.ToString();
            m_material.koshin_user_id  = Com01.clsSystemInfo.ComLineArgs.user_id;
            m_material.koshin_program  = Com01.clsSystemInfo.strExeName;

            // 検索結果
            if (dTable == null || dTable.Rows.Count == 0)
            {
                // 新規登録日時
                m_material.toroku_datetime = m_material.koshin_datetime;
                m_material.toroku_user_id  = m_material.koshin_user_id;
                m_material.toroku_program  = m_material.koshin_program;

                // 空の場合は規定値を
                m_material.invalid_flg = 0;
            }
            else
            {
                DataRow dRow = dTable.Rows[0];

                // 取得内容を構造体へ
                m_material.toroku_datetime = dRow[Com02.struct_m_material.idx_toroku_datetime].ToString();
                m_material.toroku_user_id  = dRow[Com02.struct_m_material.idx_toroku_user_id].ToString();
                m_material.toroku_program  = dRow[Com02.struct_m_material.idx_toroku_program].ToString();
                m_material.kigyo_code      = dRow[Com02.struct_m_material.idx_kigyo_code].ToString();
                m_material.material_code   = dRow[Com02.struct_m_material.idx_material_code].ToString();
                m_material.material_name   = dRow[Com02.struct_m_material.idx_material_name].ToString();
                m_material.unit_kbn        = dRow[Com02.struct_m_material.idx_unit_kbn].ToString();
                m_material.type_name       = dRow[Com02.struct_m_material.idx_type_name].ToString();
                m_material.kikaku_shiyo    = dRow[Com02.struct_m_material.idx_kikaku_shiyo].ToString();
                m_material.biko            = dRow[Com02.struct_m_material.idx_biko].ToString();
                m_material.yobi1           = dRow[Com02.struct_m_material.idx_yobi1].ToString();
                m_material.yobi2           = dRow[Com02.struct_m_material.idx_yobi2].ToString();
                m_material.yobi3           = dRow[Com02.struct_m_material.idx_yobi3].ToString();
                m_material.yobi4           = dRow[Com02.struct_m_material.idx_yobi4].ToString();
                m_material.yobi5           = dRow[Com02.struct_m_material.idx_yobi5].ToString();
                m_material.invalid_flg     = int.Parse(dRow[Com02.struct_m_material.idx_invalid_flg].ToString());
            }

            // これに対して画面内容を上書く
            if (bindingData.InvalidFlg == true)
            {
                m_material.invalid_flg = 1;
            }
            else
            {
                m_material.invalid_flg = 0;
            }
            m_material.material_name = bindingData.MaterialName;
            m_material.unit_kbn      = bindingData.UnitKbn;
            m_material.type_name     = bindingData.TypeName;
            m_material.kikaku_shiyo  = bindingData.KikakuShiyo;
            m_material.biko          = bindingData.Biko;

            return(m_material);
        }