Ejemplo n.º 1
0
        private bool ApplyFtp()
        {
            string ss = "select mkey,mvalue from dbo.ConSystem where mParentID=(select mid from dbo.ConSystem where mKey='FTP')";
            SqlConnection sc = MSSQLDB.CreateDBConnet();
            try {
                sc.Open();
                SqlCommand scmd = new SqlCommand(ss, sc);
                SqlDataAdapter sda = new SqlDataAdapter(scmd);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count == 4)
                {
                    string ftpAddress="", ftpPort="", ftpUser="", ftppassword="";
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr[0].ToString() == "Address")
                        {
                            ftpAddress = dr[1].ToString();
                            continue;
                        }
                        if (dr[0].ToString() == "Port")
                        {
                            ftpPort = dr[1].ToString();
                            continue;
                        }
                        if (dr[0].ToString() == "User")
                        {
                            ftpUser = dr[1].ToString();
                            continue;
                        }
                        if (dr[0].ToString() == "password")
                        {
                            ftppassword = dr[1].ToString();
                            continue;
                        }
                    }
                    if (ftpAddress.Length <= 0 || ftpPort.Length <= 0 || ftpUser.Length <= 0 || ftppassword.Length <= 0)
                    {

                    }
                    else
                    {//注意默认路径下,有xps和doc两个文件夹,分别对应原始和现在需要的文件,下载必须使用xps,否则客户端无法解读。
                        fw = new FtpWeb(ftpAddress, ftpPort, @"xps", ftpUser, ftppassword);
                        sc.Close();
                        return true;
                    }
                }
                sfailedopen = "FTP设置错误!";
                sc.Close();
                return false;
            }
            catch {}
            sfailedopen = MSSQLDB.error;
            return false;
        }
Ejemplo n.º 2
0
 //public Agendo(string sid, string sname,FtpWeb fw,MemoryStream ms)
 //{
 //    Init(sid, sname, fw);
 //    xpscontent = CreateXpsDocument(ms);
 //}
 //public Agendo(string sid, string sname, FtpWeb fw, string sContent)
 //{
 //    Init(sid, sname, fw);
 //    xpscontent = CreateXpsDocument(sContent);
 //}
 public Agendo(string sid, string sname, FtpWeb fw, IDocumentPaginatorSource ids, DateTime dtstart, DateTime dtend)
 {
     Init(sid, sname, fw);
     xpscontent = ids;
     initDatetime(dtstart, dtend);
 }
Ejemplo n.º 3
0
 public Agendo(string sid,string sname,FtpWeb fw)
 {
     Init(sid,sname,fw);
 }
Ejemplo n.º 4
0
 public Agendo(string sid,string sname,FtpWeb fw, IDocumentPaginatorSource Content)
 {
     Init(sid, sname, fw);
     xpscontent = Content;
 }
Ejemplo n.º 5
0
 private void Init(string sid, string sname, FtpWeb fw)
 {
     mId = sid;
     gfw = fw;
     name = sname;
 }