public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            btnBack.TouchUpInside += (sender, e) => NavigationController.PopViewController(true);

            FacebookButton = new LoginButton(new CGRect(0, 0, vwFacebookContainer.Frame.Width, vwFacebookContainer.Frame.Height));
            FacebookButton.LoginBehavior      = LoginBehavior.SystemAccount;
            FacebookButton.Layer.CornerRadius = 10;
            FacebookButton.ClipsToBounds      = true;
            FacebookButton.SetImage(null, UIControlState.Normal);
            FacebookButton.ContentEdgeInsets = new UIEdgeInsets(0, -90, 0, 90);
            FacebookButton.ReadPermissions   = new [] { "email", "public_profile", "user_friends" };
            FacebookButton.SetAttributedTitle(new NSAttributedString("SIGN IN WITH FACEBOOK"), UIControlState.Normal);
            FacebookButton.Completed += (sender, e) =>
            {
                if (e.Error != null)
                {
                }
                else if (!e.Result.IsCancelled)
                {
                    LoadingScreen.Show();

                    var apiTask = new ServiceApi().RegisterFacebook(e.Result.Token.TokenString);
                    apiTask.HandleError(LoadingScreen);
                    apiTask.OnSucess((response) =>
                    {
                        var main = Storyboard.InstantiateViewController("OnboardingCreateProfileViewController") as OnboardingCreateProfileViewController;
                        NavigationController.PushViewController(main, true);
                    });
                }
            };
            vwFacebookContainer.AddSubview(FacebookButton);

            btnSignUp.TouchUpInside += (sender, e) =>
            {
                LoadingScreen.Show();
                var apiTask = new ServiceApi().Register(txtFirstName.Text, txtLastName.Text, txtEmail.Text, txtPassword.Text, txtPassword.Text);
                apiTask.HandleError(LoadingScreen);
                apiTask.OnSucess((result) =>
                {
                    var controller = Storyboard.InstantiateViewController <OnboardingCreateProfileViewController> ();
                    NavigationController.PushViewController(controller, true);
                    LoadingScreen.Hide();
                });
            };

            btnTermsOfUse.TouchUpInside += (sender, e) =>
            {
                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://fanword.agilx.com/terms.html"));
            };
        }
        void GetData()
        {
            var apiTask = new ServiceApi().GetLikes((Activity as PostDetailsActivity).PostId);

            apiTask.HandleError(ActivityProgresDialog);
            apiTask.OnSucess(ActivityProgresDialog, response =>
            {
                var adapter           = new CustomListAdapter <PostLike>(response.Result, GetView);
                adapter.NoContentText = "No Likes";
                lvLikes.Adapter       = adapter;
                Count = response.Result.Count;
            });
        }
        void GetData()
        {
            var apiTask = new ServiceApi().GetAthletesForTeam(TeamId);

            apiTask.HandleError(LoadingScreen);
            apiTask.OnSucess(response =>
            {
                source = new CustomListSource <AthleteItem>(response.Result, GetCell, (tableView, indexPath) => 70);
                source.NoContentText = "No Athletes";
                tvAthletes.Source    = source;
                tvAthletes.ReloadData();
            });
        }
Exemple #4
0
 private void InitializeCustomMetadata()
 {
     try {
         if (ServiceApi.ListCustomMetadata().All(x => x.name != BulkEmailMetadataValue))
         {
             ServiceApi.AddCustomMetadata(BulkEmailMetadataValue);
         }
         _isMetadataInitialized = true;
     } catch (Exception e) {
         Log.ErrorFormat(
             "[InitializeCustomMetadata]: Error while handling getting custom metadata field", e);
     }
 }
Exemple #5
0
        private async void button1_Click(object sender, EventArgs e)
        {
            var bitmap = await ServiceApi.GetCodeBitmap("test");

            if (bitmap != null)
            {
                pictureBox1.Image = bitmap;
            }
            else
            {
                MessageBox.Show("请求接口失败!");
            }
        }
Exemple #6
0
 public AppConfig(IConfiguration configuration)
 {
     ConnectionStrings   = new ConnectionStrings(configuration);
     WebApplication      = new WebApplication(configuration);
     ProductInfo         = new ProductInfo(configuration);
     Security            = new Security(configuration);
     DatabaseCreation    = new DatabaseCreation(configuration);
     ServiceApi          = new ServiceApi(configuration);
     Logging             = new Logging(configuration);
     AzureAdOptions      = new AzureAdOptions(configuration);
     ApplicationInsights = new ApplicationInsights(configuration);
     Content             = new Content(configuration);
 }
        public override void OnResume()
        {
            base.OnResume();
            var apiTask = new ServiceApi().GetMyProfileDetails();

            apiTask.HandleError(ActivityProgresDialog);
            apiTask.OnSucess(ActivityProgresDialog, (response) =>
            {
                lblPosts.Text     = LargeValueHelper.GetString(response.Result.Posts);
                lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers);
                lblFollowing.Text = LargeValueHelper.GetString(response.Result.Following);
            });
        }
Exemple #8
0
        public async void bntSaveFile_Click(object sender, EventArgs e)
        {
            var bitmap = await ServiceApi.GetQRCodeBitmap("test");

            if (bitmap != null)
            {
                pictureBox1.Image = bitmap;
            }
            else
            {
                MessageBox.Show("请求接口失败!");
            }
        }
Exemple #9
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var apiTask = new ServiceApi().GetMyProfileDetails();

            apiTask.HandleError();
            apiTask.OnSucess((response) =>
            {
                lblPosts.Text     = LargeValueHelper.GetString(response.Result.Posts);
                lblFollowers.Text = LargeValueHelper.GetString(response.Result.Followers);
                lblFollowing.Text = LargeValueHelper.GetString(response.Result.Following);
            });
        }
Exemple #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var apiTask = new ServiceApi().GetSportRankings(SportId);

            apiTask.HandleError(LoadingScreen);
            apiTask.OnSucess(response =>
            {
                source            = new CustomListSource <Ranking>(response.Result, GetCell, (arg1, arg2) => 70);
                lblDate.Text      = response.Result.FirstOrDefault()?.DateUpdatedUtc.ToLocalTime().ToString("D");
                tvRankings.Source = source;
                tvRankings.ReloadData();
            });
        }
        void GetData()
        {
            var apiTask = new ServiceApi().GetNotifcations();

            apiTask.HandleError(this);
            apiTask.OnSucess(this, (response) =>
            {
                adapter = new CustomListAdapter <UserNotification>(response.Result, GetView);
                lvNotifications.Adapter = adapter;
                slRefresh.Refreshing    = false;
                var apiTask2            = new ServiceApi().MarkNotificationsAsRead();
                apiTask2.HandleError(this);
            });
        }
        void GetData()
        {
            ShowProgressDialog();
            var apiTask = new ServiceApi().GetEventTeams(EventId);

            apiTask.HandleError(this);
            apiTask.OnSucess(this, response =>
            {
                HideProgressDialog();
                var adapter     = new CustomListAdapter <EventTeam>(response.Result, GetView);
                lvTeams.Adapter = adapter;
                lblCount.Text   = response.Result.Count.ToString();
            });
        }
Exemple #13
0
        void GetData()
        {
            var apiTask = new ServiceApi().GetTags((Activity as PostDetailsActivity).PostId);

            apiTask.HandleError(ActivityProgresDialog);
            apiTask.OnSucess(ActivityProgresDialog, response =>
            {
                var adapter           = new CustomListAdapter <PostTag>(response.Result, GetView);
                adapter.NoContentText = "No Tags";
                lvTags.Adapter        = adapter;
                Count = response.Result.Count;
                (Activity as PostDetailsActivity).SetHeaderInfo(Name, Count);
            });
        }
        void GetData()
        {
            ShowProgressDialog();
            var apiTask = new ServiceApi().Followers(Id, Type);

            apiTask.HandleError(this);
            apiTask.OnSucess(this, (response) =>
            {
                HideProgressDialog();
                lblCount.Text       = response.Result.Count.ToString();
                adapter             = new CustomListAdapter <Follower>(response.Result, GetView);
                lvFollowers.Adapter = adapter;
            });
        }
Exemple #15
0
        void SetupViewBindings()
        {
            lblSchoolName.Typeface = CustomTypefaces.RobotoBold;
            lblYears.Typeface      = CustomTypefaces.RobotoBold;
            lblCurrent.Typeface    = CustomTypefaces.RobotoBold;
            lblTitle.Typeface      = CustomTypefaces.RobotoBold;

            btnBack.Click += (sender, args) => Finish();
            var user = CrossSettings.Current.GetValueOrDefaultJson <User>("User");

            if (string.IsNullOrEmpty(user.AthleteTeamId))
            {
                llAthlete.Visibility = ViewStates.Gone;
                btnEdit.Text         = "Add";
                btnDelete.Visibility = ViewStates.Gone;
            }
            else
            {
                if (!string.IsNullOrEmpty(user.AthleteProfileUrl))
                {
                    ImageService.Instance.LoadUrl(user.AthleteProfileUrl).Retry(3, 300).Transform(new CircleTransformation()).Into(imgProfile);
                }

                lblSchoolName.Text = user.AthleteSchool;
                lblSportName.Text  = user.AthleteSport;
                lblYears.Text      = user.AthleteStartDateUtc.Year + " - " + (user.AthleteEndDateUtc != null ? user.AthleteEndDateUtc?.Year.ToString() : "Present");
            }

            btnEdit.Click += (sender, args) =>
            {
                Intent intent = new Intent(this, typeof(OnboardingAthleteTeamActivity));
                intent.PutExtra("IsEdit", true);
                StartActivity(intent);
            };

            btnDelete.Click += (sender, args) =>
            {
                ShowProgressDialog();
                var apiTask = new ServiceApi().DeleteAthlete();
                apiTask.HandleError(this);
                apiTask.OnSucess(this, (response) =>
                {
                    HideProgressDialog();
                    llAthlete.Visibility = ViewStates.Gone;
                    btnEdit.Text         = "Add";
                    btnDelete.Visibility = ViewStates.Gone;
                });
            };
        }
        public Result overlaygrass()
        {
            DataTable dt1 = DB.IbatisHelper.ExecuteQueryForDataTable("GetFishnetShpState", null);  // Ibatis 数据访问,判断用户是否做了渔网生成

            if (dt1.Rows[0][0].ToString() == "0")
            {
                return(new Result(false, "用户未进行渔网生成"));
            }
            //     else
            //     { return new Result(true, "用户未进行渔网生成"); }

            DataTable dt2 = DB.IbatisHelper.ExecuteQueryForDataTable("GetGrass_overlayState", null); // Ibatis 数据访问,判断用户是否做了水面叠加分析,做了则删除它

            if (dt2.Rows[0][0].ToString() == "1")                                                    //存在水面叠加图层
            {
                try                                                                                  //更新加速场景表,前提条件表
                {
                    IbatisHelper.ExecuteDelete("UpdatetbDependTableDuetoGrass_overlay", null);
                    IbatisHelper.ExecuteDelete("deleteAdjcoefficient", null);
                    IbatisHelper.ExecuteUpdate("UpdatetbAccelerateGridSceneDuetoGrass_overlay", null);
                }
                catch (Exception ex)
                { return(new Result(false, ex.ToString())); }
            }


            try
            {
                GisClient.Result res = GisClient.ServiceApi.getGisLayerService().overlaygrass();
                if (res.Ok)
                {
                    //更新tbDependTabled的Grass_overlay
                    IbatisHelper.ExecuteUpdate("UpdatetbDependTableGrass_overlay", null);
                    return(new Result(true, res.Msg));
                }
                else
                {
                    return(new Result(false, res.Msg));
                }
            }
            catch (Exception e)
            {
                return(new Result(false, "远程调用失败" + e));
            }
            finally
            {
                ServiceApi.CloseConn();
            }
        }
        void SavePost()
        {
            ShowProgressDialog();
            var json    = JsonConvert.SerializeObject(Post);
            var apiTask = new ServiceApi().SavePost(Post);

            apiTask.HandleError(this);
            apiTask.OnSucess(this, respons =>
            {
                MainActivity.PostId = "Refresh";
                Intent intent       = new Intent(this, typeof(MainActivity));
                intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
                StartActivity(intent);
            });
        }
        public override void OnReceive(Context context, Intent intent)
        {
            try
            {
                _log?.Debug("OnReceive.");

                var api = new ServiceApi();
                api.ArrangeAppWidgetSettings(context);
                api.AppWidgetUpdateService(context, null);
            }
            catch (System.Exception ex)
            {
                _log?.Error(ex);
            }
        }
Exemple #19
0
        public override void OnDeleted(Context context, int[] appWidgetIds)
        {
            try
            {
                base.OnDeleted(context, appWidgetIds);

                AppSettings.Default.DeleteAppWidgetSettings(appWidgetIds);
                var api = new ServiceApi();
                api.StartService(context, ControlService.ActionAppServiceStop);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Exemple #20
0
        public void GetProfileData()
        {
            var apiResponse = new ServiceApi().GetUserProfile();

            apiResponse.HandleError(null, true);
            apiResponse.OnSucess(response =>
            {
                LoadingScreen.Hide();
                var result           = response.Result;
                lblName.Text         = result.DisplayName;
                lblMobileNumber.Text = result.PhoneNumber;
                addressLabel.Text    = "B/5/128, Willson Tower, LA";
                lblEmail.Text        = result.eMailAddress;
            });
        }
 private static void GeoTrackingServiceStartSafeAsync()
 {
     Task.Run(() =>
     {
         try
         {
             var api = new ServiceApi();
             api.StartService(Application.Context, ControlService.ActionAppServiceStart);
         }
         catch (Exception ex)
         {
             Log.Error(ex);
         }
     });
 }
        void GetData()
        {
            var apiTask = new ServiceApi().SearchEvents(currentTime);

            apiTask.HandleError();
            apiTask.OnSucess(response =>
            {
                if (response.Result.SearchTime == currentTime)
                {
                    result             = response.Result;
                    eventsSource.Items = response.Result.Events;
                    tvEvents.ReloadData();
                }
            });
        }
 private static void StartServer()
 {
     try
     {
         serv = new ServiceApi();
         serv.Start();
         Console.ReadLine();
     }
     catch (Exception x)
     {
         Console.WriteLine("Error StartServer: " + x.Message);
         WorkingBD.SaveLog("Error StartServer: " + x.Message);
         Console.ReadLine();
     }
 }
        void GetData()
        {
            var apiTask = new ServiceApi().SearchEvents(currentTime);

            apiTask.HandleError(this);
            apiTask.OnSucess(this, response =>
            {
                if (response.Result.SearchTime == currentTime)
                {
                    result        = response.Result;
                    adapter.Items = response.Result.Events;
                    adapter.NotifyDataSetChanged();
                }
            });
        }
        void GetData()
        {
            LoadingScreen.Show();
            var apiTask = new ServiceApi().GetEventTeams(EventId);

            apiTask.HandleError(LoadingScreen);
            apiTask.OnSucess(response =>
            {
                LoadingScreen.Hide();
                var source     = new CustomListSource <EventTeam>(response.Result, GetCell, (arg1, arg2) => 70);
                tvTeams.Source = source;
                lblCount.Text  = response.Result.Count.ToString();
                tvTeams.ReloadData();
            });
        }
Exemple #26
0
        void GetData()
        {
            var apiTask = new ServiceApi().GetLikes(PostId);

            apiTask.HandleError();
            apiTask.OnSucess(response =>
            {
                var source           = new CustomListSource <PostLike> (response.Result, GetCell, (arg1, arg2) => 55);
                source.NoContentText = "No Likes";
                tvLikes.Source       = source;
                Count = response.Result.Count;
                tvLikes.ReloadData();
                UpdateParent?.Invoke(Name, Count);
            });
        }
        public JsonResult Detalhes(string id)
        {
            var callResult = ServiceApi.Call(_configuration, HttpContext, _permissaoPath + id, ServiceType.GET, id, true);

            if (!callResult.Success)
            {
                var resultApi = new ValidationMessage(callResult);
                return(Json(new { success = false, data = resultApi }));
            }

            var model  = JsonConvert.DeserializeObject <GrupoAcesso>(Convert.ToString(callResult.Data));
            var result = _viewRenderService.RenderToStringAsync("~/Views/Gerencial/GrupoAcesso/_Detalhes.cshtml", model).Result;

            return(Json(new { success = true, data = result }));
        }
Exemple #28
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            string role       = "";
            string searchText = "";

            LoadingScreen.Show();

            var apiCall = new ServiceApi().GetUserLocation(21.17024, 72.831062, searchText, role);

            apiCall.HandleError(null, true);
            apiCall.OnSucess(response =>
            {
                LoadingScreen.Hide();

                List <UserProfileModel> data = new List <UserProfileModel>();

                for (var i = 0; i < response.Result.RecordList.Count; i++)
                {
                    var result = response.Result.RecordList[i];
                    data.Add(new UserProfileModel
                    {
                        DisplayName = result.DisplayName,
                        PhoneNumber = result.PhoneNumber,
                        Image       = result.Image,
                        Address1    = result.Address1
                    });
                }

                //foreach(var item in response.Result.RecordList)
                //{
                //    data.Add(new UserProfileModel
                //    {
                //        DisplayName = item.DisplayName,
                //        PhoneNumber = item.PhoneNumber,
                //        Image = item.Image,
                //        Address1 = item.Address1
                //    });
                //}

                UsersTableView.Source             = new UsersTableViewSource(data);
                UsersTableView.RowHeight          = UITableView.AutomaticDimension;
                UsersTableView.SeparatorColor     = UIColor.Clear;
                UsersTableView.EstimatedRowHeight = 50f;
                UsersTableView.ReloadData();
            });
        }
        public void ProcessRequest(HttpContext context)
        {
            //GET /index.php?g=Wap&m=Vote&a=index&token=uDSrEHNs9CFGcTSC&wecha_id=ocMqvwRjzPH9eseHRc_Z9nlP-DSM&id=25&iMicms=mp.weixin.qq.com HTTP/1.1
            context.Response.ContentType = "text/plain";
            pToken = QueryString("token");
            pWecha_id = QueryString("wecha_id");
            pId = QueryString("id");
            iMicms = QueryString("iMicms");

            stateUrl = ConfigTool.ReadVerifyConfig("state", "Other");

            if (stateUrl.Equals("true"))
            {
                string tokens = ConfigTool.ReadVerifyConfig("tokens", "Other");
                if (tokens.Contains(pToken))
                {
                    string pRedirectUrl = "http://" + GetRandHostUrl() + "/index.php?g=Wap&m=Vote&a=index&id=" + pId + "&token=" + pToken + "&wecha_id=" + pWecha_id + "&iMicms=" + iMicms;

                    string json = "{\"Mode\": \"WXCheckUrl\", \"Param\": \"{\'CheckUrl\':\'" + pRedirectUrl + "\'}\"}";
                    _service = new ServiceApi();
                    string resultCheck = _service.Api(json);

                    if (!resultCheck.Contains("屏蔽"))
                    {
                        //域名未被微信封号
                        hmdOpenid = ConfigTool.ReadVerifyConfig("hmdOpenid", "Other");
                        if (!hmdOpenid.Contains(pWecha_id))
                        {
                            //当前访问的用户不在黑名单
                            redirectUrl = pRedirectUrl;
                            Logger.WriteLoggger("openid:" + pWecha_id);  //后续可以扩展,可以屏蔽一些恶意投诉的微信号
                        }
                    }
                    else
                    {

                        //修改投票状态
                        ConfigTool.WriteVerifyConfig("state", "false", "Other");
                        Logger.WriteLoggger("恶意的openid:" + pWecha_id);  //后续可以扩展,可以屏蔽一些恶意投诉的微信号
                    }
                }

            }

            context.Response.Redirect(redirectUrl);
            // context.Response.Write(redirectUrl);
            context.Response.End();
        }
Exemple #30
0
        public Result cluster()
        {
            DataTable dt11 = DB.IbatisHelper.ExecuteQueryForDataTable("GetClustertoDBState", null);  // Ibatis 数据访问,判断用户是否做了场景划分

            if (dt11.Rows[0][0].ToString() == "0")
            {
                return(new Result(false, "用户未进行场景划分"));
            }


            DataTable dt2 = DB.IbatisHelper.ExecuteQueryForDataTable("GetClusterShpState", null); // Ibatis 数据访问,判断用户是否做了结果图层

            if (dt2.Rows[0][0].ToString() == "1")                                                 //做了结果图层
            {
                try                                                                               //更新前提条件表
                {
                    IbatisHelper.ExecuteDelete("UpdatetbDependTableDuetoClusterShp", null);
                    IbatisHelper.ExecuteDelete("deleteAdjcoefficient", null);
                }
                catch (Exception ex)
                { return(new Result(false, ex.ToString())); }
            }

            try
            {
                GisClient.Result res = GisClient.ServiceApi.getGisLayerService().cluster();
                if (res.Ok)
                {
                    //更新tbDependTabled的Grass_overlay
                    IbatisHelper.ExecuteUpdate("UpdatetbDependTableClusterShp", null);
                    return(new Result(true, res.Msg));
                }
                else
                {
                    return(new Result(false, res.Msg));
                }
            }
            catch (Exception e)
            {
                return(new Result(false, "远程调用失败" + e));
            }
            finally
            {
                ServiceApi.CloseConn();
            }
        }