void window_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape || e.Key == Key.Enter)
     {
         Backer.Focus();
     }
 }
        public async Task <BackerDetailModel> Handle(RegisterBackerCommand request, CancellationToken cancellationToken)
        {
            using var context = new DynamoDBContext(_dynamoDb);
            var toInsertBacker = Backer.BuildForParticipant(request.EventId, request.ParticipantId, request.Name, request.Amount, request.EmailAddress);
            await context.SaveAsync(toInsertBacker, cancellationToken);

            return(_mapper.Map(toInsertBacker, new BackerDetailModel()));
        }
Beispiel #3
0
 public Emailer(string From, string Password, Backer Backer, Startup Startup, Milestone Milestone)
 {
     this.From      = From;
     this.Password  = Password;
     this.Backer    = Backer;
     this.Startup   = Startup;
     this.Milestone = Milestone;
 }
        public int CheckProfileActive(int id)
        {
            Backer bk = new Backer();

            bk = dbContext.Backers.FirstOrDefault(i => i.Id == id);
            if (bk.IsBackerActive == true)
            {
                return(1);
            }
            return(0);
        }
        public int CheckIfEmailExists(string email)
        {
            Backer bk = new Backer();

            bk = dbContext.Backers.FirstOrDefault(i => i.Email == email);
            if (bk == null)
            {
                return(-1);
            }
            return(bk.Id);
        }
 public SqlCommand InsertBackerBADVERSION(Backer newBacker, SqlConnection connection)
 {
     using (SqlCommand sql = new SqlCommand("Insert into backers Values(@ID, @Funding, @Name, @Email)", connection))
     {
         sql.Parameters.Add(new SqlParameter("ID", newBacker.ID));
         sql.Parameters.Add(new SqlParameter("Funding", newBacker.Funding));
         sql.Parameters.Add(new SqlParameter("Name", newBacker.Name));
         sql.Parameters.Add(new SqlParameter("Email", newBacker.Email));
         return(sql);
     }
 }
        public bool DeleteBacker(int backerid)
        {
            Backer backer = dbContext.Backers.Find(backerid);

            if (backer == null)
            {
                return(false);
            }
            backer.IsBackerActive = false;
            dbContext.SaveChanges();
            return(true);
        }
        public Backer UpdateBacker(BackerOptions backerOptions, int backerId)
        {
            Backer backer = dbContext.Backers.Find(backerId);

            backer.Email = backerOptions.Email;
            if (backerOptions.Wallet != 0)
            {
                backer.Wallet = backerOptions.Wallet;
            }

            dbContext.SaveChanges();
            return(backer);
        }
        public BackerOptions GetBackerById(int backerId)
        {
            Backer backer = dbContext.Backers.Find(backerId);

            return(new BackerOptions
            {
                Id = backerId,
                Username = backer.Username,
                Email = backer.Email,
                Wallet = backer.Wallet,
                IsBackerActive = backer.IsBackerActive
            });
        }
 private void AddDonation()
 {
     if(!firstname.text.Equals("") && !familyname.text.Equals("") && !mail.text.Equals("") && !amount.text.Equals(""))
     {
         Backer b = new Backer(
             "undefined",
             firstname.text,
             familyname.text,
             mail.text,
             null
         );
         RESTService.AddDonation(b, fundable, amount.text, feedback.text, FinishAddDonation);
     }
 }
 private void FinishAddDonation()
 {
     // TODO check to add backer to model
     Backer b = new Backer(
         "undefined",
         firstname.text,
         familyname.text,
         mail.text,
         null
     );
     RESTService.fundables.Find(f => f == fundable).AddBacker(b, double.Parse(amount.text));
     ComponentProperties cp = buildingComponent.GetComponent<ComponentProperties>();
     cp.ReRender();
     CloseWindow();
 }
Beispiel #12
0
 internal ModlData(Identity id, Backer backer)
 {
     this.Id = id;
     this.Backer = backer;
 }
Beispiel #13
0
 internal About GetAbout(Identity id, Backer instance)
 {
     return new About
     {
         Id = id.Get(), //.ToString(), //instance.GetValue<object>(PrimaryKey.PropertyName).ToString(),
         Type = ModlName,
         Time = DateTime.UtcNow
     };
 }
Beispiel #14
0
 internal void SetValuesFromStorage(Backer instance, IEnumerable<Container> storage)
 {
     FirstLayer.SetValuesFromStorage(instance, storage);
 }
Beispiel #15
0
 internal IEnumerable<Container> GetStorage(Identity id, Backer instance)
 {
     return FirstLayer.GetStorage(id, instance);
 }
Beispiel #16
0
        public IEnumerable<Container> GetStorage(Identity id, Backer instance)
        {
            yield return new Container(GetAbout(id, instance), GetValues(id, instance))
            {
                Identity = GetIdentity(id.Get())
            };

            //if (HasParent)
            //    foreach (var x in Parent.GetStorage(instance))
            //        yield return x;
        }
Beispiel #17
0
        //internal IEnumerable<Property> ForeignKeys
        //{
        //    get
        //    {
        //        return Properties.Where(x => x.IsForeignKey);
        //    }
        //}
        internal void SetValuesFromStorage(Backer instance, IEnumerable<Container> storage)
        {
            //if (HasParent)
            //    Parent.SetValuesFromStorage(instance, storage);

            foreach (var value in storage.Single(x => x.About.Type == ModlName).Values)
            {
                var property = GetPropertyFromModlName(value.Key);

                if (property.IsId)
                    continue;

                if (property.IsLink)
                {
                    var linkedDefinition = Definitions.Get((property as LinkProperty).LinkedModlType);
                    var linkIdType = linkedDefinition.HasIdProperty ? linkedDefinition.IdProperty.PropertyType : typeof(Guid);
                    var newValue = Materializer.DeserializeObject(value.Value, typeof(List<>).MakeGenericType(linkIdType), Settings.Get(Type));

                    var list = ((IEnumerable)newValue).Cast<object>();
                    instance.GetRelation(property.PropertyName).Set(list.Select(x => Identity.FromId(x, linkedDefinition)));
                }
                else
                {
                    var newValue = value.Value;

                    if (value.Value != null && !property.PropertyType.IsInstanceOfType(value.Value))
                        newValue = Materializer.DeserializeObject(value.Value, property.PropertyType, Settings.Get(Type));

                    instance.SetValue(property.PropertyName, newValue);
                }

            }
        }
Beispiel #18
0
        private Dictionary<string, object> GetValues(Identity id, Backer backer)
        {
            return Properties.Select(x =>
            {

                object value;

                if (x.IsLink)
                    value = backer.GetRelation(x.PropertyName).Get();
                else if (x.IsId)
                    value = id.Get();
                else
                    value = backer.GetValue<object>(x.PropertyName);

                //if (value != null)
                //{
                //    if (typeof(IModl).IsAssignableFrom(x.PropertyType))
                //        value = null;
                //}

                return new KeyValuePair<string, object>(x.StorageName, value);
            })
            .ToDictionary(x => x.Key, x => x.Value);
        }