Beispiel #1
0
 public int insertguest(SiteGroupCms.Entity.Guest obj)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("username", obj.Username);
         _doh.AddFieldItem("title", obj.Title);
         _doh.AddFieldItem("content", obj.Content);
         _doh.AddFieldItem("userip", IPHelp.ClientIP);
         return(_doh.Insert("yy_postinfo"));
     }
 }
Beispiel #2
0
        public void updateguest()
        {
            SiteGroupCms.Entity.Guest  guest     = new SiteGroupCms.Entity.Guest();
            SiteGroupCms.Dal.GuestDal  guestdal  = new Dal.GuestDal();
            SiteGroupCms.Entity.Repost repost    = new Entity.Repost();
            SiteGroupCms.Dal.RepostDal repostdal = new Dal.RepostDal();
            guest.Id       = Str2Int(Request.Form["guestid"]);
            guest.Username = Request.Form["username"];
            guest.Addtime  = Validator.StrToDate(Request.Form["addtime"], DateTime.Now);
            guest.Title    = Request.Form["title"];
            guest.Content  = Request.Form["content"];
            guest.Audit    = Request.Form["audit"] == "true" ? 1 : 0;
            int res1 = guestdal.updateguest(guest);
            int res2 = 0;

            repost.Followid = Str2Int(Request.Form["guestid"]);
            List <SiteGroupCms.Entity.Repost> lists = repostdal.GetList(repost.Followid);

            if (lists == null)//添加
            {
                repost.Content = Request.Form["recontent"];
                repost.Addtime = Validator.StrToDate(Request.Form["retime"], DateTime.Now);
                res2           = repostdal.Insertentity(repost);
            }
            else //修改或者删除
            {
                repost.Content = Request.Form["recontent"];
                if (repost.Content != "") //修改
                {
                    repost.Addtime = Validator.StrToDate(Request.Form["retime"], DateTime.Now);
                    res2           = repostdal.Updateentity(repost);
                    new SiteGroupCms.Dal.LogDal().SaveLog(34);
                }
                else
                {
                    res2 = repostdal.deletebyfollowid(repost);
                }
            }
            if ((res1 + res2) > 0)
            {
                _response = "{\"IsError\":false,\"Message\":\"保存成功\",\"Data\":0}";
                new SiteGroupCms.Dal.LogDal().SaveLog(22);
            }
            else
            {
                _response = "{\"IsError\":true,\"Message\":\"保存失败\",\"Data\":0}";
            }
        }
Beispiel #3
0
 public int updateguest(SiteGroupCms.Entity.Guest obj)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "id=@id";
         _doh.AddConditionParameter("@id", obj.Id);
         _doh.AddFieldItem("username", obj.Username);
         _doh.AddFieldItem("title", obj.Title);
         _doh.AddFieldItem("content", obj.Content);
         _doh.AddFieldItem("userip", IPHelp.ClientIP);
         _doh.AddFieldItem("audit", obj.Audit);
         if (obj.Addtime.ToString() != "0001/1/1 0:00:00")
         {
             _doh.AddFieldItem("addtime", obj.Addtime.ToString());
         }
         return(_doh.Update("yy_postinfo"));
     }
 }
Beispiel #4
0
 public SiteGroupCms.Entity.Guest GetEntity(int id)
 {
     SiteGroupCms.Entity.Guest dos = new SiteGroupCms.Entity.Guest();
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT * FROM [yy_postinfo] WHERE [id]=" + id;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count > 0)
         {
             dos.Id       = Convert.ToInt32(dt.Rows[0]["id"].ToString());
             dos.Title    = dt.Rows[0]["title"].ToString();
             dos.Content  = dt.Rows[0]["content"].ToString();
             dos.Addtime  = Validator.StrToDate(dt.Rows[0]["addtime"].ToString(), DateTime.Now);
             dos.Userip   = dt.Rows[0]["userip"].ToString();
             dos.Audit    = Convert.ToInt32(dt.Rows[0]["audit"].ToString());
             dos.Username = dt.Rows[0]["username"].ToString();
         }
     }
     return(dos);
 }