Exemple #1
0
		protected string GetImageName(object strImageID, string prefix)
		{
			if (!Convert.IsDBNull(strImageID))
			{
				int ImageID = Convert.ToInt32(strImageID);
				BPImages bpImages = new BPImages();
				DSImages = bpImages.SelectAll();
				BEImages.tbl_ImagesRow row = DSImages.tbl_Images.FindByImageID(ImageID);
				if (row != null)
				{
					return "Uploads/" + prefix + row.ImageName;
				}
				else
				{
					return "";
				}
			}
			else
			{
				return "";
			}
		}
Exemple #2
0
		private bool UploadFile()
		{
		    //string tmpFileLocation = DoUploadByFileExtension(inpUpload, @"\Uploads\");
			string tmpFileLocation = DoUploadByFileExtension(inpUpload, @System.Configuration.ConfigurationSettings.AppSettings["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;
			}
		}