protected void grdNominationManagementSystem_SelectedIndexChanged(object sender, EventArgs e) { objEntWork = new WorkShop(); workshopObj = new WorkShopDetailsWB(); for (int i = 0; i < grdNominationManagementSystem.Rows.Count; i++) { if (grdNominationManagementSystem.SelectedIndex == i) { int nominationID = int.Parse(grdNominationManagementSystem.DataKeys[i].Value.ToString()); string topic = grdNominationManagementSystem.Rows[i].Cells[2].Text; objEntWork = workshopObj.readerForWorkShop("", nominationID); Byte[] programFile = objEntWork.ProgramFile; if (objEntWork.FileName != null) { string contentType = objEntWork.Contenttype; string fileName = objEntWork.FileName; Response.ContentType = contentType; Response.AddHeader("content-disposition", "attachment;filename=" + fileName); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(programFile); Response.End(); } } } }
protected void grdWorkShopDetails_SelectedIndexChanged(object sender, EventArgs e) { objWork = new WorkShopDetailsWB(); objEntWork = new WorkShop(); // Function used to for downloading the files from database for (int i = 0; i < grdWorkShopDetails.Rows.Count; i++) { //obtain selected index from GridView for the selected File if (grdWorkShopDetails.SelectedIndex == i) { // int nominationID = int.Parse(grdWorkShopDetailsInternationalNationals.Rows[i].Cells[0].Text.Trim()); int nominationID = int.Parse(grdWorkShopDetails.DataKeys[i].Value.ToString()); //function call for the downloading the file and reading // from database objEntWork = objWork.readerForWorkShop("", nominationID); //---------------------------- 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 (objEntWork != null) { Byte[] programFile = objEntWork.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 (objEntWork.NominationID != null) { //obtain content type of file, i.e., application/pdf, application/ vnd.msword string contentType = objEntWork.Contenttype; //obtaing filename from the table string fileName = objEntWork.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(); } else { lblMessage.Text = "File DoesNot Exists"; } } } }
//Search the Grid private void searchGrid() { DataSet dtSet = new DataSet(); objWork = new WorkShopDetailsWB(); //Function Call this.bindGrid(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { try { //this.getLoan(); txtid.Attributes.Add("readonly", "readonly"); if (Session[clsConstant.TOKEN] == null) { UrlParameterPasser urlWrapper = new UrlParameterPasser(); urlWrapper.Url = "../Logout.aspx"; urlWrapper.PassParameters(); } else { this.readRole(); //if (IsUpload == false) //{ // UrlParameterPasser urlWrapper = new UrlParameterPasser(); // urlWrapper.Url = "../Logout.aspx"; // urlWrapper.PassParameters(); //} //else //{ objEnt = new WorkShop(); workShopDetailsObj = new WorkShopDetailsWB(); objNomDetails = new NominationDetailsWB(); nomID = Session["SouthID"].ToString(); // nomID = Request.QueryString["nomI"]; objEnt = workShopDetailsObj.readerForWorkShop("", int.Parse(nomID)); DataTable dt = new DataTable(); dt = (DataTable)Session["SouthDT"]; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["iSouthExchangeID"].ToString() == nomID.ToString()) { lblNomination.Text = "<b/>" + dt.Rows[i]["vsTopic"].ToString(); lblSeats.Text = "" + dt.Rows[i]["iSeats"].ToString(); } } ViewState["iSouthID"] = null; this.bindNominatedUser(Convert.ToInt32(Session["SouthID"].ToString())); } //} else close } catch (Exception ex) { logger.Error(ex); } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { try { //this.getLoan(); txtid.Attributes.Add("readonly", "readonly"); if (Session[clsConstant.TOKEN] == null) { UrlParameterPasser urlWrapper = new UrlParameterPasser(); urlWrapper.Url = "../Logout.aspx"; urlWrapper.PassParameters(); } else { this.readRole(); //if (IsUpload == false) //{ // UrlParameterPasser urlWrapper = new UrlParameterPasser(); // urlWrapper.Url = "../Logout.aspx"; // urlWrapper.PassParameters(); //} //else //{ objEnt = new WorkShop(); workShopDetailsObj = new WorkShopDetailsWB(); objNomDetails = new NominationDetailsWB(); nomID = Session["NominationID"].ToString(); // nomID = Request.QueryString["nomI"]; objEnt = workShopDetailsObj.readerForWorkShop("", int.Parse(nomID)); lblNomination.Text = "<b/>" + objEnt.Topic.ToString(); lblSeats.Text = "" + objEnt.seats.ToString(); ViewState["iNominatedUserId"] = null; this.bindNominatedUser(Convert.ToInt32(Session["NominationID"].ToString())); // } } } catch (Exception ex) { logger.Error(ex); } } }
protected void grdWorkShopDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { objWork = new WorkShopDetailsWB(); try { //Storing the Row Index of Deleted Row int iNominationIDRowIndex = int.Parse(grdWorkShopDetails.DataKeys[e.RowIndex].Value.ToString()); if (grdWorkShopDetails.Rows.Count == 0) { lblMessage.Text = "No Information Available"; } //Function call for row delete if (objWork.deleteWorkShopDetails(iNominationIDRowIndex)) { UrlParameterPasser urlWrapper = new UrlParameterPasser("WorkshopDetailsListWB.aspx"); // Add some values urlWrapper.PassParameters(); } } catch (Exception ex) { logger.Error(ex); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { try { //this.getLoan(); txtid.Attributes.Add("readonly", "readonly"); if (Session[clsConstant.TOKEN] == null) { UrlParameterPasser urlWrapper = new UrlParameterPasser(); urlWrapper.Url = "../Logout.aspx"; urlWrapper.PassParameters(); } else { this.readRole(); if (IsUpload == false) { UrlParameterPasser urlWrapper = new UrlParameterPasser(); urlWrapper.Url = "../Logout.aspx"; urlWrapper.PassParameters(); } else { objEnt = new WorkShop(); workShopDetailsObj = new WorkShopDetailsWB(); objNomDetails = new NominationDetailsWB(); nomID = Session["StudyID"].ToString(); DataSet ds = new DataSet(); DataTable dt1 = new DataTable(); ds = (DataSet)Session["StudyDT"]; dt1 = ds.Tables[0]; for (int i = 0; i < dt1.Rows.Count; i++) { if (dt1.Rows[i]["iStudyTourID"].ToString() == nomID.ToString()) { lblNomination.Text = "<b/>" + dt1.Rows[i]["vsTopic"].ToString(); lblSeats.Text = "" + dt1.Rows[i]["iSeats"].ToString(); } } //ViewState["iStudyID"] = null; ViewState["iStudyID"] = nomID; string type = Convert.ToString(Session["VisitType"]); if (type == "1") { pnlEntry.Visible = true; pnlEntryForOutgoing.Visible = false; grdNominatedUserlistStudyOutgoing.Visible = false; grdNominatedUserlistStudy.Visible = true; this.bindNominatedUser(Convert.ToInt32(ViewState["iStudyID"].ToString())); } else { pnlEntryForOutgoing.Visible = true; pnlEntry.Visible = false; grdNominatedUserlistStudyOutgoing.Visible = true; grdNominatedUserlistStudy.Visible = false; this.bindNominatedUser2(Convert.ToInt32(ViewState["iStudyID"].ToString())); } } } } catch (Exception ex) { logger.Error(ex); } } }