public void ProcessRequest(HttpContext context) { if (context.Request.IsAuthenticated) { if (context.Request.QueryString["DocID"] != null) { SupportedDocumentModel objModel = MembersBAL.SelectSupportDocumentsById(Convert.ToInt32(context.Request.QueryString["DocID"])); if (objModel != null) { Byte[] bytes = objModel.ImageFile; context.Response.Buffer = true; context.Response.Charset = ""; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.ContentType = string.IsNullOrEmpty(objModel.DocContentType) ? "application/octet-stream" : objModel.DocContentType; context.Response.AddHeader("content-disposition", "attachment;filename=" + objModel.ImageName); context.Response.BinaryWrite(bytes); context.Response.Flush(); context.Response.End(); } } else if (context.Request.QueryString["DocFID"] != null) { FuneralDocumentModel objModel = client.SelectFuneralDocumentsByPKId(Convert.ToInt32(context.Request.QueryString["DocFID"])); if (objModel != null) { Byte[] bytes = objModel.ImageFile; context.Response.Buffer = true; context.Response.Charset = ""; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.ContentType = string.IsNullOrEmpty(objModel.DocContentType) ? "application/octet-stream" : objModel.DocContentType; context.Response.AddHeader("content-disposition", "attachment;filename=" + objModel.ImageName); context.Response.BinaryWrite(bytes); context.Response.Flush(); context.Response.End(); } } else if (context.Request.QueryString["DocClaimID"] != null) { ClaimDocumentModel objModel = client.SelectClaimsDocumentsByPKId(Convert.ToInt32(context.Request.QueryString["DocClaimID"])); if (objModel != null) { Byte[] bytes = objModel.ImageFile; context.Response.Buffer = true; context.Response.Charset = ""; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.ContentType = string.IsNullOrEmpty(objModel.DocContentType) ? "application/octet-stream" : objModel.DocContentType; context.Response.AddHeader("content-disposition", "attachment;filename=" + objModel.ImageName); context.Response.BinaryWrite(bytes); context.Response.Flush(); context.Response.End(); } } } }
public static int SaveFuneralSupportedDocument(FuneralDocumentModel model) { string query = "SaveFuneralSupportedDocument"; DbParameter[] ObjParam = new DbParameter[9]; ObjParam[0] = new DbParameter("@ImageName", DbParameter.DbType.NVarChar, 0, model.ImageName); ObjParam[1] = new DbParameter("@ImageFile", DbParameter.DbType.Image, 0, model.ImageFile); ObjParam[2] = new DbParameter("@fkiFuneralID", DbParameter.DbType.Int, 0, model.fkiFuneralID); ObjParam[3] = new DbParameter("@CreateDate", DbParameter.DbType.DateTime, 0, model.CreateDate); ObjParam[4] = new DbParameter("@Parlourid", DbParameter.DbType.UniqueIdentifier, 0, model.Parlourid); ObjParam[5] = new DbParameter("@LastModified", DbParameter.DbType.DateTime, 0, model.LastModified); ObjParam[6] = new DbParameter("@ModifiedUser", DbParameter.DbType.NVarChar, 0, model.ModifiedUser); ObjParam[7] = new DbParameter("@DocContentType", DbParameter.DbType.VarChar, 0, model.DocContentType); ObjParam[8] = new DbParameter("@DocType", DbParameter.DbType.Int, 0, model.DocType); return(Convert.ToInt32(DbConnection.GetScalarValue(CommandType.StoredProcedure, query, ObjParam))); }
protected void BtnDocumentSubmit_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (fuSupportDocument.HasFile) { string filename = Path.GetFileName(fuSupportDocument.PostedFile.FileName); string contentType = fuSupportDocument.PostedFile.ContentType; using (Stream fs = fuSupportDocument.PostedFile.InputStream) { using (BinaryReader br = new BinaryReader(fs)) { byte[] bytes = br.ReadBytes((Int32)fs.Length); FuneralDocumentModel ObjSupportedDocumentModel = new FuneralDocumentModel(); ObjSupportedDocumentModel.DocContentType = contentType; ObjSupportedDocumentModel.ImageName = filename; ObjSupportedDocumentModel.ImageFile = bytes; ObjSupportedDocumentModel.fkiFuneralID = FID; ObjSupportedDocumentModel.CreateDate = System.DateTime.Now; ObjSupportedDocumentModel.Parlourid = this.ParlourId; ObjSupportedDocumentModel.LastModified = DateTime.Now; ObjSupportedDocumentModel.ModifiedUser = this.User.Identity.Name; ObjSupportedDocumentModel.DocType = Convert.ToInt32(rdbdocument.SelectedValue.ToString()); //int documentId = client.SaveFuneralSupportedDocument(ObjSupportedDocumentModel); int documentId = FuneralBAL.SaveFuneralSupportedDocument(ObjSupportedDocumentModel); //int documentId = FuneralBAL.SaveFuneralSupportedDocument(ObjSupportedDocumentModel); if (documentId > 0) { ShowMessage(ref lblMessage, MessageType.Success, "Supporting document uploaded successfully"); } BindFuneralToUpdate(); } } } } } catch (Exception ex) { ShowMessage(ref lblMessage, MessageType.Danger, "Error in add Document: " + ex.Message); } }
public int SaveFuneralSupportedDocument(FuneralDocumentModel model) { return(FuneralBAL.SaveFuneralSupportedDocument(model)); }