Esempio n. 1
0
        internal int Editwxadimage(WxAdImages adinfo)
        {
            try
            {
                string sql = "";
                sqlHelper.BeginTrancation();
                if (adinfo.Id > 0)
                {
                    sql = "update weixin_ad_images set adid=" + adinfo.Adid + ",imageid=" + adinfo.Imageid + ",link='" + adinfo.Link + "',sort=" + adinfo.Sort + " where id=" + adinfo.Id;
                }
                else
                {
                    sql = "INSERT INTO weixin_ad_images(adid,imageid,link)" +
                          " VALUES(" + adinfo.Adid + "," + adinfo.Imageid + ",'" + adinfo.Link + "')";
                }

                var cmd = sqlHelper.PrepareTextSqlCommand(sql);
                cmd.ExecuteNonQuery();

                sqlHelper.Commit();
                sqlHelper.Dispose();
                return(1);
            }
            catch
            {
                sqlHelper.Rollback();
                sqlHelper.Dispose();
                return(0);
            }
        }
Esempio n. 2
0
 public int Editwxadimage(WxAdImages adinfo)
 {
     using (var helper = new SqlHelper())
     {
         int r = new InternalWxAdImages(helper).Editwxadimage(adinfo);
         return(r);
     }
 }
Esempio n. 3
0
        internal WxAdImages Getwxadimages(int id, int aid)
        {
            string sql = "SELECT    *  FROM weixin_ad_images where id=" + id;
            var    cmd = sqlHelper.PrepareTextSqlCommand(sql);

            using (var reader = cmd.ExecuteReader())
            {
                WxAdImages m = null;
                if (reader.Read())
                {
                    m = new WxAdImages()
                    {
                        Id      = reader.GetValue <int>("id"),
                        Adid    = reader.GetValue <int>("Adid"),
                        Imageid = reader.GetValue <int>("imageid"),
                        Link    = reader.GetValue <string>("link"),
                        Sort    = reader.GetValue <int>("sort"),
                    };
                }
                return(m);
            }
        }