Esempio n. 1
0
 public static object GetOne(string bll, string Exc, object[] par)
 {
     //ChatCallBack callBack = new ChatCallBack();
     //InstanceContext instance = new InstanceContext(callBack);
     ServiceReference1.FileTransportServiceClient ft = new ServiceReference1.FileTransportServiceClient();
     try
     {
         return(ft.GetOne(bll, Exc, par));
     }
     finally
     {
         ft.Close();
     }
 }
Esempio n. 2
0
        public static int UpOrAdd(string bll, DataTable dt)
        {
            ServiceReference1.FileTransportServiceClient ft = new ServiceReference1.FileTransportServiceClient();
            try
            {
                DataRow[]     drs = dt.Select("(A>1)");
                StringBuilder ss  = new StringBuilder();

                for (int j = 0; j < drs.Length; j++)
                {
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        //ss.Append(i);
                        //ss.Append("ю");
                        ss.Append(drs[j][i].ToString());
                        ss.Append("ж");
                    }
                    ss.Append("й");
                }

                MemoryStream ms = new MemoryStream();
                StreamWriter sw = new StreamWriter(ms);
                sw.Write(ss.ToString());
                sw.Close();
                byte[] bsrc = ms.ToArray();
                ms.Close();
                ms.Dispose();
                ms          = new MemoryStream();
                ms.Position = 0;
                // 压缩数组序列并返回压缩后的数组
                DeflateStream zipStream = new DeflateStream(ms, CompressionMode.Compress);
                zipStream.Write(bsrc, 0, bsrc.Length);
                zipStream.Close();
                zipStream.Dispose();
                return(Convert.ToInt32(ft.GetOne(bll, "UpOrAdd", new object[] { ms.ToArray() })));
            }
            finally
            {
                ft.Close();
            }
        }