コード例 #1
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
 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;
 }
コード例 #2
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
 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;
 }
コード例 #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;
 }
コード例 #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 { }
 }
コード例 #5
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
 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;
 }
コード例 #6
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
 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;
 }
コード例 #7
0
ファイル: CustomerUser.cs プロジェクト: janiukjf/CurtAdmin
 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;
     }
 }
コード例 #8
0
ファイル: CustomerUser.cs プロジェクト: janiukjf/CurtAdmin
 /// <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;
     }
 }
コード例 #9
0
ファイル: CustomerUser.cs プロジェクト: janiukjf/CurtAdmin
        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>();
            }
        }
コード例 #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;
 }
コード例 #11
0
ファイル: ScheduledTask.cs プロジェクト: janiukjf/CurtAdmin
        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();
        }
コード例 #12
0
ファイル: CustomerUser.cs プロジェクト: janiukjf/CurtAdmin
        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();
            }
        }
コード例 #13
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
        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);
        }
コード例 #14
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
 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);
 }
コード例 #15
0
ファイル: Video.cs プロジェクト: janiukjf/CurtAdmin
 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();
 }
コード例 #16
0
ファイル: CustomerUser.cs プロジェクト: janiukjf/CurtAdmin
        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;
            }
        }
コード例 #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;
 }
コード例 #18
0
ファイル: Website.cs プロジェクト: janiukjf/CurtAdmin
 public Website Get(int id = 0)
 {
     CurtDevDataContext db = new CurtDevDataContext();
     Website website = db.Websites.Where(x => x.ID.Equals(id)).FirstOrDefault<Website>();
     return website;
 }
コード例 #19
0
ファイル: Website.cs プロジェクト: janiukjf/CurtAdmin
 public List<Website> GetAll()
 {
     CurtDevDataContext db = new CurtDevDataContext();
     List<Website> websites = db.Websites.ToList<Website>();
     return websites;
 }
コード例 #20
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
 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();
     }
 }
コード例 #21
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
        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;
        }
コード例 #22
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
        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);
        }
コード例 #23
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
        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);
        }
コード例 #24
0
ファイル: ScheduledTask.cs プロジェクト: janiukjf/CurtAdmin
 public List<ScheduledTask> getTasks()
 {
     CurtDevDataContext db = new CurtDevDataContext();
     List<ScheduledTask> tasks = db.ScheduledTasks.OrderBy(x => x.name).ToList();
     return tasks;
 }
コード例 #25
0
ファイル: LandingPage.cs プロジェクト: janiukjf/CurtAdmin
 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();
 }
コード例 #26
0
ファイル: ScheduledTask.cs プロジェクト: janiukjf/CurtAdmin
 public ScheduledTask Get(int id)
 {
     CurtDevDataContext db = new CurtDevDataContext();
     ScheduledTask task = db.ScheduledTasks.Where(x => x.ID.Equals(id)).FirstOrDefault<ScheduledTask>();
     return task;
 }