private void LeaveMember(string user_token) { try { this.Loading(true); var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "user/LeaveMember", user_token); api.Execute(); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { var app_cache = new AppPreferences(this.Context); app_cache.UserTokenKey = ""; Refresh?.Invoke(this, new RefreshEventArgs(true)); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetThisWeekPrize(string guest_token) { try { this.Loading(true); var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "lotto/GetThisWeekPrize", guest_token); var json = api.Execute().Get().ToString(); var _result = JsonConvert.DeserializeObject <ApiResult <NextWeekPrize> >(json); if (_result != null) { var app_cache = new AppPreferences(this.Context); app_cache.NextWeekSequenceNo = _result.result.SequenceNo; last_week_seqno = _result.result.SequenceNo - 1; if (_result.success == true) { week_prize = _result.result; InitNextWeekPrize(rootView, _result.result); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetCount(string user_token, UserInfo user_info) { try { var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "notify/GetCount", user_token); api.Execute(); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { //var tv_push = this.rootView.FindViewById<TextView>(Resource.Id.tv_push); //tv_push.SetText(_result.result); PutCount(Convert.ToInt32(_result.result)); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetUserChoices(string user_token, string login_id) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("sequence_no", this.user_curr_seqno.ToString()); } var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "lotto/GetUserChoices", user_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <List <UserChoice> > >(e.Json); if (_result != null) { if (_result.success == true) { this.adapter.Clear(); this.adapter.AddAll(_result.result); this.adapter.NotifyDataSetChanged(); var _choice = new UserChoices() { sequenceNo = this.user_curr_seqno, loginId = login_id, choice = _result.result }; choice_list.RemoveAll(x => x.loginId == login_id && x.sequenceNo == this.user_curr_seqno); choice_list.Add(_choice); var app_cache = new AppPreferences(this.Context); app_cache.UserChoiceNumbers = choice_list; var tv_noting = this.rootView.FindViewById <TextView>(Resource.Id.tv_noting); if (_result.result.Count == 0) { tv_noting.Visibility = ViewStates.Visible; } } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetMessages(string user_token) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("notify_time", AppCommon.SNG.GetDate(Calendar.Instance)); } var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "notify/GetMessages", user_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <List <PushMessage> > >(e.Json); if (_result != null) { if (_result.success == true) { this.adapter.Clear(); this.adapter.AddAll(_result.result); this.adapter.NotifyDataSetChanged(); var tv_noting = FindViewById <TextView>(Resource.Id.tv_noting); if (_result.result.Count == 0) { tv_noting.Visibility = ViewStates.Visible; } else { tv_noting.Visibility = ViewStates.Invisible; } } else { AppDialog.SNG.Alert(this, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void AddMemberByLoginId(string guest_token, string email, string check, string id, string name, string pw) { try { this.Loading(true); var app_cache = new AppPreferences(this.ApplicationContext); var parameter = new Dictionary <string, string>(); { parameter.Add("login_id", id); parameter.Add("login_name", name); parameter.Add("password", pw); parameter.Add("mail_address", email); parameter.Add("device_type", "A"); parameter.Add("device_id", app_cache.GetDeviceId()); parameter.Add("check_number", check); } var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "user/AddMemberByLoginId", guest_token); api.Execute(parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { AppDialog.SNG.Alert(this, "회원가입을 축하드립니다.", (s1, e1) => { this.Finish(); }); } else { AppDialog.SNG.Alert(this, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void CheckMailAddress(string guest_token, string email, string check) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("mail_address", email); _parameter.Add("check_number", check); } var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "user/CheckMailAddress", guest_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { var btn_email = FindViewById <Button>(Resource.Id.btn_email); var btn_certify = FindViewById <Button>(Resource.Id.btn_certify); var et_email = FindViewById <EditText>(Resource.Id.et_email); var et_certify = FindViewById <EditText>(Resource.Id.et_certify); btn_email.Enabled = false; btn_certify.Enabled = false; et_email.Enabled = false; et_certify.Enabled = false; AppDialog.SNG.Alert(this, "인증되었습니다."); } else { AppDialog.SNG.Alert(this, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void UpdateUserInfor(string user_token, UserInfo user_info) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("login_name", user_info.loginName); _parameter.Add("max_select_number", user_info.maxSelectNumber.ToString()); _parameter.Add("digit1", user_info.digit1.ToString()); _parameter.Add("digit2", user_info.digit2.ToString()); _parameter.Add("digit3", user_info.digit3.ToString()); } var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "user/UpdateUserInfor", user_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { AppDialog.SNG.Alert(this.Context, "변경되었습니다.", (s2, e2) => { Initialize(); }); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void PushClear(string user_token) { try { var _parameter = new Dictionary <string, string>(); var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "notify/Clear", user_token); api.Execute(_parameter); api.SendFinish += (s, e) => { }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetUserSequenceNos(string user_token, string login_id) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "lotto/GetUserSequenceNos", user_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <List <TKeyValue> > >(e.Json); if (_result != null) { if (_result.success == true) { var _new_item = new TKeyValues() { loginId = login_id, numbers = _result.result }; user_numbers.RemoveAll(x => x.loginId == login_id); user_numbers.Add(_new_item); user_first_seqno = _result.result.Min(n => n.key); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetTokenByLoginId(string guest_token, string id, string pw) { try { this.Loading(true); var parameter = new Dictionary <string, string>(); { parameter.Add("login_id", id); parameter.Add("password", pw); parameter.Add("device_type", "A"); parameter.Add("device_id", FirebaseInstanceId.Instance.Token); } var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "user/GetTokenByLoginId", guest_token); api.Execute(parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { var app_cache = new AppPreferences(this.ApplicationContext); app_cache.UserTokenKey = _result.result; this.Finish(); } else { AppDialog.SNG.Alert(this, _result.message); } } Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void SendMailToRecoveryId(string guest_token, string email) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("mail_address", email); } var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "user/SendMailToRecoveryId", guest_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { var et_email = FindViewById <EditText>(Resource.Id.et_email); AppDialog.SNG.Alert(this, et_email.Text + "\n임시 비밀번호가 발송되었습니다.", (s1, e1) => { this.Finish(); }); } else { AppDialog.SNG.Alert(this, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetPrizeBySeqNo(string guest_token, int sequence_no) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("sequence_no", sequence_no.ToString()); } var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "lotto/GetPrizeBySeqNo", guest_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <WinnerPrize> >(e.Json); if (_result != null) { if (_result.success == true) { winner_list.Add(_result.result); var app_cache = new AppPreferences(this.Context); app_cache.WinnerHistory = winner_list; InitWinnerBySeqNo(rootView, _result.result); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void ChangePassword(string user_token, string password) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("password", password); } var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "user/ChangePassword", user_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { AppDialog.SNG.Alert(this, "비밀번호가 변경되었습니다.", (s1, e1) => { this.Finish(); }); } else { AppDialog.SNG.Alert(this, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void UpdateDeviceId(string user_token, string device_id) { try { var parameter = new Dictionary <string, string>(); { parameter.Add("device_type", "A"); parameter.Add("device_id", device_id); } var api = new ApiAsnycTask(this, GetString(Resource.String.api_url) + "user/UpdateDeviceId", user_token); api.Execute(parameter); api.SendFinish += (s, e) => { }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void GetUserInfo(string user_token, string login_id) { try { this.Loading(true); var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "user/GetUserInfor", user_token); api.Execute(); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <UserInfo> >(e.Json); if (_result != null) { if (_result.success == true) { _result.result.login_id = login_id; user_infos.RemoveAll(x => x.login_id == login_id); user_infos.Add(_result.result); DisplayView(_result.result); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }
private void SendChoicedNumbers(string user_token) { try { this.Loading(true); var _parameter = new Dictionary <string, string>(); { _parameter.Add("sequence_no", this.user_curr_seqno.ToString()); } var api = new ApiAsnycTask(this.Context, GetString(Resource.String.api_url) + "lotto/SendChoicedNumbers", user_token); api.Execute(_parameter); api.SendFinish += (s, e) => { var _result = JsonConvert.DeserializeObject <ApiResult <string> >(e.Json); if (_result != null) { if (_result.success == true) { AppDialog.SNG.Alert(this.Context, "메일이 발송되었습니다."); } else { AppDialog.SNG.Alert(this.Context, _result.message); } } this.Loading(false); }; } catch (Java.Lang.Exception ex) { Log.Error(this.GetType().Name, ex.Message); } }