예제 #1
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "DownloadFront")
            {
                string        k_id = e.CommandArgument.ToString();
                SqlDataReader sdr  = uc.GetFileFront(k_id);

                if (sdr.HasRows)
                {
                    sdr.Read();
                    string file = sdr["k_frontPath"].ToString();
                    Response.Redirect("http://www.stayello.com/" + file + "");
                }
                else
                {
                    string text = "File Not Uploded";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false);
                }
            }
            else if (e.CommandName == "DownloadBack")
            {
                string        k_id = e.CommandArgument.ToString();
                SqlDataReader sdr  = uc.GetFileFront(k_id);

                if (sdr.HasRows)
                {
                    sdr.Read();
                    string file = sdr["k_BackPath"].ToString();
                    Response.Redirect("http://www.stayello.com/" + file + "");
                }
                else
                {
                    string text = "File Not Uploded";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false);
                }
            }
        }
        catch (Exception ex)
        {
            string text = ex.Message.ToString();
            ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false);
        }
    }