protected void btnEditVenture_Click(object sender, EventArgs e) { lblPicCheckType.Visible = false; lblPicCheckSize.Visible = false; ventureObj = (Venture)Session["ventureObj"]; lblRequired.Visible = false; lblVentureNameCheck.Visible = false; int count = Convert.ToInt32(DbMethodsObj.CheckIfVentureNameExists(txtVentureName.Text)); if (valid.IsBlank(txtVentureName.Text) || valid.IsBlank(txtPrimaryEmail.Text) || valid.IsBlank(txtEmail.Text) || valid.IsBlank(txtDescription.Text)) { lblRequired.Visible = true; } else if (count >= 1 && txtVentureName.Text != ventureObj.name) { lblVentureNameCheck.Visible = true; } else { Venture v = new Venture(); v.ventureID = Convert.ToInt32(DbMethodsObj.GetVentureID(ventureObj.name)); v.name = txtVentureName.Text; v.description = txtDescription.Text; v.aboutUs = txtAboutUs.Text; v.contactEmail = txtEmail.Text; v.contactPhoneNumber = txtPhoneNumber.Text; v.contactLinkedIn = txtLinkedIn.Text; v.primaryContactEmail = txtPrimaryEmail.Text; v.lastUpdateDate = DateTime.Now; Expert expertProfileObj = (CapstoneBlackstone.Expert)Session["expertProfileObj"]; v.lastUpdateUser = expertProfileObj.lastName + ", " + expertProfileObj.firstName; if (FileUpload1.HasFile) { string fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName); //uploaded file extension int iFileSize = FileUpload1.PostedFile.ContentLength; //uploaded file size if (valid.TestForLegalImageTypes(fileExtension) == false) { //fail lblPicCheckType.Visible = true; lblPicCheckType.Text = fileExtension + " file extension is not allowed. Please use .png, .gif, .jpg, .jpeg, .pdf, .pcd, .fpx, .tif instead"; } else if (iFileSize >= 90000) {//fail lblPicCheckSize.Visible = true; lblPicCheckSize.Text = "Your file size is " + iFileSize + " bytes. Please reduce the size to less than 90 KB (90000 bytes)."; } else { MemoryStream ms = new MemoryStream(); var img = System.Drawing.Image.FromStream(FileUpload1.FileContent); img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); v.Picture = ms.ToArray(); int result = DbMethodsObj.UpdateVenture(v); Response.Redirect("VenturePage.aspx?name=" + ventureObj.name); } } else { v.Picture = ventureObj.Picture; int result = DbMethodsObj.UpdateVenture(v); Response.Redirect("VenturePage.aspx?name=" + ventureObj.name); } } }//end edit venture click event