コード例 #1
0
ファイル: RecordconditionImpl.cs プロジェクト: muzudho/XtA
        //────────────────────────────────────────
        /// <summary>
        /// インスタンスを作ります。
        /// </summary>
        /// <param name="out_recCond"></param>
        /// <param name="logic"></param>
        /// <param name="sField"></param>
        /// <param name="s_ParentNode"></param>
        /// <returns></returns>
        public static bool TryBuild(
            out Recordcondition out_RecCond,
            EnumLogic enumLogic,
            string sField,
            Configuration_Node parent_Conf,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, "RecCondImpl", "TryBuild",log_Reports);

            bool bSuccessful;

            sField = sField.Trim();

            if (EnumLogic.None == enumLogic && "" != sField)
            {
                // 条件式

                RecordconditionImpl rc = new RecordconditionImpl(parent_Conf);
                rc.sField = sField;
                out_RecCond = rc;
                bSuccessful = true;
            }
            else if (EnumLogic.None != enumLogic && "" == sField)
            {
                // グループ

                RecordconditionImpl rc = new RecordconditionImpl(parent_Conf);
                rc.sField = "(▲グループにフィールド属性無し103![" + enumLogic + "])";
                rc.enumLogic = enumLogic;
                out_RecCond = rc;
                bSuccessful = true;
            }
            else
            {
                out_RecCond = null;
                bSuccessful = false;
                goto gt_Error_Attribute;
            }

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

                StringBuilder s = new StringBuilder();
                s.Append("<rec-cond>インスタンスを作成する引数にエラー。");
                s.Append(Environment.NewLine);
                s.Append("logic=[");
                s.Append(enumLogic);
                s.Append("] sField=[");
                s.Append(sField);
                s.Append("]");
                s.Append(Environment.NewLine);

                s.Append(r.Message_Configuration(parent_Conf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();

                //throw new Exception(s.ToString());
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return bSuccessful;
        }
コード例 #2
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// インスタンスを作ります。
        /// </summary>
        /// <param name="out_recCond"></param>
        /// <param name="logic"></param>
        /// <param name="sField"></param>
        /// <param name="s_ParentNode"></param>
        /// <returns></returns>
        public static bool TryBuild(
            out Recordcondition out_RecCond,
            EnumLogic enumLogic,
            string sField,
            Conf_String parent_Conf,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, "RecCondImpl", "TryBuild", log_Reports);

            bool bSuccessful;

            sField = sField.Trim();

            if (EnumLogic.None == enumLogic && "" != sField)
            {
                // 条件式

                RecordconditionImpl rc = new RecordconditionImpl(parent_Conf);
                rc.sField   = sField;
                out_RecCond = rc;
                bSuccessful = true;
            }
            else if (EnumLogic.None != enumLogic && "" == sField)
            {
                // グループ

                RecordconditionImpl rc = new RecordconditionImpl(parent_Conf);
                rc.sField    = "(▲グループにフィールド属性無し103![" + enumLogic + "])";
                rc.enumLogic = enumLogic;
                out_RecCond  = rc;
                bSuccessful  = true;
            }
            else
            {
                out_RecCond = null;
                bSuccessful = false;
                goto gt_Error_Attribute;
            }

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

                StringBuilder s = new StringBuilder();
                s.Append("<rec-cond>インスタンスを作成する引数にエラー。");
                s.Append(Environment.NewLine);
                s.Append("logic=[");
                s.Append(enumLogic);
                s.Append("] sField=[");
                s.Append(sField);
                s.Append("]");
                s.Append(Environment.NewLine);

                s.Append(r.Message_Conf(parent_Conf));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();

                //throw new Exception(s.ToString());
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(bSuccessful);
        }