예제 #1
0
        /**
         * Demonstration on fetching the list of ALPHA-GOGET Integration API Project List
         */
        public ProjectListResponse getAlphaGoProjectList()
        {
            AlphaGoProjectList  agListObj    = new AlphaGoProjectList(authorizationEntity);
            ProjectListResponse project_list = agListObj.getList();

            return(project_list);
        }
예제 #2
0
        /**
         * Demonstration on fetching the list of ACCEPTED projects
         */
        public ProjectListResponse getAcceptedProjectList()
        {
            AcceptedProjectList AcceptedListObj = new AcceptedProjectList(authorizationEntity);
            ProjectListResponse project_list    = AcceptedListObj.getList();

            return(project_list);
        }
예제 #3
0
        /**
         * Demonstration on fetching the list of Project Ready by Form projects
         * in this case, i specify to fetch all specific form granted only
         */
        public ProjectListResponse getProjectReadyListOn(string formID = "all")
        {
            ProjectReadyList ReadyListObj = new ProjectReadyList(
                authorizationEntity,
                formID
                );
            ProjectListResponse project_list = ReadyListObj.getList();

            return(project_list);
        }
        public ProjectListResponse getList(int offset = 0)
        {
            String url = authorizationEntity.getBaseUrl() + "/v1/alphago/list";

            if (offset > 0)
            {
                url = url + "/" + offset.ToString();
            }
            String response = processList(url, authorizationEntity);

            ProjectListResponse obj = JsonConvert.DeserializeObject <ProjectListResponse>(response);

            return(obj);
        }
예제 #5
0
        /// <summary>
        /// 29、	项目列表
        /// </summary>
        /// <param name="token"></param>
        /// <param name="hospitalid">医院id</param>
        /// <param name="status">状态(0:进行中,1:已归档)</param>
        /// <param name="userid">创建项目的用户id</param>
        /// <returns></returns>
        /// Jerry Shi
        public string getProjectList(string token, string hospitalid, int status, string userid)
        {
            string ApiResponse = string.Empty;

            try
            {
                ProjectListResponse         projectListResponse = new ProjectListResponse();
                Dictionary <string, string> sPara = new Dictionary <string, string>();

                sPara.Add("hospitalid", hospitalid.ToString());
                sPara.Add("status", status.ToString());
                sPara.Add("userid", userid);

                ApiResponse = F8YLSubmit.BuildGetRequest(sPara, "project/list?token=" + token);
            }
            catch (Exception ex)
            {
                AppLog.Instance.Write("getProjectList", AppLog.LogMessageType.Error, ex);
            }
            return(ApiResponse);
        }
        static void Main(string[] args)
        {
            AppConfigService configService = new AppConfigService();
            AppConfig        config        = configService.getConfiguration();

            /**
             * instantiate the AuthenticateEntity to store your credentials
             * for the AlphaOne API
             */
            AuthenticateEntity authEntity = new AuthenticateEntity();

            authEntity.setBaseUrl(config.api_base_url);
            authEntity.setUsername(config.username);
            authEntity.setPassword(config.password);

            /**
             * instantiate auth service then start authenticating
             */
            AuthenticationService auth = new AuthenticationService(authEntity);

            /**
             * You have 3 Authentication types to choose
             *  - using nuget package Flurl.Http
             *  - using HttpClient class
             *  - lastly using WebRequest
             *
             * by default, its set to Flurl.Http
             */
            // auth.setAuthenticationType(AuthenticationService.AUTH_TYPE_FLURL);
            // auth.setAuthenticationType(AuthenticationService.AUTH_TYPE_HTTP_CLIENT);
            auth.setAuthenticationType(AuthenticationService.AUTH_TYPE_WEB_REQUEST);

            String response = auth.Authenticate();

            Console.WriteLine(response + "\n");

            // convert json string to object
            AuthenticationResponse result = JsonConvert.DeserializeObject <AuthenticationResponse>(response);

            /**
             * this will be the access class you need to use
             * to fetch the project list or details
             */
            AUTHORIZATION = new AuthorizationEntity(
                authEntity.getBaseUrl(),
                authEntity.getUsername(),
                result.session_key
                );

            /**
             * instantiate ProjectListService class and get the project list
             * based on different options like
             *  - accepted project list
             *  - list of projects based on forms
             *    - like BC granted/issued form
             *    - CCC issued
             *    - VRFI/RFI/IR finalised
             *  - alpha-goget integration project list
             *
             *  view the class and will give you bunch of options
             *  to get the project list
             */
            ProjectListService  list        = new ProjectListService(AUTHORIZATION);
            ProjectListResponse objResponse = list.getAcceptedProjectList();

            Console.WriteLine("Total Projects: " + objResponse.Data.TotalProjects + "\n");
            MarkResponse markResponse;

            if (objResponse.Data.List.Length > 0)
            {
                foreach (ProjectListItemObject item in objResponse.Data.List)
                {
                    Console.WriteLine("AlphaID: " + item.AlphaID);
                    Console.WriteLine("ConsentID: " + item.ConsentNumber);
                    Console.WriteLine("Flag: " + item.ApplicationFlag);
                    Console.WriteLine("RequestKey: " + item.RequestKey);

                    Console.WriteLine("\nMarking as done ...");
                    markResponse = list.markAcceptedProjectAsDone(item.AlphaID, item.ApplicationFlag, item.RequestKey);

                    Console.WriteLine("\tResult: " + markResponse.Result);
                    Console.WriteLine("\tMessage: " + markResponse.Message);
                    Console.WriteLine("\tTimestamp: " + markResponse.Timestamp);
                    if (markResponse.Result == "true")
                    {
                        Console.WriteLine("\tResponseID: " + markResponse.ResponseID);
                    }

                    break;
                }
            }

            Console.WriteLine("\n\nTesting on ALPHAONE-GOCOUNCIL ...\n\n\n");

            /**
             * AlphaOne-GoCouncil Integration Sample
             */
            objResponse = list.getAlphaGoProjectList();
            Console.WriteLine("Total Projects: " + objResponse.Data.TotalProjects + "\n");

            if (objResponse.Data.List.Length > 0)
            {
                foreach (ProjectListItemObject item in objResponse.Data.List)
                {
                    Console.WriteLine("AlphaID: " + item.AlphaID);
                    Console.WriteLine("ConsentID: " + item.ConsentNumber);
                    Console.WriteLine("Flag: " + item.ApplicationFlag);
                    Console.WriteLine("RequestKey: " + item.RequestKey);

                    Console.WriteLine("\nMarking as done ...");
                    markResponse = list.markAlphaGoProjectAsDone(item.AlphaID, item.ApplicationFlag, item.RequestKey);

                    Console.WriteLine("\tResult: " + markResponse.Result);
                    Console.WriteLine("\tMessage: " + markResponse.Message);
                    Console.WriteLine("\tTimestamp: " + markResponse.Timestamp);
                    if (markResponse.Result == "true")
                    {
                        Console.WriteLine("\tResponseID: " + markResponse.ResponseID);
                    }

                    break;
                }
            }
        }