Ejemplo n.º 1
0
        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();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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";
                    }
                }
            }
        }
        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);
                }
            }
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }