프로젝트

일반

사용자정보

개정판 74abcf6f

ID74abcf6f6a706ead3c5666b598790fadac032fbf
상위 d21e9c15
하위 77cdac33

김태성이(가) 3년 이상 전에 추가함

sign manager 추가

Change-Id: Ia511ce9bf05e3a238353a549118d3b29ab673aa0

차이점 보기:

KCOM_API/ServiceDeepView.svc.cs
2495 2495
        }
2496 2496

  
2497 2497
        [OperationContract]
2498
        public int SetSignData(string user_id,string SignStr)
2498
        public string GetSignStrokes(string project_no, string user_id)
2499
        {
2500
            string result = null;
2501
            try
2502
            {
2503
                string ifsign = getEnsembleSign(user_id);
2504
                if (string.IsNullOrEmpty(ifsign))
2505
                {
2506
                    string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2507
                    var ModelWFConnectionString = sCIConnString;
2508
                    if (null != ModelWFConnectionString)
2509
                    {
2510
                        using (CIEntities entity = new CIEntities(ModelWFConnectionString))
2511
                        {
2512
                            var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
2513
                            if (_sign.Count() > 0)
2514
                            {
2515
                                result = _sign.First().SIGN_STROKES;
2516
                            }
2517
                            else
2518
                            {
2519
                                return null;
2520
                            }
2521
                        }
2522
                    }
2523
                }
2524
                else
2525
                {
2526
                    result = ifsign;
2527
                }
2528

  
2529
            }
2530
            catch (Exception ex)
2531
            {
2532
                System.Diagnostics.Debug.WriteLine(ex);
2533
                return null;
2534
            }
2535
            return result;
2536
        }
2537

  
2538
        [OperationContract]
2539
        public int SetSignData(string user_id,string SignStr,int CropX,int CropY,int CropWidth,int CropHeight)
2499 2540
        {
2500 2541
            int result = -1;
2501 2542

  
......
2507 2548
                {
2508 2549
                    var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
2509 2550

  
2551
                    var cropImg = Convert.ToBase64String(SignatureCrop(SignStr, CropX, CropY, CropWidth, CropHeight));
2552

  
2510 2553
                    if (_sign.Count() > 0)
2511 2554
                    {
2512
                        _sign.First().SIGN_STR = SignStr;
2555
                        _sign.First().SIGN_STR = cropImg;
2513 2556
                        _sign.First().MODIFY_DATE = DateTime.Now;
2514 2557
                    }
2515 2558
                    else
......
2519 2562
                            ID = shortGuid(),
2520 2563
                            MEMBER_USER_ID = user_id,
2521 2564
                            CREATE_DATE = DateTime.Now,
2522
                            SIGN_STR = SignStr
2565
                            SIGN_STR = cropImg
2523 2566
                        });
2524 2567
                    }
2525 2568

  
......
2533 2576
            return result;
2534 2577
        }
2535 2578

  
2579

  
2580
        [OperationContract]
2581
        public int SetSignStrokes(string user_id, string strokesData)
2582
        {
2583
            int result = -1;
2584

  
2585
            try
2586
            {
2587
                string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString;
2588

  
2589
                using (CIEntities entity = new CIEntities(sCIConnString))
2590
                {
2591
                    var _sign = entity.SIGN_INFO.Where(sin => sin.MEMBER_USER_ID == user_id);
2592

  
2593
                    if (_sign.Count() > 0)
2594
                    {
2595
                        _sign.First().SIGN_STROKES = strokesData;
2596
                        _sign.First().MODIFY_DATE = DateTime.Now;
2597
                    }
2598
                    else
2599
                    {
2600
                        entity.SIGN_INFO.AddObject(new SIGN_INFO
2601
                        {
2602
                            ID = shortGuid(),
2603
                            MEMBER_USER_ID = user_id,
2604
                            CREATE_DATE = DateTime.Now,
2605
                            SIGN_STROKES = strokesData
2606
                    });
2607
                    }
2608

  
2609
                    result = entity.SaveChanges();
2610
                }
2611
            }
2612
            catch (Exception ex)
2613
            {
2614
                System.Diagnostics.Debug.WriteLine(ex);
2615
            }
2616
            return result;
2617
        }
2618

  
2619
        private byte[] SignatureCrop(string imgStr,int X,int Y,int Width,int Height)
2620
        {
2621
            using (System.IO.MemoryStream readStream = new System.IO.MemoryStream(Convert.FromBase64String(imgStr)))
2622
            {
2623
                using (System.Drawing.Image OriginalImage = System.Drawing.Image.FromStream(readStream))
2624
                {
2625
                    using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Width, Height))
2626
                    {
2627
                        bmp.SetResolution(OriginalImage.HorizontalResolution, OriginalImage.VerticalResolution);
2628
                        using (System.Drawing.Graphics Graphic = System.Drawing.Graphics.FromImage(bmp))
2629
                        {
2630
                            Graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
2631
                            Graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
2632
                            Graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
2633
                            Graphic.DrawImage(OriginalImage, new System.Drawing.Rectangle(0, 0, Width, Height), X, Y, Width, Height, System.Drawing.GraphicsUnit.Pixel);
2634
                            System.IO.MemoryStream ms = new System.IO.MemoryStream();
2635
                            bmp.Save(ms, OriginalImage.RawFormat);
2636
                            return ms.GetBuffer();
2637
                        }
2638
                    }
2639
                }
2640
            }
2641
        }
2642

  
2536 2643
        [OperationContract]        
2537 2644
        public string GetProjectName(string project_no)
2538 2645
        {

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)