public Website(Website website)
            {
                if (website == null)
                    throw new ArgumentNullException("website");

                Url = website.Url;
            }
        public void Add(string title, string url, string description, string snapshotBase64String, IEnumerable<Tag> tags, Website website, string userId)
        {
            var bookmark = new Bookmark
            {
                Description = description,
                UserId = userId,
                Title = title,
                Url = url,
                SnapshotBase64String = snapshotBase64String

            };

            //check for existing website
            var existingWebsite = websiteService.GetWebsiteByName(website.Name, userId).FirstOrDefault();
            if (existingWebsite != null)
            {
                bookmark.WebSite = existingWebsite;
            }
            else
            {
                var websiteToAdd = new Website
                {
                    Name = website.Name,
                    FaviconBase64String = website.FaviconBase64String
                };

                bookmark.WebSite = website;
            }

            AddTags(bookmark, tags, userId);

            this.bookmarks.Add(bookmark);
            this.bookmarks.SaveChanges();
        }
Example #3
0
        private void btnOK_Click( object sender, EventArgs e )
        {
            Website siteToSave = new Website
            {
                Name = tbName.Text,
                Url = tbUrl.Text,
                DailyUses = (int) numUses.Value,
            };

            // Write the image to a file.
            if ( siteImage.Image != null )
            {
                if ( !Directory.Exists( "images" ) )
                    Directory.CreateDirectory( "images" );

                string imagePath = Path.Combine( @"images\", tbName.Text + ".ico" );
                siteImage.Image.Save( imagePath, System.Drawing.Imaging.ImageFormat.Icon );
                siteToSave.ImageFilename = imagePath;
            }

            Configuration.Instance.Sites.Add( siteToSave );
            Configuration.Save( );

            Close( );
        }
 private Website CreateSiteObject()
 {
     Website site = new Website();
     site.Server = "localhost";
     site.Name = "test_site";
     site.Home = test_site;
     site.Port = 8888;
     return site;
 }
            public Website(Website website)
            {
                if (website == null)
                {
                    throw new ArgumentNullException(nameof(website));
                }

                Url = website.Url;
            }
Example #6
0
        public void ShowBrowserKilledBalloon( Website culprit )
        {
            BeginInvoke( new MethodInvoker( delegate
            {
                trayIcon.ShowBalloonTip( 2000, "ForceQuit", "We found you going to " + culprit.Name + " without starting a break, so we killed your browser.", ToolTipIcon.Info );

                // As if that wasn't enough...
                using ( SoundPlayer player = new SoundPlayer( Properties.Resources.PriceIsWrong ) )
                    player.Play( );
            } ) );
        }
Example #7
0
 public static Template Create(string name, string html, string placeHolders, Website website)
 {
     return new Template
     {
         Name = name,
         Html = html,
         Placeholders = placeHolders,
         Website = website,
         Tenant = website.Tenant
     };
 }
        public ActionResult Add()
        {
            int websiteID = ViewBag.websiteID ?? 0;
            if (websiteID == 0) {
                return RedirectToAction("Index", "Website");
            }
            List<Website> websites = new Website().GetAll();
            ViewBag.websites = websites;

            return View();
        }
Example #9
0
 public ActionResult Index(Website website)
 {
     var pages = website.EntityContext.CreateQuery<Page>().Where(p => p.Category.Website.Id == website.Id)
         .LoadRelated(p => p.Category.Website, p => p.Author, p => p.Comments).OrderByDescending(p => p.DateTime).Take(10).ToList();
     var xml = HtmlUtil.RenderPartialToString(this, "Index", new RSS { Website = website, Pages = pages });
     return new ContentResult
     {
         Content = xml,
         ContentEncoding = System.Text.Encoding.Default,
         ContentType = "application/xhtml+xml"
     };
 }
        public DeleteSiteCommand(Website website)
        {
            Tasks = new Queue<CassiniTask>();

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Stopping website..",
                    Argument = null,
                    Work = (arg) =>
                    {
                        if(App.WebSiteHosts.ContainsKey(website.Url))
                        {
                            App.WebSiteHosts[website.Url].Stop();
                            App.WebSiteHosts.Remove(website.Url);
                        }

                        return CassiniTaskResult.NoResult;
                    }
                });

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Deleting website..",
                    Argument = null,
                    Work = (arg) =>
                    {
                        App.RaiseEvent(EventKeys.WEBSITE_DELETED, this, new EventBrokerEventArgs(website));

                        return CassiniTaskResult.NoResult;
                    }
                });

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Saving configuration..",
                    Argument = null,
                    Work = (arg) =>
                    {
                        if (App.Config.Websites.ContainsKey(website.Url))
                        {
                            App.Config.Websites.Remove(website.Url);
                            App.SaveConfig();
                        }

                        return CassiniTaskResult.NoResult;
                    }
                });
        }
Example #11
0
 public WebsiteTests()
 {
     website = new Website(XElement.Parse(
     @"<website title=""My Website"">
     <content id="""">default data</content>
     <content id=""foo"">foo data</content>
     <page name="""" title="""" template=""template.htm"">
     <page name=""child"" title=""Child"" template=""template.htm""/>
     </page>
     <page name=""page-1"" title=""Page 1"" template=""template.htm""/>
     <page name=""page-2"" title=""Page 2"" template=""template.htm"">
     <page name=""page-3"" title=""Page 3"" template=""template.htm""/>
     </page>
     </website>"));
 }
        public ActionResult Edit(int id = 0, string error = "")
        {
            int websiteID = ViewBag.websiteID ?? 0;
            if (websiteID == 0) {
                return RedirectToAction("Index", "Website");
            }
            List<Website> websites = new Website().GetAll();
            ViewBag.websites = websites;

            LandingPage landingPage = new LandingPage().Get(id);
            ViewBag.landingPage = landingPage;

            ViewBag.error = error;

            return View();
        }
Example #13
0
        public MusicControl(
			MusicHub.IUserRepository userRepository,
			MusicHub.IMediaPlayer mediaServer,
            MusicHub.ILibraryRepository libraryRepository,
            MusicHub.IConnectionRepository connectionRepository,
            MusicHub.ISongRepository songRepository,
            MusicHub.IJukebox jukebox,
            Website.Models.MediaLibraryFactory mediaLibraryFactory)
        {
            this._userRepository = userRepository;
            this._mediaServer = mediaServer;
            this._libraryRepository = libraryRepository;
            this._connectionRepository = connectionRepository;
            this._songRepository = songRepository;
            this._mediaLibraryFactory = mediaLibraryFactory;
            this._jukebox = jukebox;
        }
        public StartSiteCommand(Website website)
        {
            Tasks = new Queue<CassiniTask>();

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Starting website..",
                    Argument = website,
                    Work = (arg) =>
                    {
                        if(App.WebSiteHosts.ContainsKey(website.Url))
                        {
                            App.WebSiteHosts[website.Url].Start();
                        }

                        return CassiniTaskResult.NoResult;
                    }
                });

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Writing to configuration file..",
                    Argument = website,
                    Work = (arg) =>
                    {
                        App.Config.Websites[website.Url].IsRunning = true;
                        App.SaveConfig();

                        return CassiniTaskResult.NoResult;
                    }
                });

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Reflecting changes..",
                    Argument = website,
                    Work = (arg) =>
                    {
                        App.RaiseEvent(EventKeys.WEBSITE_CHANGED, this, new EventBrokerEventArgs(website));
                        return CassiniTaskResult.NoResult;
                    }
                });
        }
Example #15
0
        public void Can_find_page_at_level()
        {
            var data = new Website(XElement.Parse(
            @"<website title=""My Website"">
            <page name="""" title="""" template=""template.htm""/>
            <page name=""page-1"" title=""Page 1"" template=""template.htm""/>
            <page name=""page-2"" title=""Page 2"" template=""template.htm"">
            <page name=""page-3"" title=""Page 3"" template=""template.htm""/>
            <page name=""page-4"" title=""Page 4"" template=""template.htm"">
            <page name=""page-4-1"" title=""Page 4-1"" template=""template.htm""/>
            <page name=""page-4-2"" title=""Page 4-2"" template=""template.htm""/>
            </page>
            <page name=""page-5"" title=""Page 5"" template=""template.htm""/>
            </page>
            </website>"));

            Assert.Same(data.Pages[2].Pages[1], data.FindCurrentPageAtLevel(2, data.Pages[2].Pages[1].Pages[1]));
        }
Example #16
0
        public override Website GetWebsite(string url)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandType = CommandType.Text;
                query.CommandText = "SELECT * FROM Chinaz_Websites WHERE Url = @Url";
                query.CreateParameter<string>("@Url", url, SqlDbType.NVarChar, 200);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    Website website = null;
                    while (reader.Next)
                    {
                        website = new Website(reader);
                    }
                    return website;
                }
            }
        }
Example #17
0
        public SortedList<string, Website> BuildWebsiteList(string[] textLines)
        {
            var websiteList = new SortedList<string, Website>();
            foreach(var line in textLines)
            {
                var stringList = line.Split(' ');
                if (stringList.Length < 2) continue;

                var websiteName = stringList[0];
                var websiteUrl = stringList[1];
                var credentialValues = new List<Credential>();
                foreach (var value in stringList.Skip(2))
                    credentialValues.Add(new Credential(value));

                if (!websiteList.ContainsKey(websiteName))
                    websiteList[websiteName] = new Website(websiteName, websiteUrl);
                websiteList[websiteName].Credentials.AddRange(credentialValues);
            }
            return websiteList;
        }
Example #18
0
        public SiteButton( Website site )
        {
            this.Website = site;

            Width = (int) ( 40 + site.ToString( ).Length * 5.75 ); // HACK
            Height = 32;
            Font = new Font( "Tahoma", 8, FontStyle.Bold );
            Padding = new Padding( 4, 0, 4, 0 );
            Top = 15;
            ImageAlign = ContentAlignment.MiddleLeft;
            TextAlign = ContentAlignment.MiddleRight;

            Click += new EventHandler( SiteButton_Click );

            // Use the downloaded icon, if available.
            if ( site.HasImage( ) && File.Exists( site.ImageFilename ) )
                Image = Image.FromFile( site.ImageFilename );

            RefreshState( );
        }
        public ChangeSiteCommand(Website old, Website website)
        {
            Tasks = new Queue<CassiniTask>();

            Tasks.Enqueue(
                new CassiniTask
                    {
                        Text = "Validating input..",
                        Argument = website,
                        Work = (arg) =>
                                   {
                                       if(website.Port != old.Port && !new WebsiteHost(website).IsPortUsable())
                                       {
                                           Cancel(new PortInUseException());
                                       }

                                       if (old.Url != website.Url && App.WebSiteHosts.ContainsKey(website.Url))
                                       {
                                           Cancel(new WebsiteExistsAtTheSameUrl());
                                       }

                                       return CassiniTaskResult.NoResult;
                                   }
                    });

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Stopping website..",
                    Argument = website,
                    Work = (arg) =>
                    {
                        CommandExecutor.Execute(new DeleteSiteCommand(old));

                        return CassiniTaskResult.NoResult;
                    }
                });

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Confuguring website..",
                    Argument = website,
                    Work = (arg) =>
                    {
                        CommandExecutor.Execute(new HostSiteCommand(website));
                        return CassiniTaskResult.NoResult;
                    }
                });

            Tasks.Enqueue(
                new CassiniTask
                {
                    Text = "Setting up website..",
                    Argument = website,
                    Work = (arg) =>
                    {
                        App.RaiseEvent(EventKeys.WEBSITE_CHANGED, this, new EventBrokerEventArgs(website));
                        return CassiniTaskResult.NoResult;
                    }
                });
        }
 public static void AddWebsites(Organization org, ICollection<OrganizationMediaWebsiteEGroupRel> list)
 {
     foreach (var rel in list)
     {
         var c = rel.MediaWebsiteEGroup;
         var website = new Website()
         {
             Id = c.Id,
             Name = c.Name,
             Type = (WebsiteType)c.WebsiteEGroupTypeId,
             Url = c.URL,
             Summary = c.Summary,
             DateDiscovered = c.DateDiscovered,
             DatePublished = c.DatePublished,
             DateOffline = c.DateOffline,
             WhoIs = c.WhoIsInfo,
             Movement = Helpers.ConvertMovementId(c.MovementClassId),
             DateCreated = c.DateCreated,
             DateUpdated = c.DateModified,
             LogEntries = new List<WebsiteLogEntry>()
         };
         website.LogEntries.Add(new WebsiteLogEntry() { Note = $"Added website {website.Name}" });
         org.LogEntries.Add(new OrganizationLogEntry() { Note = $"Added website {website.Name} to Organization" });
         org.Websites.Add(website);
     }
 }
Example #21
0
 public static int CountGroupMembers(int groupID)
 {
     return(Website.WithDatabase((db) => {
         return (int)db.QueryValue("SELECT COUNT(1) FROM GroupMembers WHERE [Group]=@0", groupID);
     }));
 }
        /// <summary>
        /// Gets the CMS zones.
        /// </summary>
        /// <param name="DataProvider">The data provider.</param>
        /// <param name="CurrentWebsite">The current website.</param>
        /// <returns></returns>
        private static IList <CMSZone> GetCMSZones(IDomainSessionFactoryProvider DataProvider, Website CurrentWebsite)
        {
            IList <CMSZone> zones;
            List <int>      applicableReportIds = CurrentWebsite.Reports
                                                  .Select(wr => wr.Report.Id).ToList();

            //	Retrieve CMS Zone data from DB.
            using (var session = DataProvider.SessionFactory.OpenSession())
            {
                //try
                //{
                //	var q2 = (session
                //		.CreateSQLQuery(sqlGetWebsitePagesX)
                //		.AddEntity("z", typeof(CMSZone))
                //		.SetResultTransformer(new DistinctRootEntityResultTransformer()) as NHibernate.ISQLQuery)
                //		.AddJoin("zv", "z.ZoneValue")
                //		.SetParameter("websiteID", CurrentWebsite.Id)
                //		.SetParameterList("applicableReportIds", applicableReportIds); ;
                //
                //	var zone2 = q2.List<CMSZone>();
                //}
                //catch (Exception ex)
                //{
                //	ex.GetType();
                //}

                var query = session
                            .CreateSQLQuery(sqlGetWebsitePages)
                            .SetResultTransformer(Transformers.AliasToBean(typeof(CMSZoneDTO)))
                            .SetParameter("websiteID", CurrentWebsite.Id)
                            .SetParameterList("applicableReportIds", applicableReportIds);
                zones = query
                        .List <CMSZoneDTO>()
                        .Select(zoneDTO => new CMSZone()
                {
                    Id           = zoneDTO.ZoneId,
                    Type         = zoneDTO.ZoneType,
                    PageType     = zoneDTO.ZonePageType,
                    CMSZoneValue = new CMSZoneValue()
                    {
                        Path            = zoneDTO.ZoneValuePath.Replace("\\", "/"),
                        Product         = zoneDTO.ZoneValueProduct,
                        ReportName      = zoneDTO.ZoneValueReportName,
                        ReportGUID      = zoneDTO.ZoneValueReportGUID.ToLower(),
                        ZoneName        = zoneDTO.ZoneValueZoneName.ToLower(),
                        TemplateContent = zoneDTO.ZoneValueTemplateContent,
                    },
                }).ToList <CMSZone>();
            }

            //	Fill in CMS Zone objects with data from ReportManifest.
            foreach (var zone in zones)
            {
                if (zone.PageType == "Report")
                {
                    var report = CurrentWebsite.Reports.Where(r => r.Report.Name == zone.CMSZoneValue.ReportName).FirstOrDefault();
                    if (report == null)
                    {
                        //throw new InvalidOperationException("Something seriously went wrong. The reporting website can not be null.");
                        continue;
                    }
                    zone.CMSZoneValue.ReportGUID = report.Report.SourceTemplate.RptId.ToLower();
                }
            }

            return(zones);
        }
Example #23
0
 private DirectoryInfo getWebsiteDirectory(Website website)
 {
     return(website.GetDirectory(ServerConfig.WebsiteDirectory));
 }
Example #24
0
 public void Delete(Website entity)
 {
     throw new NotImplementedException();
 }
Example #25
0
 public static Website ToEntity(this WebsiteModel model, Website destination)
 {
     return(model.MapTo(destination));
 }
Example #26
0
 //Website
 public static WebsiteModel ToModel(this Website entity)
 {
     return(entity.MapTo <Website, WebsiteModel>());
 }
Example #27
0
 public static IEnumerable <dynamic> GetCurrentLoans(string partID)
 {
     return(Website.WithDatabase((db) => db.Query(
                                     "SELECT * FROM Loans WHERE Returned='0' AND Part=@0", partID)));
 }
Example #28
0
 public static IEnumerable <dynamic> GetGroupMembers(int groupID)
 {
     return(Website.WithDatabase((db) => {
         return db.Query("SELECT M.* FROM GroupMembers GM JOIN Members M ON GM.Member=M.UUN WHERE [Group]=@0", groupID);
     }));
 }
Example #29
0
 public static int RemoveMemberFromGroup(int groupID, string memberUUN)
 {
     return(Website.WithDatabase((db) => {
         return (int)db.Execute("DELETE FROM GroupMembers WHERE [Group]=@0 AND Member=@1", groupID, memberUUN);
     }));
 }
Example #30
0
 public static int AddMemberToGroup(int groupID, string memberUUN)
 {
     return(Website.WithDatabase((db) => {
         return (int)db.Execute("INSERT INTO GroupMembers ([Group], Member) VALUES (@0, @1)", groupID, memberUUN);
     }));
 }
Example #31
0
 public static int HideGroup(string id)
 {
     return(Website.WithDatabase((db) => {
         return db.Execute("UPDATE Groups SET IsPresent='0' WHERE ID=@0", id);
     }));
 }
Example #32
0
 //
 // GET: /Website/
 protected override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     ViewBag.activeModule = "Website Management";
     List<Website> websites = new Website().GetAll();
     ViewBag.websites = websites;
     HttpCookie websiteCookie = new HttpCookie("");
     websiteCookie = Request.Cookies.Get("websiteID");
     int websiteID = 0;
     try {
         websiteID = Convert.ToInt32(websiteCookie.Value);
     } catch { }
     ViewBag.websiteID = websiteID;
 }
Example #33
0
 public AppPoolController(Website website)
     : base(website)
 {
 }
Example #34
0
        public async Task Start(Website website)
        {
            var sessionId = await Repository.CreateNewSession();

            _crawler.Start(website, sessionId);
        }
Example #35
0
 public static int SetPieceFlags(string id, bool loanable, bool present)
 {
     return(Website.WithDatabase((db) => db.Execute(
                                     "UPDATE Pieces SET CanLendParts=@0, IsPresent=@1 WHERE ID=@2",
                                     (loanable ? "1" : "0"), (present ? "1" : "0"), id)));
 }
Example #36
0
 public RecyclerViewAdpater(Website currentWebsite) : base()
 {
     this.currentWebsite = currentWebsite;
 }
Example #37
0
 // Create a new website object
 public Website Create(Website website)
 {
     _websites.InsertOne(website);
     return(website);
 }
Example #38
0
 public override System.Web.Mvc.ActionResult Create(Website.Models.Blog.Post p) {
     var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.Create);
     callInfo.RouteValueDictionary.Add("p", p);
     return callInfo;
 }
Example #39
0
 public static int HidePart(string partID)
 {
     return(Website.WithDatabase((db) => db.Execute("UPDATE Parts SET IsPresent='0' WHERE ID=@0", partID)));
 }
Example #40
0
        /// <summary>
        /// 查询权限角色的权限
        /// </summary>
        /// <param name="permissionRole">权限角色Id</param>
        /// <param name="website">网站</param>
        public static List <PermissionView.MenuView> QueryPremissionRolePermissions(Guid permissionRole, Website website)
        {
            var repository = Factory.CreatePermissionRoleRepository();

            return(repository.QueryPremissionRolePermissions(permissionRole, website));
        }
Example #41
0
 public static IEnumerable <dynamic> GetInstrumentList()
 {
     return(Website.WithDatabase((db) => db.Query(
                                     "SELECT DISTINCT Instrument FROM Parts WHERE Parts.IsPresent='1'")));
 }
Example #42
0
 public static string GetPartFilePath(string partID)
 {
     return(Website.WithDatabase((db) => db.QueryValue("SELECT DigitalCopyPath FROM Parts WHERE ID=@0", partID) as string));
 }
Example #43
0
 protected FlickrRip(Website w) : base(w)
 {
 }
Example #44
0
 // Remove by using website object
 public void Remove(Website websiteIn) =>
 _websites.DeleteOne(website => website.Id == websiteIn.Id);
Example #45
0
 public override System.Web.Mvc.ActionResult Edit(int id, Website.Models.Blog.Post p) {
     var callInfo = new T4MVC_ActionResult(Area, Name, ActionNames.Edit);
     callInfo.RouteValueDictionary.Add("id", id);
     callInfo.RouteValueDictionary.Add("p", p);
     return callInfo;
 }
Example #46
0
 protected IIS6Manager(Website website)
 {
     Site = website;
 }
Example #47
0
        protected void Page_Init(object sender, EventArgs e)
        {
            var securityProvider = PortalCrmConfigurationManager.CreateCrmEntitySecurityProvider();

            _sponsors = ServiceContext.CreateQuery("adx_eventsponsor")
                        .Where(es => es.GetAttributeValue <EntityReference>("adx_websiteid") == Website.ToEntityReference())
                        .ToArray()
                        .Where(es => securityProvider.TryAssert(ServiceContext, es, CrmEntityRight.Read))
                        .ToArray();
        }
Example #48
0
 // Update a website
 public void Update(string id, Website websiteIn) =>
 _websites.ReplaceOne(website => website.Id == id, websiteIn);
Example #49
0
 public Pages(Website site)
 {
     _bw = site.driver;
     _site = site;
 }
Example #50
0
        public async Task <ActionResult <UserDTO> > Resgister(RegisterDTO registerDTO)
        {
            if (await UserExist(registerDTO.Username))
            {
                return(BadRequest("Username is taken!"));
            }

            using var hmac = new HMACSHA512();


            //ICollection<Menu> menuList;

            //foreach(var item in registerDTO.Menus)
            //{
            //    menu.MenuType = item.item_id;
            //    menu.AppUserId =
            //}

            var user = new AppUser
            {
                UserName       = registerDTO.Username.ToLower(),
                PasswordHash   = hmac.ComputeHash(Encoding.UTF8.GetBytes(registerDTO.Password)),
                PasswordSalt   = hmac.Key,
                FirstName      = registerDTO.Firstname,
                LastName       = registerDTO.LastName,
                MiddleNames    = registerDTO.Middlename,
                Company        = registerDTO.Company,
                DOB            = registerDTO.DOB,
                SSN            = registerDTO.SSN,
                UserType       = registerDTO.UserType,
                Department     = registerDTO.Department,
                Location       = registerDTO.Location,
                Email          = registerDTO.Email,
                PhoneNumber    = registerDTO.PhoneNumber,
                WhatsappNumber = registerDTO.WhatsappNumber
            };

            _context.Users.Add(user);
            await _context.SaveChangesAsync();

            var newUser = await _userRepository.GetAppUser(registerDTO.Username);

            foreach (var item in registerDTO.Menus)
            {
                Menu menu = new Menu
                {
                    MenuType  = item.item_id,
                    AppUserId = newUser.Id
                };
                _context.menu.Add(menu);
                await _context.SaveChangesAsync();
            }

            foreach (var item in registerDTO.Websites)
            {
                Website website = new Website
                {
                    WebsiteType = item.item_id,
                    AppUserId   = newUser.Id
                };
                _context.website.Add(website);
                await _context.SaveChangesAsync();
            }

            return(new UserDTO
            {
                Username = user.UserName,
                Token = _tokenService.CreateToken(user)
            });
        }
Example #51
0
 public async Task <Website> Post([FromBody] Website website) => await repository.AddWebsite(website);
Example #52
0
 public async Task <Website> Put([FromBody] Website website) => await repository.UpdateWebsite(website);
Example #53
0
        private void SeedWebsites()
        {
            IServiceScope scope = CreateScope();

            using (var db = scope.ServiceProvider.GetService <WebsiteManagementDbContext>())
            {
                var website = new Website()
                {
                    Id       = Guid.NewGuid(),
                    Name     = "myWebsite",
                    Url      = "www.mysite.com",
                    Password = "******",
                    Email    = "*****@*****.**",
                    Image    = new Image()
                    {
                        Name     = "myImage.png",
                        Blob     = new byte[17],
                        MimeType = "image/png",
                    },
                    Categories = new List <Category> {
                        new Category {
                            Value = "category 1"
                        }, new Category {
                            Value = "category 2"
                        }
                    },
                };
                db.Websites.Add(website);

                var website1 = new Website()
                {
                    Id       = Guid.NewGuid(),
                    Name     = "myWebsite1",
                    Url      = "www.mysite1.com",
                    Password = "******",
                    Email    = "*****@*****.**",
                    Image    = new Image()
                    {
                        Name     = "myImage1.png",
                        Blob     = new byte[17],
                        MimeType = "image/png",
                    },
                    Categories = new List <Category> {
                        new Category {
                            Value = "category 11"
                        }, new Category {
                            Value = "category 21"
                        }
                    },
                };
                db.Websites.Add(website1);

                var website2 = new Website()
                {
                    Id       = Guid.NewGuid(),
                    Name     = "myWebsite2",
                    Url      = "www.mysite2.com",
                    Password = "******",
                    Email    = "*****@*****.**",
                    Image    = new Image()
                    {
                        Name     = "myImage2.png",
                        Blob     = new byte[17],
                        MimeType = "image/png",
                    },
                    Categories = new List <Category> {
                        new Category {
                            Value = "category 112"
                        }, new Category()
                        {
                            Value = "category 212"
                        }
                    },
                    IsDeleted = true,
                };
                db.Websites.Add(website2);

                db.SaveChanges();
            }
        }
Example #54
0
 public async Task Delete(Website website) => await repository.DeleteWebsite(website);
 public RunOnlyForWebsitesAttribute(Website websites) : base("Excluded because the test belongs to the wrong website.")
 {
     Until = !websites.HasFlag(TestEnvironment.Website)
                 ? DateTime.MaxValue.ToString("O")
                 : DateTime.MinValue.ToString("O");
 }
Example #56
0
    protected void Page_Load(object sender, EventArgs e)
    {
        for (int i = 0; i < gvViewQuotes.Rows.Count; i++)
        {
            bool   submitted    = false;
            string referenceNum = gvViewQuotes.Rows[i].Cells[0].Text;

            //check to see if the quote is submitted.  if it is, the hyperlink will be disabled and the text will be: "submitted"
            SqlConnection connSubmitted = Website.getSQLConnection();
            SqlCommand    cmdSubmitted  = Website.getSQLCommand(connSubmitted);
            cmdSubmitted.CommandText = "SELECT * FROM quote where Reference# = " + Convert.ToInt32(referenceNum) + "AND Submitted = 1";
            cmdSubmitted.CommandType = System.Data.CommandType.Text;
            SqlDataReader readerSubmitted;
            connSubmitted.Open();
            readerSubmitted = cmdSubmitted.ExecuteReader();
            int counterSubmitted = 0;
            while (readerSubmitted.Read())
            {
                counterSubmitted++;
            }
            if (counterSubmitted > 0)
            {
                submitted = true;
            }
            connSubmitted.Close();

            HyperLink hyperlink = new HyperLink();
            hyperlink.Text        = "Edit";
            hyperlink.NavigateUrl = "~/Wepages/Applicant.aspx/?ReferenceNum=" + referenceNum;
            if (submitted)
            {
                hyperlink.Text    = "Submitted";
                hyperlink.Enabled = false;
                gvViewQuotes.Rows[i].Cells[4].Controls.Add(hyperlink);
            }
            else
            {
                gvViewQuotes.Rows[i].Cells[4].Controls.Add(hyperlink);
            }

            /*System.Web.UI.WebControls.Button btnView = new System.Web.UI.WebControls.Button();
             * btnView.ID = "btnView";
             * btnView.Text = "View PDF";
             * btnView.Click += new System.EventHandler((s, ea) => viewPDF(s, ea, referenceNum));
             * if (!submitted)
             *  gvViewQuotes.Rows[i].Cells[5].Controls.Add(btnView);*/
            SqlConnection conn = Website.getSQLConnection();
            SqlCommand    cmd  = Website.getSQLCommand(conn);
            cmd.CommandText = "select * from QuotePDFs where pdfID = (select quoteID from quote where reference# = " + referenceNum + ")";
            cmd.CommandType = System.Data.CommandType.Text;
            SqlDataReader readerPDF;
            conn.Open();
            readerPDF = cmd.ExecuteReader();
            int count = 0;
            while (readerPDF.Read())
            {
                count++;
            }
            try
            {
                if (count == 1)
                {
                    System.Web.UI.WebControls.Button btnView = new System.Web.UI.WebControls.Button();
                    btnView.ID     = "btnView";
                    btnView.Text   = "View PDF";
                    btnView.Click += new System.EventHandler((s, ea) => viewPDF(s, ea, referenceNum));
                    gvViewQuotes.Rows[i].Cells[5].Controls.Add(btnView);
                }
            }
            catch { }
            conn.Close();
        }


        if (gvViewQuotes.Rows.Count < 1)
        {
            SqlConnection conn = Website.getSQLConnection();
            SqlCommand    cmd  = Website.getSQLCommand(conn);
            try
            {
                lblSearchInput.Text = "No results found.  Please fill out your Agency Information if you have not done so.";
            }
            catch { }
        }
    }
Example #57
0
 public Website SaveOrUpdate(Website entity)
 {
     throw new NotImplementedException();
 }
Example #58
0
 public static int CancelRequest(int requestID)
 {
     return(Website.WithDatabase((db) =>
                                 db.Execute("DELETE FROM Loans WHERE ID=@0 AND Fulfilled='0'", requestID)));
 }
Example #59
0
 public IIS6Manager()
 {
     Site = new Website();
 }
 private DnsZone combineZoneWithWebsite(DnsZone zone, Website website)
 {
     zone.WebsiteID = website.DataID;
     return(zone);
 }