private void SaveSubPage(string act, int uid) { string sName = "短语"; string acturl = "sub"; int itype = 0; string Title = string.Empty; string Content = string.Empty; int id = 0; if (act == "savetemp") { sName = "草稿"; itype = 1; acturl = "temp"; id = int.Parse(Utils.GetRequest("id", "post", 2, @"^[1-9]\d*$", "ID错误")); Title = Utils.GetRequest("Title", "post", 2, @"^[^\^]{1,30}$", "请输入不超30字的标题"); Content = Utils.GetRequest("Content", "post", 2, @"^[^\^]{1,5000}$", "请输入不超5000字的内容"); } else { id = int.Parse(Utils.GetRequest("id", "post", 1, @"^[0-9]\d*$", "0")); Content = Utils.GetRequest("Content", "post", 2, @"^[^\^]{1,300}$", "请输入不超300字的短语"); } BCW.Model.Submit model = new BCW.Model.Submit(); model.ID = id; model.Types = itype; model.Title = Title; model.Content = Content; model.UsID = uid; model.AddTime = DateTime.Now; if (id != 0) { if (!new BCW.BLL.Submit().Exists(id, uid, itype)) { Utils.Error("不存在的记录", ""); } new BCW.BLL.Submit().Update(model); Utils.Success("编辑" + sName + "", "编辑" + sName + "成功,正在返回..", Utils.getUrl("function.aspx?act=view" + acturl + "&ptype=1&id=" + id + "&backurl=" + Utils.getPage(0) + ""), "1"); } else { new BCW.BLL.Submit().Add(model); Utils.Success("新建短语", "新建短语成功,正在返回..", Utils.getUrl("function.aspx?act=admsub&ptype=1&backurl=" + Utils.getPage(0) + ""), "1"); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Submit model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Submit model) { return(dal.Add(model)); }