private void RemovePage() { string info = Utils.GetRequest("info", "all", 1, "", ""); int id = int.Parse(Utils.GetRequest("id", "get", 2, @"^[1-9]\d*$", "ID错误")); int hid = int.Parse(Utils.GetRequest("hid", "get", 2, @"^[1-9]\d*$", "会员ID错误")); if (info == "") { Master.Title = "撤销记录"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("确定撤销此记录吗"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getUrl("medal.aspx?info=ok&act=remove&id=" + id + "&hid=" + hid + "&backurl=" + Utils.getPage(0) + "") + "\">确定撤销</a><br />"); builder.Append("<a href=\"" + Utils.getPage("medal.aspx?act=me&hid=" + hid + "") + "\">先留着吧..</a>"); builder.Append(Out.Tab("</div>", "<br />")); } else { if (!new BCW.BLL.Medal().Exists(id, hid)) { Utils.Error("不存在的记录", ""); } BCW.Model.Medal model = new BCW.BLL.Medal().GetMedalMe(id); string sPayID = string.Empty; sPayID = Utils.Mid(model.PayID, 1, model.PayID.Length); sPayID = Utils.DelLastChar(sPayID, "#"); string[] temp = Regex.Split(sPayID, "##"); //得到位置 int strPn = 0; for (int i = 0; i < temp.Length; i++) { if (temp[i].ToString() == hid.ToString()) { strPn = i; break; } } string sPayExTime = string.Empty; sPayExTime = Utils.Mid(model.PayExTime, 1, model.PayExTime.Length); sPayExTime = Utils.DelLastChar(sPayExTime, "#"); string[] temp2 = Regex.Split(sPayExTime, "##"); string PayExTime = string.Empty; for (int i = 0; i < temp2.Length; i++) { if (i != strPn) { PayExTime += "#" + temp2[i] + "#"; } } string PayID = model.PayID.Replace("#" + hid + "#", ""); //更新 new BCW.BLL.Medal().UpdatePayID(id, PayID, PayExTime); //清缓存 string CacheKey = CacheName.App_UserMedal(hid); DataCache.RemoveByPattern(CacheKey); Utils.Success("撤销", "撤销成功..", Utils.getPage("medal.aspx?act=me&hid=" + hid + ""), "1"); } }
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"); }