Ejemplo n.º 1
0
        //────────────────────────────────────────
        #endregion



        #region 判定
        //────────────────────────────────────────

        public override bool Equals(System.Object obj)
        {
            // 引数がヌルの場合は、偽です。
            if (obj == null)
            {
                return(false);
            }

            //
            // 型が同じ時。
            //
            IntCellImpl intCellData = obj as IntCellImpl;

            if (null != intCellData)
            {
                // 空欄同士なら真です。
                if (this.IsSpaces() && intCellData.IsSpaces())
                {
                    return(true);
                }

                if (this.IsValidated && intCellData.IsValidated)
                {
                    // お互いが数値なら、数値で判定

                    return(this.value_Int == intCellData.value_Int);
                }
                else
                {
                    // どちらか片方でも非数値なら、文字列で判定

                    return(this.Text == intCellData.Text);
                }
            }

            if (obj is int)
            {
                int nIntValue = (int)obj;

                // このオブジェクトが空欄なら偽。
                if (this.IsSpaces())
                {
                    return(false);
                }

                // このオブジェクトが非int値なら偽。
                if (!this.IsValidated)
                {
                    return(false);
                }

                // 数値で比較
                return(this.value_Int == nIntValue);
            }

            return(false);
        }
Ejemplo n.º 2
0
        //────────────────────────────────────────

        public Cell NewField(string nodeConfigtree, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            Cell result;

            switch (this.Type_Field)
            {
            case EnumTypeFielddef.String:
            {
                result = new StringCellImpl(nodeConfigtree);
            }
            break;

            case EnumTypeFielddef.Int:
            {
                result = new IntCellImpl(nodeConfigtree);
            }
            break;

            case EnumTypeFielddef.Bool:
            {
                result = new BoolCellImpl(nodeConfigtree);
            }
            break;

            default:
            {
                // 未該当
                result = null;
                goto gt_Error_Unspported;
            }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("フィールド定義を元にして、フィールド値を用意しようとしましたが、未定義のフィールド型でした。");
                s.Newline();

                s.Append("this.Type.ToString()=[");
                s.Append(this.ToString_Type());
                s.Append("]");
                s.Newline();

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
Ejemplo n.º 3
0
        //────────────────────────────────────────

        /// <summary>
        /// O_TableImpl#AddRecordListで使います。
        /// </summary>
        /// <param name="columnIndex"></param>
        /// <param name="value"></param>
        /// <param name="oTable"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public static Cell ConfigurationTo_Field(
            int index_Column,
            string value,
            RecordFielddef recordFielddef,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, "Utility_Row", "ConfigurationTo_Field", log_Reports);
            //

            //
            // セルのソースヒント名
            string nodeConfigtree;

            try
            {
                nodeConfigtree = recordFielddef.ValueAt(index_Column).Name_Humaninput;
            }
            catch (ArgumentOutOfRangeException)
            {
                // エラー
                goto gt_Error_Index;
            }

            Cell result;

            // 型毎に処理を分けます。
            switch (recordFielddef.ValueAt(index_Column).Type_Field)
            {
            case EnumTypeFielddef.Int:
            {
                // 空白データも自動処理
                IntCellImpl cellData = new IntCellImpl(nodeConfigtree);
                cellData.Text = value;
                result        = cellData;
            }
            break;

            case EnumTypeFielddef.Bool:
            {
                // 空白データも自動処理
                BoolCellImpl cellData = new BoolCellImpl(nodeConfigtree);
                cellData.Text = value;
                result        = cellData;
            }
            break;

            default:
            {
                StringCellImpl cellData = new StringCellImpl(nodeConfigtree);
                cellData.Text = value;
                result        = cellData;
            }
            break;
            }

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

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append("列インデックス[" + index_Column + "](0スタート)が指定されましたが、");
                t.Newline();
                t.Append("列は[" + recordFielddef.Count + "]個しかありません。(列定義リストは、絞りこまれている場合もあります)");
                t.Newline();

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
Ejemplo n.º 4
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// DataRow → Dictionary
        /// </summary>
        /// <param name="row"></param>
        /// <param name="log_Reports"></param>
        public void Add(DataRow row, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            Dictionary <string, Cell> record = new Dictionary <string, Cell>();

            int nFieldCount = row.ItemArray.Length;

            for (int nFieldIndex = 0; nFieldIndex < nFieldCount; nFieldIndex++)
            {
                // フィールド名
                string sFieldName = xTable.RecordFielddef.ValueAt(nFieldIndex).Name_Trimupper;

                // 値
                Cell oValue;
                if (row[nFieldIndex] is DBNull)
                {
                    //// デバッグ
                    //if (true)
                    //{
                    //Log_TextIndented txt = new Log_TextIndentedImpl();

                    //    txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【ヌル】");
                    //    txt.Append(" field=[" + sFieldName + "]");

                    //    ystem.Console.WriteLine(txt.ToString());
                    //}

                    String sConfigStack = xTable.Expr_Filepath_ConfigStack.Lv4Execute_OnImplement(
                        EnumHitcount.Unconstraint, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    EnumTypeFielddef typeField = xTable.RecordFielddef.ValueAt(nFieldIndex).Type_Field;
                    switch (typeField)
                    {
                    case EnumTypeFielddef.String:
                        oValue = new StringCellImpl(sConfigStack);
                        break;

                    case EnumTypeFielddef.Int:
                        oValue = new IntCellImpl(sConfigStack);
                        break;

                    case EnumTypeFielddef.Bool:
                        oValue = new BoolCellImpl(sConfigStack);
                        break;

                    default:
                        // エラー。
                        goto gt_Error_UndefinedType;
                    }
                }
                else
                {
                    oValue = (Cell)row[nFieldIndex];

                    //// デバッグ
                    //if (true)
                    //{
                    //Log_TextIndented txt = new Log_TextIndentedImpl();

                    //    txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【○】");
                    //    txt.Append(" 値=[" + oValue.HumanInputString + "]");

                    //    ystem.Console.WriteLine(txt.ToString());
                    //}
                }

                record.Add(sFieldName, oValue);
            }

            this.List_Field.Add(record);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(" 未定義の型です。プログラムのミスの可能性があります。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
Ejemplo n.º 5
0
        //────────────────────────────────────────

        //static public string ParseString(object data)
        //{
        //    if (data is Int_HumaninputImpl)
        //    {
        //        return ((Int_HumaninputImpl)data).Text;
        //    }

        //    //
        //    // 以下、エラー対応。
        //    //
        //    // DBNull でここをよく通る。
        //    //
        //    //
        //    //if (false)
        //    //{
        //    //    Log_TextIndented t = new Log_TextIndentedImpl();

        //    //    if (data is DBNull)
        //    //    {
        //    //        t.Append("int型の値が必要なところでしたが、値が存在しませんでした。(DBNull)");
        //    //        t.Append(Environment.NewLine);
        //    //    }
        //    //    else
        //    //    {
        //    //        t.Append("指定の引数の値[");
        //    //        t.Append(((O_Value)data).SHumanInput);
        //    //        t.Append("]は、int型ではありませんでした。");
        //    //        t.Append(Environment.NewLine);
        //    //    }

        //    //    //.WriteLine("OValue_IntImpl.GetString: エラーメッセージ=" + dt.ToString());
        //    //    throw new System.ArgumentException(t.ToString());
        //    //}

        //    //
        //    //
        //    //
        //    //

        //    return "";
        //}

        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <param name="outInt"></param>
        /// <returns>正常終了なら真、異常終了なら偽。</returns>
        static public bool TryParse(
            object data,
            out int value_Out,
            EnumOperationIfErrorvalue enumCellDataErrorSupport,
            object altValue,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, "OValue_IntImpl", "TryParse", log_Reports);

            bool bResult;

            IntCellImpl err_IntCellData;

            if (data is IntCellImpl)
            {
                IntCellImpl intCellData = (IntCellImpl)data;

                if (intCellData.IsSpaces())
                {
                    //
                    // 空白の場合
                    //

                    if (EnumOperationIfErrorvalue.Spaces_To_Alt_Value == enumCellDataErrorSupport)
                    {
                        if (altValue is int)
                        {
                            value_Out = (int)altValue;

                            bResult = true;
                        }
                        else
                        {
                            // エラー
                            value_Out       = 0;//ゴミ値
                            bResult         = false;
                            err_IntCellData = intCellData;
                            goto gt_Error_AnotherType2;
                        }
                    }
                    else
                    {
                        // エラー
                        value_Out       = 0;//ゴミ値
                        bResult         = false;
                        err_IntCellData = intCellData;
                        goto gt_Error_EmptyString;
                    }
                }
                else if (!intCellData.isValidated)
                {
                    // エラー(変換に失敗した場合)
                    value_Out       = 0;//ゴミ値
                    bResult         = false;
                    err_IntCellData = intCellData;
                    goto gt_Error_Invalid;
                }
                else
                {
                    // 正常処理
                    value_Out = intCellData.value_Int;

                    bResult = true;
                }
            }
            else if (null == data)
            {
                // エラー
                value_Out = 0;//ゴミ値
                bResult   = false;
                goto gt_Error_Null;
            }
            else if (!(data is Cell))
            {
                // エラー
                value_Out = 0;//ゴミ値
                bResult   = false;
                goto gt_Error_AnotherType;
            }
            else
            {
                // エラー
                value_Out = 0;//ゴミ値
                bResult   = false;
                goto gt_Error_Class;
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(" altValue引数には、int型の値を指定してください。");
                s.Append(Environment.NewLine);
                s.Append("  intセル値=[");
                s.Append(err_IntCellData.Text);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  問題箇所ヒント:");
                s.Append(Environment.NewLine);
                s.Append("   ");
                err_IntCellData.ToText_Locationbreadcrumbs(s);
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_EmptyString:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー201!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(" セルに、int型の値を入れてください。空欄にしないでください。");
                s.Append(Environment.NewLine);
                s.Append("  intセル値=[");
                s.Append(err_IntCellData.Text);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  問題箇所ヒント:");
                s.Append(Environment.NewLine);
                s.Append("   ");
                err_IntCellData.ToText_Locationbreadcrumbs(s);
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Invalid:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー111!!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(" int型に変換できませんでした。[");
                s.Append(err_IntCellData.Text);
                s.Append("]");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                s.Append("  問題箇所ヒント:");
                s.Append(Environment.NewLine);
                s.Append("   ");
                err_IntCellData.ToText_Locationbreadcrumbs(s);
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Null:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー110!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(" 指定の引数dataに、IntCellData型の値を指定してください。空っぽでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_AnotherType:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー111!", log_Method);

                Log_TextIndentedImpl s = new Log_TextIndentedImpl();
                s.Append(" 指定の引数dataに、CellData型の値を指定してください。");
                s.Append(Environment.NewLine);
                s.Append(" 別の型[" + data.GetType().Name + "でした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Class:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー112!", log_Method);

                Log_TextIndentedImpl s = new Log_TextIndentedImpl();
                s.Append(" 指定の引数の値[");
                s.Append(((Cell)data).Text);
                s.Append("]は、IntCellData型ではありませんでした。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(bResult);
        }
Ejemplo n.º 6
0
        //────────────────────────────────────────

        /// <summary>
        /// 「E■@where」属性を解析します。
        ///
        /// 該当しないレコードは除去していきます。
        /// </summary>
        /// <param name="srcRow"></param>
        /// <param name="tableH_Source"></param>
        /// <param name="groupLogic"></param>
        /// <param name="reccondList"></param>
        /// <param name="log_Reports"></param>
        /// <returns>ロジックの真偽。</returns>
        private static bool ApplyReccond(
            DataRow srcRow,
            Table_Humaninput tableH_Source,
            EnumLogic parent_EnumLogic,
            List <Recordcondition> list_Reccond,//「E■@where」または「E■rec-cond」。子要素を持たないか、子要素に「E■rec-cond」を持つものとする。
            int nCount_Recursive_Debug,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "ApplyReccond", log_Reports);

            //
            //
            //
            //

            bool   bResult;
            string err_SField;
            int    nDebug_ChildIndex = 0;

            if (EnumLogic.Or == parent_EnumLogic)
            {
                // 1つも真がなければ、偽。
                bResult = false;
            }
            else if (EnumLogic.And == parent_EnumLogic)
            {
                // 1つも偽がなければ、真。
                bResult = true;
            }
            else
            {
                // 条件による。条件が1つもなければ真。
                bResult = true;
            }

            foreach (Recordcondition childReccond in list_Reccond)
            {
                //
                // "and" と有れば、条件に合わなかった場合 false。
                // "or" と有れば、
                //

                if (EnumLogic.None != childReccond.EnumLogic)
                {
                    // andグループ、orグループなら。

                    bool bChildHit = Utility_Table.ApplyReccond(srcRow, tableH_Source, childReccond.EnumLogic, childReccond.List_Child, nCount_Recursive_Debug + 1, log_Reports);

                    if (EnumLogic.And == parent_EnumLogic)
                    {
                        if (bChildHit)
                        {
                            // そのまま。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件内のグループで真 [" + bChildHit + "→真なのでそのまま " + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 子が真なので変化なし。");
                        }
                        else
                        {
                            // 1つでも偽があれば、偽。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件内のグループで偽 [" + bChildHit + "→偽なので確定偽に " + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 子に偽があるので偽。");
                            bResult = false;
                            goto gt_EndMethod;
                        }
                    }
                    else if (EnumLogic.Or == parent_EnumLogic)
                    {
                        if (bChildHit)
                        {
                            // 1つでも真があれば、真。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") OR条件内のグループで真 [" + bChildHit + "→真なので確定真に " + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 子に真があるので真。");
                            bResult = true;
                            goto gt_EndMethod;
                        }
                        else
                        {
                            // そのまま。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") OR条件内のグループで偽 [" + bChildHit + "→偽なのでそのまま "+ bResult + "=False] Reccond=[" + childReccond.ToString() + "] 子が偽なので変化なし。");
                        }
                    }
                    else
                    {
                        // #TODO:エラー
                        System.Console.WriteLine("L02:" + Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明ロジック[" + parent_EnumLogic + "]");
                    }
                }
                else
                {
                    // 条件なら。



                    // このレコードについて判定。
                    if (!tableH_Source.DataTable.Columns.Contains(childReccond.Name_Field))
                    {
                        // エラー
                        err_SField = childReccond.Name_Field;
                        goto gt_Error_MissField;
                    }

                    int      nFieldIx = tableH_Source.DataTable.Columns.IndexOf(childReccond.Name_Field);
                    Fielddef o_FldDef = tableH_Source.RecordFielddef.ValueAt(nFieldIx);
                    Cell     o_Value  = (Cell)srcRow[nFieldIx];


                    // 型に合わせて値取得。
                    if (o_Value is IntCellImpl)
                    {
                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyWhere: intフィールド [" + sLogic + " " + sField + " " + sOpe + " " + sValue + "]");

                        int nFieldInt;
                        {
                            IntCellImpl.TryParse(
                                o_Value,
                                out nFieldInt,
                                EnumOperationIfErrorvalue.Spaces_To_Alt_Value,
                                -1,
                                log_Reports
                                );
                        }

                        int nExpectedInt;
                        {
                            bool bHit2 = int.TryParse(childReccond.Value, out nExpectedInt);
                            if (!bHit2 && log_Reports.CanCreateReport)
                            {
                                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                                r.SetTitle("▲エラー502!", log_Method);
                                r.Message = "int型に変換できませんでした。sValue=[" + childReccond.Value + "]";
                                log_Reports.EndCreateReport();
                            }
                        }


                        if (EnumLogic.Or == parent_EnumLogic)
                        {
                            switch (childReccond.EnumOpe)
                            {
                            case EnumOpe.Gteq:
                                // 「>=」

                                if (nFieldInt >= nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Gt:
                                // 「>」

                                if (nFieldInt > nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Lteq:
                                // 「<=」

                                if (nFieldInt <= nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Lt:
                                // 「<」

                                if (nFieldInt < nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Neq:
                                // 「!=」

                                if (nFieldInt != nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Eq:
                                // ""、"eq"、は eq扱い。

                                // 「=」
                                if (nFieldInt == nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;
                            }
                        }
                        else if (EnumLogic.And == parent_EnumLogic)
                        {
                            switch (childReccond.EnumOpe)
                            {
                            case EnumOpe.Gteq:
                                // 「>=」

                                if (nFieldInt >= nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Gt:
                                // 「>」

                                if (nFieldInt > nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Lteq:
                                // 「<=」

                                if (nFieldInt <= nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Lt:
                                // 「<」

                                if (nFieldInt < nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Neq:
                                // 「!=」

                                if (nFieldInt != nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Eq:
                                // ""、"eq"、は eq扱い。

                                // 「=」
                                if (nFieldInt == nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;
                            }
                        }
                        else
                        {
                            // #TODO:エラー
                            System.Console.WriteLine("L02:" + Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明ロジック[" + parent_EnumLogic + "] nFieldIx=[" + nFieldIx + "] フィールド名=[" + o_FldDef.Name_Humaninput + "] [" + parent_EnumLogic + "][" + childReccond.Name_Field + " " + childReccond.EnumOpe + " " + childReccond.Value + "] objValueの型=[" + o_Value.GetType().Name + "]");
                        }
                    }
                    else
                    {
                        // #TODO:エラー
                        System.Console.WriteLine("L02:" + Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明フィールド nFieldIx=[" + nFieldIx + "] フィールド名=[" + o_FldDef.Name_Humaninput + "] [" + parent_EnumLogic + "][" + childReccond.Name_Field + " " + childReccond.EnumOpe + " " + childReccond.Value + "] objValueの型=[" + o_Value.GetType().Name + "]");
                    }
                }//or,and,条件


                nDebug_ChildIndex++;
            }//for


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

                StringBuilder s = new StringBuilder();
                s.Append("<rec-cond>要素のfield属性エラー");
                s.Append(Environment.NewLine);
                s.Append("field=[");
                s.Append(err_SField);
                s.Append("]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(bResult);
        }
Ejemplo n.º 7
0
        //────────────────────────────────────────

        public void Judge(
            out bool isJudge,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,
            DataRow row,
            Conf_String parent_Query,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            //

            try
            {
                object obj = row[name_KeyField];

                if (obj is DBNull)
                {
                    isJudge = false;
                    goto gt_Error_DBNull;
                }

                Cell valueH = (Cell)obj;

                // (5)キーが空欄で、検索ヒット必須でなければ、無視します。【int型フィールドの場合】
                if (IntCellImpl.IsSpaces(valueH))
                {
                    isJudge = false;
                    goto gt_EndMethod;
                }


                // (6)この行の、キー_フィールドの値を取得。
                int keyValue;

                bool bParsedSuccessful = IntCellImpl.TryParse(
                    valueH,
                    out keyValue,
                    EnumOperationIfErrorvalue.Error,
                    null,
                    log_Reports
                    );

                if (log_Reports.Successful)
                {
                    if (!bParsedSuccessful)
                    {
                        isJudge = false;
                        if (log_Reports.CanCreateReport)
                        {
                            Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error);
                            d_Report.SetTitle("▲エラー698!", log_Method);
                            d_Report.Message = "int型パース失敗。";
                            log_Reports.EndCreateReport();
                        }
                        goto gt_EndMethod;
                    }
                }



                // (7)キー値をint型に変換します。
                int expectedValue;
                if (log_Reports.Successful)
                {
                    bool bParseSuccessful2 = int.TryParse(value_Expected, out expectedValue);
                    if (!bParseSuccessful2)
                    {
                        isJudge = false;
                        if (isRequired_ExpectedValue)
                        {
                            goto gt_Error_Parse;
                        }

                        goto gt_EndMethod;
                    }
                }
                else
                {
                    expectedValue = 0;
                }



                if (log_Reports.Successful)
                {
                    // (8)該当行をレコードセットに追加。
                    if (keyValue == expectedValue)
                    {
                        //
                        // 該当行なら。
                        isJudge = true;
                    }
                    else
                    {
                        isJudge = false;
                    }
                }
                else
                {
                    isJudge = false;
                }
            }
            catch (RowNotInTableException)
            {
                // (9)指定行がなかった場合は、スルー。
                isJudge = false;

                //
                // 指定の行は、テーブルの中にありませんでした。
                // 再描画と、行の削除が被ったのかもしれません。
                // いわゆる「処理中」です。
                //

                //.WriteLine(this.GetType().Name+"#GetValueStringList: ["+refTable.Name+"]テーブルには、["+ttbwIndex+"]行が存在しませんでした。もしかすると、削除されたのかもしれません。エラー:"+e.Message);
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("検索キーに指定した[");
                s.Append(name_KeyField);
                s.Append("]というフィールドは無いです。");
                s.Newline();

                // ヒント
                parent_Query.ToText_Locationbreadcrumbs(s);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_Parse:
            // 空値ではダメという設定の場合。
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー287!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.AppendI(0, "<Select_KeyIntImplクラス>");
                s.Newline();

                s.AppendI(1, "これはint型値のプログラムです。他の型のプログラムを使ってください。");
                s.Newline();

                s.AppendI(1, "・ヒント:変数が見つからなかった場合もここに来ます。例えば、変数名「$aaa」を書こうとして、「aaa」と書いていませんか?");
                s.Newline();

                s.AppendI(1, "・ヒント:数値が大きすぎた場合もここに来ます。");
                s.Newline();

                s.AppendI(1, "sExpectedValue=[");
                s.Append(value_Expected);
                s.Append("]");
                s.Newline();
                s.Newline();

                //
                // ヒント
                parent_Query.ToText_Locationbreadcrumbs(s);

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

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 8
0
        //────────────────────────────────────────

        public static Cell NewInstance(
            object value,
            bool isRequired,
            string conf_Node,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, "Utility_HumaninputValue", "NewInstance", log_Reports);

            Cell result;

            if (value is StringCellImpl)
            {
                result = new StringCellImpl(conf_Node);
            }
            else if (value is IntCellImpl)
            {
                result = new IntCellImpl(conf_Node);
            }
            else if (value is BoolCellImpl)
            {
                result = new BoolCellImpl(conf_Node);
            }
            else
            {
                result = null;

                if (isRequired)
                {
                    //エラー
                    goto gt_Error_AnotherType;
                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("▲エラー201!(" + Info_Table.Name_Library + ")");
                s.Newline();
                s.Append("string,int,boolセルデータクラス以外のオブジェクトが指定されました。");
                s.Newline();

                s.Append("指定された値のクラス=[");
                s.Append(value.GetType().Name);
                s.Append("]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }