Esempio n. 1
0
 private int GetQuantityForSearchType(contact c, ShipmentSearch search)
 {
     if (search.SelectedType == "Galleys")
         return c.galley_copies ?? 1;
     if (search.SelectedType == "Review")
         return c.review_copies ?? 1;
     if (search.SelectedType == "Desk")
         return c.desk_copies ?? 1;
     if (search.SelectedType == "Comp")
         return c.comp_copies ?? 1;
     throw new ArgumentNullException();
 }
Esempio n. 2
0
        public int Insert(Contact c2, int createdBy)
        {
            contact newContact = new contact
                {
                    firstname = c2.Firstname,
                    lastname = c2.Lastname,
                    website = c2.Website,
                    email1 = c2.Email1,
                    is_email1_primary = c2.Is_email1_primary,
                    email2 = c2.Email2,
                    notes = c2.Notes,
                    phone = c2.Phone,
                    is_subscriber = c2.Is_subscriber,
                    sub_startdate = c2.Sub_startdate,
                    sub_enddate = c2.Sub_enddate,
                    sub_number = c2.Sub_number,
                    galley_all = c2.Galley_all,
                    galley_pos = c2.Galley_pos,
                    galley_copies = c2.Galley_copies,
                    review_all = c2.Review_all,
                    review_pos = c2.Review_pos,
                    review_copies = c2.Review_copies,
                    desk_all = c2.Desk_all,
                    desk_pos = c2.Desk_pos,
                    desk_copies = c2.Desk_copies,
                    comp_all = c2.Comp_all,
                    comp_pos = c2.Comp_pos,
                    comp_copies = c2.Comp_copies,
                    addressline1 = c2.Addressline1,
                    addressline2 = c2.Addressline2,
                    city = c2.City,
                    state = c2.State,
                    zip = c2.Zip,
                    country = c2.Country,
                    title = c2.Title,
                    organization = c2.Organization,
                    is_primary = c2.Is_primary,
                    is_bad = c2.Is_bad,
                    addressline1_alt = c2.Addressline1_alt,
                    addressline2_alt = c2.Addressline2_alt,
                    city_alt = c2.City_alt,
                    state_alt = c2.State_alt,
                    zip_alt = c2.Zip_alt,
                    country_alt = c2.Country_alt,
                    organization_alt = c2.Organization_alt,
                    title_alt = c2.Title_alt,
                    is_bad_alt = c2.Is_bad_alt,
                    sub_type = c2.Sub_type,
                    createdat = DateTime.Now,
                    createdby = createdBy,
                    updatedat = DateTime.Now,
                    updatedby = createdBy
                };

            var savedContact = dbContext.contacts.Add(newContact);
            dbContext.SaveChanges();
            c2.Id = savedContact.id;
            InsertCategories(c2, dbContext);
            return c2.Id;
        }