Exemple #1
0
        public async Task <HttpResponseMessage> SelectAll_DR([FromForm] WebApiParams param)
        {
            // Claimを取得する。
            string userName, roles, scopes, ipAddress;

            MyBaseAsyncApiController.GetClaims(out userName, out roles, out scopes, out ipAddress);

            // 引数クラスを生成
            // 下位(B・D層)は、テスト クラスを流用する
            TestParameterValue testParameterValue
                = new TestParameterValue(
                      "JsonController", "SelectAll_DR", "SelectAll_DR",
                      param.ddlDap + "%" + param.ddlMode1 + "%" + param.ddlMode2 + "%" + param.ddlExRollback,
                      new MyUserInfo(userName, ipAddress));

            // 非同期呼び出し
            AsyncRetVal asyncRetVal = await this.Call("testInProcess", testParameterValue);

            object ret = null;

            if (asyncRetVal.WsErrorInfo != null)
            {
                // ランタイムエラー
                ret = new { ExceptionMSG = asyncRetVal.WsErrorInfo };
            }
            else
            {
                TestReturnValue testReturnValue = (TestReturnValue)asyncRetVal.ReturnValue;

                if (testReturnValue.ErrorFlag == true)
                {
                    // 結果(業務続行可能なエラー)
                    asyncRetVal.WsErrorInfo = new Dictionary <string, string>();
                    asyncRetVal.WsErrorInfo["ErrorMessageID"] = testReturnValue.ErrorMessageID;
                    asyncRetVal.WsErrorInfo["ErrorMessage"]   = testReturnValue.ErrorMessage;
                    asyncRetVal.WsErrorInfo["ErrorInfo"]      = testReturnValue.ErrorInfo;

                    ret = new { ErrorMSG = asyncRetVal.WsErrorInfo };
                }
                else
                {
                    // 結果(正常系)
                    DataTable        dt  = (DataTable)testReturnValue.Obj;
                    DataToDictionary d2d = new DataToDictionary(
                        new Dictionary <string, string>
                    {
                        { "c1", "ShipperID" },
                        { "c2", "CompanyName" },
                        { "c3", "Phone" }
                    }, "", "");
                    ret = new { Message = "", Result = d2d.DataTableToDictionaryList(dt) };
                }
            }

            return(Request.CreateResponse(HttpStatusCode.OK, ret));
        }
        public async Task <ContentResult> SelectAll_DSQL([FromForm] WebApiParams param)
        {
            // Claimを取得する。
            string userName, roles, scopes, ipAddress;

            MyBaseAsyncApiController.GetClaims(out userName, out roles, out scopes, out ipAddress);

            // 引数クラスを生成
            // 下位(B・D層)は、テスト クラスを流用する
            TestParameterValue testParameterValue
                = new TestParameterValue(
                      "JsonController", "SelectAll_DSQL", "SelectAll_DSQL",
                      param.ddlDap + "%" + param.ddlMode1 + "%" + param.ddlMode2 + "%" + param.ddlExRollback,
                      new MyUserInfo(userName, ipAddress));

            testParameterValue.OrderColumn   = param.orderColumn;
            testParameterValue.OrderSequence = param.orderSequence;

            // 非同期呼び出し
            AsyncRetVal asyncRetVal = await this.Call("testInProcess", testParameterValue);

            object ret = null;

            if (asyncRetVal.WsErrorInfo != null)
            {
                // ランタイムエラー
                ret = new { ExceptionMSG = asyncRetVal.WsErrorInfo };
            }
            else
            {
                TestReturnValue testReturnValue = (TestReturnValue)asyncRetVal.ReturnValue;

                if (testReturnValue.ErrorFlag == true)
                {
                    // 結果(業務続行可能なエラー)
                    asyncRetVal.WsErrorInfo = new Dictionary <string, string>();
                    asyncRetVal.WsErrorInfo["ErrorMessageID"] = testReturnValue.ErrorMessageID;
                    asyncRetVal.WsErrorInfo["ErrorMessage"]   = testReturnValue.ErrorMessage;
                    asyncRetVal.WsErrorInfo["ErrorInfo"]      = testReturnValue.ErrorInfo;

                    ret = new { ErrorMSG = asyncRetVal.WsErrorInfo };
                }
                else
                {
                    // 結果(正常系)
                    DataTable        dt  = (DataTable)testReturnValue.Obj;
                    DataToDictionary d2d = new DataToDictionary(null, null, null);
                    ret = new { Message = "", Result = d2d.DataTableToDictionaryList(dt) };
                }
            }

            return(this.Content(JsonConvert.SerializeObject(ret, JSS)));
        }
        public async Task <ContentResult> SelectAll_DT([FromForm] WebApiParams param)
        {
            // Claimを取得する。
            string userName, roles, scopes, ipAddress;

            MyBaseAsyncApiController.GetClaims(out userName, out roles, out scopes, out ipAddress);

            // 引数クラスを生成
            // 下位(B・D層)は、テスト クラスを流用する
            TestParameterValue testParameterValue
                = new TestParameterValue(
                      "JsonController", "SelectAll_DT", "SelectAll_DT",
                      param.ddlDap + "%" + param.ddlMode1 + "%" + param.ddlMode2 + "%" + param.ddlExRollback,
                      new MyUserInfo(userName, ipAddress));

            // 非同期呼び出し
            AsyncRetVal asyncRetVal = await this.Call("testInProcess", testParameterValue);

            object ret = null;

            if (asyncRetVal.WsErrorInfo != null)
            {
                // ランタイムエラー
                ret = new { ExceptionMSG = asyncRetVal.WsErrorInfo };
            }
            else
            {
                TestReturnValue testReturnValue = (TestReturnValue)asyncRetVal.ReturnValue;

                if (testReturnValue.ErrorFlag == true)
                {
                    // 結果(業務続行可能なエラー)
                    asyncRetVal.WsErrorInfo = new Dictionary <string, string>();
                    asyncRetVal.WsErrorInfo["ErrorMessageID"] = testReturnValue.ErrorMessageID;
                    asyncRetVal.WsErrorInfo["ErrorMessage"]   = testReturnValue.ErrorMessage;
                    asyncRetVal.WsErrorInfo["ErrorInfo"]      = testReturnValue.ErrorInfo;

                    ret = new { ErrorMSG = asyncRetVal.WsErrorInfo };
                }
                else
                {
                    // 結果(正常系)
                    DataTable dt = (DataTable)testReturnValue.Obj;

                    // 一部、DataToDictionaryのテストコード
                    DataToDictionary d2d = null;
                    List <Dictionary <string, string> > list = null;

                    d2d = new DataToDictionary(
                        new Dictionary <string, string>()
                    {
                        { "ShipperID", "_ShipperID" },
                        { "CompanyName", "_CompanyName" },
                        { "Phone", "_Phone" }
                    },
                        null, null);
                    list = d2d.DataTableToDictionaryList(dt);
                    Debug.WriteLine(ObjectInspector.Inspect(list));

                    d2d  = new DataToDictionary(null, null, null);
                    list = d2d.DataTableToDictionaryList(dt);
                    Debug.WriteLine(ObjectInspector.Inspect(list));

                    ret = new { Message = "", Result = list };
                }
            }

            return(this.Content(JsonConvert.SerializeObject(ret, JSS)));
        }