public bool DelExist(string zid, string sid) { string st_ipc = string.Format("delete from st_ipc where ztid={0} and sid='{1}'", ztid, sid); string st_pa = string.Format("delete from st_pa where ztid={0} and sid='{1}'", ztid, sid); string st_pr = string.Format("delete from st_pr where ztid={0} and sid='{1}'", ztid, sid); string show_base = string.Format("delete from show_base where ztid={0} and sid='{1}'", ztid, sid); string st_iv = string.Format("delete from st_iv where ztid={0} and sid='{1}'", ztid, sid); string st_pns = string.Format("delete from st_pns where ztid={0} and sid='{1}'", ztid, sid); string st_ans = string.Format("delete from st_ans where ztid={0} and sid='{1}'", ztid, sid); string st_dmc = string.Format("delete from st_dc where ztid={0} and sid='{1}'", ztid, sid); string st_fml = string.Format("delete from st_fml where ztid={0} and sid='{1}'", ztid, sid); string st_dt = string.Format("delete from st_dt where ztid={0} and sid='{1}'", ztid, sid); using (MySqlConnection conn = MySqlDbAccess.GetMySqlConnection()) { conn.Open(); MySqlTransaction trans = conn.BeginTransaction(); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ipc); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pa); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pr); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, show_base); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_iv); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pns); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ans); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dmc); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_fml); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dt); trans.Commit(); } return(true); }
public static bool MovePt(string _strSid, string _strZid, string _strDesZtId) { bool bRs = false; string strSqlTmp = @"update show_base set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_ans set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_cpc set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_ct set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_dc set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_dt set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_ec set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_fml set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_ipc set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_iv set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_pa set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_pns set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_pr set ztid='{2}' where sid='{0}' and ztid={1};" + "update st_ztlist set app_sum=if(isnull(app_sum),1,app_sum-1) where id={1};" + "update st_ztlist set app_sum=if(isnull(app_sum),1,app_sum+1) where id={2};"; if (_strSid.Contains("','")) { int nCount = _strSid.Split(',').Count(); strSqlTmp = @"update show_base set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_ans set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_cpc set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_ct set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_dc set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_dt set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_ec set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_fml set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_ipc set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_iv set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_pa set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_pns set ztid='{2}' where sid in ({0}) and ztid={1};" + "update st_pr set ztid='{2}' where sid in ({0}) and ztid={1};" + string.Format("update st_ztlist set app_sum=if(isnull(app_sum),{0},app_sum-{0}) where id={1};", nCount, "{1}") + string.Format("update st_ztlist set app_sum=if(isnull(app_sum),{0},app_sum+{0}) where id={1};", nCount, "{2}"); } else { _strSid = _strSid.Replace("'", ""); } try { MySqlDbAccess.ExecNoQuery(CommandType.Text, string.Format(strSqlTmp, _strSid, _strZid, _strDesZtId)); bRs = true; } catch (Exception ex) { bRs = false; } return(bRs); }
/// <summary> /// 删除专题库 /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool DelZTDB(string ids) { if (MySqlDbAccess.ExecNoQuery(CommandType.Text, String.Format("update st_ztlist set isdel=1 where id in({0})", ids)).ToString() != "0") { return(true); } else { return(false); } }
/// <summary> /// 删除专题库 /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool DelZTDB(string id) { MySqlParameter parm = new MySqlParameter("?id", id); if (MySqlDbAccess.ExecNoQuery(CommandType.Text, "update st_ztlist set isdel=1 where id=?id", parm).ToString() == "0") { return(false); } else { return(true); } }
public static bool DelPt(string _strSid, string _strZid) { bool bRs = false; string strSqlTmp = @"delete from show_base where sid='{0}' and ztid={1};" + "delete from st_ans where sid='{0}' and ztid={1};" + "delete from st_cpc where sid='{0}' and ztid={1};" + "delete from st_ct where sid='{0}' and ztid={1};" + "delete from st_dc where sid='{0}' and ztid={1};" + "delete from st_dt where sid='{0}' and ztid={1};" + "delete from st_ec where sid='{0}' and ztid={1};" + "delete from st_fml where sid='{0}' and ztid={1};" + "delete from st_ipc where sid='{0}' and ztid={1};" + "delete from st_iv where sid='{0}' and ztid={1};" + "delete from st_pa where sid='{0}' and ztid={1};" + "delete from st_pns where sid='{0}' and ztid={1};" + "delete from st_pr where sid='{0}' and ztid={1};" + "update st_ztlist set app_sum=app_sum-1 where id={1};"; if (_strSid.Contains("','")) { int nCount = _strSid.Split(',').Count(); strSqlTmp = @"delete from show_base where sid in ({0}) and ztid={1};" + "delete from st_ans where sid in ({0}) and ztid={1};" + "delete from st_cpc where sid in ({0}) and ztid={1};" + "delete from st_ct where sid in ({0}) and ztid={1};" + "delete from st_dc where sid in ({0}) and ztid={1};" + "delete from st_dt where sid in ({0}) and ztid={1};" + "delete from st_ec where sid in ({0}) and ztid={1};" + "delete from st_fml where sid in ({0}) and ztid={1};" + "delete from st_ipc where sid in ({0}) and ztid={1};" + "delete from st_iv where sid in ({0}) and ztid={1};" + "delete from st_pa where sid in ({0}) and ztid={1};" + "delete from st_pns where sid in ({0}) and ztid={1};" + "delete from st_pr where sid in ({0}) and ztid={1};" + "update st_ztlist set app_sum=app_sum-" + nCount.ToString() + " where id={1};"; } try { MySqlDbAccess.ExecNoQuery(CommandType.Text, string.Format(strSqlTmp, _strSid, _strZid)); bRs = true; } catch (Exception ex) { bRs = false; } return(bRs); }
/// <summary> /// 修改专题库 /// </summary> /// <param name="id"></param> /// <param name="Name"></param> /// <param name="Desc"></param> /// <returns></returns> public static bool EditZTDB(string id, string Name, string Desc, string type) { MySqlParameter[] parms = new MySqlParameter[] { new MySqlParameter("?name", Name), new MySqlParameter("?des", Desc), new MySqlParameter("?id", id) }; if (MySqlDbAccess.ExecNoQuery(CommandType.Text, "update st_ztlist set name = ?name,des=?des where id=?id", parms) == 0) { return(false); } else { return(true); } }
public static bool UpdatePt(string _strId, string _strUpFileds, string _strTb) { bool bRs = false; string strSql = string.Format("update {0} set {1} where id={2}", _strTb, _strUpFileds, _strId); try { MySqlDbAccess.ExecNoQuery(CommandType.Text, strSql); bRs = true; } catch (Exception ex) { bRs = false; } return(bRs); }
public static bool DelKeyVal(int _nValID) { bool bRs = false; string strSqlTmp = @"delete from idx_val where id={0};" + "delete from idx_keyval where valid={0};"; try { MySqlDbAccess.ExecNoQuery(CommandType.Text, string.Format(strSqlTmp, _nValID)); bRs = true; } catch (Exception ex) { bRs = false; } return(bRs); }
/// <summary> /// 添加专题库 /// </summary> /// <param name="Name"></param> /// <param name="Desc"></param> /// <returns></returns> public static bool AddZTDB(string Name, string Desc, string type) { MySqlParameter[] parms = new MySqlParameter[] { new MySqlParameter("?name", Name), new MySqlParameter("?des", Desc), new MySqlParameter("?dbtype", type), new MySqlParameter("?createuserid", UserHelper.user.UserId), new MySqlParameter("?createtime", DateTime.Now.ToString()) }; if (MySqlDbAccess.ExecNoQuery(CommandType.Text, "insert into st_ztlist (name,des,dbtype,createuserid,createtime,isdel) values (?name,?des,?dbtype,?createuserid,?createtime,0)", parms) == 0) { return(false); } else { return(true); } }
/// <summary> /// 删除专题库 /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool DelZTDB(string ztid, string ztname) { //string st_ipc = string.Format("delete from st_ipc where ztid={0}", ztid); //string st_pa = string.Format("delete from st_pa where ztid={0}", ztid); //string st_pr = string.Format("delete from st_pr where ztid={0}", ztid); //string show_base = string.Format("delete from show_base where ztid={0}", ztid); //string st_iv = string.Format("delete from st_iv where ztid={0}", ztid); //string st_pns = string.Format("delete from st_pns where ztid={0}", ztid); //string st_ans = string.Format("delete from st_ans where ztid={0}", ztid); //string st_dmc = string.Format("delete from st_dc where ztid={0}", ztid); //string st_fml = string.Format("delete from st_fml where ztid={0}", ztid); //string st_dt = string.Format("delete from st_dt where ztid={0}", ztid); //string st_ztlist = string.Format("delete from st_ztlist where id={0}", ztid); string st_ztlist = string.Format("update st_ztlist set isdel=1 where id={0}", ztid); using (MySqlConnection conn = MySqlDbAccess.GetMySqlConnection()) { conn.Open(); MySqlTransaction trans = conn.BeginTransaction(); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ipc); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pa); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pr); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, show_base); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_iv); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pns); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ans); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dmc); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_fml); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dt); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ztlist); trans.Commit(); } log.Info("删除专题库:" + ztname + "\t成功\t" + DateTime.Now.ToString()); return(true); }