using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Pcb.Common.Utilities { public class ActiveProvider { //public static void addPoint(PortalSitesEntities db, Guid uid, int amount, ActionType type, string reason) //{ // Members Members = db.Members.Find(uid); // if (null != Members) // { // Members.LovePoints += amount; // db.ActiveLogs.Add(new ActiveLogs() // { // Uid = uid, // ActionType = (int)type, // }); // Points point = new Points() // { // Uid = uid, // Amount = amount, // ActionType = (int)type, // Reason = reason, // CreateDate = DateTime.Now // }; // db.Points.Add(point); // } //} //public static Boolean addDailyPoint(PortalSitesEntities db, Guid uid, int amount, ActionType type, string reason) //{ // Members Members = db.Members.Find(uid); // if (null != Members) // { // Members.LovePoints += amount; // db.ActiveLogs.Add(new ActiveLogs() // { // Uid = uid, // ActionType = (int)type, // }); // int limit = 20; // long today = long.Parse(DateTime.Now.ToString("yyyyMMdd")); // PointHistories ph = db.PointHistories.SingleOrDefault(m => m.day == today && m.Uid == uid); // if (null != ph) // { // if (ph.Amount >= limit) // { // return false; // } // else // { // ph.Amount += amount; // } // } // else // { // ph = new PointHistories() // { // Uid = uid, // day = today, // Amount = amount // }; // db.PointHistories.Add(ph); // } // Points point = new Points() // { // Uid = uid, // Amount = amount, // ActionType = (int)type, // Reason = reason, // CreateDate = DateTime.Now // }; // db.Points.Add(point); // return true; // } // else // { // return false; // } //} } }