示例#1
0
    private void EditSavePage()
    {
        int    TitleNum   = Utils.ParseInt(ub.GetSub("DiaryTitleNum", xmlPath));
        int    ContentNum = Utils.ParseInt(ub.GetSub("DiaryContentNum", xmlPath));
        int    id         = int.Parse(Utils.GetRequest("id", "post", 2, @"^[1-9]\d*$", "日记ID错误"));
        string Title      = Utils.GetRequest("Title", "post", 2, @"^[^\^]{1," + TitleNum + "}$", "标题限1-" + TitleNum + "字");
        string Content    = Utils.GetRequest("Content", "post", 2, @"^[^\^]{1," + ContentNum + "}$", "请输入不超" + ContentNum + "的内容");
        string Weather    = Utils.GetRequest("Weather", "post", 2, @"^[^\^]{1,5}$", "天气限1-5字");
        int    UsID       = int.Parse(Utils.GetRequest("UsID", "post", 2, @"^[1-9]\d*$", "用户ID错误"));
        string UsName     = Utils.GetRequest("UsName", "post", 2, @"^[^\^]{1,50}$", "昵称不超50字");
        int    IsTop      = int.Parse(Utils.GetRequest("IsTop", "post", 2, @"^[0-1]$", "置顶选择错误"));
        //int IsGood = int.Parse(Utils.GetRequest("IsGood", "post", 2, @"^[0-1]$", "精华选择错误"));
        int    ReadNum = int.Parse(Utils.GetRequest("ReadNum", "post", 2, @"^[0-9]\d*$", "人气填写错误"));
        string AddUsIP = Utils.GetRequest("AddUsIP", "post", 1, "", "");

        if (!Ipaddr.IsIPAddress(AddUsIP))
        {
            Utils.Error("IP填写错误", "");
        }
        DateTime AddTime = Utils.ParseTime(Utils.GetRequest("AddTime", "post", 2, DT.RegexTime, "添加时间填写出错"));

        BCW.Model.Diary model = new BCW.Model.Diary();
        model.ID      = id;
        model.Title   = Title;
        model.Content = Content;
        model.Weather = Weather;
        model.UsID    = UsID;
        model.UsName  = UsName;
        model.IsTop   = IsTop;
        model.IsGood  = 0;
        model.ReadNum = ReadNum;
        model.AddUsIP = AddUsIP;
        model.AddTime = AddTime;
        new BCW.BLL.Diary().Update2(model);

        Utils.Success("编辑日记", "编辑日记成功..", Utils.getUrl("diary.aspx?act=edit&id=" + id + "&backurl=" + Utils.getPage(0) + ""), "1");
    }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update2(BCW.Model.Diary model)
 {
     dal.Update2(model);
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(BCW.Model.Diary model)
 {
     return(dal.Add(model));
 }