public void ProcessRequest(System.Web.HttpContext context) { UserTempDataType type = StringUtil.TryParse <UserTempDataType>(context.Request.QueryString["type"], UserTempDataType.None); string action = context.Request.QueryString["action"]; User user = User.Current; context.Response.CacheControl = "no-cache"; if (user != null) { if (type != UserTempDataType.None && type != UserTempDataType.Avatar ) { if (action == "get") { UserTempData data = UserTempDataBO.Instance.GetTempData(user.UserID, type); if (data != null) { string value = data.Data.ToString(); context.Response.Write(value); context.Response.End(); } } else if (action == "save") { string format = context.Request.Form["format"]; string value = context.Request.Form["data"] + ""; if (!string.IsNullOrEmpty(format)) { value = format + "|" + value; } UserTempDataBO.Instance.SaveData(user.UserID, type, value, true); } else if (action == "delete") { UserTempDataBO.Instance.Delete(user.UserID, type); } } } }
private void addToTempTable() { DB_contextDataContext db = new DB_contextDataContext(); UserTempData uTempData = new UserTempData(); uTempData.username = this.LoggedUName; if (this.reqType.Equals("donate")) { uTempData.quantity = 1; uTempData.requestType = "donate"; } else { uTempData.quantity = int.Parse(this.txtBloodQuantity.Text.ToString()); uTempData.requestType = "request"; } db.UserTempDatas.InsertOnSubmit(uTempData); db.SubmitChanges(); MessageBox.Show("Requested For"); }
public override void SaveData(UserTempData data, bool overrideOldData) { SaveData(data.UserID, data.DataType, data.Data, overrideOldData); }
/// <summary> /// 存储新数据, 默认覆盖原来的数据 /// </summary> /// <param name="data"></param> public override void SaveData(UserTempData data) { SaveData(data, true); }
public override void SaveData(UserTempData data, bool overrideOldData) { SaveData(data.UserID,data.DataType,data.Data,overrideOldData); }
public abstract void SaveData(UserTempData data, bool overrideOldData);
public abstract void SaveData(UserTempData data);