Esempio n. 1
0
 public InterestElement(Interest interest, Action action)
     : base(interest.Keyword, interest.Language, UITableViewCellStyle.Subtitle)
 {
     Accessory = UITableViewCellAccessory.DisclosureIndicator;
     Tapped += action;
     Interest = interest;
 }
        // PUT api/Interests/5
        public HttpResponseMessage PutInterest(int id, Interest interest)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != interest.InterestId)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(interest).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
 public void onData(Interest interest, Data data)
 {
     ++callbackCount_;
     Console.Out.WriteLine("Got data packet with name " + data.getName().toUri());
     var content = data.getContent().buf();
     var contentString = "";
     for (int i = content.position(); i < content.limit(); ++i)
       contentString += (char)content.get(i);
     Console.Out.WriteLine(contentString);
 }
Esempio n. 4
0
    /// <summary>
    /// Add or update a topic-
    /// </summary>
    /// <remarks>topics-endpoint (https://developer.feedly.com/v3/topics/#add-a-topic-to-the-user-feedly-account)</remarks>
    /// <param name="topicId">The topic id.</param>
    /// <param name="interest">The interest of the topic.</param>
    /// <param name="cancellationToken">The cancellation token.</param>
    /// <returns></returns>
    /// <exception cref="System.ArgumentOutOfRangeException">Select low, medium or high for the interest.</exception>
    public async Task<bool> AddOrUpdateTopic(string topicId, Interest interest = Interest.Low, CancellationToken cancellationToken = default(CancellationToken))
    {
      if (interest == Interest.Unknown)
      {
        throw new ArgumentOutOfRangeException("Select low, medium or high for the interest.");
      }

      await Client.Request(HttpMethod.Post, "v3/topics", new { id = ValueToResource("topic", topicId, false), interest = interest.ToString().ToLower() }, true, true, cancellationToken);
      return true;
    }
        public ActionResult New(string ImageUrl, string Link, string Comment)
        {
            var currentUser = db.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();
            var physicalByteImage = Configuration.GetImageByteArray(ImageUrl);
            var newinterest = new Interest() { URL = Link, Comment = Comment, Poster = currentUser, Image = physicalByteImage };
            db.Interests.Add(newinterest);
            db.SaveChanges();

            return Json(new { Link = newinterest.Link });
        }
        public ActionResult Create(Interest interest)
        {
            if (ModelState.IsValid)
            {
                db.Interests.Add(interest);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(interest);
        }
        // POST api/Interests
        public HttpResponseMessage PostInterest(Interest interest)
        {
            if (ModelState.IsValid)
            {
                db.Interests.Add(interest);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, interest);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = interest.InterestId }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
Esempio n. 8
0
        private async Task GetMoreRepositoriesForInterest(Interest interest)
        {
            try
            {
                var search = new SearchRequest(interest.Keyword);
                search.In = new List<Octokit.InQualifier>() { Octokit.InQualifier.Description, Octokit.InQualifier.Name, Octokit.InQualifier.Readme };
                search.Language = interest.LanguageId;
				search.SortField = Octokit.RepoSearchSort.Stars;
                search.Page = Convert.ToInt32(interest.NextPage) + 1;
                var apiConnection = new Octokit.ApiConnection(_applicationService.Client.Connection);
                var response = await apiConnection.Get<Octokit.SearchRepositoryResult>(Octokit.ApiUrls.SearchRepositories(), search.Parameters);

                if (response.Items.Count == 0)
                    throw new InterestExhaustedException();

                interest.NextPage++;
                _applicationService.Account.Interests.Update(interest);

                foreach (var r in response.Items)
                {
                    _applicationService.Account.InterestedRepositories.Insert(new InterestedRepository 
                    { 
                        Name = r.Name, 
                        Owner = r.Owner.Login, 
                        Description = r.Description, 
                        InterestId = interest.Id,
						Stars = r.StargazersCount,
                        Forks = r.ForksCount,
                        ImageUrl = r.Owner.AvatarUrl
                    });
                }
            }
            catch (Octokit.ApiException e)
            {
                Debug.WriteLine(e.Message);
                interest.Exhaused = true;
                _applicationService.Account.Interests.Update(interest);
            }
            catch (InterestExhaustedException)
            {
                interest.Exhaused = true;
                _applicationService.Account.Interests.Update(interest);
            }
        }
        UIView CreateInterestButton(Interest interest, float lastY)
        {
            var scrollViewFrame = interestsScrollView.Frame;

            var interestButton = new UIButton (new RectangleF (
                0,
                lastY + PADDING_HEIGHT,
                scrollViewFrame.Width,
                40
            ));

            interestButton.Layer.BorderColor = UIColor.White.CGColor;
            interestButton.Layer.BorderWidth = 2.0f;
            interestButton.Layer.CornerRadius = 20;
            interestButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            interestButton.SetTitle (interest.Name, UIControlState.Normal);
            interestButton.TouchUpInside += (sender, e) => InterestButtonToggle (interest, interestButton);
            return interestButton;
        }
        void InterestButtonToggle(Interest interest, UIButton button)
        {
            if (userSelectedInterests.Contains (interest))
            {
                userSelectedInterests.Remove (interest);
                button.SetTitleColor (UIColor.White, UIControlState.Normal);
                button.BackgroundColor = UIColor.FromWhiteAlpha(1,0);
                button.Layer.BorderColor = UIColor.White.CGColor;
            }
            else
            {
                userSelectedInterests.Add (interest);
                button.SetTitleColor (UIColor.FromRGB(183,18,52), UIControlState.Normal);
                button.BackgroundColor = UIColor.White;
                button.Layer.BorderColor = UIColor.White.CGColor;
            }

            startTourButton.Hidden = userSelectedInterests.Count == 0;
        }
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            Converter converter = new Converter();

            try
            {
                CalcInterests calcInterests = new CalcInterests();
                Interest  = calcInterests.CalculateCompoundInterest(tbPrincipal.Text.Trim().ToString(), tbYear.Text.Trim().ToString(), tbMonth.Text.Trim().ToString(), tbRate.Text.Trim().ToString(), tbNoOfTimes.Text.Trim().ToString());
                Principal = converter.ToDouble(tbPrincipal.Text.Trim().ToString());
                Rate      = converter.ToDouble(tbRate.Text.Trim().ToString());
                Time      = converter.ToDouble(tbYear.Text.Trim().ToString()) * 12 + converter.ToDouble(tbMonth.Text.Trim().ToString());
                Interest  = Interest - Principal;
                Interestdata interestdata2 = new Interestdata();
                interestdata           = interestdata2;
                interestdata.Interest  = Interest;
                interestdata.Total     = Interest + Principal;
                interestdata.Principal = Principal;
                interestdata.Rate      = Rate;

                interestdata.Time_Month = Time;;
                if (interestDatalist == null)
                {
                    List <Interestdata> list = new List <Interestdata>();
                    interestDatalist = list;
                }
                interestDatalist.Add(interestdata);
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = interestDatalist;
                Label lb = new Label();
                lb.Location = new Point(251, 70);
                lb.Text     = Interest.ToString();

                // Adding this label in the form
                this.Controls.Add(lb);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 12
0
    public void UpdateLoop()
    {
        List <AgentAwared> affected;
        AgentAwared        leader;
        List <AgentAwared> scouts;

        foreach (InterestSource source in sources)
        {
            //avoid inactive sources
            if (!source.isActive)
            {
                continue;
            }
            source.isActive = false;
            //avoid sources that don't affect any agent
            affected = source.GetAffected(agents.ToArray());
            if (affected.Count == 0)
            {
                continue;
            }
            //get a random leader and set of scouts
            int randomLeadPos = Random.Range(0, affected.Count);
            leader = affected[randomLeadPos];
            scouts = GetScouts(affected.ToArray(), randomLeadPos);
            //call the leader to its role if necessary
            if (leader.Equals(scouts[0]))
            {
                StartCoroutine(leader.Lead());
            }
            //inform the scouts about noticing the interest, in case it's relevant
            foreach (AgentAwared a in scouts)
            {
                Interest i = source.interest;
                if (a.isRelevant(i))
                {
                    a.Notice(i);
                }
            }
        }
    }
Esempio n. 13
0
        /// <summary>
        /// Saves users Interests in the database and locally
        /// </summary>
        /// <param name="interest"></param>
        public async Task AddUserInterest(Interest interest)
        {
            try
            {
                interest.Title = interest.Title.ToLower();

                var userInterestsList = DatabaseHelper.GetSavedInterestsList();

                if (userInterestsList == null)
                {
                    userInterestsList = new List <Interest>();
                }

                userInterestsList.Add(interest);

                string userInterestsJson = JsonConvert.SerializeObject(userInterestsList);
                Settings.AddSetting(Settings.AppPrefrences.Interests, userInterestsJson);

                var addableTabItem = new Tab {
                    Title = interest.Title, ArticlePage = 1
                };
                var articles = await NewsApiHelper.SearchArticles(new string[] { interest.Title.ToLower() });

                addableTabItem.Articles.AddRange(articles);
                addableTabItem.IsBusy = false;

                MainFeedViewModel.Instance.TabItems.Insert(MainFeedViewModel.Instance.TabItems.IndexOf(MainFeedViewModel.Instance.TabItems.LastOrDefault()) + 1, addableTabItem);

                string isloggedIn = Settings.GetSetting(Settings.AppPrefrences.IsLoggedIn);

                if (isloggedIn != null || isloggedIn != "False")
                {
                    await DatabaseHelper.UpdateUserInterests(userInterestsList).ConfigureAwait(false);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
            public async Task <bool> Handle(
                Command request,
                CancellationToken cancellationToken
                )
            {
                Guid id         = request.Id;
                int  visibility = request.Visibility;
                Guid userId     = request.UserId;

                Interest existingInterest = _interestsDbContext.Interests.Find(id);

                if (existingInterest != null)
                {
                    UserInterest existingUserInterest = await _interestsDbContext.UserInterests.AsNoTracking().SingleOrDefaultAsync(u => u.IdInterest == id && u.IdUser == userId);

                    if (existingUserInterest != null)
                    {
                        throw new AppException($"The user interest {id} has already been added");
                    }
                    else
                    {
                        UserInterest userInterest = new UserInterest
                        {
                            IdInterest = id,
                            Visibility = visibility,
                            IdUser     = userId
                        };
                        _interestsDbContext.UserInterests.Add(userInterest);

                        existingInterest.PeopleCount = existingInterest.PeopleCount + 1;
                        _interestsDbContext.Interests.Update(existingInterest);

                        return(await _interestsDbContext.SaveChangesAsync() > 0);
                    }
                }
                else
                {
                    throw new AppException($"The interest {id} already as not been found");
                }
            }
Esempio n. 15
0
        // Add Interest //
        public Interest AddInterest(string name)
        {
            // using statement for the Sql Connection //
            using (var connection = new SqlConnection(ConnectionString))
            {
                // Opening connection //
                connection.Open();
                // setting the insert interest command to a variable and executing //
                var insertInterestCommand = connection.CreateCommand();
                // Setting the Command Text to insert the interest into the database //
                insertInterestCommand.CommandText = $@"Insert into interests (name)
                                                     Output inserted.*
                                                     Values(@name)";
                // Setting the insertInterest command parameters to add the value of Name //
                insertInterestCommand.Parameters.AddWithValue("name", name);

                // Setting the reader to a variable to execute after insert Interest Command //
                var reader = insertInterestCommand.ExecuteReader();

                if (reader.Read())
                {
                    // setting the inserted name value to be read as a string //
                    var insertedName = reader["name"].ToString();

                    // setting the inserted int (ID) to be read as an Int //
                    var insertedId = (int)reader["Id"];

                    // Setting the new interest with the inserted name & inserted ID //
                    var newInterest = new Interest(insertedName)
                    {
                        Id = insertedId
                    };

                    // returning the new interest //
                    return(newInterest);
                }
            }
            // Exception for when you can't find the interest //
            throw new Exception("Can't Find An Interest");
        }
Esempio n. 16
0
 static void dumpInterest(Interest interest)
 {
     Console.Out.WriteLine("name: " + interest.getName().toUri());
     Console.Out.WriteLine("minSuffixComponents: " +
                           (interest.getMinSuffixComponents() >= 0 ?
                            "" + interest.getMinSuffixComponents() : "<none>"));
     Console.Out.WriteLine("maxSuffixComponents: " +
                           (interest.getMaxSuffixComponents() >= 0 ?
                            "" + interest.getMaxSuffixComponents() : "<none>"));
     Console.Out.Write("keyLocator: ");
     if (interest.getKeyLocator().getType() == KeyLocatorType.NONE)
     {
         Console.Out.WriteLine("<none>");
     }
     else if (interest.getKeyLocator().getType() == KeyLocatorType.KEY_LOCATOR_DIGEST)
     {
         Console.Out.WriteLine("KeyLocatorDigest: " + interest.getKeyLocator().getKeyData().toHex());
     }
     else if (interest.getKeyLocator().getType() == KeyLocatorType.KEYNAME)
     {
         Console.Out.WriteLine("KeyName: " + interest.getKeyLocator().getKeyName().toUri());
     }
     else
     {
         Console.Out.WriteLine("<unrecognized ndn_KeyLocatorType>");
     }
     Console.Out.WriteLine
         ("exclude: " + (interest.getExclude().size() > 0 ?
                         interest.getExclude().toUri() : "<none>"));
     Console.Out.WriteLine("lifetimeMilliseconds: " +
                           (interest.getInterestLifetimeMilliseconds() >= 0 ?
                            "" + interest.getInterestLifetimeMilliseconds() : "<none>"));
     Console.Out.WriteLine("childSelector: " +
                           (interest.getChildSelector() >= 0 ?
                            "" + interest.getChildSelector() : "<none>"));
     Console.Out.WriteLine("mustBeFresh: " + interest.getMustBeFresh());
     Console.Out.WriteLine("nonce: " +
                           (interest.getNonce().size() > 0 ?
                            "" + interest.getNonce().toHex() : "<none>"));
 }
Esempio n. 17
0
        public static List <Interest> getStudentInterest()
        {
            List <Interest> studentInterestList = new List <Interest>();

            Interest interst1 = new Interest();

            interst1.studentId = 1;
            interst1.interest  = "Badminton";

            Interest interst2 = new Interest();

            interst2.studentId = 1;
            interst2.interest  = "C#";

            Interest interst3 = new Interest(); 
 interst3.studentId = 2; 
 interst3.interest = "Dance";


            Interest interst4 = new Interest(); 
 interst4.studentId = 2; 
 interst4.interest = "Reading";


            Interest interst5 = new Interest(); 
 interst5.studentId = 3; 
 interst5.interest = "Reading";


            Interest interst6 = new Interest(); 
 interst6.studentId = 3; 
 interst6.interest = "Singing";

            Interest interst7 = new Interest(); 
 interst7.studentId = 3; 
 interst7.interest = "Soccer";



            studentInterestList.Add(interst1);
            studentInterestList.Add(interst2);
            studentInterestList.Add(interst3);
            studentInterestList.Add(interst4);
            studentInterestList.Add(interst5);
            studentInterestList.Add(interst6);
            studentInterestList.Add(interst7);


            return(studentInterestList);
        }
        public async Task <List <Interest> > GetKeywordInterests(Query query)
        {
            List <Interest> foundInterests = new List <Interest>();

            if (query.QueryText != "")
            {
                string url            = "https://graph.facebook.com/search?type=adinterest&q=[" + query.QueryText + "]&limit=10&locale=" + query.Language + "&access_token=2334601333305211|ixo93bORPMZUVQVdib6xNSHtG-Y";
                string responseString = await GetRequestAsync(url);

                responseString = responseString.Remove(0, 8);
                responseString = responseString.Remove(responseString.Length - 1);

                JArray interests = JArray.Parse(responseString);
                foreach (JObject interest in interests)
                {
                    Interest newInterest = new Interest();
                    foreach (KeyValuePair <string, JToken> row in interest)
                    {
                        if (row.Key == "name")
                        {
                            newInterest.Name = row.Value.ToString();
                        }
                        else if (row.Key == "audience_size")
                        {
                            double audienceSize    = double.Parse(row.Value.ToString());
                            string humanizedNumber = audienceSize.Humanize(4);
                            newInterest.AudienceSize = humanizedNumber;
                        }
                        else if (row.Key == "topic")
                        {
                            newInterest.Category = row.Value.ToString();
                        }
                    }
                    newInterest.GoogleSearchUrl = "https://www.google.com/search?q=" + Regex.Replace(newInterest.Name, @"\s+", "+");
                    foundInterests.Add(newInterest);
                }
            }

            return(foundInterests);
        }
Esempio n. 19
0
        public Person SavePerson(string firstName, string lastName, DateTime dateOfBirth, List <string> interestsValues, byte[] picture,
                                 string addr1, string addr2, string city, string state, string postalCode)
        {
            if (interestsValues == null)
            {
                interestsValues = new List <string>();
            }

            // get all the interests that already exist in the repository
            var interestsInRepo = _interestRepository.GetByValues(interestsValues).ToList();

            // get just the interst values
            var interestValuesInRepo = interestsInRepo.Select(i => i.Value).ToList();

            // get all the interests provided that are NOT already in the repository
            var interestValuesNotInRepo =
                interestsValues.Where(interestValue => interestValuesInRepo.All(interestValueInRepo => interestValueInRepo != interestValue));

            // construct the person's actual list of Interest objects
            var personsInterests = new List <Interest>();

            personsInterests.AddRange(interestsInRepo);
            foreach (var interestValue in interestValuesNotInRepo)
            {
                var interest = _interestRepository.Add(Interest.Create(interestValue));
                personsInterests.Add(interest);
            }

            var person = Person.CreatePerson(firstName, lastName, dateOfBirth, personsInterests, picture, addr1, addr2, city, state,
                                             postalCode);

            if (person != null)
            {
                _personRepository.Add(person);
                _personRepository.Save();
            }

            return(person);
        }
        private void Calculate()
        {
            if (Interest.Equals(0) || LoanAmount.Equals(0) || Term.Equals(0))
            {
                Validation();
                return;
            }

            emiAmount            = emiService.CalculateEMI(LoanAmount, Interest, Term, TermType);
            TotalInterestAmount  = emiService.GetPayableInterestAmount(Term, TermType, LoanAmount);
            TotalPayment         = emiService.GetPayablePrincipalAmount(Term, TermType);
            MonthlyPayment       = emiAmount;
            TotalPrincipalAmount = LoanAmount;

            TotalPaymentCollection = new ObservableCollection <ChartDataPoint>
            {
                new ChartDataPoint("Principal", TotalPrincipalAmount),
                new ChartDataPoint("Interest", TotalInterestAmount)
            };

            MessagingCenter.Send(this, "ScrollToEnd");
        }
Esempio n. 21
0
 public void onNetworkNack(Interest interest,
                           NetworkNack networkNack)
 {
     outer_EncryptorV2.kekPendingInterestId_ = 0;
     if (nTriesLeft > 1)
     {
         outer_EncryptorV2.face_.callLater(net.named_data.jndn.encrypt.EncryptorV2.RETRY_DELAY_AFTER_NACK_MS,
                                           new net.named_data.jndn.encrypt.EncryptorV2.Anonymous_C0.Anonymous_C8(this));
     }
     else
     {
         onError.onError(
             net.named_data.jndn.encrypt.EncryptError.ErrorCode.KekRetrievalFailure,
             "Retrieval of KEK ["
             + interest.getName().toUri()
             + "] failed. Got NACK ("
             + networkNack.getReason() + ")");
         net.named_data.jndn.encrypt.EncryptorV2.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.INFO, "Scheduling retry from NACK");
         outer_EncryptorV2.face_.callLater(net.named_data.jndn.encrypt.EncryptorV2.RETRY_DELAY_KEK_RETRIEVAL_MS,
                                           new net.named_data.jndn.encrypt.EncryptorV2.Anonymous_C0.Anonymous_C7(this));
     }
 }
Esempio n. 22
0
        public async Task <Result> UpdateInterest(InterestDTO interestDTO)
        {
            if (interestDTO == null)
            {
                return(Result.Fail(Constants.InterestErrorMessages.Interest_Should_Not_Be_Empty));
            }
            var interest = Interest.Create(interestDTO.InterestName, interestDTO.InterestDescription);

            if (!interest.IsSuccessed)
            {
                return(Result.Fail(interest.GetErrorString()));
            }
            var actualInterest = await _interestRepository.GetInterestById(interestDTO.Id);

            if (!actualInterest.IsSuccessed)
            {
                return(Result.Fail(actualInterest.GetErrorString()));
            }
            actualInterest.Value.UpdateInterest(interest.Value);
            _interestRepository.Update(actualInterest.Value);
            return(await _interestRepository.SaveChangesAsync(InterestErrorMessages.Error_Occured_While_Updating_Interest));
        }
Esempio n. 23
0
        public ActionResult <Interest> Update([FromBody] Interest req)
        {
            if (req.name == null || req.name == "")
            {
                return(BadRequest());
            }

            var Interest = _resume.interests.FirstOrDefault(p => p.name == req.name);

            if (Interest != null)
            {
                _resume.interests.Remove(Interest);
            }
            else
            {
                return(NotFound());
            }

            _resume.interests.Add(req);

            return(Ok(req));
        }
Esempio n. 24
0
        public void testDecodeV03AsV02()
        {
            Interest interest1 = new Interest();

            interest1.wireDecode(new Blob(simpleCodedInterestV03, false));

            ArrayList dump1 = dumpInterest(interest1);

            Assert.AssertArrayEquals(
                "Decoded simpleCodedInterestV03 does not match the dump",
                ILOG.J2CsMapping.Collections.Collections.ToArray(dump1), ILOG.J2CsMapping.Collections.Collections.ToArray(simpleCodedInterestV03Dump));

            Interest interest2 = new Interest();

            interest2.wireDecode(new Blob(fullCodedInterestV03, false));

            ArrayList dump2 = dumpInterest(interest2);

            Assert.AssertArrayEquals(
                "Decoded fullCodedInterestV03 does not match the dump",
                ILOG.J2CsMapping.Collections.Collections.ToArray(dump2), ILOG.J2CsMapping.Collections.Collections.ToArray(fullCodedInterestV03Dump));
        }
Esempio n. 25
0
        public async Task <ActionResult> Update([FromBody] Interest interest)
        {
            if (interest == null)
            {
                return(NotFound("Interest data is not supplied"));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Interest existingInterest = _dBContext.Interests.FirstOrDefault(s => s.InterestId == interest.InterestId);

            if (existingInterest == null)
            {
                return(NotFound("Interest does not exist in the database"));
            }
            existingInterest.InterestName             = interest.InterestName;
            _dBContext.Attach(existingInterest).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            await _dBContext.SaveChangesAsync();

            return(Ok(existingInterest));
        }
Esempio n. 26
0
        /// <summary>
        /// Express an Interest to fetch the content packet with contentName, and
        /// decrypt it, fetching keys as needed.
        /// </summary>
        ///
        /// <param name="contentName">The name of the content packet.</param>
        /// <param name="onConsumeComplete_0">contentData is the fetched Data packet and result is the decrypted plain text Blob. NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param>
        /// <param name="onError_1">better error handling the callback should catch and properly handle any exceptions.</param>
        public void consume(Name contentName,
                            Consumer.OnConsumeComplete onConsumeComplete_0, net.named_data.jndn.encrypt.EncryptError.OnError onError_1)
        {
            Interest interest_2 = new Interest(contentName);

            // Prepare the callback functions.
            OnData onData_3 = new Consumer.Anonymous_C6(this, onConsumeComplete_0, onError_1);

            OnTimeout onTimeout = new Consumer.Anonymous_C5(this, onError_1, interest_2, onData_3);

            // Express the Interest.
            try {
                face_.expressInterest(interest_2, onData_3, onTimeout);
            } catch (IOException ex) {
                try {
                    onError_1.onError(net.named_data.jndn.encrypt.EncryptError.ErrorCode.IOException,
                                      "expressInterest error: " + ex.Message);
                } catch (Exception exception) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onError", exception);
                }
            }
        }
Esempio n. 27
0
        public void onData(Interest interest, Data data)
        {
            JSONNode parsedTrack = JSON.Parse(data.getContent().toString());
            string   trackID     = parsedTrack ["id"];

            try {
                Track track = consumerOuterInstance.activeTracks[trackID];
                track.setPosition(parsedTrack["x"].AsFloat, parsedTrack["y"].AsFloat, parsedTrack["z"].AsFloat);
            } catch (KeyNotFoundException) {
                // this means its a pending track (or something really wierd happened)
                consumerOuterInstance.activateTrack(trackID, parsedTrack ["x"].AsFloat, parsedTrack ["y"].AsFloat, parsedTrack ["z"].AsFloat);
            }


            int      newSeq          = Int32.Parse(interest.getName().get(-1).toEscapedString()) + 1;
            Interest newTrackInterst = new Interest(data.getName().getPrefix(-1).append(newSeq.ToString()));

            newTrackInterst.setMustBeFresh(true);
            newTrackInterst.setInterestLifetimeMilliseconds(consumerOuterInstance.config.defaultTrackLifetime);
            consumerOuterInstance.face.expressInterest(newTrackInterst, this, this);
            //It is to reuse this right? should be better than creating new objects all the time
        }
        public HttpResponseMessage DeleteInterest(int id)
        {
            Interest item = db.Interests.Find(id);

            if (item == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            db.Interests.Remove(item);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, item));
        }
Esempio n. 29
0
        public Profile()
        {
            for (int i = 3; i < 55; i++)
            {
                Age.Add(i.ToString());
            }
            Age.Add("55+");

            Interest.AddRange(new string[]
                              { String.Empty,
                                "Спорт",
                                "Музыка",
                                "Рукоделие",
                                "Литература",
                                "Рисование",
                                "Танцы",
                                "Рыбалка",
                                "Охота",
                                "Работа",
                                "Языкознание",
                                "Программирование" });

            Holiday.AddRange(new string[]
                             { "День Рождение",
                               "Новый Год",
                               "8 марта",
                               "23 февраля",
                               "14 февраля",
                               "1 сентября",
                               "1 мая",
                               "День Народного Единства",
                               "День Победы",
                               "Рождество",
                               "Крещение",
                               "Свадьба",
                               "День Учителя",
                               "День Семьи",
                               "Любви и Верности" });
        }
Esempio n. 30
0
        /// <summary>
        /// This is called from an expressInterest timeout to update the state of
        /// keyRequest. Re-express the interest if the number of retrials is less than
        /// the max limit.
        /// </summary>
        ///
        /// <param name="interest">The timed-out interest.</param>
        /// <param name="timeSlot_0">The time slot as milliseconds since Jan 1, 1970 UTC.</param>
        /// <param name="onEncryptedKeys_1">encrypted content key Data packets. If onEncryptedKeys is null, this does not use it.</param>
        internal void handleTimeout(Interest interest, double timeSlot_0,
                                    Producer.OnEncryptedKeys onEncryptedKeys_1, net.named_data.jndn.encrypt.EncryptError.OnError onError_2)
        {
            double timeCount = Math.Round(timeSlot_0, MidpointRounding.AwayFromZero);

            Producer.KeyRequest keyRequest = (Producer.KeyRequest)ILOG.J2CsMapping.Collections.Collections.Get(keyRequests_, timeCount);

            Name interestName = interest.getName();

            if ((int)(Int32)ILOG.J2CsMapping.Collections.Collections.Get(keyRequest.repeatAttempts, interestName) < maxRepeatAttempts_)
            {
                // Increase the retrial count.
                ILOG.J2CsMapping.Collections.Collections.Put(keyRequest.repeatAttempts, interestName, (int)(Int32)ILOG.J2CsMapping.Collections.Collections.Get(keyRequest.repeatAttempts, interestName) + 1);
                sendKeyInterest(interest, timeSlot_0, onEncryptedKeys_1, onError_2);
            }
            else
            {
                // Treat an eventual timeout as a network Nack.
                handleNetworkNack(interest, new NetworkNack(), timeSlot_0,
                                  onEncryptedKeys_1, onError_2);
            }
        }
Esempio n. 31
0
    //fetchTrack
    public void expressInterestForTrack(string trackID, Name.Component excludeComp = null)
    {
        Name trackName = new Name(prefix);

        trackName.append(startTimeComponent).append(producerNameComponents.tracks).append(trackID);           //.append ("0");
        Interest trackInterest = new Interest(trackName);

        if (excludeComp != null)
        {
            Exclude exclude = new Exclude();
            exclude.appendAny();
            exclude.appendComponent(excludeComp);
            trackInterest.setExclude(exclude);
        }


        trackInterest.setMustBeFresh(true);
        trackInterest.setChildSelector(1);
        TrackHandler handler = new TrackHandler(this);

        FaceSingleton.getFace().expressInterest(trackInterest, handler, handler);
    }
Esempio n. 32
0
        public void onData(Interest interest, Data data)
        {
            JSONNode parsedHint = JSON.Parse(data.getContent().toString());


            foreach (JSONNode track in parsedHint["tracks"].AsArray)
            {
                string trackID = track ["id"];
                // The consumer ignores the sequence number field in the hint for now;
                // As the consumer assumes it's getting the latest via outstanding interest.
                // Right now the consumer does not stop fetching tracks that have become inactive.
                // WHAT!!!!! EGM TODO!!!!
                if (!consumerOuterInstance.activeTracks.ContainsKey(trackID))
                {
                    if (!consumerOuterInstance.pendingTracks.ContainsKey(trackID))                       // if new track
                    {
                        consumerOuterInstance.addPendingTrack(trackID);
                    }
                }
            }
            consumerOuterInstance.expressHintInterest(data.getName().get(-1));              //exclues this interest
        }
Esempio n. 33
0
        public Child AddChildFinal(Child child, List <Interest> interestList)
        {
            Child tempChild = AddChild(child);

            foreach (var interest in interestList)
            {
                Interest      tempInterest    = interest;
                var           fetchedInterest = ctx.Interest.First(i => i.Type.Equals(interest.Type));
                ChildInterest childInterest   = new ChildInterest()
                {
                    Child      = tempChild,
                    ChildId    = tempChild.Id,
                    Interest   = fetchedInterest,
                    InterestId = fetchedInterest.Type
                };
                tempChild.ChildInterests = new List <ChildInterest>();
                tempChild.ChildInterests.Add(childInterest);
            }
            ctx.Update(tempChild);
            ctx.SaveChangesAsync();
            return(tempChild);
        }
Esempio n. 34
0
        private static void InsertInterests()
        {
            IList <Interest> interests = new List <Interest>();
            // Fetching Members...
            IList <Member> members;

            using (var context = new DiscussionBoardContext())
            {
                members = context.Members
                          .Where(m => m.FirstName
                                 .Contains("Member")).ToList();
            }
            // Time to Create Interests for Members
            int enumCounter = 1;

            foreach (var member in members)
            {
                var interest = new Interest
                {
                    // the power of Enums!
                    InterestName = (DiscussionCategories)enumCounter,
                    // Use Foreign Key to indicate this is not a Insert!
                    MemberId = member.MemberId
                };
                enumCounter++;
                interests.Add(interest);
            }
            // Saving New Interests
            using (var context = new DiscussionBoardContext())
            {
                context.Database.Log = Console.WriteLine;

                // Everything in the Graph will be marked as Added Now!
                context.Interests.AddRange(interests);

                context.SaveChanges();
                Console.ReadKey();
            }
        }
Esempio n. 35
0
        private Resume Constructed(string name = null, List <string> keywords = null)
        {
            var interest = new Interest();

            // Set values separately from object initialization to preserve any default values.
            if (name != null)
            {
                interest.Name = name;
            }
            if (keywords != null)
            {
                interest.Keywords = keywords;
            }

            return(new Resume()
            {
                Interests = new List <Interest>()
                {
                    interest
                }
            });
        }
        /// <summary>
        /// CreatedBy:Piyumi
        /// CreatedDate:2016/2/5
        /// insert details of interest which related to a loan
        /// </summary>
        /// <returns>countval</returns>
        public int insertInterestDetails(Interest interest)
        {
            DataHandler     dataHandler  = new DataHandler();
            List <object[]> paramertList = new List <object[]>();

            paramertList.Add(new object[] { "@interest_rate", interest.InterestRate });
            paramertList.Add(new object[] { "@paid_date", interest.PaidDate });
            paramertList.Add(new object[] { "@payment_period", interest.PaymentPeriod });
            paramertList.Add(new object[] { "@auto_remind_email", interest.AutoRemindEmail });
            paramertList.Add(new object[] { "@auto_remind_period", interest.RemindPeriod });
            paramertList.Add(new object[] { "@loan_id", interest.LoanId });
            paramertList.Add(new object[] { "@accrual_method_id", interest.AccrualMethodId });

            try
            {
                return(dataHandler.ExecuteSQLReturn("spInsertInterestDetails", paramertList));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 37
0
        public IHttpActionResult PutInterest(int id, Interest interest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != interest.Id)
            {
                return(BadRequest());
            }

            string userId = User.Identity.GetUserId();

            if (userId != interest.UserId)
            {
                return(StatusCode(HttpStatusCode.Conflict));
            }

            db.Entry(interest).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InterestExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 38
0
        private Interests GetPlayerInterests(string sessionKey)
        {
            Interests  playerInterests = new Interests();
            SqlCommand query           = new SqlCommand(
                "SELECT * FROM Player_Interests " +
                "INNER JOIN Sessions ON Sessions.username = Player_Interests.username " +
                "WHERE Sessions.session_key = @sessionKey;"
                );

            query.Parameters.AddWithValue("@sessionKey", sessionKey);
            Database.Connect();
            SqlDataReader reader = Database.Query(query);

            while (reader.Read())
            {
                Interest interest = reader["Interest"].ToString().ToEnum <Interest>();
                playerInterests.Preference[interest] = reader["Preference_Value"].ToFloat();
            }

            Database.Disconnect();
            return(playerInterests);
        }
Esempio n. 39
0
        // GET: api/Interest/5
        public Interest Get(double balance)
        {
            Interest amount = new Interest();

            if (balance >= 0 && balance <= 100.00)
            {
                amount.interest = (balance / 100) * 3;
            }
            else if (balance > 100.00 && balance < 1000.00)
            {
                amount.interest = (balance / 100) * 5;
            }
            else if (balance >= 1000.00)
            {
                amount.interest = (balance / 100) * 7;
            }
            else
            {
                amount.interest = 0;
            }
            return(amount);
        }
Esempio n. 40
0
        public void testInterestTimestamp()
        {
            Name interestName = new Name("/ndn/ucla/edu/something");
            Name certName     = keyChain_.getPib().getIdentity(identityName_)
                                .getKey(keyName_).getDefaultCertificate().getName();
            Face face = new Face("localhost");

            face.setCommandSigningInfo(keyChain_, certName);

            Interest oldInterest = new Interest(interestName);

            face.makeCommandInterest(oldInterest);

            // Make sure timestamps are different.
            ILOG.J2CsMapping.Threading.ThreadWrapper.sleep(100);
            Interest newInterest = new Interest(interestName);

            face.makeCommandInterest(newInterest);

            VerificationResult vr = doVerify(policyManager_, newInterest);

            Assert.AssertFalse(
                "ConfigPolicyManager returned ValidationRequest but certificate is known",
                vr.hasFurtherSteps_);
            Assert.AssertEquals("Verification of valid interest failed", 0,
                                vr.failureCount_);
            Assert.AssertEquals("Verification success called " + vr.successCount_
                                + " times instead of 1", 1, vr.successCount_);

            vr = doVerify(policyManager_, oldInterest);

            Assert.AssertFalse(
                "ConfigPolicyManager returned ValidationRequest but certificate is known",
                vr.hasFurtherSteps_);
            Assert.AssertEquals("Verification of stale interest succeeded", 0,
                                vr.successCount_);
            Assert.AssertEquals("Verification failure callback called " + vr.failureCount_
                                + " times instead of 1", 1, vr.failureCount_);
        }
Esempio n. 41
0
 public void WriteInterest(Interest i, User user)
 {
     AsyncCallback call = new AsyncCallback( SuperWriteInterest );
     LongRuningWriteInterest longProcess = new LongRuningWriteInterest(_ro.WriteInterest);
     IAsyncResult ar = longProcess.BeginInvoke(i, user, call, null);
 }
Esempio n. 42
0
 public void onTimeout(Interest interest)
 {
     ++callbackCount_;
     Console.Out.WriteLine("Time out for interest " + interest.getName().toUri());
 }
Esempio n. 43
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Member m = new Member();
            m.MemberId = Guid.NewGuid(); //adding in a random guid
            m.UserId = Guid.NewGuid(); //add in a random user id guid
            
            m.allowConnections = false; //no community.
            //-------------------
            m.allowNewsletter = true;            
            m.emailSubscription = true; // - what are our flags for personalized email


            m.FirstName = Constants.UnauthenticatedMember_FirstName;
            m.hasOtherChildren = false;
            m.isFacebookUser = false;
            m.isPrivate = true;
            m.LastName = string.Empty;
            m.PersonalityType = new Guid("8B7EB70D-64B2-45B9-B06E-6AA5CB6FE983");//Optimisic Parent
            m.Role = new Guid("2BF9D7BE-2E40-432C-ADE7-A25C80B9B9EE");//Father

            m.Email = txtEmail.Text;

            m.Password = Constants.UnauthenticatedMember_Password;
            
            Random random = new Random();
            int randomNumber = random.Next(0, 10000);
            m.ScreenName = "dummyuser_" + randomNumber.ToString();
            m.ZipCode = "01111";

            Journey j = new Journey();
            j.Key = new Guid("0642E401-8E66-4C69-89C6-294C257456C8");
            j.Value = "Still Figuring it Out";
            m.Journeys.Add(j);

            Interest intr = new Interest();
            intr.Key = new Guid("110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9");
            intr.Value = "Assisted Living";
            m.Interests.Add(intr);

            Interest intr2 = new Interest();
            intr2.Key = new Guid("3C185099-76B4-49DD-80D4-A069A3F55FA1");
            intr2.Value = "Homework and Study Skills";
            m.Interests.Add(intr2);

            //setting up a couple of issues for children
            Issue issueOne = new Issue();
            issueOne.Key = new Guid("3390C210-0B22-48FD-A411-881F956EDC0C");
            issueOne.Value = "Listening";
            Issue issueTwo = new Issue();
            issueTwo.Key = new Guid("1D338D37-CF4E-4C1C-9499-EBA6C0A2BBA0");
            issueTwo.Value = "Math";

            //setting up a couple of diagnosis values for children
            Diagnosis d1 = new Diagnosis();
            d1.Key = new Guid("A66286A0-CD70-4FDD-9D13-9CF1C90EFC4A");
            d1.Value = "Receptive Language Disorder";
            Diagnosis d2 = new Diagnosis();
            d2.Key = new Guid("7A035CC2-D6BD-4332-9518-7AB22083F652");
            d2.Value = "ADHD";

            //setting up a couple of grade values for children
            Grade g1 = new Grade();
            g1.Key = new Guid("E26222FB-07CD-413B-9127-9050B6D2D037");
            g1.Value = "Grade 1";
       
            //setting up status values for children
            Guid iepStatus = new Guid("FBE464C6-0E52-45C5-A1E9-660CB3C6B688");//yes
            Guid section504Status = new Guid("55F38A58-7506-454E-95E5-0ECE22A3B99C");//in progress
            Guid evaluationStatus = new Guid("990FB117-F12E-4E3C-898B-8A9EB217FCFD");//yes
            //------------------------------------------
            //test child 1 -- for the purposes of newsletter we only have 1 child. 
            //------------------------------------------
            Child childOne = new Child();
            childOne.ChildId = Guid.NewGuid();//random new child guid for testing purposes
            childOne.Gender = "boy";
            childOne.Nickname = "C1";
            childOne.IEPStatus = iepStatus;
            childOne.Section504Status = section504Status;
            childOne.EvaluationStatus = evaluationStatus;

            childOne.Issues.Add(issueOne);
            childOne.Issues.Add(issueTwo);
            childOne.Grades.Add(g1);
            childOne.Diagnoses.Add(d1);
            childOne.Diagnoses.Add(d2);
            m.Children.Add(childOne);

            MembershipManager mmgr = new MembershipManager();
            Member unauthMember = mmgr.AddUnauthorizedMember(m);
            //we should now have a "real" unauthorized member with comments and all
            
        }
Esempio n. 44
0
 public RegisteredInterest(Interest inter, String before, String next)
 {
     _interest = inter;
     _ringBeforeUri = before;
     _ringNextUri = next;
 }
Esempio n. 45
0
			public long expressInterest(Interest interest, OnData onData,
					OnTimeout onTimeout, OnNetworkNack onNetworkNack,
					WireFormat wireFormat) throws IOException {
Esempio n. 46
0
 public void InterestSelected(Interest interest)
 {
     if (currentLevelCharacter[questionIndex].topicName == interest.topic)
     {
         foreach(Interest i in interests)
             i.gameObject.GetComponent<BoxCollider>().enabled = false;
         interestCorrect(interest.transform.position);
     }
     else
     {
         interestIncorrect(interest);
     }
 }
Esempio n. 47
0
        public List<Interest> GetInterests(IUser user)
        {
            List<Interest> list = new List<Interest>();

            try{
                DataTable dt = _db.Select("SELECT id,user,content,updated,inserted " +
                                          "FROM interests " +
                                          "WHERE user = '******'");

                foreach(DataRow r in dt.Rows)
                {
                    Interest i = new Interest();
                    i.ID = int.Parse(r.ItemArray[0].ToString());
                    i.User = int.Parse(r.ItemArray[1].ToString());
                    i.Content = r.ItemArray[2].ToString();
                    i.Updated = long.Parse(r.ItemArray[3].ToString());
                    i.Inserted = long.Parse(r.ItemArray[4].ToString());
                    list.Add(i);
                }
            }catch{}

            return list;
        }
Esempio n. 48
0
 public MessageInsertRing(int act,Interest inter,String before,String after,String name,List<String> uris,List<String> contactingServerUri)
     : base(name, uris, contactingServerUri)
 {
     _before = before; _after = after; _actualize = act; _interest = inter;
 }
 public ActionResult Edit(Interest interest)
 {
     if (ModelState.IsValid)
     {
         db.Entry(interest).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(interest);
 }
Esempio n. 50
0
    public void interestIncorrect(Interest interest)
    {
        AudioManager.Instance.Play(wrongAnswerFX, transform, 1, false);

        interest.Disable();

        if (ShowDialogue(DialogueType.INCORRECTINTEREST) == false)
        {
            Debug.Log("I don't think they liked that. Let's look again. Remember to use your eyes to figure out what their interests are.");
        }

        Invoke ("returnInterests", minigame.GetCurrentDialogueDuration());
    }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("Connecting to salesforce");

            string fname = context.Request.QueryString["fname"];
            string lname = context.Request.QueryString["lname"];
            string email = context.Request.QueryString["email"];

            
            SalesforceManager sfMgr = new SalesforceManager("*****@*****.**", "8f9C3Ayq", "hlY0jOIILtogz3sQlLUtmERlu");
            if (sfMgr.LoggedIn)
            {
                //we are logged into salesforce.
                Member m = new Member();
                m.MemberId = Guid.NewGuid(); //adding in a random guid
                m.UserId = Guid.NewGuid(); //add in a random user id guid
                
                m.allowConnections = true;
                m.allowNewsletter = false ;
                m.emailSubscription = true;
                m.FirstName = fname;
                m.hasOtherChildren = false;
                m.isFacebookUser = true;
                m.isPrivate = true;
                m.LastName = lname;
                m.PersonalityType = new Guid("8B7EB70D-64B2-45B9-B06E-6AA5CB6FE983");//Optimisic Parent
              
                //m.Phone = 7811112222; //member phone & db need to be updated . int32 is too small for a phone number
               
                m.Role = new Guid("2BF9D7BE-2E40-432C-ADE7-A25C80B9B9EE");//Father
                
                Random random = new Random();
                int randomNumber = random.Next(0, 10000);
                m.ScreenName = "dummyuser_" + randomNumber.ToString();
                m.ZipCode = "01111";
                
                Journey j = new Journey();
                j.Key = new Guid( "0642E401-8E66-4C69-89C6-294C257456C8");
                j.Value = "Still Figuring it Out";
                m.Journeys.Add(j);

                Interest intr = new Interest();
                intr.Key = new Guid("110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9");
                intr.Value = "Assisted Living";
                m.Interests.Add(intr);

                Interest intr2 = new Interest();
                intr2.Key = new Guid("3C185099-76B4-49DD-80D4-A069A3F55FA1");
                intr2.Value = "Homework and Study Skills";
                m.Interests.Add(intr2);

                //setting up a couple of issues for children
                Issue issueOne = new Issue();
                issueOne.Key = new Guid("3390C210-0B22-48FD-A411-881F956EDC0C");
                issueOne.Value = "Listening";
                Issue issueTwo = new Issue();
                issueTwo.Key = new Guid("1D338D37-CF4E-4C1C-9499-EBA6C0A2BBA0");
                issueTwo.Value = "Math";

                //setting up a couple of diagnosis values for children
                Diagnosis d1 = new Diagnosis();
                d1.Key = new Guid("A66286A0-CD70-4FDD-9D13-9CF1C90EFC4A");
                d1.Value = "Receptive Language Disorder";
                Diagnosis d2 = new Diagnosis();
                d2.Key = new Guid("7A035CC2-D6BD-4332-9518-7AB22083F652");
                d2.Value = "ADHD";

                //setting up a couple of grade values for children
                Grade g1 = new Grade();
                g1.Key = new Guid("E26222FB-07CD-413B-9127-9050B6D2D037");
                g1.Value = "Grade 1";
                Grade g2 = new Grade();
                g2.Key = new Guid("E0B459C0-548A-4E6C-854A-E8F475416F12");
                g2.Value = "Grade 10";
              
                //setting up status values for children
                Guid iepStatus = new Guid("FBE464C6-0E52-45C5-A1E9-660CB3C6B688");//yes
                Guid section504Status = new Guid("55F38A58-7506-454E-95E5-0ECE22A3B99C");//in progress
                Guid evaluationStatus = new Guid("990FB117-F12E-4E3C-898B-8A9EB217FCFD");//yes
                //------------------------------------------
                //test child 1
                //------------------------------------------
                Child childOne = new Child();
                childOne.ChildId = Guid.NewGuid();//random new child guid for testing purposes
                childOne.Gender = "boy";
                childOne.Nickname = "Bobby";
                childOne.IEPStatus = iepStatus;
                childOne.Section504Status = section504Status;
                childOne.EvaluationStatus = evaluationStatus;

                childOne.Issues.Add(issueOne);
                childOne.Issues.Add(issueTwo);
                childOne.Grades.Add(g1);
                childOne.Diagnoses.Add(d1);
                childOne.Diagnoses.Add(d2);
                m.Children.Add(childOne); 
                //------------------------------------------
                //test child 2
                //------------------------------------------
                Child childTwo = new Child();
                childTwo.ChildId = Guid.NewGuid();//random new guid for testing
                childTwo.Gender = "boy";
                childTwo.Nickname = "Tommy";
                childTwo.IEPStatus = iepStatus;
                childTwo.Section504Status = section504Status;
                childTwo.EvaluationStatus = evaluationStatus;

                childTwo.Grades.Add(g2);
                childTwo.Issues.Add(issueOne);
                childTwo.Issues.Add(issueTwo);
                m.Children.Add(childTwo); 

                try
                {
                    SalesforceActionResult result = sfMgr.CreateWebsiteMemberAsContact(m,email);
                 
                    if (result.Success == true)
                    {
                        context.Response.Write(Environment.NewLine + "Contact (" + fname + " " + lname + ") is 'saved' to salesforce at: (" + sfMgr.SalesforceURL + ")"
                             + Environment.NewLine + "Message: " + result.Message );
                    }
                    else
                    {
                        context.Response.Write(Environment.NewLine + "Contact (" + fname + " " + lname + ") is not saved to salesforce at: (" + sfMgr.SalesforceURL + ")"
                            + Environment.NewLine + "Message: " + result.Message );
                    }
                }
                catch (Exception ex)
                {
                    context.Response.Write(Environment.NewLine + "An error occured during in RunSalesfroceUpsert.ashx.cs " + 
                        Environment.NewLine + "Message: " +  ex.Message +
                        Environment.NewLine + "Stack Trace: " + ex.StackTrace);
                }                
            }
        }
Esempio n. 52
0
        public void WriteInterest(Interest i, IUser user)
        {
            if(!CheckUserIntegrity(user))
                return;

            try{

                    DataTable dt = _db.Select("SELECT id " +
                                              "FROM interests " +
                                              "WHERE user = '******' " +
                                              "AND content = '"+i.Content+"'");
                    if(dt.Rows.Count == 0)
                    {
                    _db.Insert("INSERT INTO interests (user,content,updated,inserted) " +
                               "VALUES ('"+user.ID+"','"+i.Content+"','"+i.Updated+"','"+i.Inserted+"')");
                    }else{
                    _db.Insert("UPDATE interests SET updated = '"+i.Updated+"' " +
                               "WHERE user ='******' AND content='"+i.Content+"'");
                    }

            }catch{}
        }