Example #1
0
        private bool GetPictures(string strNo)
        {
            string err = "";
            //string strSql = "select t.fb_image1, t.fb_image2 from dt_storageweightimage t where t.fs_weightno = '" + strNo + "'";

            DataTable ds = new DataTable();
            CoreClientParam ccp = new CoreClientParam();
            ccp.ServerName = "ygjzjl.statictrackweight.StaticWeight";
            ccp.MethodName = "queryImg";
            ccp.ServerParams = new object[] { strNo };

            ccp.SourceDataTable = ds;
            this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
            DataSet tp = CreateDataSet(ds);
            if (tp != null && tp.Tables.Count > 0 && tp.Tables[0].Rows.Count > 0)
            {
                DataTable table = tp.Tables[0];

                try
                {
                    byte[] Image1 = null;
                    byte[] Image2 = null;
                    byte[] Image3 = null;
                    byte[] Image4 = null;
                    Image1 = (byte[])table.Rows[0]["FB_IMAGE1"];
                    Image2 = (byte[])table.Rows[0]["FB_IMAGE2"];
                    Image3 = (byte[])table.Rows[0]["FB_IMAGE3"];
                    Image4 = (byte[])table.Rows[0]["FB_IMAGE4"];

                    BaseInfo GetImage = new BaseInfo();
                    GetImage.BitmapToImage(Image1, pictureBox1, pictureBox1.Width, pictureBox1.Height);
                    GetImage.BitmapToImage(Image2, pictureBox3, pictureBox3.Width, pictureBox3.Height);
                    GetImage.BitmapToImage(Image3, pictureBox4, pictureBox4.Width, pictureBox4.Height);
                    GetImage.BitmapToImage(Image4, pictureBox5, pictureBox5.Width, pictureBox5.Height);

                    return true;
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("图片显示出错!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //return false;
                    return true;
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(err))
                {
                    //MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //return false;
                    return true;
                }

                try
                {
                    Image image1 = pictureBox1.Image;
                    Image image2 = pictureBox3.Image;
                    Image image3 = pictureBox4.Image;
                    Image image4 = pictureBox5.Image;

                    if (image1 != null)
                    {
                        image1.Dispose();
                    }

                    if (image2 != null)
                    {
                        image2.Dispose();
                    }
                    if (image3 != null)
                    {
                        image3.Dispose();
                    }
                    if (image4 != null)
                    {
                        image4.Dispose();
                    }
                }
                catch { }
                finally
                {
                    pictureBox1.Image = null;
                    pictureBox3.Image = null;
                    pictureBox4.Image = null;
                    pictureBox5.Image = null;
                }
                //MessageBox.Show("没有找到计量图片数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                //return false;
                return true;
            }
        }
Example #2
0
        /// <summary>
        /// 查询图像
        /// </summary>
        private void GetImage(string WeightNo)
        {
            if (WeightNo.Length <= 0)
                return;
            BaseInfo GetImage = new BaseInfo();
            GetImage.QueryCorrentionImage(WeightNo);
            DataTable dtTP = GetImage.dtImage;
            if (dtTP.Rows.Count > 0)
            {
                byte[] Image1 = (byte[])dtTP.Rows[0]["FB_IMAGE1"];
                GetImage.BitmapToImage(Image1, pictureBox1, 704, 576);
            }
            else
            {
                pictureBox1.Image = null;

            }
        }
Example #3
0
        private bool GetPictures(string strNo)
        {
            return false;
            string err = "";
            string strSql = "select t.fb_image1, t.fb_image2 from dt_storageweightimage t where t.fs_weightno = '" + strNo + "'";

            DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataTable table = ds.Tables[0];

                try
                {
                    byte[] Image1 = (byte[])table.Rows[0]["FB_IMAGE1"];
                    byte[] Image2 = (byte[])table.Rows[0]["FB_IMAGE2"];

                    BaseInfo GetImage = new BaseInfo();
                    GetImage.BitmapToImage(Image1, pictureBox1, pictureBox1.Width, pictureBox1.Height);
                    GetImage.BitmapToImage(Image2, pictureBox2, pictureBox2.Width, pictureBox2.Height);

                    return true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ͼƬ��ʾ�����\n" + ex.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(err))
                {
                    MessageBox.Show("��ѯ�����\n" + err, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }

                try
                {
                    Image image1 = pictureBox1.Image;
                    Image image2 = pictureBox2.Image;

                    if (image1 != null)
                    {
                        image1.Dispose();
                    }

                    if (image2 != null)
                    {
                        image2.Dispose();
                    }
                }
                catch { }
                finally
                {
                    pictureBox1.Image = null;
                    pictureBox2.Image = null;
                }
                MessageBox.Show("û���ҵ�����ͼƬ���ݣ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return false;
            }
        }
Example #4
0
        private void ShowPic(string WeightNo)
        {
            if (WeightNo.Length <= 0)
               return;

               BaseInfo getImage = new BaseInfo();

               getImage.QueryPDImage(WeightNo);
               DataTable dtTP = getImage.dtImage;
               if (dtTP.Rows.Count > 0)
               {
               byte[] imagebytes1 = (byte[])dtTP.Rows[0]["FB_IMAGE1"];
               byte[] imagebytes2 = (byte[])dtTP.Rows[0]["FB_IMAGE2"];
               byte[] imagebytes3 = (byte[])dtTP.Rows[0]["FB_IMAGE3"];
               byte[] imagebytes4 = (byte[])dtTP.Rows[0]["FB_IMAGE4"];
               if (imagebytes3.Length > 1 && imagebytes4.Length >1)
               {
                   getImage.BitmapToImage(imagebytes1, pictureBox1, pictureBox1.Width, pictureBox1.Height);
                   getImage.BitmapToImage(imagebytes2, pictureBox2, pictureBox2.Width, pictureBox2.Height);
                   getImage.BitmapToImage(imagebytes3, pictureBox3, pictureBox3.Width, pictureBox3.Height);
                   getImage.BitmapToImage(imagebytes4, pictureBox4, pictureBox4.Width, pictureBox4.Height);
               }
               else
               {
                   getImage.BitmapToImage(imagebytes1, pictureBox1, pictureBox1.Width, pictureBox1.Height);
                   getImage.BitmapToImage(imagebytes2, pictureBox3, pictureBox3.Width, pictureBox3.Height);
               }
               }
               else
               {
               this.pictureBox1.Image = null;
               this.pictureBox2.Image = null;
               this.pictureBox3.Image = null;
               this.pictureBox4.Image = null;
               }
        }