FriendModel:实体类(属性说明自动提取数据库字段的描述信息)
Exemple #1
0
        /// <summary>
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool CreaeWechatFriend(FriendModel model)
        {
            var strSql = (@"INSERT INTO wechat_friend
                  (`innerid`,`accountid`,`nickname`,`photo`,`openid`,`remarkname`,`area`,`sex`,`isdel`,`subscribe_time`,`subscribe`,country,province,city,`createdtime`)
                  VALUES
                  (@innerid,@accountid,@nickname,@photo,@openid,@remarkname,@area,@sex,@isdel,@subscribetime,@subscribe,@country,@province,@city,@createdtime);");

            return Helper.Execute(strSql, model) > 0;
        }
Exemple #2
0
        /// <summary>
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateWechatFriend(FriendModel model)
        {
            var strSql = @"UPDATE wechat_friend
                                        SET `nickname` = @nickname, `photo` = @photo, `remarkname` = @remarkname,`area` = @area,
                                         `sex` = @sex, `isdel` = @isdel, `subscribe_time` = @subscribetime,
                                          country=@country,province=@province,city=@city,
                                         `subscribe` = @subscribe
                                          WHERE `openid` = @openid and `accountid` = @accountid ";

            return Helper.Execute(strSql, model) > 0;
        }
Exemple #3
0
 public void CreaeWechatFriendTestMethod_DA()
 {
     Thread.Sleep(new TimeSpan(0, 0, 1));
     var name = DateTime.Now.ToString("yyyyMMddHHmmss");
     var friend = new FriendModel
     {
         Innerid = Guid.NewGuid().ToString(),
         Accountid = APPID,
         Nickname = name,
         Photo = "Photo",
         OPENID = name,
         Country = "Country",
         Province = "province",
         City = "city",
         Sex = 1,
         Isdel = 0,
         SubscribeTime = DateTime.Now.Ticks,
         Subscribe = 1,
         Createdtime = DateTime.Now
     };
     var result = da.CreaeWechatFriend(friend);
     Assert.IsTrue(result);
 }
Exemple #4
0
 public void UpdateWechatFriendTestMethod_DA_True()
 {
     Thread.Sleep(new TimeSpan(0, 0, 1));
     var openid = DateTime.Now.ToString("yyyyMMddHHmmss");
     var friend = new FriendModel
     {
         Innerid = Guid.NewGuid().ToString(),
         Accountid = APPID,
         Nickname = "Nickname",
         Photo = "Photo",
         OPENID = openid,
         Country = "Country",
         Province = "province",
         City = "city",
         Sex = 1,
         Isdel = 0,
         SubscribeTime = DateTime.Now.Ticks,
         Subscribe = 1,
         Createdtime = DateTime.Now
     };
     var friend_updated = new FriendModel
     {
         Innerid = Guid.NewGuid().ToString(),
         Accountid = APPID,
         Nickname = "Nickname1",
         Photo = "Photo1",
         OPENID = openid,
         Country = "Country1",
         Province = "province1",
         City = "city1",
         Sex = 0,
         Isdel = 1,
         SubscribeTime = DateTime.Now.Ticks,
         Subscribe = 0,
         Createdtime = DateTime.Now
     };
     var creaeWechatFriendresult = da.CreaeWechatFriend(friend);
     var isWechatFriendExistsresult = da.IsWechatFriendExists(APPID, openid);
     var updateWechatFriendresult = da.UpdateWechatFriend(friend_updated);
     Assert.IsTrue(creaeWechatFriendresult);
     Assert.IsTrue(isWechatFriendExistsresult);
     Assert.IsTrue(updateWechatFriendresult);
 }