Example #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     //int imgCount = PreWarningResultDetailsQuery.ImgList.Count;
     try
     {
         var fileName = SaveBmp();
         if (!String.IsNullOrEmpty(fileName))
         {
             PreWarningResultDetailsQuery.ImgList.Add(fileName + ".jpg");
             var ent = new WarningImg();
             ent.FileName  = fileName + ".jpg";
             ent.Remarks   = "";
             ent.WarningId = _parent.warningId;
             ent.Img       = _parent.GetBytesByImagePath(fileName + ".jpg");
             if (!WarningImgBLL.IsRepeatWithWarningIdAndFileName(_parent.warningId, ent.FileName))
             {
                 WarningImgBLL.InsertWarningImg(ent);
             }
         }
     }
     catch (Exception)
     {
         Alert.alert("请先打开高拍仪,或检查高拍仪连接是否正确");
     }
 }
Example #2
0
        //向某预警信息添加图片
        public static bool InsertWarningImg(WarningImg ent)
        {
            StringBuilder sb = new StringBuilder();

            int length = 4;

            String[]    props     = new string[length];
            SqlDbType[] types     = new SqlDbType[length];
            Object[]    contents  = new Object[length];
            string      tableName = WarningImgDbConstNames.TABLE_NAME;

            props[0] = WarningImgDbConstNames.IMG_FILENAME;
            props[1] = WarningImgDbConstNames.WARNING_ID;
            props[2] = WarningImgDbConstNames.REMARKS;
            props[3] = WarningImgDbConstNames.IMG;

            types[0] = SqlDbType.VarChar;
            types[1] = SqlDbType.VarChar;
            types[2] = SqlDbType.VarChar;
            types[3] = SqlDbType.Image;


            contents[0] = ent.FileName;
            contents[1] = ent.WarningId;
            contents[2] = ent.Remarks;
            contents[3] = ent.Img;
            //sb.Append("INSERT INTO " + WarningImgDbConstNames.TABLE_NAME + "VALUES");
            //sb.Append("('" + ent.FileName + "','" + ent.WarningId + "','" + ent.Remarks + "',"")");

            ManageDataBase db = new
                                ManageDataBase(DATABASE_TYPE.WarningManagementDB);

            db.OperateDBWithPropertys(props,
                                      WarningImgDbConstNames.TABLE_NAME, length, types, contents);
            return(false);
        }