public static void SetItem(PageCommentsModels item) { SQLData.Database db = new SQLData.Database(WebInfo.Conn); SQLData.TableObject tableObj = db.GetTableObject("PageComments"); tableObj.GetDataFromObject(item); DateTime now = DateTime.Now; string sql = "Select 1 From PageComments Where ID = " + item.ID; bool isNew = db.GetFirstValue(sql) == null; if (isNew) { tableObj["ModifyTime"] = now; tableObj.Insert(); } else { tableObj.Remove("ID"); tableObj.Remove("PageSN"); tableObj.Remove("ParentID"); tableObj.Remove("PostDate"); tableObj.Remove("ShowStatus"); tableObj.Remove("MemberShipID"); Common.Member curUser = Common.Member.Current; tableObj["Modifier"] = curUser == null ? Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id : curUser.ID; tableObj["ModifyTime"] = now; tableObj.Update(item.ID); } }
/// <summary> /// /// </summary> /// <param name="item"></param> /// <param name="IsManually">是否手動新增</param> public static void SetItem(PointsModel item, bool IsManually = false) { SQLData.Database db = new SQLData.Database(WebInfo.Conn); SQLData.TableObject tableObj = db.GetTableObject("Points"); tableObj.GetDataFromObject(item); DateTime now = DateTime.Now; string sql = "Select 1 From Points Where ID = " + item.ID; bool isNew = db.GetFirstValue(sql) == null; tableObj["SiteID"] = item.SiteID; tableObj["MemberShipID"] = item.MemberShipID; tableObj["Remark"] = string.IsNullOrEmpty(item.Remark) ? "" : item.Remark; tableObj["Description"] = string.IsNullOrEmpty(item.Description) ? "" : item.Description; tableObj["Point"] = item.Point; tableObj["IsManually"] = IsManually; tableObj["PointType"] = item.PointType; if (isNew) { if (item.Creator == 0) { tableObj["Creator"] = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; } tableObj["CreateTime"] = now; tableObj.Insert(); } else { tableObj.Remove("ID"); tableObj.Remove("SiteID"); tableObj.Remove("Creator"); tableObj.Remove("CreateTime"); Common.Member curUser = Common.Member.Current; tableObj["Modifier"] = curUser == null ? Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id : curUser.ID; tableObj["ModifyTime"] = now; tableObj.Update(item.ID); } }
public JsonResult GetMemberById(long id) { try { var member = _membersBusiness.GetById(id); if (member != null) { Common.Member mb = new Common.Member(); mb.Id = member.Id; mb.UserName = member.UserName; mb.Password = member.Password; mb.PasswordTransaction = member.PasswordTransaction; mb.PasswordEncrypted = member.PasswordEncrypted; mb.PasswordEncryptedMethod = member.PasswordEncryptedMethod; mb.LoginDate = member.LoginDate; mb.LastFailedLoginDate = member.LastFailedLoginDate; mb.Loutout = member.Loutout; mb.LockoutDate = member.LockoutDate; mb.Verify = member.Verify; mb.Status = mb.Status; mb.CreateDate = member.CreateDate; mb.ModifyDate = member.ModifyDate; mb.ActiveDate = member.ActiveDate; mb.Question = member.Question; mb.Answer = member.Answer; return(Json(mb, JsonRequestBehavior.AllowGet)); } else { return(Json(0)); } } catch (Exception) { throw; } }