public List<LandingPage> GetAllPast() { CurtDevDataContext db = new CurtDevDataContext(); List<LandingPage> landingPages = new List<LandingPage>(); landingPages = db.LandingPages.Where(x => x.endDate <= DateTime.Now).OrderBy(x => x.endDate).ToList<LandingPage>(); return landingPages; }
public List<LandingPageImage> GetImages(int id) { CurtDevDataContext db = new CurtDevDataContext(); List<LandingPageImage> images = new List<LandingPageImage>(); try { images = db.LandingPageImages.Where(x => x.landingPageID.Equals(id)).OrderBy(x => x.sort).ToList(); } catch {} return images; }
public SalesRepresentative Get(int id = 0) { CurtDevDataContext db = new CurtDevDataContext(); SalesRepresentative rep = new SalesRepresentative(); try { rep = db.SalesRepresentatives.Where(x => x.salesRepID.Equals(id)).FirstOrDefault<SalesRepresentative>(); } catch { }; return rep; }
public void Delete(int id = 0) { try { CurtDevDataContext db = new CurtDevDataContext(); SalesRepresentative rep = db.SalesRepresentatives.Where(x => x.salesRepID.Equals(id)).First<SalesRepresentative>(); db.SalesRepresentatives.DeleteOnSubmit(rep); db.SubmitChanges(); } catch { } }
public LandingPage Get(int id = 0) { CurtDevDataContext db = new CurtDevDataContext(); LandingPage landingPage = new LandingPage(); try { landingPage = db.LandingPages.Where(x => x.id.Equals(id)).First(); } catch { } return landingPage; }
public List<LandingPageData> GetData(int pageID) { CurtDevDataContext db = new CurtDevDataContext(); List<LandingPageData> datas = new List<LandingPageData>(); try { datas = db.LandingPageDatas.Where(x => x.landingPageID.Equals(pageID)).ToList(); } catch { } return datas; }
public void Delete() { try { CurtDevDataContext db = new CurtDevDataContext(); CustomerUser u = db.CustomerUsers.Where(x => x.id == this.id).FirstOrDefault<CustomerUser>(); db.CustomerUsers.DeleteOnSubmit(u); db.SubmitChanges(); } catch (Exception e) { throw e; } }
/// <summary> /// This will update the active/isactive status of the user. /// </summary> /// <param name="userID">ID of the user.</param> /// <returns>True/False</returns> public Boolean activate() { try { CurtDevDataContext db = new CurtDevDataContext(); CustomerUser u = db.CustomerUsers.Where(x => x.id == this.id).FirstOrDefault<CustomerUser>(); u.active = (u.active) ? false : true; db.SubmitChanges(); return true; } catch { return false; } }
public static List<CustomerUser> GetAll() { try { CurtDevDataContext db = new CurtDevDataContext(); List<CustomerUser> users = new List<CustomerUser>(); users = db.CustomerUsers.ToList<CustomerUser>(); return users; } catch (Exception e) { return new List<CustomerUser>(); } }
public List<SalesRepresentative> GetAll() { CurtDevDataContext db = new CurtDevDataContext(); List<SalesRepresentative> salesreps = new List<SalesRepresentative>(); try { salesreps = db.SalesRepresentatives.OrderBy(x => x.name).ToList<SalesRepresentative>(); foreach (SalesRepresentative r in salesreps) { r.count = db.Customers.Where(x => x.salesRepID.Equals(r.salesRepID)).Count(); } } catch { }; return salesreps; }
public void Run() { string url = this.url; WebClient wc = new WebClient(); wc.Proxy = null; wc.DownloadString(url); CurtDevDataContext db = new CurtDevDataContext(); ScheduledTask t = db.ScheduledTasks.Where(x => x.ID.Equals(this.ID)).FirstOrDefault<ScheduledTask>(); t.lastRan = DateTime.Now; db.SubmitChanges(); }
public CustomerUser Get(Guid id) { try { CurtDevDataContext db = new CurtDevDataContext(); CustomerUser u = new CustomerUser(); u = db.CustomerUsers.Where(x => x.id.Equals(id)).FirstOrDefault<CustomerUser>(); return u; } catch (Exception e) { return new CustomerUser(); } }
public List<LandingPageData> AddData(int pageID, string key, string value) { CurtDevDataContext db = new CurtDevDataContext(); try { LandingPageData data = new LandingPageData { dataKey = key.Trim(), dataValue = value.Trim(), landingPageID = pageID }; db.LandingPageDatas.InsertOnSubmit(data); db.SubmitChanges(); } catch { } return GetData(pageID); }
public List<LandingPageImage> AddImage(int pageID, string url) { CurtDevDataContext db = new CurtDevDataContext(); int sort = 1; try { sort = db.LandingPageImages.Where(x => x.landingPageID.Equals(pageID)).OrderByDescending(x => x.sort).Select(x => x.sort).First() + 1; } catch {} LandingPageImage image = new LandingPageImage { landingPageID = pageID, url = url, sort = sort }; db.LandingPageImages.InsertOnSubmit(image); db.SubmitChanges(); return GetImages(pageID); }
public void Update(Google.YouTube.Video ytvideo) { CurtDevDataContext db = new CurtDevDataContext(); Video v = db.Videos.Where(x => x.videoID.Equals(this.videoID)).FirstOrDefault<Video>(); v.title = ytvideo.Title; v.description = ytvideo.Description; v.embed_link = ytvideo.VideoId; v.youtubeID = ytvideo.VideoId; v.watchpage = ytvideo.WatchPage.ToString(); foreach (Google.GData.Extensions.MediaRss.MediaThumbnail thumb in ytvideo.Thumbnails) { if (thumb.Url.Contains("hqdefault")) { v.screenshot = thumb.Url; } } db.SubmitChanges(); }
public List<WebProperty> getWebProperties() { try { CurtDevDataContext db = new CurtDevDataContext(); List<WebProperty> webProperties = new List<WebProperty>(); List<int> listOfWebPropIDs = db.CustUserWebProperties.Where(x => x.userID.Equals(this.id)).Select(x => x.webPropID).ToList<int>(); foreach (int webPropID in listOfWebPropIDs) { WebProperty webProp = db.WebProperties.Where(x => x.id == webPropID).FirstOrDefault<WebProperty>(); if (webProp != null) { webProperties.Add(webProp); } } return webProperties; } catch (Exception e) { throw e; } }
public SalesRepresentative Save(int id = 0, string name = "", string code = "") { CurtDevDataContext db = new CurtDevDataContext(); SalesRepresentative rep = new SalesRepresentative(); if (id > 0) { try { rep = db.SalesRepresentatives.Where(x => x.salesRepID.Equals(id)).First<SalesRepresentative>(); rep.name = name.Trim(); rep.code = code.Trim(); db.SubmitChanges(); } catch {} } else { rep = new SalesRepresentative { name = name.Trim(), code = code.Trim() }; db.SalesRepresentatives.InsertOnSubmit(rep); db.SubmitChanges(); } return rep; }
public Website Get(int id = 0) { CurtDevDataContext db = new CurtDevDataContext(); Website website = db.Websites.Where(x => x.ID.Equals(id)).FirstOrDefault<Website>(); return website; }
public List<Website> GetAll() { CurtDevDataContext db = new CurtDevDataContext(); List<Website> websites = db.Websites.ToList<Website>(); return websites; }
public void UpdateSort(int[] img) { CurtDevDataContext db = new CurtDevDataContext(); int sort = 1; foreach (int imgID in img) { LandingPageImage image = db.LandingPageImages.Where(x => x.id.Equals(imgID)).First(); image.sort = sort++; db.SubmitChanges(); } }
public LandingPage Save(int id, string name, int websiteID, DateTime startDate, DateTime endDate, string url = "", string content = null, string linkClasses = null, bool newWindow = false, string conversionID = null, string conversionLabel = null, string menuPosition = "top") { CurtDevDataContext db = new CurtDevDataContext(); LandingPage landingPage = new LandingPage(); try { if (id == 0) { landingPage = new LandingPage { name = name, websiteID = websiteID, startDate = startDate, endDate = endDate, url = url.Trim(), pageContent = content, linkClasses = (linkClasses == null) ? linkClasses : linkClasses.Trim(), newWindow = newWindow, conversionID = conversionID, conversionLabel = conversionLabel, menuPosition = menuPosition }; db.LandingPages.InsertOnSubmit(landingPage); } else { landingPage = db.LandingPages.Where(x => x.id.Equals(id)).First(); landingPage.name = name; landingPage.websiteID = websiteID; landingPage.startDate = startDate; landingPage.endDate = endDate; landingPage.url = url.Trim(); landingPage.pageContent = content; landingPage.linkClasses = (linkClasses == null) ? linkClasses : linkClasses.Trim(); landingPage.newWindow = newWindow; landingPage.conversionID = conversionID; landingPage.conversionLabel = conversionLabel; landingPage.menuPosition = menuPosition; } db.SubmitChanges(); } catch {} return landingPage; }
public List<LandingPageImage> RemoveImage(int id) { CurtDevDataContext db = new CurtDevDataContext(); int pageID = 0; try { LandingPageImage image = db.LandingPageImages.Where(x => x.id.Equals(id)).First(); pageID = image.landingPageID; db.LandingPageImages.DeleteOnSubmit(image); db.SubmitChanges(); List<LandingPageImage> images = db.LandingPageImages.Where(x => x.landingPageID.Equals(pageID)).OrderBy(x => x.sort).ToList(); int sort = 1; foreach (LandingPageImage img in images) { img.sort = sort++; } db.SubmitChanges(); } catch { } return GetImages(pageID); }
public List<LandingPageData> RemoveData(int id) { CurtDevDataContext db = new CurtDevDataContext(); int pageID = 0; try { LandingPageData data = db.LandingPageDatas.Where(x => x.id.Equals(id)).First(); pageID = data.landingPageID; db.LandingPageDatas.DeleteOnSubmit(data); db.SubmitChanges(); } catch { } return GetData(pageID); }
public List<ScheduledTask> getTasks() { CurtDevDataContext db = new CurtDevDataContext(); List<ScheduledTask> tasks = db.ScheduledTasks.OrderBy(x => x.name).ToList(); return tasks; }
public void Remove(int id) { CurtDevDataContext db = new CurtDevDataContext(); LandingPage page = db.LandingPages.Where(x => x.id.Equals(id)).First(); List<LandingPageData> datas = page.LandingPageDatas.ToList(); ; List<LandingPageImage> images = page.LandingPageImages.ToList(); db.LandingPageDatas.DeleteAllOnSubmit(datas); db.LandingPageImages.DeleteAllOnSubmit(images); db.LandingPages.DeleteOnSubmit(page); db.SubmitChanges(); }
public ScheduledTask Get(int id) { CurtDevDataContext db = new CurtDevDataContext(); ScheduledTask task = db.ScheduledTasks.Where(x => x.ID.Equals(id)).FirstOrDefault<ScheduledTask>(); return task; }