private void GrantSavePage() { int ID = int.Parse(Utils.GetRequest("ID", "post", 2, @"^[1-9]\d*$", "勋章编号填写错误")); int iDay = int.Parse(Utils.GetRequest("iDay", "post", 2, @"^[0-9]\d*$", "勋章有效天数填写错误")); int hid = int.Parse(Utils.GetRequest("hid", "post", 2, @"^[1-9]\d*$", "会员ID错误")); if (!new BCW.BLL.Medal().Exists(ID)) { Utils.Error("不存在的勋章记录", ""); } if (new BCW.BLL.Medal().Exists(ID, hid)) { Utils.Error("此会员已存在这个勋章,如要修改期限请先撤销再授予", ""); } BCW.Model.Medal model = new BCW.BLL.Medal().GetMedal(ID); string PayID = model.PayID + "#" + hid + "#"; string ExTime = string.Empty; if (iDay == 0) { ExTime = "1990-1-1"; } else { ExTime = DT.FormatDate(DateTime.Now.AddDays(iDay), 11); } string PayExTime = model.PayExTime + "#" + ExTime + "#"; new BCW.BLL.Medal().UpdatePayID(ID, PayID, PayExTime); //清缓存 string CacheKey = CacheName.App_UserMedal(hid); DataCache.RemoveByPattern(CacheKey); //记录获授勋章日志 string DayTime = "" + iDay + "天"; if (iDay == 0) { DayTime = "永久"; } BCW.Model.Medalget m = new BCW.Model.Medalget(); m.Types = 0; m.UsID = hid; m.MedalId = ID; m.Notes = "" + model.Title + "[IMG]" + model.ImageUrl + "[/IMG][有效期" + DayTime + "]"; m.AddTime = DateTime.Now; new BCW.BLL.Medalget().Add(m); Utils.Success("授予勋章", "授予勋章并记录授日志成功..", Utils.getUrl("medal.aspx?act=me&hid=" + hid + "&ptype=1"), "1"); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Medalget model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BCW.Model.Medalget model) { return(dal.Add(model)); }