Exemple #1
0
        public static void Log(String lines)
        {
            try
            {
                EmailOrderProcessor em = new EmailOrderProcessor(new EmailSettings());
                em.FromServerPayPal("Error" + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " --> " + lines);

                System.IO.StreamWriter file = new System.IO.StreamWriter(LogDirectoryPath + "\\Error.log", true);
                file.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " --> " + lines);
                file.Close();
            }
            catch
            {
            }
        }
Exemple #2
0
        public ViewResult List(string category, int page = 1)
        {
            //--  user ip should  get--------------------
            UserIP userIP = new UserIP();

            string ip      = userIP.GetClientIpaddress();
            int    howLong = ip.Length;

            if (ip != null && ip != "::1")        // this is if running on local server
            {
                ip = ip.Remove(14, howLong - 14); // deleting some digits which are always different
            }
            //remenber

            if (Session["IP"] == null || Session["IP"].ToString() != ip) // if something is null then you cant comapare  like this, first you have to comapare to null
            {
                if (ip != "37.228.244.103" && ip != "::1")
                {
                    Session["IP"] = userIP.GetClientIpaddress();

                    EmailOrderProcessor email = new EmailOrderProcessor(new EmailSettings());
                    email.FromServerPayPal(userIP.GetClientIpaddress());

                    if (ip != null && ip != "::1")
                    {                                                                      // this is if running on local server the number ::1 this is server on my computer
                        howLong       = Session["IP"].ToString().Length;
                        Session["IP"] = Session["IP"].ToString().Remove(14, howLong - 14); // from 14 digit  next six digits remve
                    }
                }
            }

            //--------------------------------------------
            ProductsListViewModel viewModel = new ProductsListViewModel
            {
                MyItems    = repository.Myitems.Where(p => category == null || p.Category == category).OrderBy(p => p.NumberID).Skip((page - 1) * PageSize).Take(PageSize),
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,

                    TotalItems = category == null?repository.Myitems.Count() : repository.Myitems.Where(e => e.Category == category).Count()
                },
                CurrentCategory = category
            };

            return(View(viewModel));
        }