Ejemplo n.º 1
0
        public void Modify(EditSuppliesPost s, string currentUserId)
        {
            Modify(s.Supplies);
            StatusId = (int)s.Status.Status;

            updateBasicPpeDetails(s);

            Latitude  = s.Location.Latitude;
            Longitude = s.Location.Longitude;

            if (!String.IsNullOrWhiteSpace(s.Notes.NewNote))
            {
                SupplierNote newNote = new SupplierNote
                {
                    Supplier = this,
                    Note     = new Note
                    {
                        Timestamp = DateTimeOffset.Now,
                        UserId    = currentUserId,
                        Text      = s.Notes.NewNote,
                    }
                };
                SupplierNotes.Add(newNote);
            }
        }
Ejemplo n.º 2
0
        public static List <Supplier> ToSupplierModel(List <SuppliesPost> ushahidiSupplies)
        {
            List <Supplier> supplierList = new List <Supplier>();

            foreach (SuppliesPost post in ushahidiSupplies)
            {
                Supplier newSupplier = new Supplier
                {
                    StatusId    = (int)PostStatus.UnderReview, //as we will struggle to enter the capacities automatically shall we put under review to allow volunteers set to Publish when they checked capacity??
                    UshahidiId  = post.Id,
                    Timestamp   = post.DateTime,
                    Name        = post.Organisation,
                    Description = post.OrganisationDescription,
                    //ContactName = post.? //Contact details contains all of these
                    //PhoneNumber = post.?
                    Email      = "*****@*****.**", //placeholder to make sure validation passes
                    Website    = post.Website,
                    Postcode   = post.Postcode,
                    TellUsMore = post.TellUsMore,
                    Longitude  = post.Location.Lon,
                    Latitude   = post.Location.Lat
                };

                extractSupplierType(post, newSupplier);
                newSupplier.SupplierPpeTypes = extractSupplierPpeType(post);

                SupplierNote noteContact = new SupplierNote();
                noteContact.Note.Timestamp = post.DateTime;
                noteContact.Note.Text      = post.ContactDetails;
                //noteContact.Note.User = // how do we get the AppUser in here? Admin user?
                newSupplier.SupplierNotes.Add(noteContact);

                SupplierNote noteCapacity = new SupplierNote();
                noteCapacity.Note.Timestamp = post.DateTime;
                noteCapacity.Note.Text      = post.Capacity;
                //noteContact.Note.User = // how do we get the AppUser in here? Admin user?
                newSupplier.SupplierNotes.Add(noteCapacity);

                supplierList.Add(newSupplier);
            }

            return(supplierList);
        }