public static bool UpdateGaBaseData(int type, DateTime st, DateTime et)
        {
            bool flag = false;

            try
            {
                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                flag = ctx.GA_Logs.Any(c => c.Type == type && c.GAStartDate == st && c.GAEndDate == et && c.Status == false);

                if (flag)
                {
                    flag = false;
                    GA_Log log = null;
                    log = ctx.GA_Logs.FirstOrDefault(c => c.Type == type && c.GAStartDate == st && c.GAEndDate == et && c.Status == false);

                    if (log != null)
                    {
                        log.Status = true;

                        ctx.SubmitChanges();
                        flag = true;
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(flag);
        }
        public static bool InserGaBaseData(int type, DateTime st, DateTime et, bool f)
        {
            bool flag = false;
            try
            {
                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                ctx.GA_Logs.InsertOnSubmit(
                    new GA_Log()
                    {
                        Type = type,
                        GAStartDate = st,
                        GAEndDate = et,
                        Status = flag
                    }
                    );
                ctx.SubmitChanges();
                flag = true;
            }
            catch (Exception ex)
            {
                return false;
            }

            return flag;
        }
        public static bool InserGaBaseData(int type, DateTime st, DateTime et, bool f)
        {
            bool flag = false;

            try
            {
                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                ctx.GA_Logs.InsertOnSubmit(
                    new GA_Log()
                {
                    Type        = type,
                    GAStartDate = st,
                    GAEndDate   = et,
                    Status      = flag
                }
                    );
                ctx.SubmitChanges();
                flag = true;
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(flag);
        }
Example #4
0
        public static int getUserInfo(string guid, string usrid)
        {
            string memssage = "";
            int    uid      = Converter.ParseInt(usrid, -1);

            if (uid < 0)
            {
                offlineBbhomeDataContext octx = new offlineBbhomeDataContext();
                if (octx.Ga_guidUserIDs.Any(c => c.guid == guid))
                {
                    uid = octx.Ga_guidUserIDs.FirstOrDefault(c => c.guid == guid).uid;
                }
            }



            return(uid);
        }
        public static bool insert_piwik_log_reffer(List <string> refferList)
        {
            using (offlineBbhomeDataContext ctx = new offlineBbhomeDataContext())
            {
                try
                {
                    var query = refferList.Where(c => !ctx.piwik_log_reffers.Any(p => p.refferurl == c)).ToList();

                    List <piwik_log_reffer> addreffers = new List <piwik_log_reffer>();
                    query.ForEach(
                        c =>
                    {
                        string tstr = c.ToString();
                        string durl = tstr;
                        if (!string.IsNullOrEmpty(tstr) && tstr != "http://about:blank")
                        {
                            durl = GetNewString(tstr, null, true);
                        }



                        addreffers.Add(
                            new piwik_log_reffer()
                        {
                            refferurl = c.ToString(),
                            refergbk  = durl
                        }
                            )

                        ;
                    });

                    ctx.piwik_log_reffers.InsertAllOnSubmit(addreffers);
                    ctx.SubmitChanges();
                }
                catch
                {
                    return(false);
                }

                return(true);
            }
        }
        public static bool insert_piwiklog(List <UserVisitInfo> usrlist, out string msg)
        {
            bool flag = false;

            msg = "";
            try
            {
                List <Piwik_log> eventList = new List <Piwik_log>();
                foreach (UserVisitInfo e in usrlist)
                {
                    eventList.Add(new Piwik_log()
                    {
                        guid          = e.Guid,
                        action        = e.Action ?? "",
                        lastVisitTime = DateTime.Parse(e.LastVisitTime ?? "1990-1-1"),
                        spenttime     = Converter.ParseInt(e.Spent, 0),
                        pagetitle     = e.PageTitle ?? "",
                        url           = e.Url,
                        userid        = Converter.ParseInt(e.Userid, -1),
                        refferurl     = e.Referurl,
                        event_action  = e.Event_action,
                        visitIp       = e.VisitIp,
                        location      = e.Location,
                        locationsina  = e.Locationsina
                    });
                }

                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                ctx.Piwik_logs.InsertAllOnSubmit(eventList);
                ctx.SubmitChanges();

                flag = true;
            }
            catch (Exception ex)
            {
                msg = ex.ToString();
                return(false);
            }

            return(flag);
        }
        public static bool ExistGaData(int type, DateTime st, DateTime et)
        {
            bool flag = false;
            try
            {

                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                flag = ctx.GA_Logs.Any(c => c.Type == type && c.GAStartDate == st && c.GAEndDate == et);

                if (!flag)
                {
                    InserGaBaseData(type, st, et, false);
                }
            }
            catch (Exception ex)
            {
                return false;
            }

            return flag;
        }
        public static bool insert_piwikCsAction(List <Piwik_CustomerAction> usrlist, out string msg)
        {
            bool flag = false;

            msg = "";
            try
            {
                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                ctx.Piwik_CustomerActions.InsertAllOnSubmit(usrlist);
                ctx.SubmitChanges();

                flag = true;
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(false);
            }

            return(flag);
        }
        public static bool ExistGaData(int type, DateTime st, DateTime et)
        {
            bool flag = false;

            try
            {
                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                flag = ctx.GA_Logs.Any(c => c.Type == type && c.GAStartDate == st && c.GAEndDate == et);

                if (!flag)
                {
                    InserGaBaseData(type, st, et, false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(flag);
        }
        public static bool insert_piwiklog(List<UserVisitInfo> usrlist,out string msg)
        {
            bool flag = false;
            msg = "";
            try
            {
                 List<Piwik_log> eventList = new List<Piwik_log>();
                 foreach (UserVisitInfo e in usrlist)
                 {

                        eventList.Add(new Piwik_log()
                        {
                             guid=e.Guid,
                             action=e.Action??"",
                              lastVisitTime=DateTime.Parse(e.LastVisitTime??"1990-1-1"),
                              spenttime=Converter.ParseInt(e.Spent,0),
                               pagetitle=e.PageTitle??"",
                                url=e.Url,
                                 userid=Converter.ParseInt(e.Userid,-1),
                                 refferurl=e.Referurl,
                        });
                 }

                 offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                 ctx.Piwik_logs.InsertAllOnSubmit(eventList);
                 ctx.SubmitChanges();

                 flag = true;

            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return false;
            }

            return flag;
        }
Example #11
0
        public static int getUserInfo(string guid, string usrid)
        {
            string memssage = "";
            int uid = Converter.ParseInt(usrid, -1);

            if (uid < 0)
            {
                offlineBbhomeDataContext octx = new offlineBbhomeDataContext();
                if (octx.Ga_guidUserIDs.Any(c => c.guid == guid))
                {
                    uid = octx.Ga_guidUserIDs.FirstOrDefault(c => c.guid == guid).uid;
                }
            }

            return uid;
        }
Example #12
0
        public static bool UpdateGaBaseData(int type, DateTime st, DateTime et)
        {
            bool flag = false;
            try
            {
                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                flag = ctx.GA_Logs.Any(c => c.Type == type && c.GAStartDate == st && c.GAEndDate == et && c.Status == false);

                if (flag)
                {
                    flag = false;
                    GA_Log log = null;
                    log = ctx.GA_Logs.FirstOrDefault(c => c.Type == type && c.GAStartDate == st && c.GAEndDate == et && c.Status == false);

                    if (log != null)
                    {
                        log.Status = true;

                        ctx.SubmitChanges();
                        flag = true;
                    }
                }
            }
            catch (Exception ex)
            {
                return false;
            }

            return flag;
        }
Example #13
0
        public static bool insert_piwik_log_reffer(List<string> refferList)
        {
            using (offlineBbhomeDataContext ctx = new offlineBbhomeDataContext())
                {
                    try
                    {
                        var query = refferList.Where(c => !ctx.piwik_log_reffers.Any(p => p.refferurl == c)).ToList();

                        List<piwik_log_reffer> addreffers = new List<piwik_log_reffer>();
                        query.ForEach(
                        c =>
                        {
                            string tstr = c.ToString();
                            string durl = tstr;
                            if (!string.IsNullOrEmpty(tstr) && tstr != "http://about:blank")
                                durl = GetNewString(tstr, null, true);

                            addreffers.Add(
                                new piwik_log_reffer()
                                {
                                    refferurl = c.ToString(),
                                    refergbk=durl
                                }
                                )

                                ;
                        });

                        ctx.piwik_log_reffers.InsertAllOnSubmit(addreffers);
                        ctx.SubmitChanges();
                    }
                    catch
                    {
                        return false;
                    }

                    return true;

            }
        }
Example #14
0
        public static bool insert_piwikCsAction(List<Piwik_CustomerAction> usrlist, out string msg)
        {
            bool flag = false;
            msg = "";
            try
            {

                offlineBbhomeDataContext ctx = new offlineBbhomeDataContext();
                ctx.Piwik_CustomerActions.InsertAllOnSubmit(usrlist);
                ctx.SubmitChanges();

                flag = true;

            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return false;
            }

            return flag;
        }