Esempio n. 1
0
        private async void getDSField()
        {
            var dem = new DSHelper();

            GraphQL.GraphQLResponse <DSHelper.DemarcheResponse> response = await dem.getDescriptor(Program.AppSet.DSURL, Program.AppSet.DSKey, "19");//CurrentContext.CurrentView.DSNum

            if (response.Errors == null)
            {
                graphqlCache = response.Data.demarche.champDescriptors;
            }
        }
Esempio n. 2
0
        public IList <string> GetSourceFieldsListForIncomingFeed(DSFileTypes feedType, DSProductType productType)
        {
            var results = new List <string>();

            if (feedType == DSFileTypes.ItemsFull)
            {
                var featureList = new List <string>();
                var itemTypeId  = DSHelper.GetItemTypeIdFromDSProductType((int)productType);
                using (var db = _dbFactory.GetRDb())
                {
                    featureList = db.Features.GetAllAsDto()
                                  .Where(f => f.ItemTypeId == itemTypeId ||
                                         !f.ItemTypeId.HasValue)
                                  .OrderBy(f => f.Order)
                                  .Select(f => f.Name)
                                  .ToList();
                }

                results.Add("SKU");
                //results.Add("Model");
                results.Add("Qty");
                results.Add("Cost");
                results.Add("Sale Price");
                results.Add("MSRP");
                results.Add("Barcode");
                results.Add("Name");
                results.Add("Description");
                results.Add("Main Image");
                results.Add("Image 1");
                results.Add("Image 2");
                results.Add("Image 3");

                //featureList = featureList.Where(f => f != "Product Type").ToList();

                results.AddRange(featureList);
            }
            if (feedType == DSFileTypes.ItemsLite)
            {
                results.Add("SKU");
                results.Add("Sale Price");
                results.Add("Qty");
                results.Add("Cost");
            }

            return(results);
        }
        public int AuthenticateUser(string UserName, string UserPwd)
        {
            int    res = 0;
            String Query;

            Query = string.Format("Select [uid],[name],[role] from [tbl_users] where uname='{0}' AND pwd='{1}'", UserName, UserPwd);
            DataSet ds = (DataSet)DBHandler.CRUD(Query, 'r');

            if (DSHelper.HasResult(ref ds))
            {
                Global.UserId   = Convert.ToInt16(ds.Tables[0].Rows[0].ItemArray[0]);
                Global.FullName = ds.Tables[0].Rows[0].ItemArray[1].ToString();
                return(res = Convert.ToInt16(ds.Tables[0].Rows[0].ItemArray[2]));
            }
            else
            {
                return(res);
            }
        }
Esempio n. 4
0
        private string GetAccessToken()
        {
            ApiClient _apiClient = new ApiClient();

            var scopes = new List <string>
            {
                "signature",
                "impersonation",
            };
            string ClientId           = ConfigurationManager.AppSettings["ClientId"];
            string ImpersonatedUserId = ConfigurationManager.AppSettings["ImpersonatedUserId"];
            string AuthServer         = ConfigurationManager.AppSettings["AuthServer"];
            string PrivateKeyFile     = ConfigurationManager.AppSettings["PrivateKeyFile"];

            OAuthToken _authToken = _apiClient.RequestJWTUserToken(ConfigurationManager.AppSettings["ClientId"], ConfigurationManager.AppSettings["ImpersonatedUserId"], ConfigurationManager.AppSettings["AuthServer"],

                                                                   DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(PrivateKeyFile)), 1, scopes);

            return(_authToken.access_token);
        }
Esempio n. 5
0
        /// <summary>
        /// Uses Json Web Token (JWT) Authentication Method to obtain the necessary information needed to make API calls.
        /// </summary>
        /// <returns>Auth token needed for API calls</returns>
        public static OAuthToken AuthenticateWithJWT(string api, string clientId, string impersonatedUserId, string authServer, string privateKeyFile)
        {
            var apiClient = new ApiClient();
            var apiType   = Enum.Parse <ExamplesAPIType>(api);
            var scopes    = new List <string>
            {
                "signature",
                "impersonation",
            };

            if (apiType == ExamplesAPIType.Rooms)
            {
                scopes.AddRange(new List <string> {
                    "dtr.rooms.read",
                    "dtr.rooms.write",
                    "dtr.documents.read",
                    "dtr.documents.write",
                    "dtr.profile.read",
                    "dtr.profile.write",
                    "dtr.company.read",
                    "dtr.company.write",
                    "room_forms"
                });
            }

            if (apiType == ExamplesAPIType.Click)
            {
                scopes.AddRange(new List <string> {
                    "click.manage",
                    "click.send"
                });
            }

            if (apiType == ExamplesAPIType.Monitor)
            {
                scopes.AddRange(new List <string>
                {
                    "signature",
                    "impersonation"
                });
            }

            if (apiType == ExamplesAPIType.Admin)
            {
                scopes.AddRange(new List <string> {
                    "user_read",
                    "user_write",
                    "account_read",
                    "organization_read",
                    "group_read",
                    "permission_read",
                    "identity_provider_read",
                    "domain_read"
                });
            }


            return(apiClient.RequestJWTUserToken(
                       clientId, impersonatedUserId, authServer,
                       DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(privateKeyFile)), 1, scopes));
        }