Пример #1
0
        public static void UpLoadFile(byte[] bytes)
        {
            string SN  = "90E52F4D-BCA5-422F-897A-A8D3CEF35DBF"; //System.Configuration.ConfigurationManager.AppSettings["SN"];
            string MAC = "20:47:47:C8:CB:42";                    //System.Configuration.ConfigurationManager.AppSettings["MAC"];

            AuscultationService.AuscultationServiceClient remoteService = new AuscultationService.AuscultationServiceClient("WSHttpBinding_IAuscultationService");
            using (OperationContextScope scope = new OperationContextScope(remoteService.InnerChannel))
            {
                MessageHeader header = MessageHeader.CreateHeader("SN", "http://tempuri.org", SN);
                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                header = MessageHeader.CreateHeader("MAC", "http://tempuri.org", MAC);
                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                var root           = remoteService.GetRoot();
                var remoteFile     = Path.Combine(root, "AllFiles\\Remote\\" + DateTime.Now.Year + "\\" + DateTime.Now.Month);
                var guid           = Guid.NewGuid().ToString();
                var remoteFilePath = Path.Combine(remoteFile, guid.Substring(0, 6) + "\\_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + ".mp3");
                remoteService.UpLoadFile(remoteFilePath, 0, bytes);
                remoteService.Close();
            }
        }
Пример #2
0
        public static bool isUpdate()
        {
            string SN  = "90E52F4D-BCA5-422F-897A-A8D3CEF35DBF"; //System.Configuration.ConfigurationManager.AppSettings["SN"];
            string MAC = "20:47:47:C8:CB:42";                    //System.Configuration.ConfigurationManager.AppSettings["MAC"];

            AuscultationService.AuscultationServiceClient remoteService = new AuscultationService.AuscultationServiceClient("WSHttpBinding_IAuscultationService");
            using (OperationContextScope scope = new OperationContextScope(remoteService.InnerChannel))
            {
                MessageHeader header = MessageHeader.CreateHeader("SN", "http://tempuri.org", SN);
                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                header = MessageHeader.CreateHeader("MAC", "http://tempuri.org", MAC);
                OperationContext.Current.OutgoingMessageHeaders.Add(header);
                string sql = @"SELECT  Version FROM VersionMajor_Remote WHERE Enable=1";
                var    ds  = remoteService.ExecuteDataset(sql, null);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    var major = ds.Tables[0].Rows[0][0] + "";
                    remoteService.Close();
                    return(!major.Equals(Version));
                }
            }

            return(false);
        }