示例#1
0
		private bool UploadFile()
		{
			string tmpFileLocation = DoUploadByFileExtension(inpUpload, @System.Configuration.ConfigurationSettings.AppSettings.Get("UploadsPath"));
			if(tmpFileLocation != null)
			{
				string fileName = tmpFileLocation.Substring(tmpFileLocation.LastIndexOf(@"/")+1);

				BPImages bp = new BPImages();
				BEImages ds = bp.SelectAll();

				BEImages.tbl_ImagesRow ImageRow;

				if(ImageID <= 0)
				{
					ImageRow = ds.tbl_Images.Newtbl_ImagesRow();
				}
				else 
				{
					ImageRow = ds.tbl_Images.FindByImageID(ImageID);
				}

				//ImageRow.SubCategoryID = Convert.ToInt32(ddlSubCategories.SelectedValue);
				ImageRow.ImageAlias = txtAlias.Text;
				ImageRow.ImageName = Server.UrlDecode(fileName);
				ImageRow.ImageActive = chkSingle.Checked;
				ImageRow.ImageDescription = txtDesc.Text;
				//ImageRow.ClientID = Convert.ToInt32(ddlExtranetClients.SelectedValue);
				
				ImageRow.ImageCategoryID = Convert.ToInt32(ddlImageCategory.SelectedValue);
				
				ImageRow.DateModified = DateTime.Now;
				ImageRow.ModifiedByAdminID = 1;
				if(ImageID <= 0)
				{
					ImageRow.DateCreated = DateTime.Now;
					ds.tbl_Images.Addtbl_ImagesRow(ImageRow);
				}
				

				bp.Update(ds);
				return true;
			}
			else
			{
				pnlError.Visible = true;
				return false;
			}
		}
示例#2
0
		//		private void ddlCategories_SelectedIndexChanged(object sender, System.EventArgs e)
		//		{
		//			BindSubCategories();
		//		}

		private void btnDelete_Click(object sender, EventArgs e)
		{
			BPImages bp = new BPImages();
			BEImages.tbl_ImagesRow Image;
			
			DSImages = bp.SelectByID(ImageID);
			Image = DSImages.tbl_Images.FindByImageID(ImageID);

			File.Delete(Server.MapPath(@System.Configuration.ConfigurationSettings.AppSettings["UploadsPath"] + Image.ImageName));

			Image.Delete();
			bp.Update(DSImages);

			//remove all instances of this image in Products
//			BPProducts bpProducts = new BPProducts();
//			bpProducts.RemoveImagesByImageID(ImageID);

			Response.Redirect("BrowseImages.aspx");
		}
示例#3
0
		private bool UpdateRecordWithExistingFile()
		{
			try 
			{
				BPImages bp = new BPImages();
				BEImages ds = bp.SelectByID(ImageID);

				BEImages.tbl_ImagesRow ImageRow = ds.tbl_Images.FindByImageID(ImageID);

				//ImageRow.SubCategoryID = Convert.ToInt32(ddlSubCategories.SelectedValue);
				ImageRow.ImageAlias = txtAlias.Text;
				ImageRow.ImageActive = chkSingle.Checked;
				ImageRow.ImageDescription = txtDesc.Text;
				//ImageRow.ClientID = Convert.ToInt32(ddlExtranetClients.SelectedValue);
				
				ImageRow.ImageCategoryID = Convert.ToInt32(ddlImageCategory.SelectedValue);
				
				bp.Update(ds);
				return true;
			}
			catch (Exception)
			{
				pnlError.Visible = true;
				lblError.Text = "Some of the data you have entered maybe invalid, please check all fields and try again.";
				return false;
			}
		}