public void ProcessRequest(HttpContext context) { int usrID = 0; int pID = 0; string rtnFilePath = string.Empty; DocumentDA objDocDA = new DocumentDA(); if (context.Request["ID"] != null) usrID = Convert.ToInt32(context.Request["ID"]); else if (context.Request["pID"] != null) pID = Convert.ToInt32(context.Request["pID"]); context.Response.ContentType = "image/jpeg"; if (pID != 0) rtnFilePath = objDocDA.GetPresenterProfileImage(pID); else rtnFilePath = objDocDA.GetUserProfileImage(usrID); if (rtnFilePath != string.Empty) { if (File.Exists(Constant.DocRepoClient + rtnFilePath)) context.Response.WriteFile(Constant.DocRepoClient + rtnFilePath); else context.Response.WriteFile(Constant.DocRepRoot + "profileImgMissing.png"); } else context.Response.WriteFile(Constant.DocRepRoot + "profileImg.png"); }
public void ProcessRequest(HttpContext context) { int docID = 0; DocumentDA objDocDA = new DocumentDA(); if (context.Request["ID"] != null) { docID = Convert.ToInt32(context.Request["ID"]); DocAccess objDocAccess = new DocAccess(); byte[] fileContents = objDocAccess.FileToByteArray(docID); if (fileContents != null) { context.Response.AppendHeader("Content-Type", "video/mp4"); context.Response.AppendHeader("Accept-Ranges", "bytes"); context.Response.OutputStream.Write(fileContents, 0, fileContents.Length); context.Response.Flush(); } else { context.Response.ContentType = "image/jpeg"; if (File.Exists(Constant.DocRepRoot + "blankVideoTN.png")) context.Response.WriteFile(Constant.DocRepRoot + "blankVideoTN.png"); else context.Response.WriteFile(Constant.DocRepRoot + "NoDocs.png"); } } }
protected void ibtnDel_Click(object sender, ImageClickEventArgs e) { DocAccess objDocAccess = new DocAccess(); DocumentDA objDocDA = new DocumentDA(); objDocDA.ResetPresenterImgDocID(Convert.ToInt32(hProfileImgID.Value), Convert.ToInt32(Session["UserID"])); objDocAccess.removePresenterprofileImage(Convert.ToInt32(hProfileImgID.Value)); hProfileImgID.Value = "0"; dvToggle(); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Page.RouteData.Values["Id"] != null) { string docID = Page.RouteData.Values["Id"].ToString(); DocumentDA obj1 = new DocumentDA(); Response.Write("<img src='" + obj1.GetDocumentPath(Convert.ToInt32(docID), true, true) + "'>"); } } }
public void ProcessRequest(HttpContext context) { DocumentDA objDocDA = new DocumentDA(); string rtnFilePath = objDocDA.GetUserProfileImage(Convert.ToInt32(context.Session[""])); if (rtnFilePath != "") { if (File.Exists(Constant.DocRepRoot + rtnFilePath)) { context.Response.ContentType = "image/jpeg"; context.Response.WriteFile(Constant.DocRepRoot + rtnFilePath); } else throw new HttpException(404, "Invalid photo name."); } }
public void ProcessRequest(HttpContext context) { int docID = 0; DocumentDA objDocDA = new DocumentDA(); if (context.Request["ID"] != null) docID = Convert.ToInt32(context.Request["ID"]); context.Response.ContentType = "image/jpeg"; string rtnFilePath = objDocDA.GetDocumentPath(docID); if (rtnFilePath != "") { if (File.Exists(Constant.DocRepoClient + rtnFilePath)) context.Response.WriteFile(Constant.DocRepoClient + rtnFilePath); else context.Response.WriteFile(Constant.DocRepRoot + "NoDocs.png"); } else context.Response.WriteFile(Constant.DocRepRoot + "NoDocs.png"); }
public byte[] FileToByteArray(int docID) { DocumentDA objDocumentDA = new DocumentDA(); string _FileName = objDocumentDA.GetDocumentPath(docID); byte[] _Buffer = null; try { _FileName = Constant.DocRepoClient + _FileName; if (File.Exists(_FileName)) { // Open file for reading System.IO.FileStream _FileStream = new System.IO.FileStream(_FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read); // attach filestream to binary reader System.IO.BinaryReader _BinaryReader = new System.IO.BinaryReader(_FileStream); // get total byte length of the file long _TotalBytes = new System.IO.FileInfo(_FileName).Length; // read entire file into buffer _Buffer = _BinaryReader.ReadBytes((Int32)_TotalBytes); // close file reader _FileStream.Close(); _FileStream.Dispose(); _BinaryReader.Close(); } } catch (Exception _Exception) { // Error Console.WriteLine("Exception caught in process: {0}", _Exception.ToString()); } return _Buffer; }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request["ID"] != null) { hWebinarID.Value = Request["ID"].ToString(); hDocID.Value = Request["docID"].ToString(); DocumentDA objDocumentDA = new DocumentDA(); string _FileName = objDocumentDA.GetDocumentPath(Convert.ToInt32(hDocID.Value)); if (File.Exists(_FileName)) { ImgNoVideo.Visible = false; regVideo.Visible = true; } else { ImgNoVideo.Visible = true; regVideo.Visible = false; } } } }
public string getEmailRptHeader(int webinarID) { WebinarDA objWebinarDA = new WebinarDA(); List<WebinarResource> objWRes = objWebinarDA.getRegFormResoures(webinarID); int Rec = objWRes.Count; StringBuilder sb = new StringBuilder("<table width='100%'><tr>"); DocumentDA objDocDA = new DocumentDA(); if (Rec > 0) { if (objWRes[0].ResourceType.ToUpper() == "BANNER") { //sb.Append("<td><img src='" + Common.Constant.BaseURL + "Pages/logo/" + objWRes[0].DocID.ToString() + "'></td>"); sb.Append("<td><img src='" + objDocDA.GetDocumentPath(Convert.ToInt32(objWRes[0].DocID), true, true) + "'></td>"); } else { Rec = (int)(100 / objWRes.Count); for (int idx = 0; idx < objWRes.Count; idx++) { if (idx == objWRes.Count-1) sb.Append("<td valign=middle width='" + Rec.ToString() + "%' align='right'><img src='" + objDocDA.GetDocumentPath(Convert.ToInt32(objWRes[idx].DocID), true, true) + "'></td>"); else { if (idx % 2 != 0 && idx != 0) sb.Append("<td valign=middle width='" + Rec.ToString() + "%' align='center'><img src='" + objDocDA.GetDocumentPath(Convert.ToInt32(objWRes[idx].DocID), true, true) + "'></td>"); else sb.Append("<td valign=middle width='" + Rec.ToString() + "%' ><img src='" + objDocDA.GetDocumentPath(Convert.ToInt32(objWRes[idx].DocID), true, true) + "'></td>"); } } } } sb.Append("</tr></table>"); return sb.ToString(); }
private void setImageForCroping(int imgDocID) { DocumentDA objDocDA = new DocumentDA(); List<DocumentBE> objDocBE = objDocDA.GetDocumentDA(imgDocID); if (objDocBE.Count > 0) { imgCrop.ImageUrl = "~/handler/showImage.ashx?ID=" + Convert.ToString(imgDocID); hUploadedFName.Value = objDocBE[0].SavedFileName; //imgCrop.ImageUrl = Constant.ClientURL + objDocBE[0].ClientID.ToString() + "/logo/" + objDocBE[0].SavedFileName; hImgType.Value = objDocBE[0].Category; } }
public void removePresenterprofileImage(int docID) { DocumentDA objDocDA = new DocumentDA(); List<DocumentBE> objDocBE = new List<DocumentBE>(); objDocBE = objDocDA.GetDocumentDA(docID); if (objDocBE.Count > 0) { if (File.Exists(Constant.DocRepRoot + "Profile\\" + objDocBE[0].SavedFileName)) File.Delete(Constant.DocRepRoot + "Profile\\" + objDocBE[0].SavedFileName); } }
private void setResizedLogoURL(int docID) { bool isResizeRequired = false; DocumentDA objDocDA = new DocumentDA(); string rtnFilePath = objDocDA.GetDocumentPath(docID); if (rtnFilePath != "") { if (File.Exists(Constant.DocRepoClient + rtnFilePath)) { rtnFilePath = Constant.DocRepoClient + rtnFilePath; isResizeRequired = true; } else rtnFilePath = Constant.DocRepRoot + "NoDocs.png"; } else rtnFilePath = Constant.DocRepRoot + "NoDocs.png"; if (isResizeRequired) { List<DocumentBE> objDoc = objDocDA.GetDocumentDA(docID); if (objDoc.Count > 0) { if (!objDoc[0].isResized) { ImageUtility objImgUtil = new ImageUtility(); System.Drawing.Image original = System.Drawing.Image.FromFile(rtnFilePath); System.Drawing.Image resized = objImgUtil.ResizeImage(original, (objDoc[0].Category.ToUpper() == "LOGO" ? Common.Constant.LogoSize : Common.Constant.BannerSize)); string SavedFileName = ""; switch ((Path.GetExtension(objDoc[0].SavedFileName).Substring(1)).ToUpper()) { case "PNG": SavedFileName = docID.ToString() + "_rs.png"; resized.Save(Constant.DocRepoClient + Session["ClientID"].ToString() + "\\Logo\\" + SavedFileName, System.Drawing.Imaging.ImageFormat.Png); break; case "JPG": SavedFileName = docID.ToString() + "_rs.jpg"; resized.Save(Constant.DocRepoClient + Session["ClientID"].ToString() + "\\Logo\\" + SavedFileName, System.Drawing.Imaging.ImageFormat.Jpeg); break; case "GIF": SavedFileName = docID.ToString() + "_rs.gif"; resized.Save(Constant.DocRepoClient + Session["ClientID"].ToString() + "\\Logo\\" + SavedFileName, System.Drawing.Imaging.ImageFormat.Gif); break; } objDocDA.SaveDocumentDA(docID, "isResized", "1"); objDocDA.SaveDocumentDA(docID, "SavedFileName", "'" + SavedFileName + "'"); } } } }
public void ProcessRequest(HttpContext context) { int docID = 0; bool isResizeRequired = false; DocumentDA objDocDA = new DocumentDA(); if (context.Request["ID"] != null) docID = Convert.ToInt32(context.Request["ID"]); string rtnFilePath = objDocDA.GetDocumentPath(docID); if (rtnFilePath != "") { if (File.Exists(Constant.DocRepoClient + rtnFilePath)) { rtnFilePath = Constant.DocRepoClient + rtnFilePath; isResizeRequired = true; } else rtnFilePath = Constant.DocRepRoot + "NoDocs.png"; } else rtnFilePath = Constant.DocRepRoot + "NoDocs.png"; context.Response.ContentType = "image/jpeg"; if (isResizeRequired) { List<DocumentBE> objDoc = objDocDA.GetDocumentDA(docID); if (objDoc.Count > 0) { if (!objDoc[0].isResized) { ImageUtility objImgUtil = new ImageUtility(); System.Drawing.Image original = System.Drawing.Image.FromFile(rtnFilePath); System.Drawing.Image resized = objImgUtil.ResizeImage(original, Common.Constant.LogoSize); switch ((Path.GetExtension(objDoc[0].SavedFileName).Substring(1)).ToUpper()) { case "PNG": resized.Save(rtnFilePath, System.Drawing.Imaging.ImageFormat.Png); break; case "JPG": resized.Save(rtnFilePath, System.Drawing.Imaging.ImageFormat.Jpeg); break; case "GIF": resized.Save(rtnFilePath, System.Drawing.Imaging.ImageFormat.Gif); break; } objDocDA.SaveDocumentDA(docID, "isResized", "1"); } } } context.Response.WriteFile(rtnFilePath); //ImageUtility objImageUtility = new ImageUtility(); //if (!File.Exists(Server.MapPath(p2))) //{ // System.Drawing.Image original = System.Drawing.Image.FromFile(Server.MapPath(p1)); // System.Drawing.Image resized = objImageUtility.ResizeImage(original, new Size(60, 60)); // resized.Save(Server.MapPath(p2), System.Drawing.Imaging.ImageFormat.Png); //} //return p2; }
public string getUserProfileImagePath(int UserID) { DocumentDA objDocumentDA = new DocumentDA(); return objDocumentDA.GetUserProfileImage(UserID); }
public int saveFiles(UploadedFile fs, string folderType, int clientID, int actionBy, int userID, int webinarID) { int DocID = 0; string fname = ""; try { DocumentBE objDcoumentBE = new DocumentBE(); DocumentDA objDocumentDA = new DocumentDA(); if (fs.FileName != "") { fname = System.IO.Path.GetFileName(fs.FileName); switch (folderType.ToUpper()) { case "PROFILE": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Profile\\" + fname); break; case "LOGO": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname); break; case "BANNER": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname); break; case "PRESENTATION": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\WebinarDocs\\" + fname); break; case "SS": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\SS\\" + fname); break; case "TEMP": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Temp\\" + fname); break; } objDcoumentBE.DocumentID = 0; objDcoumentBE.ClientID = clientID; objDcoumentBE.Category = folderType; objDcoumentBE.OrginalFileName = fname; //fs.GetName(); objDcoumentBE.SavedFileName = fname; //fs.GetName(); objDcoumentBE.InsertedBy = actionBy; objDcoumentBE.PresenterID = userID; objDcoumentBE.WebinarID = webinarID; DocID = objDocumentDA.SaveDocumentDA(objDcoumentBE, userID, webinarID); } } catch (Exception ex) { objUtil.RecordLogToFS("DocAccess-saveFiles:" + ex.Message); } return DocID; }
public int saveFiles(UploadedFile fs, string folderType, int clientID, int actionBy) { int DocID = 0; string fname = ""; try { DocumentBE objDcoumentBE = new DocumentBE(); DocumentDA objDocumentDA = new DocumentDA(); if (fs.FileName != "") { fname = System.IO.Path.GetFileName(fs.FileName); switch (folderType.ToUpper()) { case "PROFILE": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Profile\\" + fname); break; case "LOGO": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname); break; case "BANNER": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname); break; case "PRESENTATION": fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\WebinarDocs\\" + fname); break; } objDcoumentBE.DocumentID = 0; objDcoumentBE.ClientID = clientID; objDcoumentBE.Category = folderType; objDcoumentBE.OrginalFileName = fname; //fs.GetName(); objDcoumentBE.SavedFileName = fname; //fs.GetName(); objDcoumentBE.InsertedBy = actionBy; DocID = objDocumentDA.SaveDocumentDA(objDcoumentBE); } } catch (Exception ex) { } return DocID; }
private void UpdatePresenterProfileID(int DocumentID, int PresenterID) { DocumentDA objDoc = new DocumentDA(); if (PresenterID > 0 && DocumentID > 0) objDoc.UpdatePresenterImgDocID(DocumentID, PresenterID); }
public void removeDocumentFromRepositary(int docID, int clientID, string documentType) { DocumentDA objDocDA = new DocumentDA(); List<DocumentBE> objDocBE = new List<DocumentBE>(); if (documentType.ToUpper() == "BANNER") documentType = "Logo"; objDocBE = objDocDA.GetDocumentDA(docID); if (objDocBE.Count > 0) { if (File.Exists(Constant.DocRepoClient + clientID.ToString() + "\\" + documentType + "\\" + objDocBE[0].SavedFileName)) File.Delete(Constant.DocRepoClient + clientID.ToString() + "\\" + documentType + "\\" + objDocBE[0].SavedFileName); } }