/// Function Header******************************************************* /// Function Name: InesrtSectionVisitedDetails /// Function Type: Function /// Functionality: used to insert the section visited details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void InesrtSectionVisitedDetails(Entity.UserInfo oUserInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { bool blnIsExists = false; var _varSectionVisited = (from _sv in _db.SectionVisiteds orderby _sv.dtCreatedOn descending select _sv ).ToList().Take(1); if (_varSectionVisited != null) { if (_varSectionVisited.ElementAt(0).strSectionVisited.ToLower().Equals(oUserInfo.StrSectionVisited.ToLower()) && _varSectionVisited.ElementAt(0).strUserId.ToLower().Equals(oUserInfo.StrUserId.ToLower())) { blnIsExists = true; } } if (!blnIsExists) { DAL.SectionVisited oSectionVisited = new SectionVisited(); oSectionVisited.strUserId = oUserInfo.StrUserId; oSectionVisited.strUserType = oUserInfo.StrUserType; oSectionVisited.dtCreatedOn = oUserInfo.DtCreatedOn; oSectionVisited.strAgent = oUserInfo.StrAgent; oSectionVisited.strVisitedIP = oUserInfo.StrVisitedIP; oSectionVisited.strSectionVisited = oUserInfo.StrSectionVisited; _db.SectionVisiteds.InsertOnSubmit(oSectionVisited); _db.SubmitChanges(); oSectionVisited = null; } } }
/// Function Header******************************************************* /// Function Name: InesrtSectionVisitedDetails /// Function Type: Function /// Functionality: used to insert the section visited details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.UserInfo> GetSectionVisitedDetails(Entity.UserInfo oUserInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { DAL.SectionVisited oSectionVisited = new SectionVisited(); var _varSectionVisited = (from _sv in _db.SectionVisiteds where _sv.dtCreatedOn >= Convert.ToDateTime(oUserInfo.StrDateFrom) && _sv.dtCreatedOn <= Convert.ToDateTime(oUserInfo.StrDateTo) orderby _sv.dtCreatedOn descending select new Entity.UserInfo { IntSectionVisitedId = _sv.intSectionVisitedId, StrUserId = _sv.strUserId, StrUserType = _sv.strUserType.Equals("A") ? "Administrator" : _sv.strUserType.Equals("U") ? "User" : "Company", DtCreatedOn = _sv.dtCreatedOn, StrAgent = _sv.strAgent, StrVisitedIP = _sv.strVisitedIP, StrSectionVisited = _sv.strSectionVisited }).ToList(); if (!oUserInfo.StrUserType.ToLower().Equals("x")) _varSectionVisited = _varSectionVisited.Where(x => x.StrUserType.ToLower().Equals(oUserInfo.StrUserType.ToLower())).ToList(); if (!oUserInfo.StrSectionVisited.Equals(string.Empty)) _varSectionVisited = _varSectionVisited.Where(x => x.StrSectionVisited.ToLower().Contains(oUserInfo.StrSectionVisited.ToLower())).ToList(); return _varSectionVisited; } }