protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView row = (DataRowView)e.Item.DataItem; ECompanyInbox obj = new ECompanyInbox(); sdb.toObject(((DataRowView)e.Item.DataItem).Row, obj); CheckBox cb = (CheckBox)e.Item.FindControl("ItemSelect"); WebFormUtils.LoadKeys(sdb, row, cb); Label InboxCreateDate = (Label)e.Item.FindControl("CompanyInboxCreateDate"); Label InboxSubject = (Label)e.Item.FindControl("CompanyInboxSubject"); InboxCreateDate.Text = obj.CompanyInboxCreateDate.ToString("yyyy-MM-dd HH:mm:ss"); InboxSubject.Text = obj.CompanyInboxSubject; if (obj.CompanyInboxReadDate.Ticks.Equals(0)) { InboxCreateDate.Font.Bold = true; InboxSubject.Font.Bold = true; } //cb.Visible = toolBar.DeleteButton_Visible; }
protected bool loadObject() { ECompanyInbox obj = new ECompanyInbox(); bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest); if (!db.select(masterDBConn, obj)) { if (CurID <= 0) { return(false); } else { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } } if (obj.CompanyDBID != 0 && obj.CompanyDBID != CurCompanyDBID) { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } if (obj.CompanyInboxReadDate.Ticks.Equals(0)) { obj.CompanyInboxReadDate = AppUtils.ServerDateTime(); db.update(masterDBConn, obj); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); DBFilter inboxAttachmentFilter = new DBFilter(); inboxAttachmentFilter.add(new Match("CompanyInboxID", obj.CompanyInboxID)); ArrayList inboxAttachmentList = ECompanyInboxAttachment.db.select(masterDBConn, inboxAttachmentFilter); if (inboxAttachmentList.Count > 0) { CompanyInboxAttachmentRepeater.DataSource = inboxAttachmentList; CompanyInboxAttachmentRepeater.DataBind(); } else { AttachmentRow.Visible = false; } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read)) { return; } if (Application["MasterDBConfig"] != null) { masterDBConn = ((DatabaseConfig)Application["MasterDBConfig"]).CreateDatabaseConnectionObject(); } else { Response.Redirect("~/AccessDeny.aspx"); } if (!int.TryParse(DecryptedRequest["CompanyInboxAttachmentID"], out CurCompanyInboxAttachmentID)) { CurCompanyInboxAttachmentID = -1; } if (!int.TryParse(DecryptedRequest["CompanyInboxID"], out CurCompanyInboxID)) { CurCompanyInboxID = -1; } if (Session["CompanyDBID"] != null) { CurCompanyDBID = (int)Session["CompanyDBID"]; } //string pathDelimiter = System.IO.Path.DirectorySeparatorChar.ToString(); ECompanyInboxAttachment inboxAttachment = new ECompanyInboxAttachment(); inboxAttachment.CompanyInboxAttachmentID = CurCompanyInboxAttachmentID; if (ECompanyInboxAttachment.db.select(masterDBConn, inboxAttachment)) { if (inboxAttachment.CompanyInboxID.Equals(CurCompanyInboxID)) { ECompanyInbox inbox = new ECompanyInbox(); inbox.CompanyInboxID = CurCompanyInboxID; if (ECompanyInbox.db.select(masterDBConn, inbox)) { if (inbox.CompanyDBID.Equals(CurCompanyDBID) || inbox.CompanyDBID.Equals(0)) { string documentFilePath = inboxAttachment.GetDocumentPhysicalPath(masterDBConn);// ESystemParameter.getParameter(masterDBConn, ESystemParameter.PARAM_CODE_BANKFILE_UPLOAD_FOLDER); string transferFilePath = documentFilePath; string strTmpFolder = string.Empty; if (inboxAttachment.CompanyInboxAttachmentIsCompressed) { transferFilePath = inboxAttachment.GetExtractedFilePath(masterDBConn); } if (System.IO.File.Exists(transferFilePath)) { Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/download"; //Fixed download problem on https Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(inboxAttachment.CompanyInboxAttachmentOriginalFileName)); Response.AppendHeader("Content-Length", new System.IO.FileInfo(transferFilePath).Length.ToString()); Response.Expires = -1; Response.WriteFile(transferFilePath, true); Response.Flush(); // WebUtils.TransmitFile(Response, strTmpFolder + pathDelimiter+ fileList[0], empDocument.EmpDocumentOriginalFileName, true); } inboxAttachment.RemoveExtractedFile(); Response.End(); } } } } }