Пример #1
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// フィールドから値を取得。
        ///
        /// TODO:セルタイプ以外にも対応したい。
        /// </summary>
        /// <param name="RecordSet_toSave">ヌル不可</param>
        /// <param name="eSelectedFldName">選択フィールド</param>
        /// <param name="RecordSetSaveTo_or_null"></param>
        /// <param name="log_Reports"></param>
        /// <returns>行リスト<列リスト></returns>
        public List <List <string> > P5_Select_CellType(
            RecordSet dst_Rs_toSave,
            Selectstatement selectSt_ToSave,
            Expressionv_4ASelectRecord ecv_selRec_OrNull, //where
            Configuration_Node parent_Cf_Query,           //this
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Expr.Name_Library, this, "P5_Select", log_Reports);
            //
            //

            List <List <string> > reslt_sFieldListList = new List <List <string> >();



            //
            // (1)テーブル
            Table_Humaninput o_Table;

            {
                o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                    selectSt_ToSave.Expression_From, true, log_Reports);

                if (null == o_Table)
                {
                    // エラー。
                    goto gt_Error_NullTable;
                }
            }
            if (!log_Reports.Successful)
            {
                //
                // エラーが出ていたら、さっさと抜ける。
                goto gt_EndMethod;
            }


            //
            //
            //
            //
            // 条件
            //
            //
            //
            //
            Fielddefinition keyFldDefinition     = null;
            string          err_SSelectedFldName = null;
            Exception       err_Exception        = null;
            Recordcondition err_Recordcondition  = null;

            foreach (Recordcondition recCond in selectSt_ToSave.List_Recordcondition)
            {
                err_Recordcondition = recCond;

                //
                // (2)検索のキーフィールドの定義を調べます。

                // キーフィールド定義
                {
                    List <string> sList_KeyFldName;
                    {
                        // 要素数1個。
                        sList_KeyFldName = new List <string>();
                        sList_KeyFldName.Add(recCond.Name_Field);
                    }

                    RecordFielddefinition recordFielddefinition;
                    bool bHit = o_Table.TryGetFieldDefinitionByName(
                        out recordFielddefinition,
                        sList_KeyFldName,
                        false,
                        log_Reports
                        );
                    if (!log_Reports.Successful || !bHit)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    keyFldDefinition = recordFielddefinition.ValueAt(0);
                }



                //
                // (3)選択対象のフィールドの定義を調べます。
                RecordFielddefinition recordFieldDefinition_Selected;
                {
                    bool bHit = o_Table.TryGetFieldDefinitionByName(
                        out recordFieldDefinition_Selected,
                        selectSt_ToSave.List_SName_SelectField,
                        true,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }



                //
                // (4)
                if (null == keyFldDefinition)
                {
                    // エラー。
                    goto gt_Error_NullKeyFldDefinition;
                }


                List <string> list_FldImpl3 = new List <string>();

                recordFieldDefinition_Selected.ForEach(delegate(Fielddefinition fielddefinition_Selected, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    string sSelectField = fielddefinition_Selected.Name_Trimupper;

                    //
                    // (5)
                    if (null == fielddefinition_Selected)
                    {
                        // エラー。
                        isBreak2 = true;
                        goto gt_Error_NullSelectedFldDefinition;
                    }

                    //
                    // (6)欠番

                    //
                    // (7)
                    if (null == dst_Rs_toSave || dst_Rs_toSave.List_Field.Count < 1)
                    {
                        bool bExpectedValueRequired;
                        {
                            bool parseSuccessful = bool.TryParse(selectSt_ToSave.Required, out bExpectedValueRequired);
                        }

                        //
                        // 条件
                        //
                        string name_KeyField;
                        Fielddefinition fielddefinition_Key;
                        string value_Expected;
                        P2_ReccondImpl sel2 = new P2_ReccondImpl();
                        sel2.GetFirstAwhrReccond(
                            out name_KeyField,
                            out fielddefinition_Key,
                            out value_Expected,
                            selectSt_ToSave.List_Recordcondition,
                            o_Table,
                            log_Reports
                            );
                        List <DataRow> dst_Row = new List <DataRow>();

                        SelectPerformerImpl sp = new SelectPerformerImpl();
                        sp.Select(
                            out dst_Row,
                            name_KeyField,
                            value_Expected,
                            bExpectedValueRequired,
                            fielddefinition_Key,
                            o_Table.DataTable,
                            parent_Cf_Query,
                            log_Reports
                            );

                        dst_Rs_toSave.AddList(dst_Row, log_Reports);
                        if (!log_Reports.Successful)
                        {
                            // 既エラー。
                            isBreak2 = true;
                            goto gt_EndInnermethod;
                        }

                        if (null == dst_Rs_toSave)
                        {
                            // (7-2)

                            isBreak2 = true;
                            goto gt_Error_UndefinedPrimitiveType;
                        }
                    }
                    else
                    {
                        // レコードセットは、一時記憶から取得済み。
                    }


                    // (8)
                    if (log_Reports.Successful)
                    {
                        // キー_フィールドの型別に、処理。
                        switch (keyFldDefinition.Type_Field)
                        {
                        case EnumTypeFielddefinition.String:
                            {
                                // (8-1)キーが string型フィールドなら

                                // この行の、選択対象のフィールドの値。

                                foreach (Dictionary <string, Value_Humaninput> record in dst_Rs_toSave.List_Field)
                                {
                                    // 値。

                                    Value_Humaninput selectedCellData;
                                    try
                                    {
                                        selectedCellData = (Value_Humaninput)record[sSelectField];
                                    }
                                    catch (KeyNotFoundException ex)
                                    {
                                        selectedCellData     = null;
                                        err_SSelectedFldName = sSelectField;
                                        err_Exception        = ex;
                                        isBreak2             = true;
                                        goto gt_Error_NotFoundFld;
                                    }

                                    Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue(
                                        fielddefinition_Selected,
                                        selectedCellData,
                                        parent_Cf_Query,
                                        log_Reports
                                        );

                                    list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                                }
                            }
                            break;

                        case EnumTypeFielddefinition.Int:
                            {
                                //
                                // (8-2) キー・フィールドが int型の場合。

                                foreach (Dictionary <string, Value_Humaninput> record in dst_Rs_toSave.List_Field)
                                {
                                    // この行の、選択対象のフィールドの値。

                                    if (null != log_Reports && !log_Reports.Successful)    //無限ループ防止
                                    {
                                        // エラー発生時は無視。
                                    }
                                    else
                                    {
                                        Value_Humaninput selectedCellData;
                                        try
                                        {
                                            selectedCellData = record[sSelectField];
                                        }
                                        catch (KeyNotFoundException ex)
                                        {
                                            selectedCellData     = null;
                                            err_SSelectedFldName = sSelectField;
                                            err_Exception        = ex;
                                            isBreak2             = true;
                                            goto gt_Error_NotFoundFld;
                                        }

                                        {
                                            // 値。
                                            Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue(
                                                fielddefinition_Selected,
                                                selectedCellData,
                                                parent_Cf_Query,
                                                log_Reports
                                                );

                                            list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                                        }
                                    }
                                }
                            }
                            break;

                        case EnumTypeFielddefinition.Bool:
                            {
                                // (8-3) キーが、bool型フィールド

                                // 値。
                                foreach (Dictionary <string, Value_Humaninput> record in dst_Rs_toSave.List_Field)
                                {
                                    // この行の、選択対象のフィールドの値。
                                    Value_Humaninput selectedCellData;
                                    try
                                    {
                                        selectedCellData = (Value_Humaninput)record[sSelectField];
                                    }
                                    catch (KeyNotFoundException ex)
                                    {
                                        selectedCellData     = null;
                                        err_SSelectedFldName = sSelectField;
                                        err_Exception        = ex;
                                        isBreak2             = true;
                                        goto gt_Error_NotFoundFld;
                                    }

                                    Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue(
                                        fielddefinition_Selected,
                                        selectedCellData,
                                        parent_Cf_Query,
                                        log_Reports
                                        );

                                    list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                                }
                            }
                            break;

                        default:
                            {
                                //
                                // (8-4)

                                //
                                // 既にエラー対策済み。

                                if (null != log_Reports)    //無限ループ防止
                                {
                                    //
                                    // エラー。
                                    isBreak2 = true;
                                    goto gt_Error_UndefinedPrimitiveType;
                                }

                                //
                                // 非エラー中断。
                                isBreak2 = true;
                                goto gt_EndInnermethod;
                            }
                            break;
                        }
                    }

                    goto gt_EndInnermethod;
                    //
                    #region 異常系
                    //────────────────────────────────────────
                    gt_Error_NullSelectedFldDefinition:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, o_Table.Name, log_Reports);                                                //テーブル名
                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports); //設定位置パンくずリスト

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6026;", tmpl, log_Reports);
                    }
                    goto gt_EndInnermethod;
                    //────────────────────────────────────────
                    gt_Error_UndefinedPrimitiveType:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, keyFldDefinition.ToString_Type(), log_Reports);                            //キー・フィールド定義型名
                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports); //設定位置パンくずリスト

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6027;", tmpl, log_Reports);
                    }
                    goto gt_EndInnermethod;
                    //────────────────────────────────────────
                    gt_Error_NotFoundFld:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, err_SSelectedFldName, log_Reports);                                        //選択フィールド名
                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports); //設定位置パンくずリスト
                        tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Exception), log_Reports);       //例外メッセージ

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6028;", tmpl, log_Reports);
                    }
                    goto gt_EndInnermethod;
                    //────────────────────────────────────────
                    #endregion
                    //
                    gt_EndInnermethod:
                    ;
                }, log_Reports);//select列1つ

                if (0 < list_FldImpl3.Count)
                {
                    // フィールドがあれば追加。
                    reslt_sFieldListList.Add(list_FldImpl3);
                }
            }

            goto gt_EndMethod;
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullTable:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();

                this.Owner_MemoryApplication.CreateErrorReport("Er:6024;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_NullKeyFldDefinition:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6025;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(reslt_sFieldListList);
        }
Пример #2
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param oVariableName="selectedFldDefinition"></param>
        /// <param oVariableName="selectedOValue"></param>
        /// <returns></returns>
        private Expression_Node_String GetSelectedFieldValue(
            Fielddefinition selectedFldDefinition,
            Value_Humaninput valueH_Selected,
            Configuration_Node parent_Cf_Select,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Expr.Name_Library, this, "GetSelectedFldValue", log_Reports);
            //
            //


            Expression_Node_String reslt_Expression_SelectedValue;

            switch (selectedFldDefinition.Type_Field)
            {
            case EnumTypeFielddefinition.String:
            {
                StringBuilder s = new StringBuilder();
                s.Append("StringCellDataフィールド[");
                s.Append(selectedFldDefinition.Name_Humaninput);
                s.Append("]から取得");

                string sValue = ((Value_Humaninput)valueH_Selected).Text;
                Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select);
                ec_Field.SetString(sValue, log_Reports);
                reslt_Expression_SelectedValue = ec_Field;
            }
            break;

            case EnumTypeFielddefinition.Int:
            {
                StringBuilder s = new StringBuilder();
                s.Append("IntCellDataフィールド[");
                s.Append(selectedFldDefinition.Name_Humaninput);
                s.Append("]から取得");

                string sValue = ((Value_Humaninput)valueH_Selected).Text;
                Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select);
                ec_Field.SetString(sValue, log_Reports);
                reslt_Expression_SelectedValue = ec_Field;
            }
            break;

            case EnumTypeFielddefinition.Bool:
            {
                StringBuilder s = new StringBuilder();
                s.Append("Value_Humaninput_Boolフィールド[");
                s.Append(selectedFldDefinition.Name_Humaninput);
                s.Append("]から取得");

                string sValue = ((Value_Humaninput)valueH_Selected).Text;
                Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select);
                ec_Field.SetString(sValue, log_Reports);
                reslt_Expression_SelectedValue = ec_Field;
            }
            break;

            default:
            {
                reslt_Expression_SelectedValue = null;
                goto gt_Error_NotSupportedType;
            }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotSupportedType:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, selectedFldDefinition.ToString_Type(), log_Reports);//選択したフィールド定義の型名

                this.Owner_MemoryApplication.CreateErrorReport("Er:6029;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(reslt_Expression_SelectedValue);
        }
Пример #3
0
        //────────────────────────────────────────
        /// <summary>
        /// 選択されているセルに、指定の値を上書きします。
        /// </summary>
        /// <param nFcName="outputValueStr"></param>
        /// <param nFcName="row"></param>
        /// <param nFcName="selFldDefinition">選択フィールド</param>
        /// <param nFcName="log_Reports"></param>
        public void ToMemory_ToSelectedField(
            string sValue_Output,
            Expression_Node_String ec_Fcell,
            DataRow row,
            Fielddefinition selFldDefinition,//選択したフィールド定義
            Log_Reports log_Reports
            )
        {
            //essageBox.Show("アップデートデータ【開始】 outputValueStr=[" + outputValueStr + "]\n", "(FormsImpl)" + this.GetType().NFcName );

            //.WriteLine(this.GetType().NFcName + "#: 【開始】データのアップデートを始める。");

            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM_ToSelectedField",log_Reports);
            //
            //

            string sName_SelectedFld;
            {
                bool bHit = ec_Fcell.TrySelectAttribute(
                    out sName_SelectedFld,
                    PmNames.S_SELECT.Name_Pm,
                    EnumHitcount.One,
                    log_Reports
                    );
            }

            string sConfigStack_StringOfCell = sName_SelectedFld;

            switch (selFldDefinition.Type_Field)
            {
                case EnumTypeFielddefinition.String:
                    {
                        // 空欄も自動処理
                        String_HumaninputImpl cellData = new String_HumaninputImpl(sConfigStack_StringOfCell);
                        cellData.Text = sValue_Output;

                        row[sName_SelectedFld] = cellData;
                    }
                    break;
                case EnumTypeFielddefinition.Int:
                    {
                        // 空欄も自動処理
                        Int_HumaninputImpl cellData = new Int_HumaninputImpl(sConfigStack_StringOfCell);
                        cellData.Text = sValue_Output;
                        row[sName_SelectedFld] = cellData;
                    }
                    break;
                case EnumTypeFielddefinition.Bool:
                    {
                        // 空欄も自動処理
                        Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(sConfigStack_StringOfCell);
                        cellData.Text = sValue_Output;
                        row[sName_SelectedFld] = cellData;
                    }
                    break;
                default:
                    {
                        if (log_Reports.CanCreateReport)
                        {
                            Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                            r.SetTitle("▲エラー398!", pg_Method);

                            StringBuilder t = new StringBuilder();

                            t.Append("予期しない、フィールドの型です。");
                            t.Append(Environment.NewLine);
                            t.Append("selFldDefinition.Type=[");
                            t.Append(selFldDefinition.ToString_Type());
                            t.Append("]");
                            t.Append(Environment.NewLine);
                            t.Append(Environment.NewLine);

                            // ヒント
                            t.Append(r.Message_Configuration(
                                ec_Fcell.Cur_Configuration));

                            r.Message = t.ToString();
                            log_Reports.EndCreateReport();
                        }
                    }
                    break;
            }

            //
            pg_Method.EndMethod(log_Reports);
        }
Пример #4
0
        //────────────────────────────────────────
        /// <summary>
        /// 「フィールド名=値」という条件1つで検索。該当するレコード0~N件を返す。
        /// </summary>
        /// <param name="dst_Row"></param>
        /// <param name="name_KeyField"></param>
        /// <param name="value_Expected"></param>
        /// <param name="isRequired_ExpectedValue"></param>
        /// <param name="fielddefinition_Key"></param>
        /// <param name="dataTable"></param>
        /// <param name="s_ParentNode_query"></param>
        /// <param name="log_Reports"></param>
        public void Select(
            out List<DataRow> out_List_DstRow,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,
            Fielddefinition fielddefinition_Key,
            DataTable dataTable,
            Configuration_Node parent_Query,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, this, "Select",log_Reports);

            //
            //
            //
            //

            out_List_DstRow = new List<DataRow>();

            Judge_FieldBoolImpl judgeB = new Judge_FieldBoolImpl();
            Judge_FieldIntImpl judgeI = new Judge_FieldIntImpl();
            Judge_FieldStringImpl judgeS = new Judge_FieldStringImpl();

            foreach (DataRow row in dataTable.Rows)
            {
                bool bJudge;

                switch (fielddefinition_Key.Type_Field)
                {
                    case EnumTypeFielddefinition.String:
                        {
                            // string型フィールドなら
                            judgeS.Judge(
                                out bJudge,
                                name_KeyField,
                                value_Expected,
                                isRequired_ExpectedValue,
                                row,
                                parent_Query,
                                log_Reports
                            );
                        }
                        break;
                    case EnumTypeFielddefinition.Int:
                        {
                            // int型フィールドなら
                            judgeI.Judge(
                                out bJudge,
                                name_KeyField,
                                value_Expected,
                                isRequired_ExpectedValue,
                                row,
                                parent_Query,
                                log_Reports
                            );
                        }
                        break;
                    case EnumTypeFielddefinition.Bool:
                        {
                            // bool型フィールドなら
                            judgeB.Judge(
                                out bJudge,
                                name_KeyField,
                                value_Expected,
                                isRequired_ExpectedValue,
                                row,
                                parent_Query,
                                log_Reports
                            );
                        }
                        break;
                    default:
                        {
                            // エラー。
                            goto gt_Error_UndefinedClass;
                        }
                        break;
                }

                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                if (bJudge)
                {
                    out_List_DstRow.Add(row);
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_UndefinedClass:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー899", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.AppendI(0, "<NFuncCellUpdaterImplクラス>");
                s.Append(Environment.NewLine);

                s.AppendI(1, "予期しない型です。");
                s.Append(Environment.NewLine);

                s.AppendI(1, "keyFldDefinition.Type=[");
                s.Append(fielddefinition_Key.ToString_Type());
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.AppendI(1, r.Message_Configuration(parent_Query));

                s.AppendI(0, "</NFuncCellUpdaterImplクラス>");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Пример #5
0
        //────────────────────────────────────────
        /// <summary>
        /// 
        /// </summary>
        /// <param oVariableName="selectedFldDefinition"></param>
        /// <param oVariableName="selectedOValue"></param>
        /// <returns></returns>
        private Expression_Node_String GetSelectedFieldValue(
            Fielddefinition selectedFldDefinition,
            Value_Humaninput valueH_Selected,
            Configuration_Node parent_Cf_Select,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "GetSelectedFldValue",log_Reports);
            //
            //

            Expression_Node_String reslt_Expression_SelectedValue;

            switch (selectedFldDefinition.Type_Field)
            {
                case EnumTypeFielddefinition.String:
                    {
                        StringBuilder s = new StringBuilder();
                        s.Append("StringCellDataフィールド[");
                        s.Append(selectedFldDefinition.Name_Humaninput);
                        s.Append("]から取得");

                        string sValue = ((Value_Humaninput)valueH_Selected).Text;
                        Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select);
                        ec_Field.SetString(sValue, log_Reports);
                        reslt_Expression_SelectedValue = ec_Field;
                    }
                    break;
                case EnumTypeFielddefinition.Int:
                    {
                        StringBuilder s = new StringBuilder();
                        s.Append("IntCellDataフィールド[");
                        s.Append(selectedFldDefinition.Name_Humaninput);
                        s.Append("]から取得");

                        string sValue = ((Value_Humaninput)valueH_Selected).Text;
                        Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select);
                        ec_Field.SetString(sValue, log_Reports);
                        reslt_Expression_SelectedValue = ec_Field;
                    }
                    break;
                case EnumTypeFielddefinition.Bool:
                    {
                        StringBuilder s = new StringBuilder();
                        s.Append("Value_Humaninput_Boolフィールド[");
                        s.Append(selectedFldDefinition.Name_Humaninput);
                        s.Append("]から取得");

                        string sValue = ((Value_Humaninput)valueH_Selected).Text;
                        Expression_Leaf_String ec_Field = new Expression_Leaf_StringImpl(null, parent_Cf_Select);
                        ec_Field.SetString(sValue, log_Reports);
                        reslt_Expression_SelectedValue = ec_Field;
                    }
                    break;
                default:
                    {
                        reslt_Expression_SelectedValue = null;
                        goto gt_Error_NotSupportedType;
                    }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotSupportedType:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, selectedFldDefinition.ToString_Type(), log_Reports);//選択したフィールド定義の型名

                this.Owner_MemoryApplication.CreateErrorReport("Er:6029;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return reslt_Expression_SelectedValue;
        }
Пример #6
0
        //────────────────────────────────────────

        /// <summary>
        /// 「フィールド名=値」という条件1つで検索。該当するレコード0~N件を返す。
        /// </summary>
        /// <param name="dst_Row"></param>
        /// <param name="name_KeyField"></param>
        /// <param name="value_Expected"></param>
        /// <param name="isRequired_ExpectedValue"></param>
        /// <param name="fielddefinition_Key"></param>
        /// <param name="dataTable"></param>
        /// <param name="s_ParentNode_query"></param>
        /// <param name="log_Reports"></param>
        public void Select(
            out List <DataRow> out_List_DstRow,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,
            Fielddefinition fielddefinition_Key,
            DataTable dataTable,
            Configuration_Node parent_Query,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, this, "Select", log_Reports);

            //
            //
            //
            //

            out_List_DstRow = new List <DataRow>();

            Judge_FieldBoolImpl   judgeB = new Judge_FieldBoolImpl();
            Judge_FieldIntImpl    judgeI = new Judge_FieldIntImpl();
            Judge_FieldStringImpl judgeS = new Judge_FieldStringImpl();


            foreach (DataRow row in dataTable.Rows)
            {
                bool bJudge;

                switch (fielddefinition_Key.Type_Field)
                {
                case EnumTypeFielddefinition.String:
                {
                    // string型フィールドなら
                    judgeS.Judge(
                        out bJudge,
                        name_KeyField,
                        value_Expected,
                        isRequired_ExpectedValue,
                        row,
                        parent_Query,
                        log_Reports
                        );
                }
                break;

                case EnumTypeFielddefinition.Int:
                {
                    // int型フィールドなら
                    judgeI.Judge(
                        out bJudge,
                        name_KeyField,
                        value_Expected,
                        isRequired_ExpectedValue,
                        row,
                        parent_Query,
                        log_Reports
                        );
                }
                break;

                case EnumTypeFielddefinition.Bool:
                {
                    // bool型フィールドなら
                    judgeB.Judge(
                        out bJudge,
                        name_KeyField,
                        value_Expected,
                        isRequired_ExpectedValue,
                        row,
                        parent_Query,
                        log_Reports
                        );
                }
                break;

                default:
                {
                    // エラー。
                    goto gt_Error_UndefinedClass;
                }
                break;
                }

                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                if (bJudge)
                {
                    out_List_DstRow.Add(row);
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedClass:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー899", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.AppendI(0, "<NFuncCellUpdaterImplクラス>");
                s.Append(Environment.NewLine);

                s.AppendI(1, "予期しない型です。");
                s.Append(Environment.NewLine);

                s.AppendI(1, "keyFldDefinition.Type=[");
                s.Append(fielddefinition_Key.ToString_Type());
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                // ヒント
                s.AppendI(1, r.Message_Configuration(parent_Query));

                s.AppendI(0, "</NFuncCellUpdaterImplクラス>");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Пример #7
0
        //────────────────────────────────────────

        /// <summary>
        /// 選択されているセルに、指定の値を上書きします。
        /// </summary>
        /// <param nFcName="outputValueStr"></param>
        /// <param nFcName="row"></param>
        /// <param nFcName="selFldDefinition">選択フィールド</param>
        /// <param nFcName="log_Reports"></param>
        public void ToMemory_ToSelectedField(
            string sValue_Output,
            Expression_Node_String ec_Fcell,
            DataRow row,
            Fielddefinition selFldDefinition,//選択したフィールド定義
            Log_Reports log_Reports
            )
        {
            //essageBox.Show("アップデートデータ【開始】 outputValueStr=[" + outputValueStr + "]\n", "(FormsImpl)" + this.GetType().NFcName );

            //.WriteLine(this.GetType().NFcName + "#: 【開始】データのアップデートを始める。");

            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM_ToSelectedField", log_Reports);
            //
            //

            string sName_SelectedFld;
            {
                bool bHit = ec_Fcell.TrySelectAttribute(
                    out sName_SelectedFld,
                    PmNames.S_SELECT.Name_Pm,
                    EnumHitcount.One,
                    log_Reports
                    );
            }

            string sConfigStack_StringOfCell = sName_SelectedFld;

            switch (selFldDefinition.Type_Field)
            {
            case EnumTypeFielddefinition.String:
            {
                // 空欄も自動処理
                String_HumaninputImpl cellData = new String_HumaninputImpl(sConfigStack_StringOfCell);
                cellData.Text = sValue_Output;

                row[sName_SelectedFld] = cellData;
            }
            break;

            case EnumTypeFielddefinition.Int:
            {
                // 空欄も自動処理
                Int_HumaninputImpl cellData = new Int_HumaninputImpl(sConfigStack_StringOfCell);
                cellData.Text          = sValue_Output;
                row[sName_SelectedFld] = cellData;
            }
            break;

            case EnumTypeFielddefinition.Bool:
            {
                // 空欄も自動処理
                Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(sConfigStack_StringOfCell);
                cellData.Text          = sValue_Output;
                row[sName_SelectedFld] = cellData;
            }
            break;

            default:
            {
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー398!", pg_Method);

                    StringBuilder t = new StringBuilder();

                    t.Append("予期しない、フィールドの型です。");
                    t.Append(Environment.NewLine);
                    t.Append("selFldDefinition.Type=[");
                    t.Append(selFldDefinition.ToString_Type());
                    t.Append("]");
                    t.Append(Environment.NewLine);
                    t.Append(Environment.NewLine);

                    // ヒント
                    t.Append(r.Message_Configuration(
                                 ec_Fcell.Cur_Configuration));

                    r.Message = t.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            break;
            }

            //
            pg_Method.EndMethod(log_Reports);
        }