Exemplo n.º 1
0
        private void SaveSnapParaToDB()
        {
            //string LockID = MyLockIDStr;
            //string SnapUUID = MyAutoFileNameStr;

            SnapID = 0;

            SnapImage MySnapImage = new SnapImage();

            MySnapImage.LockID     = this.MyLockIDStr;
            MySnapImage.SnapTypeID = this.SnapTypeID;
            MySnapImage.SnapUUID   = MyAutoFileNameStr;

            SnapManager MySnapManager = new SnapManager();
            int         ReturnValue   = MySnapManager.InsertSnap(MySnapImage, ref SnapID);

            if (ReturnValue == 0)
            {
                string MyTimeMarker = string.Format("{0:MM-dd HH:mm:ss}", DateTime.Now) + ":" + DateTime.Now.Millisecond.ToString();// + "[" + DateTime.Now.Ticks.ToString() + "]";
                this.MyAsynchLockServerSocketService.DisplayResultInfor(1, string.Format(MyTimeMarker + "锁端[{0}][{1}]扩展保存参数到数据库成功", MyLockIDStr, MyReadWriteChannel.MyTCPClient.Client.RemoteEndPoint));
            }
            else
            {
                string MyTimeMarker = string.Format("{0:MM-dd HH:mm:ss}", DateTime.Now) + ":" + DateTime.Now.Millisecond.ToString();// + "[" + DateTime.Now.Ticks.ToString() + "]";
                this.MyAsynchLockServerSocketService.DisplayResultInfor(1, string.Format(MyTimeMarker + "锁端[{0}][{1}]扩展保存参数到数据库失败", MyLockIDStr, MyReadWriteChannel.MyTCPClient.Client.RemoteEndPoint));
            }
        }
Exemplo n.º 2
0
        static void server_SnapMailMergeRecordStarted(object sender, SnapMailMergeRecordStartedEventArgs e)
        {
            if (e.RecordIndex == 3)
            {
                for (int i = 0; i < e.RecordDocument.Fields.Count; i++)
                {
                    DevExpress.XtraRichEdit.API.Native.Field item = e.RecordDocument.Fields[i];
                    SnapImage snImage = e.RecordDocument.ParseField(item) as SnapImage;
                    if (snImage != null)
                    {
                        if (snImage.DataFieldName == "Picture")
                        {
                            snImage.BeginUpdate();
                            snImage.ScaleX = snImage.ScaleX * 2;
                            snImage.ScaleY = snImage.ScaleY * 2;
                            snImage.EndUpdate();
                            item.Update();
                        }
                    }
                }
                e.RecordDocument.EndUpdate();

                // Another code snippet for the same result:
                //e.RecordDocument.Fields[2].ShowCodes = true;
                //e.RecordDocument.Replace(e.RecordDocument.Fields[2].CodeRange, @"SNIMAGE Picture \sy 20000 \sx 20000");
                //e.RecordDocument.Fields[2].Update();
            }
        }
Exemplo n.º 3
0
        private Image LoadImage(SnapImage sshot)
        {
            byte[] bsImage = null;
            string path    = Path.Combine(DataPath, sshot.SessionId + ".rdt");

            if (File.Exists(path))
            {
                using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    using (BinaryReader br = new BinaryReader(fs))
                    {
                        br.BaseStream.Seek(sshot.ImagePos, SeekOrigin.Begin);
                        bsImage = br.ReadBytes(sshot.ImageLength);
                    }
            }

            Image img = null;

            if (bsImage != null && bsImage.Length > 0)
            {
                using (MemoryStream ms = new MemoryStream(bsImage))
                    img = Image.FromStream(ms);
            }
            return(img);
        }