Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 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 { }
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 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;
     }
 }
Ejemplo n.º 8
0
 /// <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;
     }
 }
Ejemplo n.º 9
0
        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>();
            }
        }
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
        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();
        }
Ejemplo n.º 12
0
        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();
            }
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
 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);
 }
Ejemplo n.º 15
0
 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();
 }
Ejemplo n.º 16
0
        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;
            }
        }
Ejemplo n.º 17
0
 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;
 }
Ejemplo n.º 18
0
 public Website Get(int id = 0)
 {
     CurtDevDataContext db = new CurtDevDataContext();
     Website website = db.Websites.Where(x => x.ID.Equals(id)).FirstOrDefault<Website>();
     return website;
 }
Ejemplo n.º 19
0
 public List<Website> GetAll()
 {
     CurtDevDataContext db = new CurtDevDataContext();
     List<Website> websites = db.Websites.ToList<Website>();
     return websites;
 }
Ejemplo n.º 20
0
 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();
     }
 }
Ejemplo n.º 21
0
        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;
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
 public List<ScheduledTask> getTasks()
 {
     CurtDevDataContext db = new CurtDevDataContext();
     List<ScheduledTask> tasks = db.ScheduledTasks.OrderBy(x => x.name).ToList();
     return tasks;
 }
Ejemplo n.º 25
0
 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();
 }
Ejemplo n.º 26
0
 public ScheduledTask Get(int id)
 {
     CurtDevDataContext db = new CurtDevDataContext();
     ScheduledTask task = db.ScheduledTasks.Where(x => x.ID.Equals(id)).FirstOrDefault<ScheduledTask>();
     return task;
 }