Пример #1
0
        /// <summary>
        /// Grid Data 선택
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridMain_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int rowHandle = gridMainView.GetRowHandleByMouseEventArgs(e);

            if (rowHandle == GridControl.InvalidRowHandle)
            {
                return;
            }

            if (gridMain.IsGroupRowHandle(rowHandle))
            {
                return;
            }                                                    // A group row has been double clicked

            EmsPartInfo target = gridMain.SelectedItem as EmsPartInfo;

            if (null != target)
            {
                if ("A" == target.ORDER_DEV)
                {
                    EqpPartEdit(target.PART_CLS_ID, target.PART_CLS_NM);
                }
                else
                {
                    EqpPartEdit(target.PART_CLS_ID, target.PART_CLS_NM, target.PART_ID);
                }
            }
        }
Пример #2
0
        private void btnRegist_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            try
            {
                EmsPartInfo target = gridMain.SelectedItem as EmsPartInfo;

                if (null != target)
                {
                    EqpPartEdit(target.PART_CLS_ID, target.PART_CLS_NM);
                }
                else
                {
                    EqpPartEdit("", "");
                }
            }
            catch (Exception err)
            {
                this.BaseClass.Error(err);
            }
        }
        /// <summary>
        /// Part Info Sel
        /// </summary>
        private void PartInfoSel()
        {
            try
            {
                //var _USER_ID = this.BaseInfo.user_id.ToString();

                var param = new Dictionary <string, object>
                {
                    { "P_CENTER_CD", this.BaseClass.CenterCD },
                    { "P_PART_ID", TargetPartID }
                };

                var    strOutParam = new[] { "P_EMS_PART_INFO" };
                string callProc    = "PK_EMS_EBSE006_01P.SP_EMS_PART_INFO_SEL";

                using (BaseDataAccess da = new BaseDataAccess())
                {
                    var outData = da.GetSpDataSet(
                        callProc                                  // 호출 프로시저
                        , param                                   // Input 파라메터
                        , strOutParam                             // Output 파라메터
                        );

                    if (outData.Tables[0].Rows.Count > 0)
                    {
                        var info = new ObservableCollection <EmsPartInfo>();
                        info.ToObservableCollection(outData.Tables[0]);

                        CurrPartInfo          = info[0];
                        CurrPartInfo.IsUpdate = true;

                        _imageId = (null == CurrPartInfo.PART_IMG_FILE_ID) ? "" : CurrPartInfo.PART_IMG_FILE_ID;

                        if (!string.IsNullOrEmpty(_imageId))
                        {
                            string aDown = _imageId + ".jpg";

                            string path = System.IO.Path.GetDirectoryName(
                                Environment.GetFolderPath(
                                    Environment.SpecialFolder.Personal));

                            path = System.IO.Path.Combine(path, "Downloads\\");

                            try
                            {
                                WebClient myWebClient = new WebClient();

                                myWebClient.DownloadFile(EmsSession.Instance.FileDownloadUrl + aDown, path + aDown);

                                myWebClient.Dispose();

                                if (null != _imageStream)
                                {
                                    _imageStream.Close();
                                    _imageStream = null;
                                }

                                // FileStream to get the Photo
                                FileStream fs;

                                // Get Image Data from the Filesystem if User has loaded a Photo
                                fs           = new FileStream(path + aDown, FileMode.Open, FileAccess.Read);
                                _imageLength = (int)fs.Length;

                                // Create a byte array of file stream length
                                _imageData = new byte[fs.Length];

                                // Read block of bytes from stream into the byte array
                                fs.Read(_imageData, 0, System.Convert.ToInt32(fs.Length));

                                // Close the File Stream
                                fs.Close();

                                var imageSource = new BitmapImage();

                                // Get the primitive byte data into in-memory data stream
                                _imageStream = new MemoryStream(_imageData);
                                imageSource.BeginInit();
                                imageSource.StreamSource = _imageStream;
                                imageSource.EndInit();

                                // Assign the Source property of your image
                                imgPartImage.Source = imageSource as ImageSource;
                            }
                            catch (Exception)
                            {
                                this.BaseClass.MsgError("ERR_FAIL_IMG_TRANS");
                            }
                        }

                        tbxPartId.Text = CurrPartInfo.PART_ID;
                        tbxPartNm.Text = CurrPartInfo.PART_NM;

                        tbxPartMnfact.Text = CurrPartInfo.PART_MNFACT;
                        tbxPbsStnd.Text    = CurrPartInfo.PART_STND;
                        tbxInstModel.Text  = CurrPartInfo.PART_MODEL;
                        tbxPurchNm.Text    = CurrPartInfo.PURCH_NM;

                        tbxLifrCle.Text     = CurrPartInfo.LIFE_CLE.ToString();
                        tbxAlmLeadTime.Text = CurrPartInfo.ALM_LEAD_TIME.ToString();

                        tbxPartClsId.Text = CurrPartInfo.PART_CLS_NM;
                        tbxPartClsId.Tag  = CurrPartInfo.PARENT_ID;

                        rbStokMngY.IsChecked = "Y" == CurrPartInfo.STOCK_MNG_YN;
                        rbStokMngN.IsChecked = !rbStokMngY.IsChecked.Value;

                        if (null != CurrPartInfo.PART_IMG)
                        {
                            _imageData = CurrPartInfo.PART_IMG.ToArray();

                            var imageSource = new BitmapImage();

                            // Get the primitive byte data into in-memory data stream
                            _imageStream = new MemoryStream(CurrPartInfo.PART_IMG);
                            imageSource.BeginInit();
                            imageSource.StreamSource = _imageStream;
                            imageSource.EndInit();

                            // Assign the Source property of your image
                            imgPartImage.Source = imageSource as ImageSource;
                        }

                        info.Clear();
                        info = null;
                    }
                    else
                    {
                        CurrPartInfo       = new EmsPartInfo();
                        CurrPartInfo.IsNew = true;
                    }
                }
            }
            catch (Exception ex)
            {
                this.BaseClass.Error(ex);
                this.BaseClass.MsgError(ex.Message, BaseEnumClass.CodeMessage.MESSAGE);
            }
        }