Beispiel #1
0
        //────────────────────────────────────────
        public static bool TryParse(
            object value,
            out Value_Humaninput out_ValueH,
            bool isRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, "Utility_HumaninputValue", "TryParse", log_Reports);

            bool bResult;

            if (value is Value_Humaninput)
            {
                out_ValueH = (Value_Humaninput)value;

                bResult = true;
            }
            else
            {
                out_ValueH = null;
                bResult = false;

                if (isRequired)
                {
                    goto gt_Error_AnotherType;
                }

                goto gt_EndMethod;
            }

            goto gt_EndMethod;
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_AnotherType:
            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("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 bResult;
        }
Beispiel #2
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────
        //
        // テーブル改造
        //

        /// <summary>
        /// 指定のフィールドから左を、全て右に1列分ずらします。一番右の列は無くなります。
        /// 開いた列には null が入ります。
        /// </summary>
        /// <param name="columnIndex"></param>
        public void Insert(int columnIndex, Value_Humaninput valueH, Log_Reports log_Reports)
        {
            object[] itemArray         = this.DataRow.ItemArray;//ItemArrayを取得する処理は重い。
            int      length            = itemArray.Length;
            int      index_Destination = length - 1;

            //右から順に左へ。
            for (int index_Source = index_Destination - 1; columnIndex <= index_Source; index_Source--)
            {
                //上書きコピー
                itemArray[index_Source + 1] = itemArray[index_Source];

                //todo:型チェンジは? 値を移動したら型も一緒に移動している。
            }

            //挿入するはずの列は空に。
            itemArray[columnIndex] = valueH;
        }
Beispiel #3
0
        //────────────────────────────────────────

        public override void ToText_Content(Log_TextIndented s)
        {
            s.Increment();

            int cur_IndexColumn = 0;

            foreach (object obj in this.DataRow.ItemArray)
            {
                Value_Humaninput valueH = (Value_Humaninput)obj;

                s.Append("[");
                s.Append(cur_IndexColumn);
                s.Append(":");
                s.Append(valueH.Text);
                s.Append("]");

                cur_IndexColumn++;
            }

            s.Decrement();
        }
Beispiel #4
0
        //────────────────────────────────────────

        /// <summary>
        /// デバッグ用に内容をダンプします。
        /// </summary>
        /// <returns></returns>
        public string ToString_DebugDump()
        {
            StringBuilder s = new StringBuilder();

            int cur_IndexColumn = 0;

            foreach (object obj in this.DataRow.ItemArray)
            {
                Value_Humaninput valueH = (Value_Humaninput)obj;

                s.Append("[");
                s.Append(cur_IndexColumn);
                s.Append("](");
                s.Append(valueH.Text);
                s.Append(")");

                cur_IndexColumn++;
            }

            return(s.ToString());
        }
Beispiel #5
0
        /// <summary>
        /// 配列の要素をテキストとして取得します。
        /// </summary>
        /// <param name="name_Field"></param>
        /// <returns></returns>
        public string TextAt(string name_Field)
        {
            string text;

            if (!this.DataRow.Table.Columns.Contains(name_Field))
            {
                text = "";
            }
            else
            {
                Value_Humaninput valueH = (Value_Humaninput)this.DataRow[name_Field];
                if (null != valueH)
                {
                    text = valueH.Text;
                }
                else
                {
                    text = "";
                }
            }

            return(text);
        }
Beispiel #6
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="expected"></param>
        /// <returns>該当がなければ -1。</returns>
        public int ColumnIndexOf_Trimupper(string expected)
        {
            int result = -1;

            int cur_IndexColumn = 0;

            foreach (object obj in this.DataRow.ItemArray)
            {
                Value_Humaninput valueH = (Value_Humaninput)obj;

                if (expected == valueH.Text.Trim().ToUpper())
                {
                    result = cur_IndexColumn;
                    break;
                }
                else
                {
                }

                cur_IndexColumn++;
            }

            return(result);
        }
Beispiel #7
0
 /// <summary>
 /// 配列の要素を取得します。
 /// </summary>
 /// <param name="name_Field"></param>
 /// <returns></returns>
 public void SetValueAt(string name_Field, Value_Humaninput valueH, Log_Reports log_Reports)
 {
     this.DataRow[name_Field] = valueH;
 }
Beispiel #8
0
 /// <summary>
 /// 配列の要素を取得します。
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public void SetValueAt(int index, Value_Humaninput valueH, Log_Reports log_Reports)
 {
     this.DataRow[index] = valueH;
 }
Beispiel #9
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;
        }
Beispiel #10
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(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);
                    Fielddefinition  o_FldDef = tableH_Source.RecordFielddefinition.ValueAt(nFieldIx);
                    Value_Humaninput o_Value  = (Value_Humaninput)srcRow[nFieldIx];


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

                        int nFieldInt;
                        {
                            Int_HumaninputImpl.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(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(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);
        }
Beispiel #11
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);
        }
Beispiel #12
0
        //────────────────────────────────────────

        public void Judge(
            out bool isJudge,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,//使ってない。
            DataRow row,
            Configuration_Node 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
            {
                // 無い列名を指定した場合。
                if (!row.Table.Columns.Contains(name_KeyField))
                {
                    // エラー
                    isJudge = false;
                    goto gt_Error_NothingKeyField;
                }

                Value_Humaninput valueH = (Value_Humaninput)row[name_KeyField];


                //
                // (5)キーが空欄なら、無視します。【文字列型フィールドのみ】
                //
                if (String_HumaninputImpl.IsSpaces(valueH))
                {
                    isJudge = false;
                    goto gt_EndMethod;
                }


                //
                // (6)この行の、キー_フィールドの値を取得。
                //
                string keyValue;
                bool   isParsedSuccessful = String_HumaninputImpl.TryParse(
                    valueH,
                    out keyValue,
                    parent_Query.ToString(),//TODO:本当はテーブル名がいい。 xenonTable.SName,
                    name_KeyField,
                    log_Method,
                    log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    isJudge = false;
                    goto gt_EndMethod;
                }

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



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

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

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

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

                StringBuilder s = new StringBuilder();
                s.Append("無い列名が指定されました。 sKeyFieldName=[" + name_KeyField + "]");
                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Beispiel #13
0
        //────────────────────────────────────────

        /// <summary>
        /// リスト・ビューに、テーブルをセットします。
        /// </summary>
        public void SetDataSourceToListView(
            Table_Humaninput xenonTable, ListView listView, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            DataTable dataTable = xenonTable.DataTable;

            listView.Clear();

            // リスト・ビューにフィールドを追加します。
            xenonTable.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
            {
                // 列を追加します。見出しと幅も設定します。
                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(fielddefinition.Name_Humaninput);

                if (this.IsVisibled_Fieldtype)
                {
                    // デバッグ用に、フィールドの型もヘッダーに表示する場合。
                    s.Append(":");
                    s.Append(fielddefinition.ToString_Type());
                }

                listView.Columns.Add(s.ToString(), 90);
            }, log_Reports);


            for (int index_Row = 0; index_Row < dataTable.Rows.Count; index_Row++)
            {
                DataRow row = dataTable.Rows[index_Row];

                ListViewItem item = null;

                object[] recordFields = row.ItemArray;//ItemArrayは1回の呼び出しが重い。
                for (int indexColumn = 0; indexColumn < recordFields.Length; indexColumn++)
                {
                    object columnObject = recordFields[indexColumn];

                    if (columnObject is Value_Humaninput)
                    {
                        Value_Humaninput valueH = (Value_Humaninput)columnObject;

                        string valueField = valueH.Text;

                        // レコードを作成します。
                        if (0 == indexColumn)
                        {
                            // 最初の列の場合は、行追加になります。

                            // 文字列を追加。
                            item = new ListViewItem(valueField);
                            listView.Items.Add(item);
                        }
                        else
                        {
                            // 最初の列より後ろは、列追加になります。

                            // 文字列を追加。
                            item.SubItems.Add(valueField);
                        }
                    }
                    else if (columnObject is DBNull)
                    {
                        // 空欄、または列データを未設定。
                        goto gt_Error_DBNull;
                    }
                    else
                    {
                        //エラー
                        goto gt_Error_UnknownType;
                    }
                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Newline();
                s.Append("列が未設定(DBNull)。テーブル名=[" + xenonTable.Name + "]");

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Newline();
                s.Append("未定義の型の列。テーブル名=[" + xenonTable.Name + "]");

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

        public void Judge(
            out bool isJudge,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,
            DataRow row,
            Configuration_Node 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
            {
                Value_Humaninput valueH = (Value_Humaninput)row[name_KeyField];

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



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

                bool isParsedSuccessful = Bool_HumaninputImpl.TryParse(
                    valueH,
                    out isKeyValue,
                    EnumOperationIfErrorvalue.Error,
                    null,
                    log_Reports
                    );
                if (log_Reports.Successful)
                {
                    if (!isParsedSuccessful)
                    {
                        // エラー。
                        isJudge = false;
                        if (log_Reports.CanCreateReport)
                        {
                            Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error);
                            d_Report.SetTitle("▲エラー699!", log_Method);
                            d_Report.Message = "bool型パース失敗。";
                            log_Reports.EndCreateReport();
                        }
                        goto gt_EndMethod;
                    }
                }


                bool isExpectedValue;
                if (log_Reports.Successful)
                {
                    // (8)キー値をbool型に変換します。
                    bool isParseSuccessful2 = bool.TryParse(value_Expected, out isExpectedValue);
                    if (!isParseSuccessful2)
                    {
                        isJudge = false;
                        if (isRequired_ExpectedValue)
                        {
                            // 空値ではダメという設定の場合。
                            goto gt_Error_Parse;
                        }
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    isExpectedValue = false;
                }



                // (8)該当行をレコードセットに追加。
                if (log_Reports.Successful)
                {
                    if (isKeyValue == isExpectedValue)
                    {
                        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_Parse:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー286!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.AppendI(0, "<Select_KeyBoolImplクラス>");
                s.Append(Environment.NewLine);

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

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

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

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

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



        #region イベントハンドラー
        //────────────────────────────────────────

        public override string P2b_GetStyleName(
            int nCurIx, CustomcontrolListbox cctLst, Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "P2_GetStyleAttrNames", pg_Logging);
            //
            //


            string sResult;

            // 行をセットしたので、取り出されるのも行です。
            // DataRowをセットしましたが、取り出されるのは DataRowViewになるようです。
            DataRowView row = (DataRowView)cctLst.Items[nCurIx];

            // スタイルのNAME値が入っている。
            Value_Humaninput valueH = Utility_Row.GetFieldvalue(
                NamesFld.S_EXPL_SS,
                row.Row,
                false,//該当なしも可
                pg_Logging,
                Info_LayoutImpl.Name_Library + ":" + this.GetType().Name + "#P2_:リストボックスのEXPL-SS"
                );

            if (!pg_Logging.Successful)
            {
                // 既エラー。
                sResult = "";
                goto gt_EndMethod;
            }

            if (pg_Logging.Successful)
            {
                // 正常時

                if (null == valueH)
                {
                    sResult = "";
                }
                else
                {
                    sResult = ((Value_Humaninput)valueH).Text;
                }
            }
            else
            {
                sResult = "";
            }

            goto gt_EndMethod;

            //
            //
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
            return(sResult);
        }
Beispiel #16
0
        //────────────────────────────────────────
        #endregion



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

        public void SelectItem(
            Expression_Node_String ec_KeyFieldName,
            Expression_Node_String ec_ExpectedValue,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();

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


            string sName_KeyFld = ec_KeyFieldName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

            bool bMatched = false;

            //
            // リストボックスは、現在作成中かも知れない。
            // 項目を選択するタイミングが合わないかも知れない。
            //
            // ※TODO: リストボックスの構築が終わるまで待ちたい。
            //
            string err_STableName;

            for (int nRow = 0; nRow < this.Items.Count; nRow++)
            {
                //.WriteLine(this.GetType().Name + "#SelectItem:(" + Info_Forms .LibraryName+ ") rowIndex=[" + rowIndex + "]");

                DataRowView dataRowView = (DataRowView)this.Items[nRow];

                Value_Humaninput o_FldValue = null;//フィールド
                {
                    // todo: フィールド値
                    if (dataRowView.DataView.Table.Columns.Contains(sName_KeyFld))
                    {
                        object fldValue = dataRowView.Row[sName_KeyFld];

                        bool bParsedSuccessful = Utility_HumaninputValue.TryParse(
                            fldValue,
                            out o_FldValue,
                            true,
                            log_Reports
                            );
                        if (!log_Reports.Successful)
                        {
                            goto gt_EndMethod;
                        }
                    }
                    else
                    {
                        // エラー
                        err_STableName = dataRowView.DataView.Table.TableName;
                        goto gt_Error_NotFoundField;
                    }
                }

                Value_Humaninput o_ExpectedValue = null;
                {
                    //
                    // oFldValue と同じ型の CellData を作成。
                    //
                    o_ExpectedValue = Utility_HumaninputValue.NewInstance(
                        o_FldValue,
                        true,
                        pg_Method.Fullname,
                        log_Reports
                        );
                    if (!log_Reports.Successful)
                    {
                        goto gt_EndMethod;
                    }

                    o_ExpectedValue.Text = ec_ExpectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                }

                if (log_Reports.Successful)
                {
                    if (o_ExpectedValue.Equals(o_FldValue))
                    {
                        //
                        // 一致したら
                        //

                        bMatched = true;
                        //
                        // その列を選択。
                        //
                        this.ControlCommon.BAutomaticinputting = true;
                        this.SelectedIndex = nRow;
                        {
                            // リストボックスの縦幅
                            int nH = this.Height;
                            // 項目の高さ
                            int nIH = this.ItemHeight;
                            // 表示項目数
                            float nVi = (float)nH / (float)nIH;
                            // 半分の位置
                            int nHalf = (int)Math.Floor(nVi / 2.0f);

                            int nTI = nRow - nHalf;
                            if (nTI < 0)
                            {
                                nTI = 0;
                            }
                            this.TopIndex = nTI;//選択した項目が中央に表示されるようにスクロール。
                        }
                        this.ControlCommon.BAutomaticinputting = false;

                        break;
                    }
                }
            }


            // 一致していなければ、選択を解除。
            if (!bMatched)
            {
                //
                // まず、選択解除。
                //
                this.ControlCommon.BAutomaticinputting = true;
                this.ClearSelected();//.SelectedIndex = -1;
                this.ControlCommon.BAutomaticinputting = false;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NotFoundField:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sName_KeyFld, log_Reports);                                                                   //キー・フィールド名
                tmpl.SetParameter(2, err_STableName, log_Reports);                                                                 //テーブル名
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(ec_KeyFieldName.Cur_Configuration), log_Reports);  //キー・フィールド名の設定位置パンくずリスト
                tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(ec_ExpectedValue.Cur_Configuration), log_Reports); //テーブル名の設定位置パンくずリスト

                this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:505;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Beispiel #17
0
        //────────────────────────────────────────

        /// <summary>
        /// スタイルシート・テーブルは、最低限「NAME」「STYLE」の2つで構成されたテーブルです。
        /// </summary>
        /// <param name="oStyleSheetTable"></param>
        /// <returns></returns>
        public MemoryStyles Translate(
            Table_Humaninput xenonTable_Stylesheet,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();

            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "MToO", log_Reports);

            //
            //
            //
            //

            if (null == xenonTable_Stylesheet)
            {
                goto gt_Error_NullTable;
            }

            MemoryStyles oStyleAttrList = new MemoryStylesImpl();

            int nIndex = 0;

            foreach (DataRow dataRow in xenonTable_Stylesheet.DataTable.Rows)
            {
                string sId;
                if (log_Reports.Successful)
                {
                    // 正常時

                    Value_Humaninput valueH;
                    if (log_Reports.Successful)
                    {
                        // 正常時

                        valueH = Utility_Row.GetFieldvalue(
                            "NAME",
                            dataRow,
                            true,
                            log_Reports,
                            "スタイルシートテーブル(NAME検索時)"
                            );
                        if (!log_Reports.Successful)
                        {
                            // 既エラー。
                            goto gt_EndMethod;
                        }
                    }
                    else
                    {
                        valueH = null;
                    }

                    if (log_Reports.Successful)
                    {
                        // 正常時

                        sId = ((Value_Humaninput)valueH).Text;//"スタイルシートテーブルパーサーのID"
                    }
                    else
                    {
                        sId = "";
                    }
                }
                else
                {
                    sId = "";
                }

                string sStyle;
                if (log_Reports.Successful)
                {
                    // 正常時

                    Value_Humaninput valueH = Utility_Row.GetFieldvalue(
                        "STYLE",
                        dataRow,
                        true,
                        log_Reports,
                        "スタイルシートテーブル(STYLE検索時)"
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    sStyle = ((Value_Humaninput)valueH).Text;//"スタイルシートテーブルパーサーのSTYLE"
                }
                else
                {
                    sStyle = "";
                }

                RecordXenonStyle item = new RecordXenonStyleImpl();
                item.Id    = sId;
                item.Style = sStyle;
                oStyleAttrList.Dictionary_RecordStyle.Add(sId, item);

                nIndex++;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullTable:
            {
                oStyleAttrList = null;

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

                    StringBuilder t = new StringBuilder();
                    t.Append("テーブルがヌルでした。");
                    t.Append(Environment.NewLine);
                    t.Append(Environment.NewLine);

                    // ヒント

                    r.Message = t.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return(oStyleAttrList);
        }
Beispiel #18
0
        //────────────────────────────────────────
        //
        // テーブル改造
        //
        /// <summary>
        /// 指定のフィールドから左を、全て右に1列分ずらします。一番右の列は無くなります。
        /// 開いた列には null が入ります。
        /// </summary>
        /// <param name="columnIndex"></param>
        public void Insert(int columnIndex, Value_Humaninput valueH, Log_Reports log_Reports)
        {
            object[] itemArray = this.DataRow.ItemArray;//ItemArrayを取得する処理は重い。
            int length = itemArray.Length;
            int index_Destination = length - 1;

            //右から順に左へ。
            for (int index_Source = index_Destination - 1; columnIndex <= index_Source; index_Source-- )
            {
                //上書きコピー
                itemArray[index_Source + 1] = itemArray[index_Source];

                //todo:型チェンジは? 値を移動したら型も一緒に移動している。
            }

            //挿入するはずの列は空に。
            itemArray[columnIndex] = valueH;
        }
Beispiel #19
0
        //────────────────────────────────────────
        #endregion



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

        public static bool TryParse(
            object value,
            out Value_Humaninput out_ValueH,
            bool isRequired,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            bool bResult;

            if (value is Value_Humaninput)
            {
                out_ValueH = (Value_Humaninput)value;

                bResult = true;
            }
            else
            {
                out_ValueH = null;
                bResult    = false;

                if (isRequired)
                {
                    goto gt_Error_AnotherType;
                }

                goto gt_EndMethod;
            }

            goto gt_EndMethod;
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_AnotherType:
            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("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(bResult);
        }
Beispiel #20
0
 /// <summary>
 /// 配列の要素を取得します。
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public void SetValueAt(int index, Value_Humaninput valueH, Log_Reports log_Reports)
 {
     this.DataRow[index] = valueH;
 }
Beispiel #21
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="out_sFieldListList"></param>
        /// <param name="out_O_NewFldDefList"></param>
        /// <param name="src_sNewFieldNameList"></param>
        /// <param name="e_Where"></param>
        /// <param name="tableH_Source"></param>
        /// <param name="log_Reports"></param>
        public static void SelectFieldListList(
            out List <List <string> > listList_SField_Out,
            out RecordFielddefinition out_RecordFielddefinition_New,
            EnumLogic enumWhereLogic,
            List <string> list_SName_NewField_Src,
            List <Recordcondition> list_Reccond,
            Table_Humaninput tableH_Source,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            //

            RecordFielddefinition recordFielddefinition_New = new RecordFielddefinitionImpl();
            List <int>            list_indexField           = new List <int>();

            //
            // 新しい、列定義リストを作成します。
            //
            {
                // 最初の列は「NO」とします。
                list_SName_NewField_Src.Insert(0, Utility_Table.S_FIELD_NO);

                //fieldIndex
                int nFIx = 0;
                tableH_Source.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
                {
                    if (list_SName_NewField_Src.Contains(fielddefinition.Name_Humaninput))
                    {
                        // 選出されたフィールドだけでリストを作ります。
                        recordFielddefinition_New.Add(fielddefinition);
                        list_indexField.Add(nFIx);
                    }

                    nFIx++;
                }, log_Reports);
            }



            //
            // テーブルに列定義を設定した後で。
            // 移し替えたいデータ値の配列を作ります。
            listList_SField_Out = new List <List <string> >();
            //
            {
                int nEndover = list_indexField.Count;
                foreach (DataRow srcRow in tableH_Source.DataTable.Rows)
                {
                    List <string> sList_NewField = new List <string>();


                    //
                    // 「E■@where」属性を解析します。
                    //
                    // 該当しないレコードは除去していきます。
                    //
                    // 「E■@where」に logic属性が無い場合は logic="and" とします。
                    if (EnumLogic.None == enumWhereLogic)
                    {
                        enumWhereLogic = EnumLogic.And;
                    }
                    bool bHit = Utility_Table.ApplyReccond(srcRow, tableH_Source, enumWhereLogic, list_Reccond, 0, log_Reports);
                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.SelectFieldListList: (結果) [" + bHit + "]");

                    if (bHit)
                    {
                        for (int nA = 0; nA < nEndover; nA++)
                        {
                            // TODO:指定のフィールド・インデックスだけをピックアップしたい。
                            int nB = list_indexField[nA];
                            Value_Humaninput o_Value = (Value_Humaninput)srcRow[nB];

                            sList_NewField.Add(o_Value.Text);
                        }

                        listList_SField_Out.Add(sList_NewField);
                    }
                    //hit
                }
            }


            goto gt_EndMethod;

            //
            //
            //
            //
gt_EndMethod:
            out_RecordFielddefinition_New = recordFielddefinition_New;
            log_Method.EndMethod(log_Reports);
        }
Beispiel #22
0
 /// <summary>
 /// 配列の要素を取得します。
 /// </summary>
 /// <param name="name_Field"></param>
 /// <returns></returns>
 public void SetValueAt(string name_Field, Value_Humaninput valueH, Log_Reports log_Reports)
 {
     this.DataRow[name_Field] = valueH;
 }
Beispiel #23
0
        // ──────────────────────────────

        public void Perform(
            ref Builder_TexttemplateP1pImpl ref_FormatString,
            DataRowView dataRowView,
            Table_Humaninput xenonTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            // TODO IDは「前ゼロ付き文字列」または「int型」なので、念のため一度文字列に変換。
            int nP1pNumber = 1;

            foreach (Fieldkey fieldKey in list_FieldKeies)
            {
                //"[" + oTable.Name + "]テーブルの或る行の[" + fieldKey.Name + "]フィールド値。"//valueOTable.SourceFilePath.HumanInputText

                Value_Humaninput valueH = Utility_Row.GetFieldvalue(
                    fieldKey.Name,
                    dataRowView.Row,
                    true,
                    log_Reports,
                    fieldKey.Description
                    );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }


                // 正常時
                EnumTypeFielddefinition typeFd = FielddefinitionImpl.TypefieldFromString(fieldKey.Name_Type, true, log_Reports);
                switch (typeFd)
                {
                case EnumTypeFielddefinition.String:
                {
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // String_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;

                case EnumTypeFielddefinition.Int:
                {
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // Int_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;

                case EnumTypeFielddefinition.Bool:
                {
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // Bool_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;

                default:
                {
                    // 未定義の型は、string扱い。
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // String_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;
                }

                nP1pNumber++;
            }//foreach

            // 正常
            goto gt_EndMethod;
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
Beispiel #24
0
        //────────────────────────────────────────

        public void Judge(
            out bool isJudge,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,
            DataRow row,
            Configuration_Node 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;
                }

                Value_Humaninput valueH = (Value_Humaninput)obj;

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


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

                bool bParsedSuccessful = Int_HumaninputImpl.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);
        }