免费服务热线:400-016-7107
在线客服为您服务

免费服务热线

400-016-7107

工作时间

周一至周五 9:00-18:00

(12:00-13:30及法定假日除外)

SAP Business One浏览器扩展组件-代码样本

时间:2018-09-14
分享到 :

SAP Business One浏览器扩展组件-代码样本

上传和下载文件

if (SBO_Application.ClientType == BoClientType.ct_Browser)

{

    string path = null;

    try

    {

        path = SBO_Application.GetFileFromBrowser();

        using (FileStream fs = File.Open(path, FileMode.Open))

        {

            //read the file

        }

    }

    catch (Exception ex)

    {

        //exception handling

    }

 

    try

    {

        bool isSucceed = SBO_Application.SendFileToBrowser(path);

    }

    catch (Exception ex)

    {

        //exception handling

    }

}

else if(SBO_Application.ClientType == BoClientType.ct_Desktop)

{

    System.IO.Stream readStream = null;

    OpenFileDialog openFileDialog1 = new OpenFileDialog();

    if (openFileDialog1.ShowDialog() == DialogResult.OK)

    {

        try

        {

            if ((readStream = openFileDialog1.OpenFile()) != null)

            {

                using (readStream)

                {

                    //read the file

                }

            }

        }

        catch (Exception ex)

        {

            //exception handling

        }

    }

 

    SaveFileDialog saveFileDialog1 = new SaveFileDialog();

    System.IO.Stream writeStream = null;

    if (saveFileDialog1.ShowDialog() == DialogResult.OK)

    {

        try

        {

            if ((writeStream = saveFileDialog1.OpenFile()) != null)

            {

                using (writeStream)

                {

                    //write the file

                }

            }

        }

        catch (Exception ex)

        {

            //exception handling

        }

    }

}


TransInfo斯凯普斯是SAP制造业解决方案核心合作伙伴,SAP金牌实施商专注上海/无锡/苏州/广州/深圳/东莞/成都等地SAP ERP软件SAP制造业ERP软件、 电子制造ERP医药行业ERP精细化工ERP机械制造设备行业ERP实施服务