internal WxSubscribeSource GetReserveproVerifywxqrcode(int comid, int qrcodeviewtype)
        {
            string sql = "select * from WxSubscribeSource where    comid=" + comid + " and qrcodeviewtype=" + qrcodeviewtype + " and comid>0 and qrcodeviewtype>0";
            var    cmd = sqlHelper.PrepareTextSqlCommand(sql);

            using (var reader = cmd.ExecuteReader())
            {
                WxSubscribeSource m = null;
                if (reader.Read())
                {
                    m = new WxSubscribeSource
                    {
                        Id                   = reader.GetValue <int>("id"),
                        Sourcetype           = reader.GetValue <int>("sourcetype"),
                        Activityid           = reader.GetValue <int>("activityid"),
                        Channelcompanyid     = reader.GetValue <int>("channelcompanyid"),
                        viewchannelcompanyid = reader.GetValue <int>("viewchannelcompanyid"),
                        Comid                = reader.GetValue <int>("comid"),
                        Ticket               = reader.GetValue <string>("ticket"),
                        Title                = reader.GetValue <string>("title"),
                        Qrcodeurl            = reader.GetValue <string>("qrcodeurl"),
                        Createtime           = reader.GetValue <DateTime>("createtime"),
                        Onlinestatus         = Convert.IsDBNull(reader.GetValue(9)) == true ? true : reader.GetValue <bool>("onlinestatus"),
                        Channelid            = reader.GetValue <int>("channelid"),
                        Productid            = reader.GetValue <int>("productid"),

                        qrcodeviewtype   = reader.GetValue <int>("qrcodeviewtype"),
                        projectid        = reader.GetValue <int>("projectid"),
                        wxmaterialtypeid = reader.GetValue <int>("wxmaterialtypeid"),
                        Wxmaterialid     = reader.GetValue <int>("Wxmaterialid"),
                    };
                }
                return(m);
            }
        }
        internal WxSubscribeSource GetWXSourceByChannelcompanyid(int channelcompanyid)
        {
            string sql = "select * from WxSubscribeSource where   sourcetype=2 and channelcompanyid=" + channelcompanyid + " and channelid=0 and onlinestatus=1  ";
            var    cmd = sqlHelper.PrepareTextSqlCommand(sql);

            using (var reader = cmd.ExecuteReader())
            {
                WxSubscribeSource m = null;
                if (reader.Read())
                {
                    m = new WxSubscribeSource
                    {
                        Id               = reader.GetValue <int>("id"),
                        Sourcetype       = reader.GetValue <int>("sourcetype"),
                        Activityid       = reader.GetValue <int>("activityid"),
                        Channelcompanyid = reader.GetValue <int>("channelcompanyid"),
                        Comid            = reader.GetValue <int>("comid"),
                        Ticket           = reader.GetValue <string>("ticket"),
                        Title            = reader.GetValue <string>("title"),
                        Qrcodeurl        = reader.GetValue <string>("qrcodeurl"),
                        Createtime       = reader.GetValue <DateTime>("createtime"),
                        Onlinestatus     = Convert.IsDBNull(reader.GetValue(9)) == true ? true : reader.GetValue <bool>("onlinestatus"),
                        Channelid        = reader.GetValue <int>("channelid"),
                        Productid        = reader.GetValue <int>("productid")
                    };
                }
                return(m);
            }
        }
Beispiel #3
0
        public int EditSubscribeSource(WxSubscribeSource source)
        {
            using (var helper = new SqlHelper())
            {
                var list = new InternalWxSubscribeSource(helper).EditSubscribeSource(source);

                return(list);
            }
        }
        internal int EditSubscribeSource(WxSubscribeSource source)
        {
            var cmd = sqlHelper.PrepareStoredSqlCommand("usp_InsertOrUpdateWxSubscribeSource");

            cmd.AddParam("@id", source.Id);
            cmd.AddParam("@sourcetype", source.Sourcetype);
            cmd.AddParam("@channelcompanyid", source.Channelcompanyid);
            cmd.AddParam("@activityid", source.Activityid);
            cmd.AddParam("@comid", source.Comid);
            cmd.AddParam("@ticket", source.Ticket);

            var parm = cmd.AddReturnValueParameter("ReturnValue");

            cmd.ExecuteNonQuery();
            return((int)parm.Value);
        }
        internal WxSubscribeSource Getchannelwxqrcodebychannelid(int channelid)
        {
            string sql = "select * from WxSubscribeSource where    channelid=" + channelid;

            //判断渠道是否有二维码
            int num = Getqrcodenumbychannelid(channelid);

            if (num == 0)
            {
                int isdefaultchannel = 0;
                int channelcompanyid = 0;
                //如果渠道是默认渠道,则查询门店二维码
                Member_Channel mcompany = new MemberChannelData().GetChannelDetail(channelid);
                if (mcompany != null)
                {
                    if (mcompany.Whetherdefaultchannel == 1)
                    {
                        isdefaultchannel = 1;
                        channelcompanyid = mcompany.Companyid;
                    }
                }

                if (isdefaultchannel == 1)
                {
                    sql = "select * from WxSubscribeSource where channelcompanyid=" + channelcompanyid + " and channelid=0 and channelcompanyid>0";
                }
            }


            var cmd = sqlHelper.PrepareTextSqlCommand(sql);

            using (var reader = cmd.ExecuteReader())
            {
                WxSubscribeSource m = null;
                if (reader.Read())
                {
                    m = new WxSubscribeSource
                    {
                        Id                   = reader.GetValue <int>("id"),
                        Sourcetype           = reader.GetValue <int>("sourcetype"),
                        Activityid           = reader.GetValue <int>("activityid"),
                        Channelcompanyid     = reader.GetValue <int>("channelcompanyid"),
                        viewchannelcompanyid = reader.GetValue <int>("viewchannelcompanyid"),
                        Comid                = reader.GetValue <int>("comid"),
                        Ticket               = reader.GetValue <string>("ticket"),
                        Title                = reader.GetValue <string>("title"),
                        Qrcodeurl            = reader.GetValue <string>("qrcodeurl"),
                        Createtime           = reader.GetValue <DateTime>("createtime"),
                        Onlinestatus         = Convert.IsDBNull(reader.GetValue(9)) == true ? true : reader.GetValue <bool>("onlinestatus"),
                        Channelid            = reader.GetValue <int>("channelid"),
                        Productid            = reader.GetValue <int>("productid"),

                        qrcodeviewtype   = reader.GetValue <int>("qrcodeviewtype"),
                        projectid        = reader.GetValue <int>("projectid"),
                        wxmaterialtypeid = reader.GetValue <int>("wxmaterialtypeid"),
                        Wxmaterialid     = reader.GetValue <int>("Wxmaterialid"),

                        choujiangactid = reader.GetValue <int>("choujiangactid"),
                    };
                }
                return(m);
            }
        }