public void PostLog(int PostID, int ActionTypeID) { var _Browser = objNetworkOperation.ClientBrowser(); var _Device = objNetworkOperation.ClientDeviceType(); var _IP_Address = objNetworkOperation.ClientIPaddress(); var _HostName = objNetworkOperation.ClientHostName(); var _ActionTime = DateConvertor.TimeNow(); var _DateMiladi = DateConvertor.DateToNumber(DateConvertor.TodayDateMiladi()); var _DateShamsi = DateConvertor.DateToNumber(DateConvertor.TodayDate()); List <PostAction> PstAct = new List <PostAction>(); PstAct.Add(new PostAction { ActionTime = _ActionTime, ActionTypeID = ActionTypeID, Browser = _Browser, Device = _Device, IP_Address = _IP_Address, HostName = _HostName, DateMiladi = _DateMiladi, DateShamsi = _DateShamsi, PostID = PostID }); C_LikeViewList.NewLikeView(PstAct); SaveLog(); }
public void StartOperation(string CurrentClientIP) { NetworkOperation objNetworkOperation = new NetworkOperation(); //string CurrentClientIP = ClientIPaddress(); IpInformation IpInfo = GetLocationIPINFO(CurrentClientIP); var _objEntityWebsiteVisit = new RepositoryPattern <WebsiteVisit>(new ApplicationDbContext()); var newItem = new WebsiteVisit { VisitTime = TimeNow(), DateShamsi = DateConvertor.DateToNumber(DateConvertor.TodayDate()), DateMiladi = DateConvertor.DateToNumber(DateConvertor.TodayDateMiladi()), Browser = objNetworkOperation.ClientBrowser(), DeviceInfo = objNetworkOperation.ClientDeviceType(), IP_Address = CurrentClientIP, HostName = objNetworkOperation.ClientHostName(), country = IpInfo.country, //asn = IpInfo.@as, city = IpInfo.city, countryCode = IpInfo.countryCode, isp = IpInfo.isp, lat = IpInfo.lat, lon = (IpInfo.lon), org = IpInfo.org, query = IpInfo.query, region = IpInfo.region, regionName = IpInfo.regionName, status = IpInfo.status, timezone = IpInfo.timezone, zip = IpInfo.zip, district = IpInfo.district, mobile = IpInfo.mobile, // == true? "1" : "0", proxy = IpInfo.proxy, // == true ? "1" : "0" reverse = IpInfo.reverse }; _objEntityWebsiteVisit.Insert(newItem); _objEntityWebsiteVisit.Save(); try { var strSubject = " بازديد از وبسايت " + newItem.DateShamsi + " " + newItem.VisitTime; var strMessage = " بازديد وب سايت" + " <br /> " + " IP Address : " + newItem.IP_Address + " <br /> " + " مشخصات دستگاه : " + newItem.DeviceInfo + " <br /> " + " كشور : " + newItem.country + " <br /> " + " شهر و منطقه : " + newItem.regionName + " - " + newItem.city; OpratingClasses.EmailService emailService = new OpratingClasses.EmailService(); Task.Factory.StartNew(() => emailService.SendMail(strSubject, strMessage)); } catch (Exception) { } var cou = newItem.ID; _objEntityWebsiteVisit.Dispose(); }