public void SendMessage_CarImageDelete() { BFService.BigFileService bs = new BigFileService(CarEnum.BigServiceSysID); DataTable dt = MySQL.ExecProc("usp_Car_ImageCanDelete", new string[] { }, out SQLExec, out SQLResult).Tables[0]; foreach (DataRow dr in dt.Rows) { try { if (dr["img"].ToString().Contains("big.tourzj.com")) { string bfid = dr["CarImg"].ToString().Substring(dr["CarImg"].ToString().LastIndexOf("/") + 1); bs.Delete(bfid); MySQL.ExecProc("usp_Car_ImageDelete", new string[] { dr["TableName"].ToString(), dr["ID"].ToString() }, out SQLExec, out SQLResult); } else { //进行本地的图片删除 } } catch { //此处应该做一个日志记录! } } }
public string SaveCarInfo(string DeviceName, string CarNo, string PassTime, string NoColor, string CarType, string CarDirection, string CarImg) { //调整算法,写入到临时表,使用任务此程序来处理所有数据 //if (CarNo == "无法识别") //{ // return ""; //} string carno = CarNo.Trim(); if (carno == "无车牌") { carno = "无法识别"; } string CarTypeASCII = ((int)CarType.ToUpper().ToCharArray()[0]).ToString(); //货车信息 //if (CarTypeASCII != "75" && CarTypeASCII != "88") //{ // return ""; //} string CarDirectionDB = CarDirection == "19" ? "0" : "1"; string imgurl = ""; #region 图片保存 if (!string.IsNullOrEmpty(CarImg)) { //imgurl = Base64ImgSave(CarImg); //图片服务器坏了!!! BFResult br = new BFResult(); try { byte[] bytes = Convert.FromBase64String(CarImg); BigFileService bs = new BigFileService(CarEnum.BigServiceSysID); br = bs.UpLoadALL("0", carno + "_" + PassTime + ".jpg", "image/jpeg", bytes, "1024", "768"); if (br.code == 1) { imgurl = "http://big.tourzj.com/bfinfo/GetFile/" + br.message; } //MemoryStream memStream = new MemoryStream(bytes); //BinaryFormatter binFormatter = new BinaryFormatter(); //Image img = (Image)binFormatter.Deserialize(memStream); } catch { } } #endregion MySQL.ExecProc("usp_Car_SaveTemp_Save", new string[] { DeviceName, CarNo, PassTime, NoColor, CarTypeASCII, CarDirectionDB, imgurl, null, null }, out SQLExec, out SQLResult); if (SQLExec) { return("保存成功"); } else { return(SQLResult); } }