protected void dsfd_Click(object sender, EventArgs e) { SendRecEventWB EventDetailsObj = new SendRecEventWB(); WorkShop objEntEvent = new WorkShop(); // Function used to for downloading the files from database //obtain selected index from GridView for the selected File // int nominationID = int.Parse(grdWorkShopDetailsInternationalNationals.Rows[i].Cells[0].Text.Trim()); //function call for the downloading the file and reading // from database objEntEvent = EventDetailsObj.readerForEvent("", Convert.ToInt32(ViewState["EventId"])); //---------------------------- Reading of File-------------------------- //Information Stored in database is in the form of Binary //Populates an array of objects with the column values of the current row. if (objEntEvent != null) { Byte[] programFile = objEntEvent.ProgramFile; //obtain content type from database, read the no of rows in the table //Check Whether is their any information available in the database or not if (objEntEvent.NominationID != null) { //obtain content type of file, i.e., application/pdf, application/ vnd.msword string contentType = objEntEvent.Contenttype; //obtaing filename from the table string fileName = objEntEvent.FileName; //The ContentType property specifies the HTTP content type for the response. //If no ContentType is specified, the default is text/HTML. Response.ContentType = contentType; //The AddHeader method adds a new HTML header and value to the response sent to the client Response.AddHeader("content-disposition", "attachment;filename=" + fileName); //The Charset property appends the name of the character set (for example, ISO-8859-13) to the content-type header in the Response object //Here Blank is attached Response.Charset = ""; //Provides enumerated values that are used to set the Cache-Control HTTP header. Response.Cache.SetCacheability(HttpCacheability.NoCache); } //Provides enumerated values that are used to set the Cache-Control HTTP header. Response.BinaryWrite(programFile); //The End method causes the Web server to stop // processing the script and return the current result. Response.End(); } }
public void getAllDetails(string iNominationID) { entEventWB objEnt; SendRecEventWB objDoc = new SendRecEventWB(); int userid = ((UserDetails)Session[clsConstant.TOKEN]).UserID; string iType = ""; if (type == "received") { iType = "S"; } objEnt = objDoc.setEntValues3(int.Parse(iNominationID)); //, userid lblEventName.Text = objEnt.EventName; lblEventType.Text = objEnt.EventType; lblFromDate.Text = objEnt.FromDate; lblToDate.Text = objEnt.ToDate; lblVenue.Text = objEnt.Venue; lblSponsored.Text = objEnt.Sponsored; lblNomination.Text = objEnt.Nomination; lblInvite.Text = objEnt.Invite; lblNationalInternational.Text = objEnt.InternationalNational; lblSector.Text = objEnt.Sector; lblFile.Text = objEnt.FileName; lblFile2.Text = objEnt.SecondFileName; lblDueDate.Text = objEnt.LastDate; lblSendBy.Text = objEnt.SenderName; lblStatus.Text = objEnt.Status; lblType.Text = objEnt.VisitType.ToString() == "1"?"Incoming":"Outgoing"; lblWorkshopId.Text = ViewState["EventId"].ToString(); ViewState["vsTopic"] = objEnt.EventName; lblFromUser.Text = objEnt.FromUser; StringBuilder s = new StringBuilder(); CommonFunction objCommon = new CommonFunction(); DataSet dset = new DataSet(); int iUserID = ((UserDetails)Session[clsConstant.TOKEN]).UserID; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@SouthExchangeID", Request.QueryString["id"].ToString()) }; dset = objCommon.getEventData("Sp_SelectSouthExchangeVisitsDetails", param); #region ToList if (dset.Tables[2].Rows.Count > 0) { s.Append("<tr class='TrClass' style='background-color: #337ab7;color:black;'>"); s.Append("<th class='TdClass' style='font-size:18px'>Details </th>"); s.Append("</tr>"); for (int i = 0; i < dset.Tables[2].Rows.Count; i++) { s.Append("<tr class='TrClass'>"); s.Append("<td class='TdClass'>" + dset.Tables[2].Rows[i]["ToName"].ToString() + "</td>"); s.Append("</tr>"); } lblsendto.Text = s.ToString(); s = s.Clear(); } else { lblsendto.Text = "Currently To users are not available!"; lblsendto.ForeColor = System.Drawing.Color.Red; } #endregion #region ToCCList if (dset.Tables[3].Rows.Count > 0) { s.Append("<tr class='TrClass' style='background-color: #337ab7;color:black;'>"); s.Append("<th class='TdClass' style='font-size:18px'>Details </th>"); s.Append("</tr>"); for (int i = 0; i < dset.Tables[3].Rows.Count; i++) { s.Append("<tr class='TrClass'>"); s.Append("<td class='TdClass'>" + dset.Tables[3].Rows[i]["ToNameCC"].ToString() + "</td>"); s.Append("</tr>"); } lblccTo.Text = s.ToString(); s = s.Clear(); } else { lblccTo.Text = "Currently CC users are not available!"; lblccTo.ForeColor = System.Drawing.Color.Red; } #endregion if (lblStatus.Text == "Rejected" || lblStatus.Text == "Approved") { btnApprove.Visible = false; btnReject.Visible = false; btnReply.Visible = false; } else { btnApprove.Visible = true; btnReject.Visible = true; } ViewState["EventId"] = iNominationID; if (((UserDetails)Session[clsConstant.TOKEN]).UserID.ToString() == objEnt.SendUserId) { btnApprove.Visible = false; btnReject.Visible = false; btnReply.Visible = false; } if (Convert.ToDateTime(objEnt.LastDate) < DateTime.Now) { btnApprove.Visible = true; btnReject.Visible = true; } else { btnApprove.Visible = false; btnReject.Visible = false; } if (getUserDetailsChecks(iNominationID, "W") != userid.ToString()) { btnApprove.Visible = false; btnReject.Visible = false; } else if (objEnt.Status == "Approved" || objEnt.Status == "Rejected") { btnApprove.Visible = false; btnReject.Visible = false; } }
public void getAllDetails(string iStudyID) { entEventWB objEnt; SendRecEventWB objDoc = new SendRecEventWB(); int userid = ((UserDetails)Session[clsConstant.TOKEN]).UserID; string iType = ""; if (type == "received") { iType = "S"; } objEnt = objDoc.setEntValuesForWB(int.Parse(iStudyID)); //, userid lblPipeline.Text = objEnt.EventName1; lblPortfolio.Text = objEnt.EventName2; lblAAA.Text = objEnt.EventName3; if ((lblAAA.Text) != "") { LabelPipeline.Visible = false; LabelPortfolio.Visible = false; LabelAAA.Visible = true; trpipeline.Visible = false; trportfolio.Visible = false; trAAA.Visible = true; } else if (lblPortfolio.Text != "") { LabelPortfolio.Visible = true; LabelPipeline.Visible = false; LabelAAA.Visible = false; trportfolio.Visible = true; trpipeline.Visible = false; trAAA.Visible = false; } else { LabelPipeline.Visible = true; LabelPortfolio.Visible = false; LabelAAA.Visible = false; trpipeline.Visible = true; trportfolio.Visible = false; trAAA.Visible = false; } lblPlace.Text = objEnt.Place; lblCreateDate.Text = objEnt.Date; lblJustification1.Text = objEnt.Justification1; lblJustification2.Text = objEnt.Justification2; lblExpenditure.Text = objEnt.Expenditure; lblLastYear.Text = objEnt.LastYear; lblLastPlace.Text = objEnt.LastPlace; lblParticipants.Text = objEnt.Participents; lblPurpose.Text = objEnt.Purpose; lblLastExpenditure.Text = objEnt.LastExpenditure; lblComment.Text = objEnt.Comment; lblSendBy.Text = objEnt.SendBy; lblWorkshopId.Text = ViewState["StudyId"].ToString(); lblcreatedby.Text = objEnt.SenderName.ToString(); //lblSendBy.Text = objEnt.SenderName; lblStatus.Text = objEnt.Status; if (lblStatus.Text == "Replied") { lblSendBy.Text = objEnt.SendBy; btnReply.Visible = false; } else { lblSendBy.Text = objEnt.SenderName; } if (lblStatus.Text == "Rejected" || lblStatus.Text == "Approved") { btnReply.Visible = false; } if (lblStatus.Text == "Forwarded") { btnApprove.Visible = false; btnReject.Visible = false; btnReply.Visible = true; } ViewState["StudyId"] = iStudyID; if (((UserDetails)Session[clsConstant.TOKEN]).UserID.ToString() == objEnt.SendUserId) { btnReply.Visible = true; } btnApprove.Visible = false; btnReject.Visible = false; }