private void EditSavePage() { int id = int.Parse(Utils.GetRequest("id", "post", 2, @"^[1-9]\d*$", "猜猜ID错误")); string Title = Utils.GetRequest("Title", "post", 2, @"^[\s\S]{1,20}$", "猜猜题目限20字内"); string Content = Utils.GetRequest("Content", "post", 2, @"^[\s\S]{1,500}$", "猜猜描述限500字内"); int UserID = int.Parse(Utils.GetRequest("UserID", "post", 2, @"^[1-9]\d*$", "用户ID填写错误")); string UserName = Utils.GetRequest("UserName", "post", 2, @"^[\s\S]{1,10}$", "昵称填写错误"); int Price = int.Parse(Utils.GetRequest("Price", "post", 2, @"^[0-9]\d*$", "猜猜单份价格填写错误")); DateTime CloseTime = Utils.ParseTime(Utils.GetRequest("CloseTime", "post", 2, DT.RegexTime, "截止时间格式填写出错,正确格式如" + DT.FormatDate(DateTime.Now, 0) + "")); DateTime OpenTime = Utils.ParseTime(Utils.GetRequest("OpenTime", "post", 2, DT.RegexTime, "承诺开奖时间格式填写出错,正确格式如" + DT.FormatDate(DateTime.Now, 0) + "")); int State = int.Parse(Utils.GetRequest("State", "post", 2, @"^[0-2]$", "猜猜状态填写错误")); int CclType = int.Parse(Utils.GetRequest("CclType", "post", 2, @"^[1-7]$", "猜猜类型填写错误")); if (!new BCW.BLL.Game.Free().Exists(id)) { Utils.Error("不存在的猜猜记录", ""); } if (!new BCW.BLL.User().Exists(UserID)) { Utils.Error("不存在的用户ID", ""); } BCW.Model.Game.Free model = new BCW.Model.Game.Free(); model.ID = id; model.Title = Title; model.Content = Content; model.UserID = UserID; model.UserName = UserName; model.Price = Price; model.CloseTime = CloseTime; model.OpenTime = OpenTime; model.State = State; model.CclType = CclType; new BCW.BLL.Game.Free().Update(model); Utils.Success("编辑猜猜乐", "编辑猜猜乐成功..", Utils.getUrl("free.aspx?act=edit&id=" + id + "&backurl=" + Utils.getPage(0) + ""), "1"); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Game.Free model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Game.Free model) { return(dal.Add(model)); }