public void GenerateHiveCall(ProjectQuestionModel projectQuestionModel)
        {
            try
            {
                string fileName = projectQuestionModel.QuestionsModel.StartAndDestinationModel.Mode + "_" + DateTime.Now.ToString("ddMMyyyy_HHmmss", CultureInfo.InvariantCulture);
                HiveServer.Models.Asset[] asset = new HiveServer.Models.Asset[] {
                    new HiveServer.Models.Asset
                    {
                        Name     = fileName,
                        Url      = "smart-agora.org",
                        Metadata = new HiveServer.Models.Metadata()
                        {
                            record = projectQuestionModel.QuestionsModel
                        }
                    }
                };

                //string email = System.Web.HttpContext.Current.Session["Email"].ToString();
                //string userName = email.Substring(0, email.IndexOf("@"));//"userName"; // System.Web.HttpContext.Current.Session["Email"].ToString();
                string userName = "******";
                client.CreateAsset(projectQuestionModel.ProjectId, asset, userName);
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.InnerException == null ? ex.Message + " - " + ex.StackTrace : ex.Message + " - " + ex.InnerException.Message);
                throw ex;
            }
        }
Пример #2
0
        public async Task <Models.Asset> GetAssetData(string projectId, string assetId)
        {
            Models.Asset        asset    = null;
            HttpResponseMessage response = await client.GetAsync("/projects/" + projectId + "/assets/" + assetId);

            if (response.IsSuccessStatusCode)
            {
                string str = await response.Content.ReadAsStringAsync();

                JToken token = JObject.Parse(str);
                asset = ((Models.Asset)JsonConvert.DeserializeObject <Models.Asset>(token.First.First.ToString()));
            }
            return(asset);
        }