public void UpdateMediaID(string updateValue, string wxstring) { MeidaInformation objMeida = JsonConvert.DeserializeObject <MeidaInformation>(wxstring); CRMLIBASHX obj = JsonConvert.DeserializeObject <CRMLIBASHX>(updateValue); DbConnection conn = CyDbConnManager.GetDbConnection("CRMDB"); try { conn.Open(); } catch (Exception e) { throw new MyDbException(e.Message, true); } CyQuery query = new CyQuery(conn); try { query.SQL.Text = "update WX_MEDIADY set MEDIA_ID=:MEDIA_ID where JLBH=:JLBH"; query.ParamByName("MEDIA_ID").AsString = objMeida.media_id; query.ParamByName("JLBH").AsInteger = obj.iJLBH; query.ExecSQL(); } catch (Exception e) { if (e is MyDbException) { throw e; } throw new MyDbException(e.Message, query.SqlText); } }
public override string DeleteNews(out string msg, string PUBLICID, string PUBLICIF, string updateValue, HttpContext context = null) { method = "POST"; Token = (new WX_Token()).getToken(PUBLICIF); Token1 oToken = new Token1(); oToken = JsonConvert.DeserializeObject <Token1>(Token); Url = "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token=" + oToken.result; string wxstring = WXRequestString(out msg, context, updateValue); if (msg.Length > 0) { WriteToLog(msg); } else { MeidaInformation objMeida = JsonConvert.DeserializeObject <MeidaInformation>(updateValue); DbConnection conn = CyDbConnManager.GetDbConnection("CRMDB"); try { conn.Open(); } catch (Exception e) { throw new MyDbException(e.Message, true); } CyQuery query = new CyQuery(conn); try { query.SQL.Text = "delete from WX_MEDIADY where MEDIA_ID=:MEDIA_ID"; query.ParamByName("MEDIA_ID").AsString = objMeida.media_id; query.ExecSQL(); query.SQL.Text = "delete from WX_NEWSDY_ITEM where JLBH=(select JLBH from WX_MEDIADY where MEDIA_ID=:MEDIA_ID)"; query.ParamByName("MEDIA_ID").AsString = objMeida.media_id; query.ExecSQL(); } catch (Exception e) { if (e is MyDbException) { throw e; } throw new MyDbException(e.Message, query.SqlText); } } return(wxstring); }