Exemple #1
0
        private void OnPhotoBtnClick(object sender, EventArgs e)
        {
            SortedList sortedList = new SortedList();

            sortedList.Add("type", GetUploadType());
            sortedList.Add("pack_id", _objectId);
            sortedList.Add("pack_barcode", BarCode);

            HCSCM_set_image addNewImage = new HCSCM_set_image(sortedList);

            //获取一个值,指是否在Windows任务栏中显示窗体。
            addNewImage.ShowInTaskbar = false;
            if (addNewImage.ShowDialog() == DialogResult.OK)
            {
                string imageName = string.Format("{0}{1}.jpg", _imageNamePrefix, addNewImage.ImageData01.Name);
                int    rowIndex  = pictureGrid.Rows.Add();
                pictureGrid.Rows[rowIndex].Cells["idCol"].Value          = pictureGrid.RowCount;
                pictureGrid.Rows[rowIndex].Cells["pictureNameCol"].Value = string.Format("图片{0}", pictureGrid.RowCount);
                if (addNewImage.ImageData01 != null)
                {
                    pictureGrid.Rows[rowIndex].Cells["imageNameCol"].Value = imageName;
                }
                pictureGrid.Rows[rowIndex].Cells["imageCol"].Value       = addNewImage.PrictureView.Image;
                pictureGrid.Rows[rowIndex].Cells["uploadStateCol"].Value = "上传完成";
                pictureGrid.Rows[rowIndex].Cells["imageStateCol"].Value  = 8;
                picturePreview.Images = new List <Image>()
                {
                    addNewImage.PrictureView.Image
                };
                SortedList sqlParameters = new SortedList();
                SortedList imageItem     = new SortedList();
                sqlParameters.Add(1, imageItem);
                imageItem.Add(1, imageName);
                imageItem.Add(2, string.Format("{0}.jpg", addNewImage.ImageData01.Name));
                CnasRemotCall remoteCall = new CnasRemotCall();
                string        testSql    = remoteCall.RemotInterface.CheckUPDataList("HCS_image_up001", sqlParameters);
                int           result     = remoteCall.RemotInterface.UPDataList("HCS_image_up001", sqlParameters);
            }
        }
        /// <summary>
        /// 拍照
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void but_media_Click(object sender, EventArgs e)
        {
            if (dgv_01.SelectedRows.Count > 0)
            {
                SortedList sortedList = new SortedList();

                //设置一个类型"xxx/"
                sortedList.Add("type", "3");
                //包ID
                sortedList.Add("pack_id", this.dgv_01.SelectedRows[0].Cells["id"].Value);
                //包的条码
                sortedList.Add("pack_barcode", "");

                HCSCM_set_image HCSCM_pack_image = new HCSCM_set_image(sortedList);
                //获取一个值,指是否在Windows任务栏中显示窗体。
                HCSCM_pack_image.ShowInTaskbar = false;
                HCSCM_pack_image.ShowDialog();
            }
            else
            {
                MessageBox.Show("请选择一行数据", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }