예제 #1
0
        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);
            }
        }
예제 #2
0
        //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();
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        public static void SetItemText(RewardTextModel item)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("RewardText");
            tableObj.GetDataFromObject(item);

            string sql             = "Select top 1 * From RewardText Where ID = @ID and SiteID= @SiteID ";
            ParameterCollection a1 = new ParameterCollection();

            a1.Add("ID", item.ID);
            a1.Add("SiteID", item.SiteID);
            bool isNew = db.GetFirstValue(sql, a1) == null;

            if (isNew)
            {
                tableObj["Creator"]    = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = DateTime.Now;

                tableObj.Insert();
            }
            else
            {
                //tableObj.Remove("SiteID");
                //tableObj.Remove("Creator");
                //tableObj.Remove("CreateTime");

                //tableObj["Modifier"] = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                //tableObj["ModifyTime"] = DateTime.Now;
                string a = "UPDATE RewardText  set Text =@Text ,Modifier=@Modifier,ModifyTime=@ModifyTime Where ID = @ID2 and SiteID= @SiteID2";

                SQLData.ParameterCollection paraList = new SQLData.ParameterCollection();
                paraList.Add("ID2", item.ID);
                paraList.Add("SiteID2", item.SiteID);
                paraList.Add("Text", item.Text);
                paraList.Add("Modifier", WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id);
                paraList.Add("ModifyTime", DateTime.Now);
                int exeCount = db.ExecuteNonQuery(a, paraList);
            }
        }