private void populateCommentsTable() { try { Goals gi = new Goals(Request.QueryString["id"].ToString()); divComments.InnerHtml = gi.populateCommentsTable(); } catch(Exception ex) { divComments.InnerHtml = "An Error Occurred: " + ex.ToString(); } }
protected void btnAddComment_Click(object sender, EventArgs e) { try { Goals gi = new Goals(Request.QueryString["id"].ToString()); gi.addComment(txtComment.Text, Session["GoalOwner"].ToString()); txtComment.Text = ""; //RepopulateTable populateCommentsTable(); } catch(Exception ex) { txtComment.Text = "Error: " + ex.ToString(); } }
private void populateGoalData() { if(Request.QueryString["id"]!=null) { Goals gi = new Goals(Request.QueryString["id"].ToString()); //Populate Goal Info divGoalInfo.InnerHtml = gi.populateGoalText(); //Populate Comments populateCommentsTable(); //Populate Pictures populatePicturesTable(); } else { divComments.InnerHtml = "Error"; divGoalInfo.InnerHtml = "Error"; divPictures.InnerHtml = "Error"; } }
protected void btnPictureUpload_Click(object sender, EventArgs e) { #region Upload if (!FileUploadPictures.HasFile) { } else { string fileName = ""; string ext = ""; string dbFileName = ""; if (FileUploadPictures.HasFile) { string tempstr = Request.QueryString["id"].ToString(); string[] typeArray = FileUploadPictures.FileName.Split('.'); ext = "." + typeArray[typeArray.Length - 1]; fileName = Server.MapPath("images") + "/" + tempstr + ext; dbFileName = "images/" + tempstr + ext; int number = 1; fileName = Server.MapPath("images") + "/" + tempstr + number.ToString() + ext; dbFileName = "images/" + tempstr + number.ToString() + ext; while (File.Exists(fileName)) { number++; fileName = Server.MapPath("images") + "/" + tempstr + number.ToString() + ext; dbFileName = "images/" + tempstr + number.ToString() + ext; } FtpWebRequest request; string folderName = "/goals.ayalasolivan.com/images/"; string absoluteFileName = dbFileName; request = WebRequest.Create(new Uri(string.Format(@"ftp://[email protected]/goals.ayalasolivan.com/" + dbFileName))) as FtpWebRequest; request.Method = WebRequestMethods.Ftp.UploadFile; request.UseBinary = true; request.UsePassive = true; request.KeepAlive = true; request.Credentials = new NetworkCredential("hectorhaas2", "6470060aA@"); request.ConnectionGroupName = "group"; byte[] buffer = FileUploadPictures.FileBytes; Stream requestStream = request.GetRequestStream(); requestStream.Write(buffer, 0, buffer.Length); requestStream.Close(); requestStream.Flush(); Goals gi = new Goals(Request.QueryString["id"].ToString()); gi.UploadPicture(Session["GoalOwner"].ToString(), txtPictureComment.Text, dbFileName); } } #endregion txtPictureComment.Text = ""; //reloadPics populatePicturesTable(); }
private void populatePicturesTable() { Goals gi = new Goals(Request.QueryString["id"].ToString()); divPictures.InnerHtml = gi.populatePictures(); }