Пример #1
0
        public async Task <HttpResponseMessage> Select(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", "Select", "Select",
                      param.ddlDap + "%" + param.ddlMode1 + "%" + param.ddlMode2 + "%" + param.ddlExRollback,
                      new MyUserInfo(userName, ipAddress));

            testParameterValue.ShipperID = param.Shipper.ShipperID;

            // 非同期呼び出し
            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
                {
                    // 結果(正常系)
                    Dictionary <string, string> dic = new Dictionary <string, string>()
                    {
                        { "ShipperID", testReturnValue.ShipperID.ToString() },
                        { "CompanyName", testReturnValue.CompanyName },
                        { "Phone", testReturnValue.Phone }
                    };
                    ret = new { Message = "", Result = dic };
                }
            }

            return(Request.CreateResponse(HttpStatusCode.OK, ret));
        }
Пример #2
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> Update(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", "Update", "Update",
                      param.ddlDap + "%" + param.ddlMode1 + "%" + param.ddlMode2 + "%" + param.ddlExRollback,
                      new MyUserInfo(userName, ipAddress));

            testParameterValue.ShipperID   = param.shipper.ShipperID;
            testParameterValue.CompanyName = param.shipper.CompanyName;
            testParameterValue.Phone       = param.shipper.Phone;

            // 非同期呼び出し
            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
                {
                    // 結果(正常系)
                    string message = testReturnValue.Obj.ToString() + "件更新";

                    ret = new { Message = message };
                }
            }

            return(this.Content(JsonConvert.SerializeObject(ret, JSS)));
        }
        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)));
        }
Пример #6
0
        public async Task <HttpResponseMessage> SelectAll_DSQL(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;
                    List <Dictionary <string, string> > list = new List <Dictionary <string, string> >();

                    foreach (DataRow row in dt.Rows)
                    {
                        Dictionary <string, string> dic = new Dictionary <string, string>();
                        dic.Add(dt.Columns[0].ColumnName, row[0].ToString());
                        dic.Add(dt.Columns[1].ColumnName, row[1].ToString());
                        dic.Add(dt.Columns[2].ColumnName, row[2].ToString());

                        list.Add(dic);
                    }

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

            return(Request.CreateResponse(HttpStatusCode.OK, ret));
        }