Esempio n. 1
0
        public tb_MaterialExtEntity GetMaterialExtByCustomReply(string weixincode, string keyword)
        {
            tb_MaterialExtEntity tb_MaterialExtEntity = new tb_MaterialExtEntity();

            tb_MaterialExtEntity = tb_CustomReplydal.GetMaterialExtByCustomReply(weixincode, keyword);
            return(tb_MaterialExtEntity);
        }
Esempio n. 2
0
        public tb_MaterialExtEntity GetMaterialExtByToolbar(string weixincode, string eventkey)
        {
            tb_MaterialExtEntity tb_MaterialExtEntity = new tb_MaterialExtEntity();

            tb_MaterialExtEntity = tb_Toolbardal.GetMaterialExtByToolbar(weixincode, eventkey);
            return(tb_MaterialExtEntity);
        }
Esempio n. 3
0
        public Jnwf.Model.tb_MaterialExtEntity GetMaterialExt(int materialid)
        {
            tb_MaterialExtEntity Obj = new tb_MaterialExtEntity();

            SqlParameter[] _param =
            {
                new SqlParameter("@materialid", SqlDbType.Int)
            };
            _param[0].Value = materialid;

            string sqlStr = "select * from tb_Material where ID=@materialid and Status=1";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.weixinRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    Obj = Populate_tb_MaterialExtEntity_FromDr(dr);
                }
            }

            string sqlStr2 = "select * from tb_MaterialContent where MaterialID=@materialid ";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.weixinRW, CommandType.Text, sqlStr2, _param))
            {
                while (dr.Read())
                {
                    Obj.list.Add(Populate_tb_MaterialContentEntity_FromDr(dr));
                }
            }
            return(Obj);
        }
Esempio n. 4
0
        public IList <tb_MaterialExtEntity> Get_tb_MaterialList(string weixincode)
        {
            IList <tb_MaterialAllEntity> Obj = new List <tb_MaterialAllEntity>();
            IList <tb_MaterialExtEntity> ext = new List <tb_MaterialExtEntity>();

            SqlParameter[] _param =
            {
                new SqlParameter("@WeiXinCode", SqlDbType.VarChar)
            };
            _param[0].Value = weixincode;
            string sqlStr = "select a.ID,a.UserID,a.WeiXinCode,a.TypeID,a.Status,a.AddTime, b.MaterialID, b.Title, b.Author, b.Description, b.ImageUrl, b.TextContent, b.Url, b.OrderBy from tb_Material a inner join tb_MaterialContent b on a.ID=b.MaterialID where a.WeiXinCode=@WeiXinCode and a.Status=1 and a.TypeID in (2,3)";

            using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.weixinRW, CommandType.Text, sqlStr, _param))
            {
                while (dr.Read())
                {
                    Obj.Add(Populate_tb_MaterialAllEntity_FromDr(dr));
                }
            }
            //return Obj;

            List <tb_MaterialAllEntity> list = Obj as List <tb_MaterialAllEntity>;

            if (list != null)
            {
                foreach (IGrouping <int, tb_MaterialAllEntity> arr in list.GroupBy(c => c.ID))
                {
                    tb_MaterialExtEntity e = new tb_MaterialExtEntity();

                    foreach (tb_MaterialAllEntity m in arr)
                    {
                        e.ID         = m.ID;
                        e.UserID     = m.UserID;
                        e.WeiXinCode = m.WeiXinCode;
                        e.TypeID     = m.TypeID;
                        e.Status     = m.Status;
                        e.AddTime    = m.AddTime;

                        e.list.Add(new tb_MaterialContentEntity()
                        {
                            MaterialID  = m.MaterialID,
                            Title       = m.Title,
                            Author      = m.Author,
                            Description = m.Description,
                            ImageUrl    = m.ImageUrl,
                            TextContent = m.TextContent,
                            Url         = m.Url,
                            OrderBy     = m.OrderBy
                        });
                    }
                    ext.Add(e);
                }
            }
            return(ext);
        }
Esempio n. 5
0
        public tb_MaterialExtEntity Populate_tb_MaterialExtEntity_FromDr(IDataReader dr)
        {
            tb_MaterialExtEntity Obj = new tb_MaterialExtEntity();

            Obj.ID         = ((dr["ID"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["ID"]);
            Obj.UserID     = dr["UserID"].ToString();
            Obj.WeiXinCode = dr["WeiXinCode"].ToString();
            Obj.TypeID     = ((dr["TypeID"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["TypeID"]);
            Obj.Status     = ((dr["Status"]) == DBNull.Value) ? 0 : Convert.ToInt32(dr["Status"]);
            Obj.AddTime    = ((dr["AddTime"]) == DBNull.Value) ? Convert.ToDateTime("1900-1-1") : Convert.ToDateTime(dr["AddTime"]);
            Obj.UpdateTime = ((dr["UpdateTime"]) == DBNull.Value) ? Convert.ToDateTime("1900-1-1") : Convert.ToDateTime(dr["UpdateTime"]);

            return(Obj);
        }