//wei20180808 複製功能抄徵件 public static void Copy(long siteId, IEnumerable <long> ids) { if (ids == null || ids.Count() == 0) { return; } long menuId = RewardDAO.GetMenuID(siteId); MenusModels menu = DataAccess.MenusDAO.GetInfo(siteId, menuId); SQLData.Database db = new SQLData.Database(WebInfo.Conn); foreach (long id in ids) { SQLData.TableObject tableObj = db.GetTableObject("Reward", id); if (tableObj.Count == 0) { continue; } long newId = WorkLib.GetItem.NewSN(); tableObj["ID"] = newId; //tableObj["CardNo"] = Golbal.PubFunc.AddPage(siteId, menuId, menu.SN, "Reward", "Index", true); tableObj["Sort"] = 1; tableObj["Creator"] = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; tableObj["CreateTime"] = DateTime.Now; tableObj.Remove("Modifier"); tableObj.Remove("ModifyTime"); tableObj.Insert(); } }
public static void SetItemPlace(RewardPlaceModel item) { SQLData.Database db = new SQLData.Database(WebInfo.Conn); SQLData.TableObject tableObj = db.GetTableObject("RewardPlace"); tableObj.GetDataFromObject(item); string sql = "Select 1 From RewardPlace Where ID = " + item.ID; bool isNew = db.GetFirstValue(sql) == null; if (isNew) { tableObj["Creator"] = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; tableObj["CreateTime"] = DateTime.Now; tableObj.Insert(); } else { tableObj.Remove("ID"); tableObj.Remove("SiteID"); tableObj.Remove("Creator"); tableObj.Remove("CreateTime"); tableObj["Modifier"] = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; tableObj["ModifyTime"] = DateTime.Now; tableObj.Update(item.ID); } }
public static void SetItem(RewardModel item) { SQLData.Database db = new SQLData.Database(WebInfo.Conn); SQLData.TableObject tableObj = db.GetTableObject("Reward"); object objSort = db.GetFirstValue(" SELECT TOP 1 Sort FROM Reward ORDER BY Sort DESC "); int maxSort = (objSort == null || objSort == DBNull.Value)? 1: (int)objSort; tableObj.GetDataFromObject(item); string sql = "Select 1 From Reward Where ID = " + item.ID; bool isNew = db.GetFirstValue(sql) == null; if (isNew) { tableObj["Creator"] = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; tableObj["CreateTime"] = DateTime.Now; tableObj["Sort"] = 1;//wei 20180726 拿掉 maxSort + tableObj.Insert(); } else { tableObj.Remove("ID"); tableObj.Remove("SiteID"); tableObj.Remove("Creator"); tableObj.Remove("CreateTime"); tableObj.Remove("Sort"); tableObj["Modifier"] = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id; tableObj["ModifyTime"] = DateTime.Now; tableObj.Update(item.ID); } }