private bool create_contribution(SNote note, SMedia media, DateTime note_date, DateTime note_mod_date, string content, string note_id, bool is_design_idea, int collection_id, string status, TableTopDataClassesDataContext db) { Contribution c = new Contribution(); c.date = note_date; c.modified_date = note_mod_date; c.location_id = find_location_id(note); string note_content = content; if (media != null) { c.media_url = media.link; } else { c.media_url = ""; } c.note = note_content; c.status = status; if (is_design_idea) { c.tags = "Design Idea"; } else { if (media != null) { c.tags = media.kind; } else { c.tags = note.kind; } } c.technical_info = note_id; c.web_username = note.webusername; db.Contributions.InsertOnSubmit(c); if (!SubmitChangesToLocalDB(db)) { return(false); } // Collection_Contribution_Mapping map = new Collection_Contribution_Mapping(); map.collection_id = collection_id; map.contribution_id = c.id; map.date = note_date; db.Collection_Contribution_Mappings.InsertOnSubmit(map); if (!SubmitChangesToLocalDB(db)) { return(false); } return(true); }
private string get_media_info(SMedia m, int note_id) { string link = ""; string link_prefix = "http://res.cloudinary.com/university-of-colorado/image/upload/v1400187706/"; if (m.link != null) { link = m.link; if (link.StartsWith(link_prefix)) { link = link.Substring(link_prefix.Length); } } string r = m.id + "," + m.kind + "," + link + "," + m.title + "," + m.created_at + "," + note_id; return(r); }