public void Addvister() { var _hitTotal = db.GetTable<ESHOP_CONFIG>(); if (_hitTotal != null && _hitTotal.ToList().Count > 0) { _hitTotal.ToList()[0].CONFIG_HITCOUNTER = _hitTotal.ToList()[0].CONFIG_HITCOUNTER + 1; db.SubmitChanges(); } var list = db.GetTable<ESHOP_HITCOUNTER>().Where(a => (a.HIT_DATE.Value.Date - DateTime.Now.Date).Days == 0).ToList(); if (list != null && list.Count > 0) { list[0].HIT_VALUE += 1; db.SubmitChanges(); } else { ESHOP_HITCOUNTER eshop = new ESHOP_HITCOUNTER(); eshop.HIT_VALUE = 1; eshop.HIT_DATE = DateTime.Now; db.ESHOP_HITCOUNTERs.InsertOnSubmit(eshop); db.SubmitChanges(); } }
partial void DeleteESHOP_HITCOUNTER(ESHOP_HITCOUNTER instance);
partial void UpdateESHOP_HITCOUNTER(ESHOP_HITCOUNTER instance);
partial void InsertESHOP_HITCOUNTER(ESHOP_HITCOUNTER instance);
public void AddHitCouter() { try { var list = db.ESHOP_HITCOUNTERs.Where(n => n.HIT_DATE.Value.Date == DateTime.Now.Date).ToList(); if (list.Count() <= 0) { ESHOP_HITCOUNTER _hit = new ESHOP_HITCOUNTER(); _hit.HIT_DATE = DateTime.Now; _hit.HIT_VALUE = 1; db.ESHOP_HITCOUNTERs.InsertOnSubmit(_hit); db.SubmitChanges(); } else { list[0].HIT_VALUE += 1; db.SubmitChanges(); } } catch { } }
public void Addvister() { var _hitTotal = db.GetTable<ESHOP_CONFIG>(); _hitTotal.ToList()[0].CONFIG_HITCOUNTER = _hitTotal.ToList()[0].CONFIG_HITCOUNTER + 1; db.SubmitChanges(); db = new dbVuonRauVietDataContext(); ESHOP_HITCOUNTER hit = new ESHOP_HITCOUNTER(); var now = DateTime.Now; var hitdate = new DateTime(now.Year, now.Month, now.Day); hit.HIT_DATE = hitdate; hit.HIT_VALUE = 1; db.ESHOP_HITCOUNTERs.InsertOnSubmit(hit); db.SubmitChanges(); }