Beispiel #1
0
    private void GetUploadedFiles(string pono, string type)
    {
        try
        {
            string    decrypt_Str = crypt.Decryptdata(pono);
            string    isdata      = string.Empty;
            string    path        = (string)ActionController.ExecuteAction("", "Early_Payment_Request.aspx", "getpath", ref isdata, type);
            string    val         = decrypt_Str + ".pdf";
            WebClient client      = new WebClient();
            string[]  extension   = val.Split(".".ToCharArray());
            //Byte[] buffer = null;
            Byte[] buffer = client.DownloadData("http://" + path + val);

            /*Byte[] buffer = null;
             * if(type!="PO")
             * {
             *  buffer = client.DownloadData("http://200.200.200.43/PO/"+ val);
             * }
             * else
             * {
             *
             *  buffer = client.DownloadData("http://200.200.200.43/Challan/2016/Roha/"+ val);
             * }*/
            //Byte[] buffer = client.DownloadData("http://200.200.200.43/PO/"+ val);
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("content-length", buffer.Length.ToString());
            HttpContext.Current.Response.BinaryWrite(buffer);
        }
        catch (Exception ex)
        {
            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + ex.ToString() + "');}</script>");
            FSL.Logging.Logger.WriteEventLog(false, ex);
        }
    }
    private void GetUploadedFiles(string pono, string type)
    {
        try
        {
            string decrypt_Str = crypt.Decryptdata(pono);
            string isdata      = string.Empty;
            string path        = (string)ActionController.ExecuteAction("", "Early_Payment_Request.aspx", "getpath", ref isdata, type);
            //path=@"\\\\200.200.200.43\\Vendor Portal\\PO";
//Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('"+path+"');}</script>");
//MsgBox.Show(@"\\\\200.200.200.43\\Vendor Portal\\PO\\4500196834.pdf");
            //Response.Redirect("file://200.200.200.43/Vendor%20Portal/PO/4500196834.pdf",false);
            //          Response.Redirect(@"file:\\200.200.200.43\Vendor%20Portal\PO\4500196834.pdf");
            path = "file://" + path.Replace("\\", "//");
            path = path.Replace("//", "/");
            path = path.Replace("///", "//");

            string val = decrypt_Str + ".pdf";

            WebClient client = new WebClient();
            Byte[]    buffer = client.DownloadData(path + val);
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("content-length", buffer.Length.ToString());
            HttpContext.Current.Response.BinaryWrite(buffer);

/*            if (Directory.Exists(path))
 *          {
 *              if (File.Exists(@"" + path + "" + decrypt_Str + ".pdf"))
 *              {
 *                  string[] FileNames = Directory.GetFiles(path);
 *                  WebClient client = new WebClient();
 *                  string val = decrypt_Str + ".pdf";
 *                  string[] extension = val.Split(".".ToCharArray());
 *                  Byte[] buffer = client.DownloadData(path + val);
 *                  HttpContext.Current.Response.ContentType = "application/pdf";
 *                  HttpContext.Current.Response.AddHeader("content-length", buffer.Length.ToString());
 *                  HttpContext.Current.Response.BinaryWrite(buffer);
 *              }
 *              else
 *              {
 *                  Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('File Does Not Exists');}</script>");
 *              }
 *          }
 *          else
 *          {
 *              Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Directory Does Not Exists');}</script>");
 *          }*/
        }
        catch (Exception ex)
        {
            FSL.Logging.Logger.WriteEventLog(false, ex);
        }
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(Bank_Voucher));
            if (!Page.IsPostBack)
            {
                if (Convert.ToString(Request.QueryString["P"]) != "" && Convert.ToString(Request.QueryString["R"]) != "")
                {
                    string process_name = Convert.ToString(Request.QueryString["P"]);
                    string req_no       = Convert.ToString(Request.QueryString["R"]);
                    //string process_name = "T1RIRVIgRVhQRU5TRVM=";
                    //string req_no = "T0UtMjAxNjE3LTI=";

                    process_name = crypt.Decryptdata(process_name);
                    req_no       = crypt.Decryptdata(req_no);
                    bindData(process_name, req_no);
                }
            }
        }
        catch (Exception Exc) { FSL.Logging.Logger.WriteEventLog(false, Exc); }
    }