コード例 #1
0
    protected void uploadPhoto(object sender, EventArgs e)
    {
        string description = PhotoDescription.Text;

        //string selValue = DropDownListCategory.SelectedValue;
        if (/*selValue == null || */ description == null || selectedPhoto.HasFile == false)
        {
            Response.Redirect(Request.Url.AbsoluteUri);
        }
        SharePhotos.Database.Entities.Category category = null;
        try
        {
            category = new SharePhotos.Database.Entities.Category(categoryName.Text);
        }
        catch (Exception ex) {
            categoryName.Text = "Does not exists";
            return;
        }

        int categoryId = category.getId();
        int newId      = Photo.createPhoto(album.getId(), categoryId, description);

        selectedPhoto.SaveAs("C:\\Users\\rhasna\\Documents\\Visual Studio 2010\\WebSites\\SharePhotos\\Photos\\" + newId + ".jpg");
        Response.Redirect(Request.Url.AbsoluteUri);
    }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Params.AllKeys.Contains <string>("category"))
     {
         string category_name = Request.Params.Get("category");
         try
         {
             category = new SharePhotos.Database.Entities.Category(category_name);
         }
         catch (Exception ex)
         {
             Response.Redirect("Default.aspx");
         }
         allPhotos = Photo.getAllPhotos(category.getId());
     }
     else
     {
         allCategories = SharePhotos.Database.Entities.Category.getAllCategories();
     }
 }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Params.AllKeys.Contains<string>("category"))
        {

            string category_name = Request.Params.Get("category");
            try
            {
                category = new SharePhotos.Database.Entities.Category(category_name);
            }
            catch (Exception ex)
            {
                Response.Redirect("Default.aspx");
            }
            allPhotos = Photo.getAllPhotos(category.getId());
        }
        else {
            allCategories = SharePhotos.Database.Entities.Category.getAllCategories();
        }
    }
コード例 #4
0
    protected void uploadPhoto(object sender, EventArgs e)
    {
        string description = PhotoDescription.Text;
        //string selValue = DropDownListCategory.SelectedValue;
        if (/*selValue == null || */description == null || selectedPhoto.HasFile == false) {
            Response.Redirect(Request.Url.AbsoluteUri);
        }
        SharePhotos.Database.Entities.Category category = null;
        try
        {
            category = new SharePhotos.Database.Entities.Category(categoryName.Text);
        }
        catch (Exception ex) {
            categoryName.Text = "Does not exists";
            return;
        }

        int categoryId = category.getId();
        int newId = Photo.createPhoto(album.getId(), categoryId, description);
        selectedPhoto.SaveAs("C:\\Users\\rhasna\\Documents\\Visual Studio 2010\\WebSites\\SharePhotos\\Photos\\" + newId + ".jpg");
        Response.Redirect(Request.Url.AbsoluteUri);
    }