public static int Delete(IEnumerable <long> ids)
        {
            if (ids?.Count() == 0)
            {
                return(0);
            }

            string sql =
                "Delete AdsStatisticsLabels Where ID In ({0})\n";

            int num = 0;

            using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(WebInfo.Conn)) {
                num = conn.Execute(string.Format(sql, string.Join(", ", ids)));
            }

            ParagraphDAO.DeleteBySourceNo(ids);

            return(num);
        }
Example #2
0
        public static int Delete(long id)
        {
            string sql =
                "Delete Pages Where NO IN (SELECT PageNo From Zones Where No IN (SELECT ZoneNo From Cards WHERE No IN (Select CardNo From ArticleIntro WHERE  ID={0})))\n" +
                "Delete Zones Where No IN (SELECT ZoneNo From Cards WHERE No IN (Select CardNo From ArticleIntro WHERE  ID={0}))\n" +
                "Delete Cards WHERE No IN (Select CardNo From Article WHERE ID={0}) \n" +
                "Delete ArticleIntro Where ID={0} \n";

            int num = 0;

            using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(WebInfo.Conn))
            {
                num = conn.Execute(string.Format(sql, id.ToString()));
            }
            long[] ids = new long[1] {
                id
            };
            ParagraphDAO.DeleteBySourceNo(ids.ToList());

            return(num);
        }
Example #3
0
        public static int Delete(IEnumerable <long> ids)
        {
            if (ids?.Count() == 0)
            {
                return(0);
            }

            string sql =
                "Delete Pages Where NO IN (SELECT PageNo From Zones Where No IN (SELECT ZoneNo From Cards WHERE No IN (Select CardNo From Article WHERE  ID IN ({0}))))\n" +
                "Delete Zones Where No IN (SELECT ZoneNo From Cards WHERE No IN (Select CardNo From Article WHERE  ID IN ({0})))\n" +
                "Delete Cards WHERE No IN (Select CardNo From Article WHERE  ID IN ({0}))\n" +
                "Delete Article Where ID In ({0})\n" +
                "Delete ArticleToPoster Where ArticleID In ({0})\n" +
                "Delete ArticleToType Where ArticleID In ({0})\n";

            int num = 0;

            using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(WebInfo.Conn)) {
                num = conn.Execute(string.Format(sql, string.Join(", ", ids)));
            }
            ParagraphDAO.DeleteBySourceNo(ids);

            return(num);
        }