Exemple #1
0
        /// <summary>
        /// 指定したコミットIDのコミット詳細を取得する。
        /// 対象リポジトリが存在しない場合はnullが返る。
        /// </summary>
        /// <param name="gitMap">Git情報</param>
        /// <param name="repositoryName">リポジトリ名</param>
        /// <param name="owner">オーナー名</param>
        /// <param name="commitId">コミットID</param>
        /// <returns>コミット詳細</returns>
        public async Task <Result <CommitModel, string> > GetCommitByIdAsync(UserTenantGitMap gitMap, string repositoryName, string owner, string commitId)
        {
            // API呼び出しパラメータ作成
            RequestParam param = CreateRequestParam(gitMap);

            param.ApiPath = $"/repos/{owner}/{repositoryName}/commits/{commitId}";

            // API 呼び出し
            Result <string, string> response = await this.SendGetRequestAsync(param);

            if (response.IsSuccess)
            {
                var result = JsonConvert.DeserializeObject <GetCommitModel>(response.Value);
                var commit = new CommitModel()
                {
                    CommitId      = result.sha,
                    Comment       = result.commit?.message,
                    CommitAt      = result.commit?.author?.date.ToLocalFormatedString(),
                    CommitterName = result.commit?.author?.name
                };
                return(Result <CommitModel, string> .CreateResult(commit));
            }
            else
            {
                return(Result <CommitModel, string> .CreateErrorResult(response.Error));
            }
        }
Exemple #2
0
        /// <summary>
        /// リポジトリ一覧を取得する。
        /// 特に範囲は限定せず、<see cref="Git.Token"/>の権限で参照可能なすべてのリポジトリが対象となる。
        /// </summary>
        /// <param name="gitMap">Git情報</param>
        /// <returns>リポジトリ一覧</returns>
        public async Task <Result <IEnumerable <RepositoryModel>, string> > GetAllRepositoriesAsync(UserTenantGitMap gitMap)
        {
            if (string.IsNullOrEmpty(gitMap.GitToken))
            {
                //トークンが設定されていない場合、GitHubのリポジトリ一覧は取得できない
                //なので空の結果を返す

                return(Result <IEnumerable <RepositoryModel>, string> .CreateResult(new List <RepositoryModel>()));
            }

            // API呼び出しパラメータ作成
            RequestParam param = CreateRequestParam(gitMap);

            param.ApiPath = $"/user/repos";

            // API 呼び出し
            Result <string, string> response = await this.SendGetRequestAsync(param);

            if (response.IsSuccess)
            {
                var result = JsonConvert.DeserializeObject <IEnumerable <GetRepositoryModel> >(response.Value);
                return(Result <IEnumerable <RepositoryModel>, string> .CreateResult(
                           result.Select(e => new RepositoryModel()
                {
                    Owner = e.owner.login,         //GitHubではAPI実行にそのリポジトリのオーナー名が必要なので、それをKeyに入れる
                    Name = e.name,
                    FullName = e.full_name,
                }).OrderBy(e => e.FullName)));
            }
            else
            {
                return(Result <IEnumerable <RepositoryModel>, string> .CreateErrorResult(response.Error));
            }
        }
Exemple #3
0
        public JsonResult QueryDayLog(RequestParam param)
        {
            ILogDataService logService = IocMvcFactoryHelper.GetInterface <ILogDataService>();

            Common.Data.JsonData json = logService.QueryLogs(param);
            return(Json(json));
        }
Exemple #4
0
        /// <summary>
        /// コミット一覧を取得する。
        /// 対象リポジトリが存在しない場合はnullが返る。
        /// </summary>
        /// <param name="gitMap">Git情報</param>
        /// <param name="repositoryName">リポジトリ名</param>
        /// <param name="owner">オーナー名</param>
        /// <param name="branchName">ブランチ名</param>
        /// <returns>コミット一覧</returns>
        public async Task <Result <IEnumerable <CommitModel>, string> > GetAllCommitsAsync(UserTenantGitMap gitMap, string repositoryName, string owner, string branchName)
        {
            // API呼び出しパラメータ作成
            RequestParam param = CreateRequestParam(gitMap);

            param.ApiPath = $"/repos/{owner}/{repositoryName}/commits";
            if (string.IsNullOrEmpty(branchName) == false)
            {
                param.QueryParams = new Dictionary <string, string>
                {
                    { "sha", branchName }
                };
            }

            // API 呼び出し
            Result <string, string> response = await this.SendGetRequestAsync(param);

            if (response.IsSuccess)
            {
                var result = JsonConvert.DeserializeObject <IEnumerable <GetCommitModel> >(response.Value);
                return(Result <IEnumerable <CommitModel>, string> .CreateResult(
                           result.Select(e => new CommitModel()
                {
                    CommitId = e.sha,
                    Comment = e.commit?.message,
                    CommitAt = e.commit?.author?.date.ToLocalFormatedString(),
                    CommitterName = e.commit?.author?.name
                })));
            }
            else
            {
                return(Result <IEnumerable <CommitModel>, string> .CreateErrorResult(response.Error));
            }
        }
Exemple #5
0
        public static void SendToServer(string serverProxy, STS sts, JsonData json, Action <JsonData> callback)
        {
            ServerService service = null;

            if (!mServerServices.TryGetValue(serverProxy, out service))
            {
                return;
            }

            RequestParam param = new RequestParam();

            param["sts"]      = (int)sts;
            param["data"]     = json.ToJson();
            param["response"] = (byte)((callback != null) ? 1 : 0);
            service.Service.Call("RemoteHandle", param, (result) =>
            {
                var reader        = new MessageStructure(result.Message as byte[]);
                string jsonStr    = reader.ReadString();
                JsonData jsonData = JsonMapper.ToObject(jsonStr);
                if (callback != null)
                {
                    callback(jsonData);
                }
            });
        }
Exemple #6
0
        public void GivenIWantToBeAbleToDeleteABlogPostWithTheId(string postId)
        {
            var xmlRpc = ScenarioContext.Current.Get <RequestTop>(Keys.XmlRpcRequest);

            xmlRpc.Method = "blogger.deletePost";

            var param = new RequestParam
            {
                RequestValue =
                {
                    ValueChoice = MemberValue.ValueType.String,
                    Value       = postId.ToString(CultureInfo.InvariantCulture)
                }
            };

            xmlRpc.Params.Add(param);

            // A boolean is specified by the Blogger API, this is ignored but included here for completeness.
            var param2 = new RequestParam
            {
                RequestValue =
                {
                    ValueChoice = MemberValue.ValueType.@Boolean,
                    Value       = 0
                }
            };

            xmlRpc.Params.Add(param2);

            ScenarioContext.Current.Set(xmlRpc, Keys.XmlRpcRequest);
        }
        public ResultInfo <AppDownloadInfo> SelectPackageInformation(RequestParam <RequestVersion> reqst)
        {
            ResultInfo <AppDownloadInfo> result = new ResultInfo <AppDownloadInfo>("99999");

            using (B_AppUpdatePackage bll = new B_AppUpdatePackage())
            {
                var model = bll.GetLastModel(reqst.body.Platform, reqst.body.Channel, reqst.body.DeviceVersion.Trim());
                if (model != null)
                {
                    //if (model.Version.Trim() == reqst.body.DeviceVersion.Trim())
                    if (!Utils.IsNewAppVersion(reqst.body.DeviceVersion.Trim(), model.Version.Trim()))
                    {
                        result.code    = "0";
                        result.message = "你已是最新版本,无需更新!";
                        result.body    = null;
                        return(result);
                    }
                    result.code             = "1";
                    result.body             = new AppDownloadInfo();
                    result.body.Channel     = model.Channel;
                    result.body.Code        = model.Code;
                    result.body.UpdateLevel = model.UpdateLevel;
                    result.body.Description = model.Description;
                    result.body.FileName    = model.Code + ".apk";
                    result.body.CreateTime  = model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
                    result.body.IsEnable    = Convert.ToBoolean(model.IsEnable);
                    result.body.ValideCode  = model.ValideCode;
                    result.body.Version     = model.Version;
                }
            }
            return(result);
        }
Exemple #8
0
        public ResultInfo <List <NormalAreaEntity> > SelectCity(RequestParam <RequestAreaEntity> reqst)
        {
            var ri = new ResultInfo <List <NormalAreaEntity> >("99999");

            try
            {
                var lst = logic.SelectCities(reqst.body.parentId);
                if (lst != null)
                {
                    ri.code = "1";
                    ri.body = lst;
                }
                else
                {
                    ri.code = "1000000010";
                }
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                ri.code    = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #9
0
        public ResultInfo <BasePage <List <OwnBonusEntity> > > SelectPersonalBonuses(RequestParam <RequestOwnBonus> reqst)
        {
            var ri = new ResultInfo <BasePage <List <OwnBonusEntity> > >("99999");

            try
            {
                int userId    = ConvertHelper.ParseValue(reqst.body.userId.ToString(), 0);
                int pageIndex = ConvertHelper.ParseValue(reqst.body.pageIndex.ToString(), 0);
                int pageSize  = ConvertHelper.ParseValue(reqst.body.pageSize.ToString(), 0);
                ri.code = "1";
                ri.body = bonusLogic.SelectOwnBonuses(pageIndex, pageSize, userId);
                if (ri.body == null || ri.body.rows == null || ri.body.rows.Count < 1)
                {
                    ri.code = "1000000010";
                    ri.body = null;
                }
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #10
0
        public ResultInfo <ResponseUserAddressEntity> SelectUserAddress(RequestParam <RequestMemberDetail> reqst)
        {
            var ri = new ResultInfo <ResponseUserAddressEntity>("99999");

            try
            {
                int userId = ConvertHelper.ParseValue(reqst.body.userId.ToString(), 0);


                ri.body = bonusLogic.SelectUserAddress(userId);
                if (ri.body == null)
                {
                    ri.code = "1000000010";
                }
                else
                {
                    ri.code = "1";
                }

                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #11
0
        public ResultInfo <MemberWithRedpacketEntity> SelectMemberInformation(RequestParam <RequestMemberDetail> reqst)
        {
            //todo 添加会员基本信息代码

            var ri = new ResultInfo <MemberWithRedpacketEntity>("99999");

            try
            {
                var userId = reqst.body.userId.ToString();
                if (string.IsNullOrEmpty(userId))
                {
                    ri.code = "1000000000";
                }
                else
                {
                    ri.code = "1";
                    var ent = _logic.SelectMemberWithRedpacketByUserId(ConvertHelper.ParseValue(userId, 0));
                    if (ent == null)
                    {
                        ri.code = "1000000015";
                    }
                    ri.body = ent;
                }
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                ri.code    = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #12
0
        ///// <summary>
        ///// 验证原始手机号接口--解志辉
        ///// </summary>
        ///// <param name="reqst">The reqst.</param>
        ///// <returns>ResultInfo&lt;System.String&gt;.</returns>
        /////  创 建 者:解志辉
        /////  创建日期:2016-05-25 16:29:13
        //public ResultInfo<string> ValidateOrgMobile(RequestParam<RequestValidateOrgMobileEntity> reqst)
        //{
        //    var ri = new ResultInfo<string>("99999");
        //    try
        //    {
        //        var mobile = _logic.SelectUserMobileByUserId(reqst.body.userId);//当前用户手机号

        //        if (string.IsNullOrEmpty(reqst.body.mobile))
        //        {
        //            ri.code = "1000000000";
        //        }
        //        else if (!ValidateHelper.IsHandset(reqst.body.mobile))
        //        {
        //            ri.code = "1000000001";
        //        }
        //        else if (mobile != reqst.body.mobile)
        //        {
        //            ri.code = "1000000013";
        //        }

        //        else
        //        {
        //            #region 验证code 通过后修改密码

        //            var code = reqst.body.code;
        //            var w = 8;
        //            if (_recordLogic.CheckCode(code, w, mobile))
        //            {

        //                ri.code = "1";

        //            }
        //            else
        //            {
        //                ri.code = "1000000011"; //验证码不存在或已过期
        //            }

        //            #endregion
        //        }
        //        ri.message = Settings.Instance.GetErrorMsg(ri.code);
        //        return ri;
        //    }
        //    catch (Exception ex)
        //    {
        //        LoggerHelper.Error(ex.ToString());
        //        LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
        //        ri.message = Settings.Instance.GetErrorMsg(ri.code);
        //        return ri;
        //    }

        //}

        /// <summary>
        /// 验证用户是否实名--解志辉
        /// </summary>
        /// <param name="reqst"></param>
        /// <returns></returns>
        public ResultInfo <int> IsRealName(RequestParam <RequestMemberDetail> reqst)
        {
            var ri = new ResultInfo <int>("99999");

            try
            {
                var ent = _logic.SelectMemberByUserId(reqst.body.userId);
                if (string.IsNullOrEmpty(ent.UsrCustId))
                {
                    ri.body = 0;
                }
                else
                {
                    ri.body = 1;
                }
                ri.code    = "1";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #13
0
        public ResultInfo <string> ModifyPassword(RequestParam <RequestModifyPass> reqst)
        {
            //todo 添加修改密码代码
            var ri = new ResultInfo <string>("99999");

            try
            {
                var orgPwd = reqst.body.orgPwd.ToString();
                var newPwd = reqst.body.newPwd.ToString();
                var userId = reqst.body.userId.ToString();

                var ent = _logic.SelectMemberByUserId(ConvertHelper.ParseValue(userId, 0));
                if (ent != null)
                {
                    #region 验证原始密码是否正确

                    if (!ent.password.Equals(EncryptHelper.Encrypt(orgPwd)))
                    {
                        ri.code = "1000000012";
                    }
                    else
                    {
                        #region 验证通过,修改密码

                        try
                        {
                            _logic.ModifyPassword(ent.mobile, newPwd);

                            SendMsg(ent.mobile);

                            ri.code = "1";
                        }
                        catch (Exception ex)
                        {
                            LoggerHelper.Error(ex.ToString());
                            ri.code = "0";
                        }

                        #endregion
                    }

                    #endregion
                }
                else
                {
                    ri.code = "1000000021";
                }


                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
        public ActionResult Student(RequestParam model)
        {
            string id = model.UserId;
            UnitOfWork uow = new UnitOfWork();
            var user = uow.Users.Get(a => a.UserID == model.UserId && a.UserRole == (int)UserRoles.Student).FirstOrDefault();
            if (user != null)
            {
                if (model.Status == "block")
                {
                    user.Status = (int)UserStatus.Blocked;
                    ViewBag.Message = Resources.Resources.MsgTeacherApproveSuccess;
                }
                else if (model.Status == "active")
                {
                    user.Status = (int)UserStatus.Approved;
                    ViewBag.Message = Resources.Resources.MsgTeacherApproveSuccess;
                }
                else if (model.Status == "delete")
                {
                    user.Status = (int)UserStatus.Deleted;
                    ViewBag.Message = Resources.Resources.MsgTeacherApproveSuccess;

                }
                uow.Users.Update(user);
                uow.Save();
            }
            user.Email = Encryptor.Decrypt(user.Email);
            //User user = uow.Users.Get(a => a.UserID == id).FirstOrDefault();

            return View(user);
        }
        /// <summary>
        /// 将目标Action跳转到社交服
        /// </summary>
        /// <param name="httpGet"></param>
        public static async void SendDesActionToSocialServer(HttpGet httpGet)
        {
            //检查
            if (SocialSession == null)
            {
                TraceLog.WriteError("SendDesActionToSocialServer error, 社交服没连接");
                return;
            }
            int desActionId = 0;

            if (!httpGet.GetInt("DesActionId", ref desActionId))
            {
                TraceLog.WriteError("SendDesActionToSocialServer error, 未指定目标ActionId");
                return;
            }
            //执行
            RequestParam param = new RequestParam();

            param["ActionId"] = desActionId;
            foreach (var key in httpGet.Keys)
            {
                if (key == "ActionId" || key == "DesActionId")
                {
                    continue;
                }
                param[key] = httpGet[key];
            }
            string post = string.Format("?d={0}", System.Web.HttpUtility.UrlEncode(param.ToPostString()));
            var    data = Encoding.UTF8.GetBytes(post);
            await SocialSession.SendAsync(data, 0, data.Length);
        }
Exemple #16
0
        /// <summary>
        /// 获取用户关联的银行列表--解志辉
        /// </summary>
        /// <returns></returns>
        public ResultInfo <List <MemberBankEntity> > SelectUserBankList(RequestParam <RequestMemberDetail> reqst)
        {
            QueryCardInfoByHuiFu(logic.SelectMemberByUserId(reqst.body.userId).UsrCustId);

            var ri = new ResultInfo <List <MemberBankEntity> >("99999");

            try
            {
                ri.code = "1";
                ri.body = logic.SelectUserBankList(reqst.body.userId);
                if (ri.body == null)
                {
                    ri.code = "4000000000";
                }
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                LoggerHelper.Error(JsonHelper.Entity2Json(ri));
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #17
0
        /// <summary>
        /// ブランチ一覧を取得する。
        /// 対象リポジトリが存在しない場合はnullが返る。
        /// </summary>
        /// <param name="gitMap">Git情報</param>
        /// <param name="repositoryName">リポジトリ名</param>
        /// <param name="owner">オーナー名</param>
        /// <returns>ブランチ一覧</returns>
        public async Task <Result <IEnumerable <BranchModel>, string> > GetAllBranchesAsync(UserTenantGitMap gitMap, string repositoryName, string owner)
        {
            // API呼び出しパラメータ作成
            RequestParam param = CreateRequestParam(gitMap);

            param.ApiPath = $"/repos/{owner}/{repositoryName}/branches";

            // API 呼び出し
            Result <string, string> response = await this.SendGetRequestAsync(param);

            if (response.IsSuccess)
            {
                var result = JsonConvert.DeserializeObject <IEnumerable <GetBranchModel> >(response.Value);
                return(Result <IEnumerable <BranchModel>, string> .CreateResult(
                           result.Select(e => new BranchModel()
                {
                    BranchName = e.name,
                    CommitId = e.commit?.sha
                })));
            }
            else
            {
                return(Result <IEnumerable <BranchModel>, string> .CreateErrorResult(response.Error));
            }
        }
Exemple #18
0
        /// <summary>
        /// 发送清空banner事件
        /// </summary>
        /// <param name="request"></param>
        /// <param name="response"></param>
        protected override void DoSendAction(RequestParam request, ResponseParam response)
        {
            Dictionary <string, object> dataDic = new Dictionary <string, object>();

            dataDic.Add(OpOperateActionEvent.CLEAR_BANNER, request.actionName);
            this.FireBizEventSent(this, OpOperateActionEvent.CLEAR_BANNER, null, dataDic);
        }
Exemple #19
0
        /// <summary>
        /// オーナー名&リポジトリ名から、プロジェクトIDを取得する。
        /// </summary>
        /// <remarks>
        /// GitLab APIではGitで一般的な{オーナー名}/{リポジトリ名}ではなく、プロジェクトIDという独自識別子でリポジトリを特定する。
        /// なので、この変換を行うためのAPI呼び出しが必要。
        /// ちなみに、逆にWebUIを参照する際はオーナー名が必要という仕様。
        /// </remarks>
        protected async override Task <Result <string, string> > GetProjectIdAsync(UserTenantGitMap gitMap, string repositoryName, string owner)
        {
            // オーナー名&リポジトリ名を指定して取得する
            RequestParam param = CreateRequestParam(gitMap);

            param.ApiPath = $"/api/v4/projects/{owner}%2F{repositoryName}";

            var response = await SendGetRequestAsync(param);

            if (response.IsSuccess)
            {
                //一度GitLabの専用出力モデルに吐き出す
                var result = JsonConvert.DeserializeObject <IEnumerable <GetRepositoryModel> >("[" + response.Value + "]");
                //ロジック層に返すための版用モデルに変換
                var outModel = result.First();
                if (outModel == null)
                {
                    string message = $"Repository {owner}/{repositoryName} is not found.";
                    LogWarning(message);
                    return(Result <string, string> .CreateErrorResult(message));
                }
                return(Result <string, string> .CreateResult(outModel.id.ToString()));
            }
            else
            {
                LogError(response.Error);
                return(Result <string, string> .CreateErrorResult(response.Error));
            }
        }
        public JsonResult ParamMultiDynamic([FromBody] RequestParam <dynamic> param)
        {
            var data1 = JsonConvert.DeserializeObject <SampleModel>(param.Params.data1.ToString());
            var data2 = JsonConvert.DeserializeObject <SampleModel>(param.Params.data2.ToString());

            return(Json(param));
        }
Exemple #21
0
        /// <summary>
        /// オーナー名&リポジトリ名から、プロジェクトIDを取得する。
        /// </summary>
        /// <remarks>
        /// GitLab APIではGitで一般的な{オーナー名}/{リポジトリ名}ではなく、プロジェクトIDという独自識別子でリポジトリを特定する。
        /// なので、この変換を行うためのAPI呼び出しが必要。
        /// ちなみに、逆にWebUIを参照する際はオーナー名が必要という仕様。
        /// </remarks>
        private async Task <Result <string, string> > GetProjectIdAsync(UserTenantGitMap gitMap, string repositoryName, string owner)
        {
            //検索上限が100件だが、リポジトリ名でフィルタ(部分一致)をかけて検索するので、そこまでの件数にはならない想定
            RequestParam param = CreateRequestParam(gitMap);

            param.ApiPath     = $"/api/v4/projects";
            param.QueryParams = new Dictionary <string, string>()
            {
                { "search", repositoryName },
                { "per_page", "100" }
            };
            var response = await SendGetRequestAsync(param);

            if (response.IsSuccess)
            {
                //一度GitLabの専用出力モデルに吐き出す
                var result = JsonConvert.DeserializeObject <IEnumerable <GetRepositoryModel> >(response.Value);
                //ロジック層に返すための版用モデルに変換
                var outModel = result.FirstOrDefault(r => r.path_with_namespace == $"{owner}/{repositoryName}");
                if (outModel == null)
                {
                    string message = $"Repository {owner}/{repositoryName} is not found.";
                    LogWarning(message);
                    return(Result <string, string> .CreateErrorResult(message));
                }
                return(Result <string, string> .CreateResult(outModel.id.ToString()));
            }
            else
            {
                LogError(response.Error);
                return(Result <string, string> .CreateErrorResult(response.Error));
            }
        }
        private async void backToMainPage(string testCardNumber)
        {
            Frame root = Window.Current.Content as Frame;

            if ((bool)this.raBtn_both_no.IsChecked)
            {
                root.Navigate(typeof(MainPage), testCardNumber);
                return;
            }
            else if ((bool)this.raBtn_swingCard_yes.IsChecked)
            {
                string swingCard = swingCardStart + testCardNumber + swingCardEnd;
                root.Navigate(typeof(MainPage), swingCard);
                return;
            }
            else if ((bool)this.raBtn_smartPhone_yes.IsChecked)
            {
                showLoading();
                try {
                    JsonAnalyst result  = await new HttpCaller().CallAppService(RequestParam.getSmartPhoneParam(testCardNumber), RequestParam.getSmartPhoneUrl());
                    string      barcode = result.GetFirstLevelValue("Barcode");
                    root.Navigate(typeof(MainPage), barcode);
                } catch (Exception ex) {
                    showError(ex);
                } finally {
                    hideLoading();
                }
            }
        }
        public ApiResponseStatus ProcessRequest(RequestParam requestParam, string token)
        {
            var processRequest = new ProcessRequest();

            return(processRequest.ProcessWebRequest(requestParam.Url, requestParam.RequestType,
                                                    requestParam.RequestBody, requestParam.Parameters, token));
        }
Exemple #24
0
        /// <summary>
        /// ブランチ一覧を取得する。
        /// 対象リポジトリが存在しない場合はnullが返る。
        /// </summary>
        /// <param name="gitMap">Git情報</param>
        /// <param name="repositoryName">リポジトリ名</param>
        /// <param name="owner">オーナー名</param>
        /// <returns>ブランチ一覧</returns>
        public async Task <Result <IEnumerable <BranchModel>, string> > GetAllBranchesAsync(UserTenantGitMap gitMap, string repositoryName, string owner)
        {
            var projectId = await GetProjectIdAsync(gitMap, repositoryName, owner);

            if (projectId.IsSuccess == false)
            {
                //プロジェクトIDがない=ブランチが一つもない=という事なので、nullを返却
                return(Result <IEnumerable <BranchModel>, string> .CreateResult(null));
            }
            RequestParam param   = CreateRequestParam(gitMap);
            string       apiPath = $"/api/v4/projects/{projectId.Value}/repository/branches";

            var response = await SendGetFullPageRequestsAsync <GetBranchModel>(apiPath, gitMap, new Dictionary <string, string>());

            if (response.IsSuccess)
            {
                return(Result <IEnumerable <BranchModel>, string> .CreateResult(
                           response.Value.Select(e => new BranchModel()
                {
                    BranchName = e.name,
                    CommitId = e.commit?.id
                })));
            }
            else
            {
                LogError(response.Error);
                return(Result <IEnumerable <BranchModel>, string> .CreateErrorResult(response.Error));
            }
        }
Exemple #25
0
        public ResultInfo <List <AdEntity> > SelectWebAd(RequestParam <RequestAd> reqst)
        {
            var ri = new ResultInfo <List <AdEntity> >("99999");

            try
            {
                int top      = ConvertHelper.ParseValue(reqst.body.top.ToString(), 0);
                int adtypeId = ConvertHelper.ParseValue(reqst.body.adtypeId.ToString(), 0);


                ri.body = adnewsLogic.GetWebAd(adtypeId, top);

                if (ri.body == null)
                {
                    ri.code = "1000000010";
                }
                else
                {
                    ri.code = "1";
                }

                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                ri.body    = KickOutAppStoreRejectedAd(ri.body, reqst.header.appId.Value.ToString());
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #26
0
        public ResultInfo <BasePage <List <NewsEntity> > > SelectWebNews(RequestParam <RequestNews> reqst)
        {
            var ri = new ResultInfo <BasePage <List <NewsEntity> > >("99999");

            try
            {
                int newType   = ConvertHelper.ParseValue(reqst.body.newType.ToString(), 0);
                int pageIndex = ConvertHelper.ParseValue(reqst.body.pageIndex.ToString(), 0);
                int pageSize  = ConvertHelper.ParseValue(reqst.body.pageSize.ToString(), 0);

                ri.body = adnewsLogic.SelectWebNews(newType, pageIndex, pageSize);

                if (ri.body == null)
                {
                    ri.code = "1000000010";
                }
                else
                {
                    ri.code = "1";
                }

                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(ex.ToString());
                LoggerHelper.Error(JsonHelper.Entity2Json(reqst)); ri.code = "500";
                ri.message = Settings.Instance.GetErrorMsg(ri.code);
                return(ri);
            }
        }
Exemple #27
0
 public static void Broadcast(string routePath, RequestParam param, Action <RemotePackage> callback)
 {
     foreach (RemoteService remoteService in m_TcpRemotes.Values)
     {
         remoteService.Call(routePath, param, callback);
     }
 }
        /// <summary>
        /// 全てのイメージのリストを取得
        /// </summary>
        private async Task <IEnumerable <GetImagesApiModel> > GetContainerRegistryJsonAsync(Registry registry, string project, string token)
        {
            // API呼び出しパラメータ作成
            string       encodedProjectName = project.Replace("/", "%2F");
            RequestParam param = new RequestParam()
            {
                BaseUrl = registry.ApiUrl,
                ApiPath = $"api/v4/projects/{encodedProjectName}/registry/repositories",
                Headers = new Dictionary <string, string>()
                {
                    { "PRIVATE-TOKEN", token } //GitLabはトークンの形式がBearerではないので、ヘッダに独自で追加
                }
            };
            // API 呼び出し
            var response = await this.SendGetRequestAsync(param);

            if (response.IsSuccess)
            {
                var images = ConvertResult <IEnumerable <GetImagesApiModel> >(response);
                return(images);
            }
            else
            {
                LogError("イメージ一覧の取得に失敗:" + response.Error);
                return(null);
            }
        }
        public ActionResult Index(RequestParam <RequestMemberDetail> reqst)
        {
            LoggerHelper.Info(JsonHelper.Entity2Json(reqst));
            UserEntity     br = new UserEntity();
            B_member_table b  = new B_member_table();
            M_member_table p  = new M_member_table();

            p = b.GetModel(reqst.body.userId);

            if (p != null)
            {
                if (p.UsrCustId.Length <= 0)
                {
                    LoggerHelper.Warning("未实名,跳转至实名接口");
                    RequestParam <RequestValidate> vldParam = new RequestParam <RequestValidate>();
                    RequestValidate rv = new RequestValidate();
                    rv.userId     = reqst.body.userId.ToString();
                    vldParam.body = rv;
                    return(RedirectToAction("RequestRealName", "Index", new { area = "UserAuthentication", userId = reqst.body.userId.ToString() }));//未实名,跳转至实名接口
                }



                br.Version   = "10";
                br.CmdId     = "UserLogin";
                br.MerCustId = Settings.Instance.MerCustId;
                br.UsrCustId = p.UsrCustId;
                return(View(br));
            }
            else
            {
                return(Content("异常错误,请联系管理员"));
            }
        }
Exemple #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="routePath">Call method path, ex:className.method</param>
        /// <param name="param"></param>
        /// <param name="callback"></param>
        public void Call(string routePath, RequestParam param, Action <RemotePackage> callback)
        {
            int msgId = Interlocked.Increment(ref _msgId);

            param["MsgId"]    = msgId;
            param["route"]    = routePath;
            param["Sid"]      = _sessionId;
            param["Uid"]      = _userId;
            param["ActionId"] = 0;
            param["ssid"]     = _proxySessionId;
            param["isproxy"]  = true;
            param["proxyId"]  = _proxyId;
            string post = string.Format("d={0}", HttpUtility.UrlEncode(param.ToPostString()));

            if (_client.IsSocket)
            {
                post = "?" + post;
            }
            var responsePack = new RemotePackage {
                MsgId = _msgId, RouteName = routePath
            };

            responsePack.Callback += callback;
            PutToWaitQueue(responsePack);
            _client.Send(post);
        }
Exemple #31
0
 private void RequestParamTest( RequestParam method, string command )
 {
     method( command, "mynick" );
     Assertion.AssertEquals( "PRIVMSG mynick :" + Quote + command + Quote , BufferToString() );
     try
     {
         method(command, null);
         Assertion.Fail("Null");
     }
     catch( ArgumentException ae )
     {
         Assertion.Assert( true );
     }
     try
     {
         method(command,"");
         Assertion.Fail("Empty");
     }
     catch( ArgumentException ae )
     {
         Assertion.Assert( true );
     }
     try
     {
         method(command,"bad value" );
         Assertion.Fail("Bad value");
     }
     catch( ArgumentException ae )
     {
         Assertion.Assert( true );
     }
     try
     {
         method(null,"mynick" );
         Assertion.Fail("Bad command");
     }
     catch( ArgumentException ae )
     {
         Assertion.Assert( true );
     }
 }