Esempio n. 1
0
        /// <summary>
        /// 删除一条数据,及子表所有相关数据
        /// </summary>
        public bool Delete(int id)
        {
            List <string> sqllist = new List <string>();
            //删除管理角色权限
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from " + databaseprefix + "manager_role_value ");
            strSql.Append(" where role_id=@0");
            sqllist.Add(strSql.ToString());
            //删除管理角色
            StringBuilder strSql2 = new StringBuilder();

            strSql2.Append("delete from " + databaseprefix + "manager_role ");
            strSql2.Append(" where id=@0");
            sqllist.Add(strSql2.ToString());

            int rowsAffected = WriteDataBase.ExecuteSqlTran(sqllist, id);

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 执行插件SQL语句
        /// </summary>
        public bool ExeSqlStr(string dirPath, string xPath)
        {
            bool          result = true;
            int           count  = 0;
            List <string> ls     = ReadChildNodesValue(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING, xPath);

            if (ls != null)
            {
                using (IDbConnection conn = new DapperView().Context())
                {
                    using (IDbTransaction trans = conn.BeginTransaction())
                    {
                        try
                        {
                            count += WriteDataBase.ExecuteSqlTran(conn, trans, ls);
                            trans.Commit();
                            return(count > 0);
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            return(false);
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 执行插件SQL语句
        /// </summary>
        public bool ExeSqlStrs(string dirPath, string xPath)
        {
            bool          result = true;
            List <string> ls     = ReadChildNodesValue(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING, xPath);

            if (ls != null)
            {
                if (WriteDataBase.ExecuteSqlTran(ls) == 0)
                {
                    result = false;
                }
            }
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            List <string> sqllist = new List <string>();
            //删除规则内容表
            StringBuilder strSql2 = new StringBuilder();

            strSql2.Append("delete from " + databaseprefix + "weixin_request_content");
            strSql2.Append(" where rule_id=@0 ");
            sqllist.Add(strSql2.ToString());

            //删除规则主表
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from " + databaseprefix + "weixin_request_rule");
            strSql.Append(" where id=@0");
            sqllist.Add(strSql.ToString());

            return(WriteDataBase.ExecuteSqlTran(sqllist, id) > 0);
        }
Esempio n. 5
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            List <string> sqllist = new List <string>();
            //删除微信请求回复内容表
            StringBuilder strSql1 = new StringBuilder();

            strSql1.Append("delete " + databaseprefix + "weixin_request_content");
            strSql1.Append(" where account_id=@0");
            sqllist.Add(strSql1.ToString());

            //删除微信请求回复规格表
            StringBuilder strSql2 = new StringBuilder();

            strSql2.Append("delete " + databaseprefix + "weixin_request_rule");
            strSql2.Append(" where account_id=@0");
            sqllist.Add(strSql2.ToString());

            //删除微信公众平台回复信息表
            StringBuilder strSql3 = new StringBuilder();

            strSql3.Append("delete from " + databaseprefix + "weixin_response_content");
            strSql3.Append(" where account_id=@0");
            sqllist.Add(strSql3.ToString());

            //删除微信ACCESS TOKEN存储表
            StringBuilder strSql4 = new StringBuilder();

            strSql4.Append("delete from " + databaseprefix + "weixin_access_token");
            strSql4.Append(" where account_id=@0");
            sqllist.Add(strSql4.ToString());

            //删除微信公众号主表
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from " + databaseprefix + "weixin_account");
            strSql.Append(" where id=@0");
            sqllist.Add(strSql.ToString());

            return(WriteDataBase.ExecuteSqlTran(sqllist, id) > 0);
        }